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:



83
84
85
# File 'lib/fog/dns/google/models/record.rb', line 83

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
29
30
# 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.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:



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

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.id)
  new_attributes.key?(:async) ? async = new_attributes[:async] : async = true
  change.wait_for { ready? } unless async
  self
end

#reloadFog::DNS::Google::Record

Reloads a Resource Record Sets resource

Returns:



56
57
58
59
60
61
62
# File 'lib/fog/dns/google/models/record.rb', line 56

def reload
  requires :name, :type

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

#saveFog::DNS::Google::Record

Creates a new Resource Record Sets resource

Returns:



68
69
70
71
72
73
74
75
76
77
# File 'lib/fog/dns/google/models/record.rb', line 68

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.id)
  change.wait_for { ready? }
  self
end