Class: Wavefront::Proxy

Inherits:
CoreApi show all
Defined in:
lib/wavefront-sdk/proxy.rb

Overview

Manage and query Wavefront proxies.

Instance Attribute Summary

Attributes inherited from CoreApi

#api, #creds, #logger, #opts, #update_keys

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

#config(id) ⇒ Wavefront::Response

GET /api/v2/proxy/id/config Get a specific proxy config

Parameters:

  • id (String)

    ID of the proxy

Returns:



106
107
108
109
# File 'lib/wavefront-sdk/proxy.rb', line 106

def config(id)
  wf_proxy_id?(id)
  api.get([id, 'config'].uri_concat)
end

#delete(id) ⇒ Wavefront::Response

DELETE /api/v2/proxy/id Delete a specific proxy

Deleting an active proxy moves it to ‘trash’, from where it can be restored with an #undelete operation. Deleting a proxy in ‘trash’ removes it for ever.

Parameters:

  • id (String)

    ID of the proxy

Returns:



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

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

#describe(id) ⇒ Wavefront::Response

GET /api/v2/proxy/id Get a specific proxy

Parameters:

  • id (String)

    ID of the proxy

Returns:



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

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

#list(offset = 0, limit = 100) ⇒ Object

GET /api/v2/proxy Get all proxies for a customer

Parameters:

  • offset (Int) (defaults to: 0)

    proxy at which the list begins

  • limit (Int) (defaults to: 100)

    the number of proxies to return



16
17
18
# File 'lib/wavefront-sdk/proxy.rb', line 16

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

#preprocessor_rules(id) ⇒ Wavefront::Response

GET /api/v2/proxy/id/preprocessorRules Get a specific proxy preprocessor rules

Parameters:

  • id (String)

    ID of the proxy

Returns:



117
118
119
120
# File 'lib/wavefront-sdk/proxy.rb', line 117

def preprocessor_rules(id)
  wf_proxy_id?(id)
  api.get([id, 'preprocessorRules'].uri_concat)
end

#rename(id, name) ⇒ Wavefront::Response

PUT /api/v2/proxy/id Update the name of a specific proxy

Rename a proxy. This changes the human-readable name, not the unique identifier.

Parameters:

  • id (String)

    ID of the proxy

  • name (String)

    new name

Returns:



69
70
71
72
73
# File 'lib/wavefront-sdk/proxy.rb', line 69

def rename(id, name)
  wf_proxy_id?(id)
  wf_string?(name)
  update(id, name: name)
end

#shutdown(id) ⇒ Wavefront::Response

Shutdown a proxy. Requires proxy >=5.x. Might not be effective if you have something like systemd or SMF restarting a failed proxy.

Parameters:

  • id (String)

    ID of the proxy

Returns:



95
96
97
98
# File 'lib/wavefront-sdk/proxy.rb', line 95

def shutdown(id)
  wf_proxy_id?(id)
  api.put(id, { shutdown: true }, 'application/json')
end

#undelete(id) ⇒ Wavefront::Response

POST /api/v2/proxy/id/undelete Undelete a specific proxy

Move a proxy from ‘trash’ back into active service.

Parameters:

  • id (String)

    ID of the proxy

Returns:



54
55
56
57
# File 'lib/wavefront-sdk/proxy.rb', line 54

def undelete(id)
  wf_proxy_id?(id)
  api.post([id, 'undelete'].uri_concat)
end

#update(id, payload) ⇒ Wavefront::Response

A generic function to change properties of a proxy. So far as I know, only the ‘name’ property can currently be changed, and we supply a dedicated #rename method for that.

Parameters:

  • id (String)

    ID of the proxy

  • payload (Hash)

    a key: value hash, where the key is the property to change and the value is its desired value. No validation is performed on any part of the payload.

Returns:



85
86
87
88
# File 'lib/wavefront-sdk/proxy.rb', line 85

def update(id, payload)
  wf_proxy_id?(id)
  api.put(id, payload)
end