class DatadogBackup::Dashboards

Public Class Methods

new(options) click to toggle source
Calls superclass method DatadogBackup::Core::new
# File lib/datadog_backup/dashboards.rb, line 38
def initialize(options)
  super(options)
  @banlist = %w[modified_at url].freeze
end

Public Instance Methods

all_boards() click to toggle source
# File lib/datadog_backup/dashboards.rb, line 5
def all_boards
  get_all.fetch('dashboards')
end
api_resource_name() click to toggle source
# File lib/datadog_backup/dashboards.rb, line 18
def api_resource_name
  'dashboard'
end
api_service() click to toggle source
# File lib/datadog_backup/dashboards.rb, line 9
def api_service
  # The underlying class from Dogapi that talks to datadog
  client.instance_variable_get(:@dashboard_service)
end
api_version() click to toggle source
# File lib/datadog_backup/dashboards.rb, line 14
def api_version
  'v1'
end
backup() click to toggle source
# File lib/datadog_backup/dashboards.rb, line 22
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