Sha256: 9c3523f910d5e60ca7726ce62b063881969c62d968645ffd3dd7cf101c28c403

Contents?: true

Size: 1.89 KB

Versions: 40

Compression:

Stored size: 1.89 KB

Contents

module Fog
  module DNS
    class AWS
      class Real
        require 'fog/aws/parsers/dns/get_hosted_zone'

        # retrieve information about a hosted zone
        #
        # ==== Parameters
        # * zone_id<~String> - The ID of the hosted zone
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'HostedZone'<~Hash>:
        #       * 'Id'<~String> -
        #       * 'Name'<~String> -
        #       * 'CallerReference'<~String>
        #       * 'Comment'<~String> -
        #     * 'NameServers'<~Array>
        #       * 'NameServer'<~String>
        #   * status<~Integer> - 200 when successful
        def get_hosted_zone(zone_id)
          # AWS methods return zone_ids that looks like '/hostedzone/id'.  Let the caller either use
          # that form or just the actual id (which is what this request needs)
          zone_id = zone_id.sub('/hostedzone/', '')

          request({
            :expects => 200,
            :idempotent => true,
            :method  => 'GET',
            :parser  => Fog::Parsers::DNS::AWS::GetHostedZone.new,
            :path    => "hostedzone/#{zone_id}"
          })
        end
      end

      class Mock
        def get_hosted_zone(zone_id)
          response = Excon::Response.new
          if (zone = self.data[:zones][zone_id])
            response.status = 200
            response.body = {
              'HostedZone' => {
                'Id' => zone[:id],
                'Name' => zone[:name],
                'CallerReference' => zone[:reference],
                'Comment' => zone[:comment]
              },
              'NameServers' => Fog::AWS::Mock.nameservers
            }
            response
          else
            raise Fog::DNS::AWS::NotFound.new("NoSuchHostedZone => A hosted zone with the specified hosted zone ID does not exist.")
          end
        end
      end
    end
  end
end

Version data entries

40 entries across 38 versions & 3 rubygems

Version Path
fog-aws-3.1.0 lib/fog/aws/requests/dns/get_hosted_zone.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-aws-2.0.1/lib/fog/aws/requests/dns/get_hosted_zone.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-aws-2.0.1/lib/fog/aws/requests/dns/get_hosted_zone.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-aws-2.0.1/lib/fog/aws/requests/dns/get_hosted_zone.rb
fog-aws-3.0.0 lib/fog/aws/requests/dns/get_hosted_zone.rb
fog-aws-2.0.1 lib/fog/aws/requests/dns/get_hosted_zone.rb
fog-aws-2.0.0 lib/fog/aws/requests/dns/get_hosted_zone.rb
fog-aws-1.4.1 lib/fog/aws/requests/dns/get_hosted_zone.rb
fog-aws-1.4.0 lib/fog/aws/requests/dns/get_hosted_zone.rb
fog-aws-1.3.0 lib/fog/aws/requests/dns/get_hosted_zone.rb
fog-aws-1.2.1 lib/fog/aws/requests/dns/get_hosted_zone.rb
fog-aws-1.2.0 lib/fog/aws/requests/dns/get_hosted_zone.rb
fog-aws-1.1.0 lib/fog/aws/requests/dns/get_hosted_zone.rb
fog-aws-1.0.0 lib/fog/aws/requests/dns/get_hosted_zone.rb
fog-aws-0.13.0 lib/fog/aws/requests/dns/get_hosted_zone.rb
fog-aws-0.12.0 lib/fog/aws/requests/dns/get_hosted_zone.rb
fog-aws-0.11.0 lib/fog/aws/requests/dns/get_hosted_zone.rb
fog-aws-0.10.0 lib/fog/aws/requests/dns/get_hosted_zone.rb
fog-aws-0.9.4 lib/fog/aws/requests/dns/get_hosted_zone.rb
fog-aws-0.9.3 lib/fog/aws/requests/dns/get_hosted_zone.rb