Class: Wavefront::UserGroup
- Includes:
- UserMixins
- Defined in:
- lib/wavefront-sdk/usergroup.rb
Overview
Manage and query Wavefront user groups
Instance Attribute Summary
Attributes inherited from CoreApi
Instance Method Summary collapse
-
#add_users_to_group(id, user_list = []) ⇒ Wavefront::Response
POST /api/v2/usergroup/id/addUsers Add multiple users to a specific user group.
-
#create(body) ⇒ Wavefront::Response
POST /api/v2/usergroup Create a specific user group.
-
#delete(id) ⇒ Wavefront::Response
DELETE /api/v2/usergroup/id Delete a specific user group.
-
#describe(id) ⇒ Wavefront::Response
GET /api/v2/usergroup/id Get a specific user group.
-
#grant(perm, group_list = []) ⇒ Wavefront::Response
POST /api/v2/usergroup/grant/permission Grants a single permission to user group(s).
-
#list(offset = 0, limit = 100) ⇒ Wavefront::Response
GET /api/v2/usergroup Get all user groups for a customer.
-
#remove_users_from_group(id, user_list = []) ⇒ Wavefront::Response
POST /api/v2/usergroup/id/removeUsers Remove multiple users from a specific user group.
-
#revoke(perm, group_list = []) ⇒ Wavefront::Response
POST /api/v2/usergroup/revoke/permission Revokes a single permission from user group(s).
-
#update(id, body, modify = true) ⇒ Wavefront::Response
PUT /api/v2/usergroup/id Update a specific user group.
- #update_keys ⇒ Object
Methods included from UserMixins
#validate_user_list, #validate_usergroup_list
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_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
#add_users_to_group(id, user_list = []) ⇒ Wavefront::Response
POST /api/v2/usergroup/id/addUsers Add multiple users to a specific user group
88 89 90 91 92 |
# File 'lib/wavefront-sdk/usergroup.rb', line 88 def add_users_to_group(id, user_list = []) wf_usergroup_id?(id) validate_user_list(user_list) api.post([id, 'addUsers'].uri_concat, user_list, 'application/json') end |
#create(body) ⇒ Wavefront::Response
POST /api/v2/usergroup Create a specific user group
33 34 35 36 |
# File 'lib/wavefront-sdk/usergroup.rb', line 33 def create(body) raise ArgumentError unless body.is_a?(Hash) api.post('', body, 'application/json') end |
#delete(id) ⇒ Wavefront::Response
DELETE /api/v2/usergroup/id Delete a specific user group
44 45 46 47 |
# File 'lib/wavefront-sdk/usergroup.rb', line 44 def delete(id) wf_usergroup_id?(id) api.delete(id) end |
#describe(id) ⇒ Wavefront::Response
GET /api/v2/usergroup/id Get a specific user group
55 56 57 58 |
# File 'lib/wavefront-sdk/usergroup.rb', line 55 def describe(id) wf_usergroup_id?(id) api.get(id) end |
#grant(perm, group_list = []) ⇒ Wavefront::Response
POST /api/v2/usergroup/grant/permission Grants a single permission to user group(s)
116 117 118 119 |
# File 'lib/wavefront-sdk/usergroup.rb', line 116 def grant(perm, group_list = []) validate_usergroup_list(group_list) api.post(['grant', perm].uri_concat, group_list, 'application/json') end |
#list(offset = 0, limit = 100) ⇒ Wavefront::Response
GET /api/v2/usergroup Get all user groups for a customer
21 22 23 |
# File 'lib/wavefront-sdk/usergroup.rb', line 21 def list(offset = 0, limit = 100) api.get('', offset: offset, limit: limit) end |
#remove_users_from_group(id, user_list = []) ⇒ Wavefront::Response
POST /api/v2/usergroup/id/removeUsers Remove multiple users from a specific user group
101 102 103 104 105 106 |
# File 'lib/wavefront-sdk/usergroup.rb', line 101 def remove_users_from_group(id, user_list = []) wf_usergroup_id?(id) validate_user_list(user_list) api.post([id, 'removeUsers'].uri_concat, user_list, 'application/json') end |
#revoke(perm, group_list = []) ⇒ Wavefront::Response
POST /api/v2/usergroup/revoke/permission Revokes a single permission from user group(s)
129 130 131 132 |
# File 'lib/wavefront-sdk/usergroup.rb', line 129 def revoke(perm, group_list = []) validate_usergroup_list(group_list) api.post(['revoke', perm].uri_concat, group_list, 'application/json') end |
#update(id, body, modify = true) ⇒ Wavefront::Response
PUT /api/v2/usergroup/id Update a specific user group
71 72 73 74 75 76 77 78 79 |
# File 'lib/wavefront-sdk/usergroup.rb', line 71 def update(id, body, modify = true) wf_usergroup_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
11 12 13 |
# File 'lib/wavefront-sdk/usergroup.rb', line 11 def update_keys %i[id name] end |