Class: Wavefront::Dashboard
Overview
View and manage dashboards.
Instance Attribute Summary
Attributes inherited from Base
#api_base, #conn, #debug, #logger, #net, #noop, #opts, #verbose
Instance Method Summary collapse
-
#create(body) ⇒ Wavefront::Response
POST /api/v2/dashboard Create a specific dashboard.
-
#delete(id) ⇒ Wavefront::Response
DELETE /api/v2/dashboard/id Delete a specific dashboard.
-
#describe(id, version = nil) ⇒ Wavefront::Response
GET /api/v2/dashboard/id Get a specific dashboard / Get a specific historical version of a specific dashboard.
-
#history(id) ⇒ Wavefront::Response
GET /api/v2/dashboard/id/history Get the version history of an dashboard.
-
#list(offset = 0, limit = 100) ⇒ Wavefront::Response
GET /api/v2/dashboard Get all dashboards for a customer.
-
#tag_add(id, tag) ⇒ Wavefront::Response
PUT /api/v2/dashboard/id/tag/tagValue Add a tag to a specific dashboard.
-
#tag_delete(id, tag) ⇒ Wavefront::Response
DELETE /api/v2/dashboard/id/tag/tagValue Remove a tag from a specific dashboard.
-
#tag_set(id, tags) ⇒ Wavefront::Response
POST /api/v2/dashboard/id/tag Set all tags associated with a specific dashboard.
-
#tags(id) ⇒ Wavefront::Response
GET /api/v2/dashboard/id/tag Get all tags associated with a specific dashboard.
-
#undelete(id) ⇒ Wavefront::Response
POST /api/v2/dashboard/id/undelete Move an dashboard from ‘trash’ back into active service.
-
#update(id, body, modify = true) ⇒ Wavefront::Response
PUT /api/v2/dashboard/id Update a specific dashboard.
- #update_keys ⇒ Object
Methods inherited from Base
#api_delete, #api_get, #api_post, #api_put, #hash_for_update, #initialize, #log, #mk_conn, #respond, #time_to_ms
Methods included from Mixins
Methods included from Validators
#wf_alert_id?, #wf_alert_severity?, #wf_cloudintegration_id?, #wf_dashboard_id?, #wf_epoch?, #wf_event_id?, #wf_granularity?, #wf_link_id?, #wf_link_template?, #wf_maintenance_window_id?, #wf_message_id?, #wf_metric_name?, #wf_ms_ts?, #wf_name?, #wf_point?, #wf_point_tags?, #wf_proxy_id?, #wf_savedsearch_entity?, #wf_savedsearch_id?, #wf_source_id?, #wf_string?, #wf_tag?, #wf_ts?, #wf_user_id?, #wf_value?, #wf_version?, #wf_webhook_id?
Constructor Details
This class inherits a constructor from Wavefront::Base
Instance Method Details
#create(body) ⇒ Wavefront::Response
POST /api/v2/dashboard Create a specific dashboard. Refer to the Swagger API docs for valid keys.
30 31 32 33 |
# File 'lib/wavefront-sdk/dashboard.rb', line 30 def create(body) raise ArgumentError unless body.is_a?(Hash) api_post('', body, 'application/json') end |
#delete(id) ⇒ Wavefront::Response
DELETE /api/v2/dashboard/id Delete a specific dashboard. Deleting an active dashboard moves it to ‘trash’, from where it can be restored with an #undelete operation. Deleting an dashboard in ‘trash’ removes it for ever.
44 45 46 47 |
# File 'lib/wavefront-sdk/dashboard.rb', line 44 def delete(id) wf_dashboard_id?(id) api_delete(id) end |
#describe(id, version = nil) ⇒ Wavefront::Response
GET /api/v2/dashboard/id Get a specific dashboard / Get a specific historical version of a specific dashboard.
57 58 59 60 61 62 63 |
# File 'lib/wavefront-sdk/dashboard.rb', line 57 def describe(id, version = nil) wf_dashboard_id?(id) wf_version?(version) if version fragments = [id] fragments += ['history', version] if version api_get(fragments.uri_concat) end |
#history(id) ⇒ Wavefront::Response
GET /api/v2/dashboard/id/history Get the version history of an dashboard.
93 94 95 96 |
# File 'lib/wavefront-sdk/dashboard.rb', line 93 def history(id) wf_dashboard_id?(id) api_get([id, 'history'].uri_concat) end |
#list(offset = 0, limit = 100) ⇒ Wavefront::Response
GET /api/v2/dashboard Get all dashboards for a customer.
19 20 21 |
# File 'lib/wavefront-sdk/dashboard.rb', line 19 def list(offset = 0, limit = 100) api_get('', { offset: offset, limit: limit }) end |
#tag_add(id, tag) ⇒ Wavefront::Response
PUT /api/v2/dashboard/id/tag/tagValue Add a tag to a specific dashboard.
145 146 147 148 149 |
# File 'lib/wavefront-sdk/dashboard.rb', line 145 def tag_add(id, tag) wf_dashboard_id?(id) wf_string?(tag) api_put([id, 'tag', tag].uri_concat) end |
#tag_delete(id, tag) ⇒ Wavefront::Response
DELETE /api/v2/dashboard/id/tag/tagValue Remove a tag from a specific dashboard.
132 133 134 135 136 |
# File 'lib/wavefront-sdk/dashboard.rb', line 132 def tag_delete(id, tag) wf_dashboard_id?(id) wf_string?(tag) api_delete([id, 'tag', tag].uri_concat) end |
#tag_set(id, tags) ⇒ Wavefront::Response
POST /api/v2/dashboard/id/tag Set all tags associated with a specific dashboard.
118 119 120 121 122 123 |
# File 'lib/wavefront-sdk/dashboard.rb', line 118 def tag_set(id, ) wf_dashboard_id?(id) = Array() .each { |t| wf_string?(t) } api_post([id, 'tag'].uri_concat, .to_json, 'application/json') end |
#tags(id) ⇒ Wavefront::Response
GET /api/v2/dashboard/id/tag Get all tags associated with a specific dashboard.
105 106 107 108 |
# File 'lib/wavefront-sdk/dashboard.rb', line 105 def (id) wf_dashboard_id?(id) api_get([id, 'tag'].uri_concat) end |
#undelete(id) ⇒ Wavefront::Response
POST /api/v2/dashboard/id/undelete Move an dashboard from ‘trash’ back into active service.
157 158 159 160 |
# File 'lib/wavefront-sdk/dashboard.rb', line 157 def undelete(id) wf_dashboard_id?(id) api_post([id, 'undelete'].uri_concat) end |
#update(id, body, modify = true) ⇒ Wavefront::Response
PUT /api/v2/dashboard/id Update a specific dashboard.
76 77 78 79 80 81 82 83 84 |
# File 'lib/wavefront-sdk/dashboard.rb', line 76 def update(id, body, modify = true) wf_dashboard_id?(id) raise ArgumentError unless body.is_a?(Hash) return api_put(id, body, 'application/json') unless modify api_put(id, hash_for_update(describe(id).response, body), 'application/json') end |
#update_keys ⇒ Object
8 9 10 |
# File 'lib/wavefront-sdk/dashboard.rb', line 8 def update_keys %i(id name url description sections) end |