2010-12-12 09:51:52 -05:00
|
|
|
module Fog
|
2011-06-15 20:25:01 -04:00
|
|
|
module DNS
|
|
|
|
class Zerigo
|
2010-12-12 09:51:52 -05:00
|
|
|
class Real
|
|
|
|
|
2011-08-24 15:40:47 -04:00
|
|
|
require 'fog/zerigo/parsers/dns/get_zone'
|
2010-12-12 09:51:52 -05:00
|
|
|
|
2010-12-12 21:18:21 -05:00
|
|
|
# Get details of a DNS zone. The response is similar to list_zones, with the
|
2010-12-12 09:51:52 -05:00
|
|
|
# addition of hosts-count and possibly hosts.
|
|
|
|
#
|
|
|
|
# ==== Parameters
|
|
|
|
# * zone<~String> - Either the zone ID or the zone name (ie sample-domain.com)
|
|
|
|
#
|
|
|
|
# ==== Returns
|
|
|
|
# * response<~Excon::Response>:
|
|
|
|
# * body<~Hash>:
|
2010-12-12 21:18:21 -05:00
|
|
|
# * 'default-ttl'<~Integer>
|
|
|
|
# * 'id'<~Integer>
|
|
|
|
# * 'nx-ttl'<~Integer>
|
|
|
|
# * 'hosts-count'<~Integer>
|
|
|
|
# * 'created-at'<~String>
|
|
|
|
# * 'custom-nameservers'<~String>
|
|
|
|
# * 'custom-ns'<~String>
|
|
|
|
# * 'domain'<~String>
|
|
|
|
# * 'hostmaster'<~String>
|
|
|
|
# * 'notes'<~String>
|
|
|
|
# * 'ns1'<~String>
|
|
|
|
# * 'ns-type'<~String>
|
|
|
|
# * 'slave-nameservers'<~String>
|
|
|
|
# * 'tag-list'<~String>
|
|
|
|
# * 'updated-at'<~String>
|
|
|
|
# * 'hosts'<~Array> - a list of all host records. For the format of host info, see get_host()
|
|
|
|
# * 'axfr-ips'<~String>
|
|
|
|
# * 'restrict-axfr'<~String>
|
2010-12-13 08:51:04 -05:00
|
|
|
# * 'status'<~Integer> - 200 indicates success
|
|
|
|
|
2011-10-08 20:19:32 -04:00
|
|
|
def get_zone(zone_id_or_domain)
|
2010-12-12 09:51:52 -05:00
|
|
|
request(
|
|
|
|
:expects => 200,
|
|
|
|
:method => 'GET',
|
2011-06-15 20:25:01 -04:00
|
|
|
:parser => Fog::Parsers::DNS::Zerigo::GetZone.new,
|
2011-10-08 20:19:32 -04:00
|
|
|
:path => "/api/1.1/zones/#{zone_id_or_domain}.xml"
|
2010-12-12 09:51:52 -05:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2011-10-08 20:19:32 -04:00
|
|
|
|
|
|
|
class Mock # :nodoc:all
|
|
|
|
def get_zone(zone_id_or_domain)
|
|
|
|
zone = find_by_zone_id(zone_id_or_domain) || find_by_domain(zone_id_or_domain)
|
|
|
|
|
|
|
|
response = Excon::Response.new
|
|
|
|
|
|
|
|
if zone
|
|
|
|
response.status = 200
|
|
|
|
response.body = zone
|
|
|
|
else
|
|
|
|
response.status = 404
|
|
|
|
end
|
|
|
|
|
|
|
|
response
|
|
|
|
end
|
|
|
|
end
|
2010-12-12 09:51:52 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|