Sha256: 7abf3767e07176a68603aeab0bd491213cc0b70f2e7604c19c763c0c5a3403a1
Contents?: true
Size: 877 Bytes
Versions: 5
Compression:
Stored size: 877 Bytes
Contents
# frozen_string_literal: true module DatadogBackup class Monitors < Core API_SERVICE_NAME = :@monitor_svc BANLIST = %w[overall_state overall_state_modified matching_downtimes modified] def all_monitors @all_monitors ||= client_with_200(:get_all_monitors) end def api_service # The underlying class from Dogapi that talks to datadog client.instance_variable_get(:@monitor_svc) end def api_version 'v1' end def api_resource_name 'monitor' end def backup all_monitors.map do |monitor| id = monitor['id'] write_file(dump(get_by_id(id)), filename(id)) end end def diff(id) super(id, BANLIST) end def get_by_id(id) except(all_monitors.select { |monitor| monitor['id'].to_s == id.to_s }.first, BANLIST) end def restore!; end end end
Version data entries
5 entries across 5 versions & 1 rubygems