Sha256: 751e1bc3dddce9cd4ffe7b607360a81135f45ae4deb524e73c14f4bb6b192822

Contents?: true

Size: 1.79 KB

Versions: 7

Compression:

Stored size: 1.79 KB

Contents

module Fog
  module Zerigo
    class DNS
      class Real

        require 'fog/dns/parsers/zerigo/find_hosts'

        # Get list of all the host records that match the FQDN.  If desired, can limit
        # search to a specific zone
        #
        #
        # ==== Parameters
        # * fqdn<~String> - domain to look for
        # * zone_id<~Integer> - if want to limit search to specific zone
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'hosts'<~Hash>
        #       * 'created-at'<~String>
        #       * 'data'<~String>
        #       * 'fqdn'<~String>
        #       * 'host-type'<~String>
        #       * 'hostname'<~String>
        #       * 'id'<~Integer>
        #       * 'notes'<~String>
        #       * 'priority'<~Integer>
        #       * 'ttl'<~Integer>
        #       * 'updated-at'<~String>
        #       * 'zone-id'<~String>
        #   * 'status'<~Integer> - 200 indicated success
        #
        def find_hosts( fqdn, zone_id = nil)
          if zone_id.nil?
            #look for matching host across all zones
            request(
              :expects  => 200,
              :method   => 'GET',
              :parser   => Fog::Parsers::Zerigo::DNS::FindHosts.new,
              :path     => "/api/1.1/hosts.xml?fqdn=#{fqdn}"
            )
          else
            #look for hosts in a specific zone
            request(
              :expects  => 200,
              :method   => 'GET',
              :parser   => Fog::Parsers::Zerigo::DNS::FindHosts.new,
              :path     => "/api/1.1/zones/#{zone_id}/hosts.xml?fqdn=#{fqdn}"
            )
          end
        end

      end

      class Mock

        def find_hosts( fqdn, zone_id = nil)
          Fog::Mock.not_implemented
        end

      end
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
fog-0.5.1 lib/fog/dns/requests/zerigo/find_hosts.rb
fog-0.5.0 lib/fog/dns/requests/zerigo/find_hosts.rb
phpfog-fog-0.4.1.3 lib/fog/dns/requests/zerigo/find_hosts.rb
phpfog-fog-0.4.1.2 lib/fog/dns/requests/zerigo/find_hosts.rb
phpfog-fog-0.4.1.1 lib/fog/dns/requests/zerigo/find_hosts.rb
phpfog-fog-0.4.1 lib/fog/dns/requests/zerigo/find_hosts.rb
fog-0.4.1 lib/fog/dns/requests/zerigo/find_hosts.rb