Class: DatadogBackup::Dashboards
- Defined in:
- lib/datadog_backup/dashboards.rb
Instance Method Summary collapse
- #all_dashboards ⇒ Object
- #api_resource_name ⇒ Object
- #api_version ⇒ Object
- #backup ⇒ Object
-
#initialize(options) ⇒ Dashboards
constructor
A new instance of Dashboards.
Methods inherited from Core
#api_service, #api_url, #body_with_2xx, #create, #diff, #except, #get, #get_all, #get_and_write_file, #get_by_id, #myclass, #restore, #update
Methods included from Options
#action, #backup_dir, #concurrency_limit, #diff_format, #force_restore, #output_format, #resources
Methods included from LocalFilesystem
#all_file_ids, #all_file_ids_for_selected_resources, #all_files, #class_from_id, #dump, #file_type, #filename, #find_file_by_id, #load_from_file, #load_from_file_by_id, #mydir, #purge, #write_file
Constructor Details
#initialize(options) ⇒ Dashboards
Returns a new instance of Dashboards.
34 35 36 37 |
# File 'lib/datadog_backup/dashboards.rb', line 34 def initialize() super() @banlist = %w[modified_at url].freeze end |
Instance Method Details
#all_dashboards ⇒ Object
30 31 32 |
# File 'lib/datadog_backup/dashboards.rb', line 30 def all_dashboards get_all.fetch('dashboards') end |
#api_resource_name ⇒ Object
10 11 12 |
# File 'lib/datadog_backup/dashboards.rb', line 10 def api_resource_name 'dashboard' end |
#api_version ⇒ Object
6 7 8 |
# File 'lib/datadog_backup/dashboards.rb', line 6 def api_version 'v1' end |
#backup ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/datadog_backup/dashboards.rb', line 14 def backup LOGGER.info("Starting diffs on #{::DatadogBackup::ThreadPool::TPOOL.max_length} threads") futures = all_dashboards.map do |board| Concurrent::Promises.future_on(::DatadogBackup::ThreadPool::TPOOL, board) do |board| id = board['id'] get_and_write_file(id) end end watcher = ::DatadogBackup::ThreadPool.watcher watcher.join if watcher.status Concurrent::Promises.zip(*futures).value! end |