1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/bluebox/models/dns/zone.rb

65 lines
1.4 KiB
Ruby
Raw Normal View History

require 'fog/core/model'
require 'fog/bluebox/models/dns/records'
module Fog
module DNS
class Bluebox
class Zone < Fog::Model
identity :id
attribute :domain, :aliases => 'name'
attribute :serial
attribute :ttl
attribute :retry
attribute :expires
attribute :record_count, :aliases => 'record-count'
attribute :refresh
attribute :minimum
def initialize(attributes = {})
2011-04-04 19:57:08 -04:00
self.ttl ||= 3600
super(attributes)
end
def destroy
raise Fog::Errors::Error.new('Not implemented')
end
def records
@records ||= begin
Fog::DNS::Bluebox::Records.new(
:zone => self,
2012-12-22 18:29:33 -05:00
:service => service
)
end
end
def nameservers
[
'ns1.blueblxgrid.com',
'ns2.blueblxgrid.com',
'ns3.blueblxgrid.com'
]
end
def destroy
requires :identity
2012-12-22 18:29:33 -05:00
service.delete_zone(identity)
true
end
def save
requires :domain, :ttl
options = attributes.dup
options[:name] = options.delete(:domain)
2012-12-22 18:29:33 -05:00
data = identity.nil? ? service.create_zone(options) : service.update_zone(identity, options)
merge_attributes(data.body)
true
end
end
end
end
end