2010-12-22 23:36:53 -05:00
|
|
|
require 'fog/core/collection'
|
2011-08-24 15:40:47 -04:00
|
|
|
require 'fog/zerigo/models/dns/zone'
|
2010-12-22 23:36:53 -05:00
|
|
|
|
|
|
|
module Fog
|
2011-06-15 20:25:01 -04:00
|
|
|
module DNS
|
|
|
|
class Zerigo
|
2010-12-22 23:36:53 -05:00
|
|
|
|
|
|
|
class Zones < Fog::Collection
|
|
|
|
|
2011-06-15 20:25:01 -04:00
|
|
|
model Fog::DNS::Zerigo::Zone
|
2010-12-22 23:36:53 -05:00
|
|
|
|
|
|
|
def all
|
2012-12-22 18:21:16 -05:00
|
|
|
data = service.list_zones.body['zones']
|
2010-12-22 23:36:53 -05:00
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
2011-10-08 20:19:32 -04:00
|
|
|
def get(zone_id_or_domain)
|
2012-12-22 18:21:16 -05:00
|
|
|
data = service.get_zone(zone_id_or_domain).body
|
2010-12-22 23:36:53 -05:00
|
|
|
zone = new(data)
|
|
|
|
zone.records.load(data['hosts'])
|
|
|
|
zone
|
2011-01-03 18:39:38 -05:00
|
|
|
rescue Fog::Service::NotFound
|
2010-12-22 23:36:53 -05:00
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|