2010-12-12 18:02:02 -05:00
|
|
|
module Fog
|
2011-06-15 20:25:01 -04:00
|
|
|
module DNS
|
|
|
|
class Zerigo
|
2010-12-12 18:02:02 -05:00
|
|
|
class Real
|
|
|
|
|
2011-08-24 15:40:47 -04:00
|
|
|
require 'fog/zerigo/parsers/dns/get_host'
|
2010-12-12 18:02:02 -05:00
|
|
|
|
2010-12-12 21:18:21 -05:00
|
|
|
# get details about a given host record
|
2010-12-12 18:02:02 -05:00
|
|
|
#
|
2010-12-12 21:18:21 -05:00
|
|
|
# ==== Parameters
|
|
|
|
# * host_id<~Integer> - ID of the host record to retrieve
|
2010-12-12 18:02:02 -05:00
|
|
|
# ==== Returns
|
2014-02-19 07:30:59 -05:00
|
|
|
# * response<~Excon::Response>:
|
2010-12-12 21:18:21 -05:00
|
|
|
# * body<~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>
|
2010-12-13 08:51:04 -05:00
|
|
|
# * 'status'<~Integer> - 200 indicates success
|
2011-10-08 20:19:32 -04:00
|
|
|
def get_host(host_id)
|
2010-12-12 18:02:02 -05:00
|
|
|
request(
|
|
|
|
:expects => 200,
|
|
|
|
:method => 'GET',
|
2011-06-15 20:25:01 -04:00
|
|
|
:parser => Fog::Parsers::DNS::Zerigo::GetHost.new,
|
2010-12-12 18:02:02 -05:00
|
|
|
:path => "/api/1.1/hosts/#{host_id}.xml"
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2011-10-08 20:19:32 -04:00
|
|
|
|
|
|
|
class Mock # :nodoc:all
|
|
|
|
def get_host(host_id)
|
|
|
|
host = find_host(host_id)
|
|
|
|
|
|
|
|
response = Excon::Response.new
|
|
|
|
|
|
|
|
if host
|
|
|
|
response.status = 200
|
|
|
|
response.body = host
|
|
|
|
else
|
|
|
|
response.status = 404
|
|
|
|
end
|
|
|
|
|
|
|
|
response
|
|
|
|
end
|
|
|
|
end
|
2010-12-12 18:02:02 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|