Class: WavefrontCli::Role

Inherits:
Base
  • Object
show all
Defined in:
lib/wavefront-cli/role.rb

Overview

CLI coverage for the v2 ‘role’ API.

Constant Summary

Constants included from Constants

Constants::ALL_PAGE_SIZE, Constants::DEFAULT_CONFIG, Constants::DEFAULT_OPTS, Constants::EVENT_STATE_DIR, Constants::HUMAN_TIME_FORMAT, Constants::HUMAN_TIME_FORMAT_MS, Constants::SEARCH_SPLIT

Instance Attribute Summary

Attributes inherited from Base

#klass, #klass_word, #options, #wf

Instance Method Summary collapse

Methods inherited from Base

#_sdk_class, #cannot_noop!, #check_response_blocks, #check_status, #cli_output_class, #conds_to_query, #descriptive_name, #dispatch, #display, #display_api_error, #display_class, #display_no_api_response, #do_delete, #do_describe, #do_dump, #do_import, #do_list, #do_search, #do_set, #do_undelete, #dump_json, #dump_yaml, #extract_values, #failed_validation_message, #format_var, #handle_error, #handle_response, #hcl_fields, #import_to_create, #initialize, #item_dump_call, #load_display_class, #matching_method, #method_word_list, #mk_creds, #mk_opts, #name_of_do_method, #no_api_response, #ok_exit, #one_or_all, #options_and_exit, #parseable_output, #range_hash, #require_sdk_class, #run, #search_key, #smart_delete, #smart_delete_message, #status_error_handler, #unsupported_format_message, #validate_id, #validate_input, #validate_opts, #validate_tags, #validator_exception, #validator_method, #warning_message

Constructor Details

This class inherits a constructor from WavefrontCli::Base

Instance Method Details

#do_accountsObject



18
19
20
# File 'lib/wavefront-cli/role.rb', line 18

def do_accounts
  things_with_role(:account, options[:'<id>'])
end

#do_createObject



12
13
14
15
16
# File 'lib/wavefront-cli/role.rb', line 12

def do_create
  wf.create({ name: options[:'<name>'],
              description: options[:description],
              permissions: options[:permission] }.compact)
end

#do_give_toObject



26
27
28
# File 'lib/wavefront-cli/role.rb', line 26

def do_give_to
  wf.add_assignees(options[:'<id>'], options[:'<member>'])
end

#do_grantObject



34
35
36
# File 'lib/wavefront-cli/role.rb', line 34

def do_grant
  wf.grant(options[:'<permission>'], Array(options[:'<id>']))
end

#do_groupsObject



22
23
24
# File 'lib/wavefront-cli/role.rb', line 22

def do_groups
  things_with_role(:usergroup, options[:'<id>'])
end

#do_revokeObject



38
39
40
# File 'lib/wavefront-cli/role.rb', line 38

def do_revoke
  wf.revoke(options[:'<permission>'], Array(options[:'<id>']))
end

#do_take_fromObject



30
31
32
# File 'lib/wavefront-cli/role.rb', line 30

def do_take_from
  wf.remove_assignees(options[:'<id>'], options[:'<member>'])
end