Class: Wavefront::ServiceAccount
- Defined in:
- lib/wavefront-sdk/serviceaccount.rb
Overview
Manage and query Wavefront service accounts
Instance Attribute Summary
Attributes inherited from CoreApi
Instance Method Summary collapse
-
#activate(id) ⇒ Wavefront::Response
POST /api/v2/account/serviceaccount/id/activate Activates the given service account.
- #api_base ⇒ Object
-
#create(body) ⇒ Wavefront::Response
POST /api/v2/account/serviceaccount Creates a service account Refer to the Swagger API docs for valid keys.
-
#deactivate(id) ⇒ Wavefront::Response
POST /api/v2/account/serviceaccount/id/deactivate Deactivates the given service account.
-
#describe(id) ⇒ Wavefront::Response
GET /api/v2/account/serviceaccount/id Retrieves a service account by identifier.
-
#list ⇒ Object
GET /api/v2/account/serviceaccount Get all service accounts.
-
#update(id, body, modify = true) ⇒ Wavefront::Response
PUT /api/v2/account/serviceaccount/id Updates the service account.
- #update_keys ⇒ Object
Methods inherited from CoreApi
#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
#activate(id) ⇒ Wavefront::Response
POST /api/v2/account/serviceaccount/id/activate Activates the given service account
75 76 77 78 |
# File 'lib/wavefront-sdk/serviceaccount.rb', line 75 def activate(id) wf_serviceaccount_id?(id) api.post([id, 'activate'].uri_concat, nil, 'application/json') end |
#api_base ⇒ Object
10 11 12 |
# File 'lib/wavefront-sdk/serviceaccount.rb', line 10 def api_base '/account/serviceaccount' end |
#create(body) ⇒ Wavefront::Response
POST /api/v2/account/serviceaccount Creates a service account Refer to the Swagger API docs for valid keys.
31 32 33 34 35 |
# File 'lib/wavefront-sdk/serviceaccount.rb', line 31 def create(body) raise ArgumentError unless body.is_a?(Hash) api.post('', body, 'application/json') end |
#deactivate(id) ⇒ Wavefront::Response
POST /api/v2/account/serviceaccount/id/deactivate Deactivates the given service account
86 87 88 89 |
# File 'lib/wavefront-sdk/serviceaccount.rb', line 86 def deactivate(id) wf_serviceaccount_id?(id) api.post([id, 'deactivate'].uri_concat, nil, 'application/json') end |
#describe(id) ⇒ Wavefront::Response
GET /api/v2/account/serviceaccount/id Retrieves a service account by identifier
43 44 45 46 |
# File 'lib/wavefront-sdk/serviceaccount.rb', line 43 def describe(id) wf_serviceaccount_id?(id) api.get(id) end |
#list ⇒ Object
GET /api/v2/account/serviceaccount Get all service accounts
20 21 22 |
# File 'lib/wavefront-sdk/serviceaccount.rb', line 20 def list api.get('') end |
#update(id, body, modify = true) ⇒ Wavefront::Response
PUT /api/v2/account/serviceaccount/id Updates the service account
59 60 61 62 63 64 65 66 67 |
# File 'lib/wavefront-sdk/serviceaccount.rb', line 59 def update(id, body, modify = true) wf_serviceaccount_id?(id) raise ArgumentError unless body.is_a?(Hash) return api.put(id, body, 'application/json') unless modify api.put(id, hash_for_update(describe(id).response, body), 'application/json') end |
#update_keys ⇒ Object
91 92 93 |
# File 'lib/wavefront-sdk/serviceaccount.rb', line 91 def update_keys %i[description tokens groups userGroups active identifier] end |