Class: DatadogBackup::Monitors
- Defined in:
- lib/datadog_backup/monitors.rb
Overview
Monitor specific overrides for backup and restore.
Constant Summary
Constants inherited from Resources
Instance Method Summary collapse
- #all ⇒ Object
- #backup ⇒ Object
- #get_by_id(id) ⇒ Object
-
#initialize(options) ⇒ Monitors
constructor
A new instance of Monitors.
Methods inherited from Resources
#body_with_2xx, #create, #diff, #except, #get, #get_all, #get_and_write_file, #myclass, #restore, #update
Methods included from Options
#action, #backup_dir, #concurrency_limit, #diff_format, #disable_array_sort, #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) ⇒ Monitors
Returns a new instance of Monitors.
22 23 24 25 |
# File 'lib/datadog_backup/monitors.rb', line 22 def initialize() super() @banlist = %w[overall_state overall_state_modified matching_downtimes modified].freeze end |
Instance Method Details
#all ⇒ Object
6 7 8 |
# File 'lib/datadog_backup/monitors.rb', line 6 def all get_all end |
#backup ⇒ Object
10 11 12 13 14 15 |
# File 'lib/datadog_backup/monitors.rb', line 10 def backup all.map do |monitor| id = monitor['id'] write_file(dump(get_by_id(id)), filename(id)) end end |
#get_by_id(id) ⇒ Object
17 18 19 20 |
# File 'lib/datadog_backup/monitors.rb', line 17 def get_by_id(id) monitor = all.select { |m| m['id'].to_s == id.to_s }.first monitor.nil? ? {} : except(monitor) end |