Class: RecordStore::Provider::DynECT
- Inherits:
-
RecordStore::Provider
- Object
- RecordStore::Provider
- RecordStore::Provider::DynECT
- Defined in:
- lib/record_store/provider/dynect.rb
Class Method Summary collapse
-
.apply_changeset(changeset, stdout = $stdout) ⇒ Object
Applies changeset to provider.
- .freeze_zone(zone) ⇒ Object
- .publish(zone) ⇒ Object
-
.retrieve_current_records(zone:, stdout: $stdout) ⇒ Object
returns an array of Record objects that match the records which exist in the provider.
- .thaw_zone(zone) ⇒ Object
-
.zones ⇒ Object
Returns an array of the zones managed by provider as strings.
Methods inherited from RecordStore::Provider
build_zone, empty_non_terminal_over_wildcard?, freezable?, provider_for, record_types, supports_alias?, thawable?, to_s
Class Method Details
.apply_changeset(changeset, stdout = $stdout) ⇒ Object
Applies changeset to provider
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/record_store/provider/dynect.rb', line 23 def apply_changeset(changeset, stdout = $stdout) thaw_zone(changeset.zone) super publish(changeset.zone) rescue StandardError puts "An exception occurred while applying DNS changes, deleting changeset" discard_change_set(changeset.zone) raise ensure freeze_zone(changeset.zone) end |
.freeze_zone(zone) ⇒ Object
10 11 12 |
# File 'lib/record_store/provider/dynect.rb', line 10 def freeze_zone(zone) session.put_zone(zone, freeze: true) end |
.publish(zone) ⇒ Object
18 19 20 |
# File 'lib/record_store/provider/dynect.rb', line 18 def publish(zone) session.put_zone(zone, publish: true) end |
.retrieve_current_records(zone:, stdout: $stdout) ⇒ Object
returns an array of Record objects that match the records which exist in the provider
36 37 38 39 40 41 42 43 44 |
# File 'lib/record_store/provider/dynect.rb', line 36 def retrieve_current_records(zone:, stdout: $stdout) session.get_all_records(zone).body.fetch('data').flat_map do |_type, records| records.map do |record_body| build_from_api(record_body) rescue StandardError stdout.puts "Cannot build record: #{record_body}" end end.compact end |
.thaw_zone(zone) ⇒ Object
14 15 16 |
# File 'lib/record_store/provider/dynect.rb', line 14 def thaw_zone(zone) session.put_zone(zone, thaw: true) end |
.zones ⇒ Object
Returns an array of the zones managed by provider as strings
47 48 49 |
# File 'lib/record_store/provider/dynect.rb', line 47 def zones session.zones.map(&:domain) end |