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

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

Overview

Managed Zone resource

Instance Method Summary collapse

Instance Method Details

#changesObject

Enumerates the list of Changes for the Managed Zone


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

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

#destroyBoolean

Deletes a previously created Managed Zone


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

def destroy
  requires :identity

  service.delete_managed_zone(identity)
  true
end

#recordsObject

Enumerates the list of Resource Record Sets for the Managed Zone


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

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

#saveFog::DNS::Google::Zone

Creates a new Managed Zone

Raises:

  • (Fog::Errors::Error)

    If Managed Zone already exists


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

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(name, domain, description)
  merge_attributes(data.to_h)
  self
end