Sha256: fbefa34e282e768853c3099d9fe40758b304cc7e9361b606378c843fed950ef3

Contents?: true

Size: 1.57 KB

Versions: 39

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     => ['NodeList', 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

39 entries across 39 versions & 12 rubygems

Version Path
gapinc-fog-1.12.1.2.1 lib/fog/dynect/requests/dns/get_node_list.rb
fog-maestrodev-1.15.0.20130829165835 lib/fog/dynect/requests/dns/get_node_list.rb
fog-1.15.0 lib/fog/dynect/requests/dns/get_node_list.rb
gapinc-fog-1.14.0 lib/fog/dynect/requests/dns/get_node_list.rb
fog-maestrodev-1.14.0.20130806165225 lib/fog/dynect/requests/dns/get_node_list.rb
fog-1.14.0 lib/fog/dynect/requests/dns/get_node_list.rb
fog-1.13.0 lib/fog/dynect/requests/dns/get_node_list.rb
gapinc-fog-1.12.1.2 lib/fog/dynect/requests/dns/get_node_list.rb
gapinc-fog-1.12.1.1 lib/fog/dynect/requests/dns/get_node_list.rb
gapinc-fog-1.12.1a lib/fog/dynect/requests/dns/get_node_list.rb
gapinc-fog-1.12.1 lib/fog/dynect/requests/dns/get_node_list.rb
fog-1.12.1 lib/fog/dynect/requests/dns/get_node_list.rb
fog-1.12.0 lib/fog/dynect/requests/dns/get_node_list.rb
hpfog-0.0.20 lib/fog/dynect/requests/dns/get_node_list.rb
vagrant-shell-0.2.6 vendor/bundle/gems/fog-1.10.1/lib/fog/dynect/requests/dns/get_node_list.rb
vagrant-shell-0.2.5 vendor/bundle/gems/fog-1.10.1/lib/fog/dynect/requests/dns/get_node_list.rb
fog-nirvanix-1.8.2 lib/fog/dynect/requests/dns/get_node_list.rb
fog-1.11.1 lib/fog/dynect/requests/dns/get_node_list.rb
fog-1.11.0 lib/fog/dynect/requests/dns/get_node_list.rb
fog-nirvanix-1.8.1 lib/fog/dynect/requests/dns/get_node_list.rb