Class: Fog::DNS::Google::Record
- Inherits:
-
Model
- Object
- Model
- Fog::DNS::Google::Record
- Defined in:
- lib/fog/dns/google/models/record.rb
Overview
Resource Record Sets resource
Instance Attribute Summary collapse
-
#zone ⇒ Fog::DNS::Google::Zone
readonly
Returns the Managed Zone of the Resource Record Sets resource.
Instance Method Summary collapse
-
#destroy(async = true) ⇒ Boolean
Deletes a previously created Resource Record Sets resource.
-
#modify(new_attributes) ⇒ Fog::DNS::Google::Record
Modifies a previously created Resource Record Sets resource.
-
#reload ⇒ Fog::DNS::Google::Record
Reloads a Resource Record Sets resource.
-
#save ⇒ Fog::DNS::Google::Record
Creates a new Resource Record Sets resource.
Instance Attribute Details
#zone ⇒ Fog::DNS::Google::Zone
Returns the Managed Zone of the Resource Record Sets resource
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
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
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 |
#reload ⇒ Fog::DNS::Google::Record
Reloads a Resource Record Sets resource
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 |
#save ⇒ Fog::DNS::Google::Record
Creates a new Resource Record Sets resource
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 |