Class: Dd2tf::Import::Monitor

Inherits:
Base
  • Object
show all
Defined in:
lib/dd2tf/import/monitor.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #print

Constructor Details

This class inherits a constructor from Dd2tf::Import::Base

Instance Method Details

#resource_typeObject



4
5
6
# File 'lib/dd2tf/import/monitor.rb', line 4

def resource_type
  "datadog_monitor"
end

#resourcesObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/dd2tf/import/monitor.rb', line 8

def resources
  resources = []
  monitors = @client.get_all_monitors[1]

  monitors.each do |monitor|
    monitor_name = monitor["name"].underscore.gsub(" ", "_").gsub(::Dd2tf::UNALLOWED_RESOURCE_TITLE_REGEXP, '')
    resource_id = monitor["id"]
    resources << { resource_id: resource_id, resource_name: monitor_name }
  end

  resources
end