Class: Wavefront::Proxy

Inherits:
Base
  • Object
show all
Defined in:
lib/wavefront-sdk/proxy.rb

Overview

Manage and query Wavefront proxies.

Instance Attribute Summary

Attributes inherited from Base

#api_base, #conn, #debug, #logger, #net, #noop, #opts, #update_keys, #verbose

Instance Method Summary collapse

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

#parse_time

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

#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 an proxy in ‘trash’ removes it for ever.

Parameters:

  • id (String)

    ID of the proxy

Returns:



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

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:



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

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



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

def list(offset = 0, limit = 100)
  api_get('', { offset: offset, limit: limit })
end

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

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

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

Parameters:

  • id (String)

    ID of the proxy

  • name (String)

    new name

Returns:



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

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

#undelete(id) ⇒ Wavefront::Response

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

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

Parameters:

  • id (String)

    ID of the proxy

Returns:



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

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 an 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:



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

def update(id, payload)
  wf_proxy_id?(id)
  api_put(id, payload)
end