Class: Wavefront::MetricsPolicy
- Defined in:
- lib/wavefront-sdk/metricspolicy.rb
Overview
Manage and query Wavefront metrics policies
Instance Attribute Summary
Attributes inherited from CoreApi
#api, #creds, #logger, #opts, #update_keys
Instance Method Summary collapse
-
#describe(version = nil) ⇒ Wavefront::Response
GET /api/v2/metricspolicy Get the metrics policy GET /api/v2/metricspolicy/history/version Get a specific historical version of a metrics policy.
-
#history(offset = 0, limit = 100) ⇒ Object
GET /api/v2/metricspolicy/history Get the version history of metrics policy.
-
#revert(version) ⇒ Wavefront::Response
POST /api/v2/metricspolicy/revert/version Revert to a specific historical version of a metrics policy.
-
#update(body) ⇒ Wavefront::Response
PUT /api/v2/metricspolicy Update the metrics policy.
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_account_id?, #wf_alert_id?, #wf_alert_severity?, #wf_apitoken_id?, #wf_aws_external_id?, #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_ingestionpolicy_id?, #wf_integration_id?, #wf_link_id?, #wf_link_template?, #wf_maintenance_window_id?, #wf_message_id?, #wf_metric_name?, #wf_metricspolicy_id?, #wf_monitoredapplication_id?, #wf_monitoredcluster_id?, #wf_ms_ts?, #wf_name?, #wf_notificant_id?, #wf_permission?, #wf_point?, #wf_point_tag?, #wf_point_tags?, #wf_proxy_id?, #wf_role_id?, #wf_sampling_value?, #wf_savedsearch_entity?, #wf_savedsearch_id?, #wf_serviceaccount_id?, #wf_source_id?, #wf_spansamplingpolicy_id?, #wf_string?, #wf_tag?, #wf_trace?, #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
#describe(version = nil) ⇒ Wavefront::Response
GET /api/v2/metricspolicy Get the metrics policy GET /api/v2/metricspolicy/history/version Get a specific historical version of a metrics policy
17 18 19 20 21 22 23 24 |
# File 'lib/wavefront-sdk/metricspolicy.rb', line 17 def describe(version = nil) if version wf_version?(version) api.get(['history', version].uri_concat) else api.get('') end end |
#history(offset = 0, limit = 100) ⇒ Object
GET /api/v2/metricspolicy/history Get the version history of metrics policy
32 33 34 |
# File 'lib/wavefront-sdk/metricspolicy.rb', line 32 def history(offset = 0, limit = 100) api.get('history', offset: offset, limit: limit) end |
#revert(version) ⇒ Wavefront::Response
POST /api/v2/metricspolicy/revert/version Revert to a specific historical version of a metrics policy
41 42 43 44 |
# File 'lib/wavefront-sdk/metricspolicy.rb', line 41 def revert(version) wf_version?(version) api.post(['revert', version].uri_concat, nil, 'application/json') end |
#update(body) ⇒ Wavefront::Response
PUT /api/v2/metricspolicy Update the metrics policy
51 52 53 54 55 |
# File 'lib/wavefront-sdk/metricspolicy.rb', line 51 def update(body) raise ArgumentError unless body.is_a?(Hash) api.put('', body, 'application/json') end |