Class: Fog::Google::DNS::Records
- Inherits:
-
Collection
- Object
- Collection
- Fog::Google::DNS::Records
- Defined in:
- lib/fog/google/dns/models/records.rb
Instance Method Summary collapse
-
#all ⇒ Array<Fog::Google::DNS::Record>
Enumerates Resource Record Sets that have been created but not yet deleted.
-
#get(name, type) ⇒ Fog::Google::DNS::Record
Fetches the representation of an existing Resource Record Set.
-
#new(attributes = {}) ⇒ Fog::Google::DNS::Record
Creates a new instance of a Resource Record Set.
Instance Method Details
#all ⇒ Array<Fog::Google::DNS::Record>
Enumerates Resource Record Sets that have been created but not yet deleted
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fog/google/dns/models/records.rb', line 13 def all requires :zone data = service.list_resource_record_sets(zone.identity) .to_h[:rrsets] || [] load(data) rescue ::Google::Apis::ClientError => e raise e unless e.status_code == 404 [] end |
#get(name, type) ⇒ Fog::Google::DNS::Record
Fetches the representation of an existing Resource Record Set
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/fog/google/dns/models/records.rb', line 31 def get(name, type) requires :zone records = service.list_resource_record_sets(zone.identity, :name => name, :type => type) .to_h[:rrsets] || [] records.any? ? new(records.first) : nil rescue ::Google::Apis::ClientError => e raise e unless e.status_code == 404 nil end |
#new(attributes = {}) ⇒ Fog::Google::DNS::Record
Creates a new instance of a Resource Record Set
47 48 49 50 51 |
# File 'lib/fog/google/dns/models/records.rb', line 47 def new(attributes = {}) requires :zone super({ :zone => zone }.merge!(attributes)) end |