Class: Fog::DNS::Google::Record

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

Overview

Resource Record Sets resource

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#zoneFog::DNS::Google::Zone

Returns the Managed Zone of the Resource Record Sets resource

Returns:



77
78
79
# File 'lib/fog/dns/google/models/record.rb', line 77

def zone
  @zone
end

Instance Method Details

#destroy(async = true) ⇒ Boolean

Deletes a previously created Resource Record Sets resource

Parameters:

  • async (Boolean) (defaults to: true)

    If the operation must be asyncronous (true by default)

Returns:

  • (Boolean)

    If the Resource Record Set has been deleted



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

def destroy(async = true)
  requires :name, :type, :ttl, :rrdatas

  data = service.create_change(zone.id, [], [resource_record_set_format])
  change = Fog::DNS::Google::Changes.new(:service => service, :zone => zone).get(data.body["id"])
  change.wait_for { ready? } unless async
  true
end

#modify(new_attributes) ⇒ Fog::DNS::Google::Record

Modifies a previously created Resource Record Sets resource

Parameters:

  • new_attributes (Hash)

    Resource Record Set new attributes

Returns:



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/fog/dns/google/models/record.rb', line 35

def modify(new_attributes)
  requires :name, :type, :ttl, :rrdatas

  deletions = resource_record_set_format
  merge_attributes(new_attributes)

  data = service.create_change(zone.id, [resource_record_set_format], [deletions])
  change = Fog::DNS::Google::Changes.new(:service => service, :zone => zone).get(data.body["id"])
  async = new_attributes.key?(:async) ? new_attributes[:async] : true
  change.wait_for { ready? } unless async
  self
end

#reloadFog::DNS::Google::Record

Reloads a Resource Record Sets resource

Returns:



52
53
54
55
56
57
58
# File 'lib/fog/dns/google/models/record.rb', line 52

def reload
  requires :name, :type

  data = collection.get(name, type)
  merge_attributes(data.attributes)
  self
end

#saveFog::DNS::Google::Record

Creates a new Resource Record Sets resource

Returns:



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

def save
  requires :name, :type, :ttl, :rrdatas

  data = service.create_change(zone.id, [resource_record_set_format], [])
  change = Fog::DNS::Google::Changes.new(:service => service, :zone => zone).get(data.body["id"])
  change.wait_for { !pending? }
  self
end