Class: Wavefront::Notificant
- Defined in:
- lib/wavefront-sdk/notificant.rb
Overview
Manage and query Wavefront notification targets.
Instance Attribute Summary
Attributes inherited from CoreApi
#api, #creds, #logger, #opts, #update_keys
Instance Method Summary collapse
-
#create(body) ⇒ Wavefront::Response
POST /api/v2/notificant Create a notification target.
-
#delete(id) ⇒ Wavefront::Response
DELETE /api/v2/notificant/id Delete a specific notificant.
-
#describe(id) ⇒ Wavefront::Response
GET /api/v2/notificant/id Get a specific notification target.
-
#list(offset = 0, limit = 100) ⇒ Object
GET /api/v2/notificant Get all notification targets for a customer.
-
#test(id) ⇒ Wavefront::Response
POST /api/v2/notificant/test/id Create a notification target.
-
#update(id, body, modify = true) ⇒ Wavefront::Response
PUT /api/v2/notificant/id Update a specific notification target.
Methods inherited from CoreApi
#api_base, #api_path, #hash_for_update, #initialize, #setup_api, #time_to_ms
Methods included from Mixins
#log, #parse_relative_time, #parse_time, #relative_time, #time_multiplier, #valid_relative_time?
Methods included from Validators
#uuid?, #wf_alert_id?, #wf_alert_severity?, #wf_cloudintegration_id?, #wf_dashboard_id?, #wf_derivedmetric_id?, #wf_distribution?, #wf_distribution_count?, #wf_distribution_interval?, #wf_distribution_values?, #wf_epoch?, #wf_event_id?, #wf_granularity?, #wf_integration_id?, #wf_link_id?, #wf_link_template?, #wf_maintenance_window_id?, #wf_message_id?, #wf_metric_name?, #wf_ms_ts?, #wf_name?, #wf_notificant_id?, #wf_point?, #wf_point_tag?, #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_usergroup_id?, #wf_value?, #wf_version?, #wf_webhook_id?
Constructor Details
This class inherits a constructor from Wavefront::CoreApi
Instance Method Details
#create(body) ⇒ Wavefront::Response
POST /api/v2/notificant Create a notification target.
24 25 26 27 |
# File 'lib/wavefront-sdk/notificant.rb', line 24 def create(body) raise ArgumentError unless body.is_a?(Hash) api.post('', body, 'application/json') end |
#delete(id) ⇒ Wavefront::Response
DELETE /api/v2/notificant/id Delete a specific notificant
35 36 37 38 |
# File 'lib/wavefront-sdk/notificant.rb', line 35 def delete(id) wf_notificant_id?(id) api.delete(id) end |
#describe(id) ⇒ Wavefront::Response
GET /api/v2/notificant/id Get a specific notification target
46 47 48 49 |
# File 'lib/wavefront-sdk/notificant.rb', line 46 def describe(id) wf_notificant_id?(id) api.get(id) end |
#list(offset = 0, limit = 100) ⇒ Object
GET /api/v2/notificant Get all notification targets for a customer
14 15 16 |
# File 'lib/wavefront-sdk/notificant.rb', line 14 def list(offset = 0, limit = 100) api.get('', offset: offset, limit: limit) end |
#test(id) ⇒ Wavefront::Response
POST /api/v2/notificant/test/id Create a notification target.
78 79 80 81 |
# File 'lib/wavefront-sdk/notificant.rb', line 78 def test(id) wf_notificant_id?(id) api.post(['test', id].uri_concat, nil) end |
#update(id, body, modify = true) ⇒ Wavefront::Response
PUT /api/v2/notificant/id Update a specific notification target
62 63 64 65 66 67 68 69 70 |
# File 'lib/wavefront-sdk/notificant.rb', line 62 def update(id, body, modify = true) wf_notificant_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 |