Class: RecordStore::Provider::OracleCloudDNS
- Inherits:
-
RecordStore::Provider
- Object
- RecordStore::Provider
- RecordStore::Provider::OracleCloudDNS
- Defined in:
- lib/record_store/provider/oracle_cloud_dns.rb
Defined Under Namespace
Classes: Error
Class Method Summary collapse
- .client ⇒ Object
-
.retrieve_current_records(zone:, stdout: $stdout) ⇒ Object
Downloads all the records from the provider.
-
.zones ⇒ Object
Returns an array of the zones managed by provider as strings.
Methods inherited from RecordStore::Provider
apply_changeset, build_zone, empty_non_terminal_over_wildcard?, freezable?, provider_for, record_types, supports_alias?, thawable?, to_s
Class Method Details
.client ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/record_store/provider/oracle_cloud_dns.rb', line 8 def client @client ||= begin config = OCI::Config.new config.user = secrets['user'] config.fingerprint = secrets['fingerprint'] config.key_content = secrets['key_content'] config.tenancy = secrets['tenancy'] config.region = secrets['region'] config.validate OCI::Dns::DnsClient.new(config: config) end end |
.retrieve_current_records(zone:, stdout: $stdout) ⇒ Object
Downloads all the records from the provider.
Returns: an array of ‘Record` for each record in the provider’s zone
24 25 26 27 28 29 30 31 32 |
# File 'lib/record_store/provider/oracle_cloud_dns.rb', line 24 def retrieve_current_records(zone:, stdout: $stdout) client.get_zone_records(zone) .flat_map { |response| response.data.items } .flat_map { |api_record| build_from_api(api_record) } .compact rescue OCI::Errors::HttpRequestBasedError stdout.puts "Cannot build record for zone: #{zone}" raise end |
.zones ⇒ Object
Returns an array of the zones managed by provider as strings
35 36 37 |
# File 'lib/record_store/provider/oracle_cloud_dns.rb', line 35 def zones client.list_zones(secrets['compartment_id']).data.map(&:name) end |