Sha256: d2cf7abc1dccd6a4f1fcb224c6f8f05771ba5a065a0c4316777d3f251c82a7be

Contents?: true

Size: 1.42 KB

Versions: 12

Compression:

Stored size: 1.42 KB

Contents

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 = {})
          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,
              :service => service
            )
          end
        end

        def nameservers
          [
            'ns1.blueblxgrid.com',
            'ns2.blueblxgrid.com',
            'ns3.blueblxgrid.com'
          ]
        end

        def destroy
          requires :identity
          service.delete_zone(identity)
          true
        end

        def save
          requires :domain, :ttl
          options = attributes.dup
          options[:name] = options.delete(:domain)
          data = identity.nil? ? service.create_zone(options) : service.update_zone(identity, options)
          merge_attributes(data.body)
          true
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 5 rubygems

Version Path
hpfog-0.0.20 lib/fog/bluebox/models/dns/zone.rb
vagrant-shell-0.2.6 vendor/bundle/gems/fog-1.10.1/lib/fog/bluebox/models/dns/zone.rb
vagrant-shell-0.2.5 vendor/bundle/gems/fog-1.10.1/lib/fog/bluebox/models/dns/zone.rb
fog-1.11.1 lib/fog/bluebox/models/dns/zone.rb
fog-1.11.0 lib/fog/bluebox/models/dns/zone.rb
fog-1.10.1 lib/fog/bluebox/models/dns/zone.rb
fog-test-me-1.10.0 lib/fog/bluebox/models/dns/zone.rb
fog-1.10.0 lib/fog/bluebox/models/dns/zone.rb
fog-1.9.0 lib/fog/bluebox/models/dns/zone.rb
fog-maestrodev-1.8.0.20130114204828 lib/fog/bluebox/models/dns/zone.rb
fog-maestrodev-1.8.0.20130111070250 lib/fog/bluebox/models/dns/zone.rb
fog-maestrodev-1.8.0.20130109172219 lib/fog/bluebox/models/dns/zone.rb