Class: DnsMadeEasy::CLI::Commands::Zone::Export
- Defined in:
- lib/dnsmadeeasy/cli/commands/zone.rb
Overview
Exports DNS Made Easy records as canonical zone-file text.
Constant Summary
Constants inherited from Base
Base::DEFAULT_CREDENTIAL_PATHS, Base::SUPPORTED_FORMATS
Constants included from MessageHelpers
Instance Method Summary collapse
Methods included from MessageHelpers
error, included, info, print_box, success, warn
Instance Method Details
#call(**options) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/dnsmadeeasy/cli/commands/zone.rb', line 74 def call(**) configure_authentication(credentials: [:credentials], api_key: [:api_key], api_secret: [:api_secret]) domain = .fetch(:domain) export_ttl = [:ttl] || 300 result = DnsMadeEasy::Zone::RemoteAdapter.new( DnsMadeEasy.client.records_for(domain), domain: domain, default_ttl: export_ttl ).call fail_export(result.failure) if result.failure? records_result = export_ready_records(result.value!, strict_rfc: [:strict_rfc]) fail_export(records_result.failure) if records_result.failure? records, warnings = records_result.value! export_records( domain, records, warnings: warnings, format: [:format] || 'rfc', output: [:output], ttl: export_ttl, include_apex_ns: [:include_apex_ns] ) success( "Zone export complete.\nDomain: #{domain}\nRecords: #{records.length}\n" \ "Destination: #{[:output] || 'STDOUT'}" ) end |