Class: DatadogBackup::Dashboards
- Inherits:
-
Core
- Object
- Core
- DatadogBackup::Dashboards
show all
- Defined in:
- lib/datadog_backup/dashboards.rb
Constant Summary
collapse
- BANLIST =
%w[modified_at url]
Instance Method Summary
collapse
Methods inherited from Core
#client_with_200, #except, #get_and_write_file, #initialize, #myclass, #restore, #update, #update_with_200
Methods included from Options
#action, #backup_dir, #client, #concurrency_limit, #datadog_api_key, #datadog_app_key, #diff_format, #logger, #output_format, #resources
#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
Instance Method Details
#all_boards ⇒ Object
7
8
9
|
# File 'lib/datadog_backup/dashboards.rb', line 7
def all_boards
client_with_200(:get_all_boards).fetch('dashboards')
end
|
#api_resource_name ⇒ Object
20
21
22
|
# File 'lib/datadog_backup/dashboards.rb', line 20
def api_resource_name
'dashboard'
end
|
#api_service ⇒ Object
11
12
13
14
|
# File 'lib/datadog_backup/dashboards.rb', line 11
def api_service
client.instance_variable_get(:@dashboard_service)
end
|
#api_version ⇒ Object
16
17
18
|
# File 'lib/datadog_backup/dashboards.rb', line 16
def api_version
'v1'
end
|
#backup ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/datadog_backup/dashboards.rb', line 24
def backup
logger.info("Starting diffs on #{::DatadogBackup::ThreadPool::TPOOL.max_length} threads")
futures = all_boards.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(logger)
watcher.join if watcher.status
Concurrent::Promises.zip(*futures).value!
end
|
#diff(id) ⇒ Object
40
41
42
|
# File 'lib/datadog_backup/dashboards.rb', line 40
def diff(id)
super(id, BANLIST)
end
|
#get_by_id(id) ⇒ Object
44
45
46
|
# File 'lib/datadog_backup/dashboards.rb', line 44
def get_by_id(id)
except(client_with_200(:get_board, id), BANLIST)
end
|
#restore! ⇒ Object
48
|
# File 'lib/datadog_backup/dashboards.rb', line 48
def restore!; end
|