Class: Dd2tf::Import::Timeboard

Inherits:
Base
  • Object
show all
Defined in:
lib/dd2tf/import/timeboard.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/timeboard.rb', line 4

def resource_type
  "datadog_timeboard"
end

#resourcesObject



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

def resources
  resources = []
  boards = @client.get_dashboards[1]["dashes"]

  boards.each do |board|
    board_name = board["title"].underscore.gsub(" ", "_").gsub(::Dd2tf::UNALLOWED_RESOURCE_TITLE_REGEXP, '')
    resource_id = board["id"]
    resources << { resource_id: resource_id, resource_name: board_name }
  end

  resources
end