Class: Fog::DNS::Google::Record
- Inherits:
-
Model
- Object
- Model
- Fog::DNS::Google::Record
- Defined in:
- lib/fog/google/models/dns/record.rb
Overview
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.
-
#zone ⇒ Fog::DNS::Google::Zone
Returns the Managed Zone of the Resource Record Sets resource.
Instance Method Details
#destroy(async = true) ⇒ Boolean
Deletes a previously created Resource Record Sets resource
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fog/google/models/dns/record.rb', line 23 def destroy(async = true) requires :name, :type, :ttl, :rrdatas data = service.create_change(self.zone.id, [], [resource_record_set_format]) change = Fog::DNS::Google::Changes.new(:service => service, :zone => zone).get(data.body['id']) unless async change.wait_for { ready? } end true end |
#modify(new_attributes) ⇒ Fog::DNS::Google::Record
Modifies a previously created Resource Record Sets resource
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/fog/google/models/dns/record.rb', line 39 def modify(new_attributes) requires :name, :type, :ttl, :rrdatas deletions = resource_record_set_format merge_attributes(new_attributes) data = service.create_change(self.zone.id, [resource_record_set_format], [deletions]) change = Fog::DNS::Google::Changes.new(:service => service, :zone => zone).get(data.body['id']) async = new_attributes.has_key?(:async) ? new_attributes[:async] : true unless async change.wait_for { ready? } end self end |
#reload ⇒ Fog::DNS::Google::Record
Reloads a Resource Record Sets resource
58 59 60 61 62 63 64 |
# File 'lib/fog/google/models/dns/record.rb', line 58 def reload requires :name, :type data = collection.get(self.name, self.type) merge_attributes(data.attributes) self end |
#save ⇒ Fog::DNS::Google::Record
Creates a new Resource Record Sets resource
70 71 72 73 74 75 76 77 |
# File 'lib/fog/google/models/dns/record.rb', line 70 def save requires :name, :type, :ttl, :rrdatas data = service.create_change(self.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 |
#zone ⇒ Fog::DNS::Google::Zone
Returns the Managed Zone of the Resource Record Sets resource
83 84 85 |
# File 'lib/fog/google/models/dns/record.rb', line 83 def zone @zone end |