Sha256: 42cc3343c0831888f510f1a0896702f3e4e5d7500f8efc890fea2ac805e8d826

Contents?: true

Size: 1.57 KB

Versions: 42

Compression:

Stored size: 1.57 KB

Contents

module Fog
  module DNS
    class Dynect
      class Real

        # Get one or more node lists
        #
        # ==== Parameters
        # * zone<~String> - zone to lookup node lists for
        # * options<~Hash>
        #   * fqdn<~String> - fully qualified domain name of node to lookup

        def get_node_list(zone, options = {})
          requested_fqdn = options['fqdn'] || options[:fqdn]
          request(
            :expects  => 200,
            :idempotent => true,
            :method   => :get,
            :path     => ['AllRecord', zone, requested_fqdn].compact.join('/')
          )
        end
      end

      class Mock
        def get_node_list(zone, options = {})
          raise Fog::DNS::Dynect::NotFound unless zone = self.data[:zones][zone]

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

          data = [zone[:zone]]

          if fqdn = options[:fqdn]
            data = data | zone[:records].collect { |type, records| records.select { |record| record[:fqdn] == fqdn } }.flatten.compact
          else
            data = data | zone[:records].collect { |type, records| records.collect { |record| record[:fqdn] } }.flatten
          end

          response.body = {
            "status" => "success",
            "data" => data,
            "job_id" => Fog::Dynect::Mock.job_id,
            "msgs" => [{
              "INFO" => "get_tree: Here is your zone tree",
              "SOURCE" => "BLL",
              "ERR_CD" => nil,
              "LVL" => "INFO"
            }]
          }

          response
        end
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 3 rubygems

Version Path
fog-1.22.0 lib/fog/dynect/requests/dns/get_node_list.rb
fog-1.21.0 lib/fog/dynect/requests/dns/get_node_list.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/dynect/requests/dns/get_node_list.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/dynect/requests/dns/get_node_list.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/dynect/requests/dns/get_node_list.rb
fog-1.20.0 lib/fog/dynect/requests/dns/get_node_list.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/dynect/requests/dns/get_node_list.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/dynect/requests/dns/get_node_list.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/dynect/requests/dns/get_node_list.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/dynect/requests/dns/get_node_list.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/dynect/requests/dns/get_node_list.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/dynect/requests/dns/get_node_list.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/dynect/requests/dns/get_node_list.rb
fog-1.19.0 lib/fog/dynect/requests/dns/get_node_list.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/dynect/requests/dns/get_node_list.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/dynect/requests/dns/get_node_list.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/dynect/requests/dns/get_node_list.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/dynect/requests/dns/get_node_list.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/dynect/requests/dns/get_node_list.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/dynect/requests/dns/get_node_list.rb