module WavefrontCli::Mixin::Acl
Standard ACL commands. Mix this module in to get ACL support.
Public Instance Methods
_acl_action(action)
click to toggle source
@param action [Symbol] :grant_to or :revoke_from @return [Wavefront::Response]
# File lib/wavefront-cli/command_mixins/acl.rb, line 69 def _acl_action(action) entity_type, entities = acl_entities resp = send(format('%<action>s_%<type>s', action: action, type: entity_type), options[:'<id>'], entities) print_status(resp.status) do_acls end
do_acl_clear()
click to toggle source
# File lib/wavefront-cli/command_mixins/acl.rb, line 13 def do_acl_clear cannot_noop! wf.acl_set(options[:'<id>'], [], [everyone_id]) do_acls end
do_acl_grant()
click to toggle source
# File lib/wavefront-cli/command_mixins/acl.rb, line 19 def do_acl_grant return grant_view if options[:view] return grant_modify if options[:modify] raise WavefrontCli::Exception::InsufficientData end
do_acl_revoke()
click to toggle source
# File lib/wavefront-cli/command_mixins/acl.rb, line 26 def do_acl_revoke return revoke_view if options[:view] return revoke_modify if options[:modify] raise WavefrontCli::Exception::InsufficientData end
do_acls()
click to toggle source
# File lib/wavefront-cli/command_mixins/acl.rb, line 9 def do_acls wf.acls([options[:'<id>']]) end
everyone_id()
click to toggle source
@return [String] UUID of 'Everyone' group @raise WavefrontCli::Exception::UserGroupNotFound
if group
does not exist. This is caught in the controller.
# File lib/wavefront-cli/command_mixins/acl.rb, line 37 def everyone_id require 'wavefront-sdk/search' wfs = Wavefront::Search.new(mk_creds, mk_opts) query = conds_to_query(['name=Everyone']) wfs.search(:usergroup, query).response.items.first.id rescue RuntimeError raise WavefrontCli::Exception::UserGroupNotFound, 'Everyone' end
grant_modify()
click to toggle source
# File lib/wavefront-cli/command_mixins/acl.rb, line 46 def grant_modify wf.acl_add(options[:'<id>'], [], options[:'<name>']) do_acls end
grant_view()
click to toggle source
# File lib/wavefront-cli/command_mixins/acl.rb, line 51 def grant_view wf.acl_add(options[:'<id>'], options[:'<name>'], []) do_acls end
print_status(status)
click to toggle source
# File lib/wavefront-cli/command_mixins/acl.rb, line 82 def print_status(status) puts status.message unless status.message.empty? rescue NoMethodError nil end
revoke_modify()
click to toggle source
# File lib/wavefront-cli/command_mixins/acl.rb, line 61 def revoke_modify wf.acl_delete(options[:'<id>'], [], options[:'<name>']) do_acls end
revoke_view()
click to toggle source
# File lib/wavefront-cli/command_mixins/acl.rb, line 56 def revoke_view wf.acl_delete(options[:'<id>'], options[:'<name>'], []) do_acls end