2011-01-24 20:30:57 -05:00
|
|
|
require 'fog/core/model'
|
2011-08-24 20:58:47 -04:00
|
|
|
require 'fog/bluebox/models/dns/records'
|
2011-01-24 20:30:57 -05:00
|
|
|
|
|
|
|
module Fog
|
2011-06-15 20:25:01 -04:00
|
|
|
module DNS
|
|
|
|
class Bluebox
|
2011-01-24 20:30:57 -05:00
|
|
|
|
|
|
|
class Zone < Fog::Model
|
|
|
|
|
|
|
|
identity :id
|
|
|
|
|
2011-02-25 18:10:12 -05:00
|
|
|
attribute :domain, :aliases => 'name'
|
2011-01-24 20:30:57 -05:00
|
|
|
attribute :serial
|
|
|
|
attribute :ttl
|
|
|
|
attribute :retry
|
|
|
|
attribute :expires
|
2011-02-25 18:10:12 -05:00
|
|
|
attribute :record_count, :aliases => 'record-count'
|
2011-01-24 20:30:57 -05:00
|
|
|
attribute :refresh
|
|
|
|
attribute :minimum
|
|
|
|
|
|
|
|
def initialize(attributes = {})
|
2011-04-04 19:57:08 -04:00
|
|
|
self.ttl ||= 3600
|
2011-01-24 20:30:57 -05:00
|
|
|
super(attributes)
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
raise Fog::Errors::Error.new('Not implemented')
|
|
|
|
end
|
|
|
|
|
|
|
|
def records
|
|
|
|
@records ||= begin
|
2011-06-15 20:25:01 -04:00
|
|
|
Fog::DNS::Bluebox::Records.new(
|
2011-01-24 20:30:57 -05:00
|
|
|
:zone => self,
|
2012-12-22 18:29:33 -05:00
|
|
|
:service => service
|
2011-01-24 20:30:57 -05:00
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def nameservers
|
|
|
|
[
|
|
|
|
'ns1.blueblxgrid.com',
|
|
|
|
'ns2.blueblxgrid.com',
|
|
|
|
'ns3.blueblxgrid.com'
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2011-02-17 02:27:23 -05:00
|
|
|
def destroy
|
|
|
|
requires :identity
|
2012-12-22 18:29:33 -05:00
|
|
|
service.delete_zone(identity)
|
2011-02-17 02:27:23 -05:00
|
|
|
true
|
2011-01-24 20:30:57 -05:00
|
|
|
end
|
|
|
|
|
2011-02-17 02:27:23 -05:00
|
|
|
def save
|
2011-02-25 18:10:12 -05:00
|
|
|
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)
|
2011-02-17 02:27:23 -05:00
|
|
|
merge_attributes(data.body)
|
|
|
|
true
|
|
|
|
end
|
2011-01-24 20:30:57 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|