Sha256: 35d1590704867b27806ab77133cb6c1a14f5e5e36e430e9f88a19a8451ecff1e

Contents?: true

Size: 1.51 KB

Versions: 33

Compression:

Stored size: 1.51 KB

Contents

module Fog
  module DNS
    class Dynect
      class Real
        # Get one or more zones
        #
        # ==== Parameters
        # * options<~Hash>:
        #   * zone<~String> - name of zone to lookup, or omit to return list of zones

        def get_zone(options = {})
          request(
            :expects  => 200,
            :idempotent => true,
            :method   => :get,
            :path     => ['Zone', options['zone']].compact.join('/')
          )
        end
      end

      class Mock
        def get_zone(options = {})
          if options['zone']
            raise Fog::DNS::Dynect::NotFound unless zone = self.data[:zones][options['zone']]
            data = {
              "zone_type" => zone[:zone_type],
              "serial_style" => zone[:serial_style],
              "serial" => zone[:serial],
              "zone" => zone[:zone]
            }
            info = "get: Your zone, #{zone[:zone]}"
          else
            data = self.data[:zones].map { |zone, data| "/REST/Zone/#{zone}/" }
            info = "get: Your #{data.size} zones"
          end

          response = Excon::Response.new
          response.status = 200

          response.body = {
            "status" => "success",
            "data" => data,
            "job_id" => Fog::Dynect::Mock.job_id,
            "msgs" => [{
              "INFO" => info,
              "SOURCE" => "BLL",
              "ERR_CD" => nil,
              "LVL" => "INFO"
            }]
          }

          response
        end
      end
    end
  end
end

Version data entries

33 entries across 31 versions & 6 rubygems

Version Path
fog-dynect-0.4.0 lib/fog/dynect/requests/dns/get_zone.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-dynect-0.0.3/lib/fog/dynect/requests/dns/get_zone.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-dynect-0.0.3/lib/fog/dynect/requests/dns/get_zone.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-dynect-0.0.3/lib/fog/dynect/requests/dns/get_zone.rb
fog-dynect-0.3.0 lib/fog/dynect/requests/dns/get_zone.rb
fog-dynect-0.2.0 lib/fog/dynect/requests/dns/get_zone.rb
fog-dynect-0.1.0 lib/fog/dynect/requests/dns/get_zone.rb
fog-dynect-0.0.3 lib/fog/dynect/requests/dns/get_zone.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/dynect/requests/dns/get_zone.rb
fog-dynect-0.0.2 lib/fog/dynect/requests/dns/get_zone.rb
fog-dynect-0.0.1 lib/fog/dynect/requests/dns/get_zone.rb
fog-1.32.0 lib/fog/dynect/requests/dns/get_zone.rb
fog-1.31.0 lib/fog/dynect/requests/dns/get_zone.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/dynect/requests/dns/get_zone.rb
fog-1.30.0 lib/fog/dynect/requests/dns/get_zone.rb
fog-1.29.0 lib/fog/dynect/requests/dns/get_zone.rb
fog-1.28.0 lib/fog/dynect/requests/dns/get_zone.rb
fog-1.27.0 lib/fog/dynect/requests/dns/get_zone.rb
fog-1.26.0 lib/fog/dynect/requests/dns/get_zone.rb
fog-1.25.0 lib/fog/dynect/requests/dns/get_zone.rb