Class: Wavefront::ApiToken
- Defined in:
- lib/wavefront-sdk/apitoken.rb
Overview
View and manage API tokens
Instance Attribute Summary
Attributes inherited from CoreApi
#api, #creds, #logger, #opts, #update_keys
Instance Method Summary collapse
-
#create ⇒ Wavefront::Response
POST /api/v2/apitoken Create a new api token.
-
#delete(id) ⇒ Wavefront::Response
DELETE /api/v2/apitoken/id Delete the specified api token.
-
#list ⇒ Wavefront::Response
GET /api/v2/apitoken Get all api tokens for a user.
-
#rename(id, name) ⇒ Wavefront::Response
PUT /api/v2/apitoken/id Update the name of the specified api token.
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_apitoken_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_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 ⇒ Wavefront::Response
POST /api/v2/apitoken Create a new api token
22 23 24 |
# File 'lib/wavefront-sdk/apitoken.rb', line 22 def create api.post('', nil, 'application/json') end |
#delete(id) ⇒ Wavefront::Response
DELETE /api/v2/apitoken/id Delete the specified api token
32 33 34 35 |
# File 'lib/wavefront-sdk/apitoken.rb', line 32 def delete(id) wf_apitoken_id?(id) api.delete(id) end |
#list ⇒ Wavefront::Response
GET /api/v2/apitoken Get all api tokens for a user
13 14 15 |
# File 'lib/wavefront-sdk/apitoken.rb', line 13 def list api.get('') end |
#rename(id, name) ⇒ Wavefront::Response
PUT /api/v2/apitoken/id Update the name of the specified api token
44 45 46 47 |
# File 'lib/wavefront-sdk/apitoken.rb', line 44 def rename(id, name) wf_apitoken_id?(id) api.put(id, { tokenID: id, tokenName: name }, 'application/json') end |