1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/zerigo/requests/compute/find_hosts.rb

62 lines
1.7 KiB
Ruby
Raw Normal View History

module Fog
module Zerigo
class Compute
class Real
require 'fog/zerigo/parsers/compute/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>
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::Compute::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::Compute::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