Class: Wavefront::SavedSearch

Inherits:
CoreApi
  • Object
show all
Defined in:
lib/wavefront-sdk/savedsearch.rb

Overview

View and manage Cloud Integrations. These are identified by a UUID.

Instance Attribute Summary

Attributes inherited from CoreApi

#api, #creds, #logger, #opts

Instance Method Summary collapse

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

#create(body) ⇒ Wavefront::Response

POST /api/v2/savedsearch Create a saved search. Refer to the Swagger API docs for valid keys.

Parameters:

  • body (Hash)

    description of saved search

Returns:

Raises:

  • (ArgumentError)


29
30
31
32
33
# File 'lib/wavefront-sdk/savedsearch.rb', line 29

def create(body)
  raise ArgumentError unless body.is_a?(Hash)

  api.post('', body, 'application/json')
end

#delete(id) ⇒ Wavefront::Response

DELETE /api/v2/savedsearch/id Delete a specific saved search.

Parameters:

  • id (String)

    ID of the saved search

Returns:



41
42
43
44
# File 'lib/wavefront-sdk/savedsearch.rb', line 41

def delete(id)
  wf_savedsearch_id?(id)
  api.delete(id)
end

#describe(id) ⇒ Wavefront::Response

GET /api/v2/savedsearch/id Get a specific saved search.

Parameters:

  • id (String)

    ID of the saved search

Returns:



52
53
54
55
# File 'lib/wavefront-sdk/savedsearch.rb', line 52

def describe(id)
  wf_savedsearch_id?(id)
  api.get(id)
end

#entity(entitytype, offset = 0, limit = 100) ⇒ Wavefront::Response

GET /api/v2/savedsearch/type/entitytype Get all saved searches for a specific entity type for a user.

Parameters:

  • entitytype (String)

    type of entity to retrieve

  • offset (Int) (defaults to: 0)

    saved search at which the list begins

  • limit (Int) (defaults to: 100)

    the number of saved searches to return

Returns:



78
79
80
81
82
# File 'lib/wavefront-sdk/savedsearch.rb', line 78

def entity(entitytype, offset = 0, limit = 100)
  wf_savedsearch_entity?(entitytype)
  api.get(['type', entitytype].uri_concat, offset: offset,
                                           limit: limit)
end

#list(offset = 0, limit = 100) ⇒ Wavefront::Response

GET /api/v2/savedsearch Get all saved searches for a user.

Parameters:

  • offset (Int) (defaults to: 0)

    saved search at which the list begins

  • limit (Int) (defaults to: 100)

    the number of saved searches to return

Returns:



18
19
20
# File 'lib/wavefront-sdk/savedsearch.rb', line 18

def list(offset = 0, limit = 100)
  api.get('', offset: offset, limit: limit)
end

#update(id, body) ⇒ Object

PUT /api/v2/savedsearch/id Update a specific saved search.

Parameters:

Raises:

  • (ArgumentError)


63
64
65
66
67
68
# File 'lib/wavefront-sdk/savedsearch.rb', line 63

def update(id, body)
  wf_savedsearch_id?(id)
  raise ArgumentError unless body.is_a?(Hash)

  api.put(id, body)
end

#update_keysObject



84
85
86
# File 'lib/wavefront-sdk/savedsearch.rb', line 84

def update_keys
  %i[query entityType]
end