Sha256: 3bbcf441432815ca3914632d44f1dd82cde160c0d738e3fa7ef7acaad67794d2

Contents?: true

Size: 1.67 KB

Versions: 3

Compression:

Stored size: 1.67 KB

Contents

module Fog
  module DNS
    class Zerigo
      class Real

        require 'fog/zerigo/parsers/dns/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::DNS::Zerigo::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::DNS::Zerigo::FindHosts.new,
              :path     => "/api/1.1/zones/#{zone_id}/hosts.xml?fqdn=#{fqdn}"
            )
          end
        end

      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
brightbox-cli-0.14.1 lib/brightbox-cli/vendor/fog/lib/fog/zerigo/requests/dns/find_hosts.rb
brightbox-cli-0.14.0 lib/brightbox-cli/vendor/fog/lib/fog/zerigo/requests/dns/find_hosts.rb
fog-1.0.0 lib/fog/zerigo/requests/dns/find_hosts.rb