2013-05-03 12:31:08 -06:00
|
|
|
module Fog
|
|
|
|
module HP
|
|
|
|
class DNS
|
|
|
|
class Real
|
2013-10-03 18:54:17 -04:00
|
|
|
# Get authoritative nameservers for existing DNS domain
|
2013-05-03 12:31:08 -06:00
|
|
|
#
|
|
|
|
# ==== Parameters
|
2013-10-03 18:54:17 -04:00
|
|
|
# * domain_id<~String> - UUId of the domain to get nameservers for
|
2013-05-03 12:31:08 -06:00
|
|
|
#
|
|
|
|
# ==== Returns
|
|
|
|
# * response<~Excon::Response>:
|
2013-10-03 18:54:17 -04:00
|
|
|
# * body<~Hash>:
|
|
|
|
# * 'nameservers'<~Array>:
|
|
|
|
# * 'id'<~String> - UUID of the domain
|
|
|
|
# * 'name'<~String> - Name of the domain
|
|
|
|
# * 'ttl'<~Integer> - TTL for the domain
|
|
|
|
# * 'email'<~String> - Email for the domain
|
|
|
|
# * 'serial'<~Integer> - Serial number for the domain
|
|
|
|
# * 'created_at'<~String> - created date time stamp
|
|
|
|
def get_servers_hosting_domain(domain_id)
|
2013-05-03 12:31:08 -06:00
|
|
|
request(
|
2013-10-03 18:54:17 -04:00
|
|
|
:expects => 200,
|
2013-05-03 12:31:08 -06:00
|
|
|
:method => 'GET',
|
2013-10-03 18:54:17 -04:00
|
|
|
:path => "domains/#{domain_id}/servers"
|
2013-05-03 12:31:08 -06:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
class Mock
|
|
|
|
|
2013-10-03 18:54:17 -04:00
|
|
|
def get_servers_hosting_domain(domain_id)
|
|
|
|
response = Excon::Response.new
|
|
|
|
if list_domains.body['domains'].detect { |_| _['id'] == domain_id }
|
2013-05-03 12:31:08 -06:00
|
|
|
response.status = 200
|
2013-10-03 18:54:17 -04:00
|
|
|
response.body = { 'servers' => dummy_servers }
|
2013-05-03 12:31:08 -06:00
|
|
|
response
|
|
|
|
else
|
2013-10-03 18:54:17 -04:00
|
|
|
raise Fog::HP::DNS::NotFound
|
2013-05-03 12:31:08 -06:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-10-03 18:54:17 -04:00
|
|
|
def dummy_servers
|
|
|
|
[
|
|
|
|
{
|
|
|
|
'id' => Fog::HP::Mock.uuid.to_s,
|
|
|
|
'name' => 'ns1.provider.com.',
|
|
|
|
'created_at' => '2012-01-01T13:32:20Z',
|
|
|
|
'updated_at' => '2012-01-01T13:32:20Z'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'id' => Fog::HP::Mock.uuid.to_s,
|
|
|
|
'name' => 'ns2.provider.com.',
|
|
|
|
'created_at' => '2012-01-01T13:32:20Z',
|
|
|
|
'updated_at' => '2012-01-01T13:32:20Z'
|
|
|
|
},
|
|
|
|
]
|
|
|
|
end
|
2013-05-03 12:31:08 -06:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|