Sha256: 01511d2f11cb2d1eaf1815ed520f9c0f90f5a0b9881a965fb705dc312d2d7a33
Contents?: true
Size: 1.47 KB
Versions: 19
Compression:
Stored size: 1.47 KB
Contents
require 'fog/core/model' require 'fog/slicehost/models/dns/records' module Fog module DNS class Slicehost class Zone < Fog::Model identity :id attribute :active attribute :domain, :aliases => 'origin' attribute :ttl def initialize(attributes={}) self.active ||= true self.ttl ||= 3600 super end def active=(new_active) attributes[:active] = case new_active when false, 'N' false when true, 'Y' true end end def destroy requires :identity connection.delete_zone(identity) true end def records @records ||= begin Fog::DNS::Slicehost::Records.new( :zone => self, :connection => connection ).all end end def nameservers [ 'ns1.slicehost.net', 'ns2.slicehost.net', 'ns3.slicehost.net' ] end def save raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity requires :active, :domain, :ttl options = {} options[:active] = active ? 'Y' : 'N' options[:ttl] = ttl data = connection.create_zone(domain, options) merge_attributes(data.body) true end end end end end
Version data entries
19 entries across 19 versions & 6 rubygems