Class: Google::Cloud::Dns::Zone::Transaction
- Inherits:
-
Object
- Object
- Google::Cloud::Dns::Zone::Transaction
- Defined in:
- lib/google/cloud/dns/zone/transaction.rb
Overview
DNS Zone Transaction
This object is used by #update when passed a block. These methods are used to update the records that are sent to the Google Cloud DNS API.
Instance Method Summary collapse
-
#add(name, type, ttl, data) ⇒ Object
Adds a record to the Zone.
-
#modify(name, type) {|record| ... } ⇒ Object
Modifies records on the Zone.
-
#remove(name, type) ⇒ Object
Removes records from the Zone.
-
#replace(name, type, ttl, data) ⇒ Object
Replaces existing records on the Zone.
Instance Method Details
#add(name, type, ttl, data) ⇒ Object
Adds a record to the Zone.
82 83 84 |
# File 'lib/google/cloud/dns/zone/transaction.rb', line 82 def add name, type, ttl, data @additions += Array(@zone.record(name, type, ttl, data)) end |
#modify(name, type) {|record| ... } ⇒ Object
Modifies records on the Zone. Records matching the name
and type
are yielded to the block where they can be modified.
169 170 171 172 173 174 175 |
# File 'lib/google/cloud/dns/zone/transaction.rb', line 169 def modify name, type existing = @zone.records(name, type).all.to_a updated = existing.map(&:dup) updated.each { |r| yield r } @additions += updated @deletions += existing end |
#remove(name, type) ⇒ Object
Removes records from the Zone. The records are looked up before they are removed.
106 107 108 |
# File 'lib/google/cloud/dns/zone/transaction.rb', line 106 def remove name, type @deletions += @zone.records(name, type).all.to_a end |
#replace(name, type, ttl, data) ⇒ Object
Replaces existing records on the Zone. Records matching the name
and type
are replaced.
141 142 143 144 |
# File 'lib/google/cloud/dns/zone/transaction.rb', line 141 def replace name, type, ttl, data remove name, type add name, type, ttl, data end |