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