Module: Wavefront::Mixin::Acl
Overview
ACL mixins
Mix this module into class which supports ACLs, ensuring there is a valid_id? method to perform ID validation.
Instance Method Summary collapse
-
#acl_add(id, view = [], modify = []) ⇒ Wavefront::Response
POST /api/v2/entity/acl/add Adds the specified ids to the given object’s ACL.
-
#acl_delete(id, view = [], modify = []) ⇒ Wavefront::Response
POST /api/v2/entity/acl/remove Removes the specified ids from the given object’s ACL.
-
#acl_set(id, view = [], modify = []) ⇒ Wavefront::Response
PUT /api/v2/entity/acl/set Set ACL for the specified object.
-
#acls(id_list) ⇒ Wavefront::Response
GET /api/v2/entity/acl Get list of Access Control Lists for the specified object.
Instance Method Details
#acl_add(id, view = [], modify = []) ⇒ Wavefront::Response
POST /api/v2/entity/acl/add Adds the specified ids to the given object’s ACL
29 30 31 32 33 34 35 |
# File 'lib/wavefront-sdk/api_mixins/acl.rb', line 29 def acl_add(id, view = [], modify = []) valid_id?(id) api.post(%w[acl add].uri_concat, acl_body(id, view, modify), 'application/json') end |
#acl_delete(id, view = [], modify = []) ⇒ Wavefront::Response
POST /api/v2/entity/acl/remove Removes the specified ids from the given object’s ACL
Though the API method is ‘remove’, the acl method names have been chosen to correspond with the tag methods.
49 50 51 52 53 54 55 |
# File 'lib/wavefront-sdk/api_mixins/acl.rb', line 49 def acl_delete(id, view = [], modify = []) valid_id?(id) api.post(%w[acl remove].uri_concat, acl_body(id, view, modify), 'application/json') end |
#acl_set(id, view = [], modify = []) ⇒ Wavefront::Response
PUT /api/v2/entity/acl/set Set ACL for the specified object
66 67 68 |
# File 'lib/wavefront-sdk/api_mixins/acl.rb', line 66 def acl_set(id, view = [], modify = []) api.put(%w[acl set].uri_concat, acl_body(id, view, modify)) end |
#acls(id_list) ⇒ Wavefront::Response
GET /api/v2/entity/acl Get list of Access Control Lists for the specified object
15 16 17 18 |
# File 'lib/wavefront-sdk/api_mixins/acl.rb', line 15 def acls(id_list) id_list.each { |id| valid_id?(id) } api.get_flat_params('acl', id: id_list) end |