Class: Fog::DNS::Google::Zone

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/google/models/dns/zone.rb

Overview

Managed Zone resource

Instance Method Summary collapse

Instance Method Details

#changesObject

Enumerates the list of Changes for the Managed Zone



24
25
26
27
28
29
30
31
# File 'lib/fog/google/models/dns/zone.rb', line 24

def changes
  @changes = begin
    Fog::DNS::Google::Changes.new(
      :service => service,
      :zone => self
    )
  end
end

#destroyBoolean

Deletes a previously created Managed Zone

Returns:

  • (Boolean)

    If the Managed Zone has been deleted



37
38
39
40
41
42
# File 'lib/fog/google/models/dns/zone.rb', line 37

def destroy
  requires :identity

  service.delete_managed_zone(self.identity)
  true
end

#recordsObject

Enumerates the list of Resource Record Sets for the Managed Zone



48
49
50
51
52
53
54
55
# File 'lib/fog/google/models/dns/zone.rb', line 48

def records
  @records = begin
    Fog::DNS::Google::Records.new(
      :service => service,
      :zone => self
    )
  end
end

#saveFog::DNS::Google::Zone

Creates a new Managed Zone

Returns:

Raises:

  • (Fog::Errors::Error)

    If Managed Zone already exists



62
63
64
65
66
67
68
69
70
# File 'lib/fog/google/models/dns/zone.rb', line 62

def save
  requires :name, :domain, :description

  raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?

  data = service.create_managed_zone(self.name, self.domain, self.description)
  merge_attributes(data.body)
  self
end