2013-10-03 18:54:17 -04:00
|
|
|
require 'fog/core/collection'
|
2013-10-07 14:53:50 -04:00
|
|
|
require 'fog/hp/models/dns/domain'
|
2013-10-03 18:54:17 -04:00
|
|
|
|
|
|
|
module Fog
|
|
|
|
module HP
|
|
|
|
class DNS
|
|
|
|
|
|
|
|
class Domains < Fog::Collection
|
|
|
|
|
2013-10-07 14:53:50 -04:00
|
|
|
model Fog::HP::DNS::Domain
|
2013-10-03 18:54:17 -04:00
|
|
|
|
2013-10-07 14:53:50 -04:00
|
|
|
def all
|
|
|
|
load(service.list_domains.body['domains'])
|
2013-10-03 18:54:17 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def get(domain_id)
|
2013-10-07 14:53:50 -04:00
|
|
|
### Inconsistent API - does not return a 'domain'
|
|
|
|
if domain = service.get_domain(domain_id).body
|
2013-10-03 18:54:17 -04:00
|
|
|
new(domain)
|
|
|
|
end
|
|
|
|
rescue Fog::HP::DNS::NotFound
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|