Class: WavefrontCli::ServiceAccount
- Inherits:
-
Base
- Object
- Base
- WavefrontCli::ServiceAccount
show all
- Defined in:
- lib/wavefront-cli/serviceaccount.rb
Overview
CLI coverage for the v2 ‘serviceaccount’ 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 collapse
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, #dispatch, #display, #display_api_error, #display_class, #display_no_api_response, #do_dump, #do_import, #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, #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_method, #warning_message
Instance Attribute Details
#wf_apitoken ⇒ Object
Returns the value of attribute wf_apitoken.
11
12
13
|
# File 'lib/wavefront-cli/serviceaccount.rb', line 11
def wf_apitoken
@wf_apitoken
end
|
Instance Method Details
#do_activate ⇒ Object
34
35
36
|
# File 'lib/wavefront-cli/serviceaccount.rb', line 34
def do_activate
wf.activate(options[:'<id>'])
end
|
#do_apitoken_create ⇒ Object
82
83
84
|
# File 'lib/wavefront-cli/serviceaccount.rb', line 82
def do_apitoken_create
wf_apitoken.sa_create(options[:'<id>'], options[:name])
end
|
#do_apitoken_delete ⇒ Object
86
87
88
|
# File 'lib/wavefront-cli/serviceaccount.rb', line 86
def do_apitoken_delete
wf_apitoken.sa_delete(options[:'<id>'], options[:'<token_id>'])
end
|
#do_apitoken_list ⇒ Object
78
79
80
|
# File 'lib/wavefront-cli/serviceaccount.rb', line 78
def do_apitoken_list
wf_apitoken.sa_list(options[:'<id>'])
end
|
#do_apitoken_rename ⇒ Object
90
91
92
93
94
|
# File 'lib/wavefront-cli/serviceaccount.rb', line 90
def do_apitoken_rename
wf_apitoken.sa_rename(options[:'<id>'],
options[:'<token_id>'],
options[:'<name>'])
end
|
#do_create ⇒ Object
29
30
31
32
|
# File 'lib/wavefront-cli/serviceaccount.rb', line 29
def do_create
wf_user_id?(options[:'<id>'])
wf.create(user_body)
end
|
#do_deactivate ⇒ Object
38
39
40
|
# File 'lib/wavefront-cli/serviceaccount.rb', line 38
def do_deactivate
wf.deactivate(options[:'<id>'])
end
|
#do_delete ⇒ Object
50
51
52
|
# File 'lib/wavefront-cli/serviceaccount.rb', line 50
def do_delete
account_hook.delete_accounts(options[:'<account>'])
end
|
#do_describe ⇒ Object
Also known as:
do_groups, do_ingestionpolicy, do_roles
21
22
23
|
# File 'lib/wavefront-cli/serviceaccount.rb', line 21
def do_describe
wf.describe(options[:'<id>'])
end
|
#do_grant ⇒ Object
62
63
64
65
66
67
68
|
# File 'lib/wavefront-cli/serviceaccount.rb', line 62
def do_grant
cannot_noop!
wf_permission?(options[:'<permission>'])
body = add_perm_to_list(current_state, options[:'<permission>'])
wf.update(options[:'<id>'], body)
end
|
#do_join ⇒ Object
42
43
44
45
46
47
48
|
# File 'lib/wavefront-cli/serviceaccount.rb', line 42
def do_join
cannot_noop!
options[:'<group>'].each { |g| wf_usergroup_id?(g) }
body = add_groups_to_list(current_state, options[:'<group>'])
wf.update(options[:'<id>'], body)
end
|
#do_leave ⇒ Object
54
55
56
57
58
59
60
|
# File 'lib/wavefront-cli/serviceaccount.rb', line 54
def do_leave
cannot_noop!
options[:'<group>'].each { |g| wf_usergroup_id?(g) }
body = remove_groups_from_list(current_state, options[:'<group>'])
wf.update(options[:'<id>'], body)
end
|
#do_list ⇒ Object
17
18
19
|
# File 'lib/wavefront-cli/serviceaccount.rb', line 17
def do_list
wf.list
end
|
#do_revoke ⇒ Object
70
71
72
73
74
75
76
|
# File 'lib/wavefront-cli/serviceaccount.rb', line 70
def do_revoke
cannot_noop!
wf_permission?(options[:'<permission>'])
body = remove_perm_from_list(current_state, options[:'<permission>'])
wf.update(options[:'<id>'], body)
end
|
96
97
98
99
100
|
# File 'lib/wavefront-cli/serviceaccount.rb', line 96
def
validate_groups
validate_tokens
validate_ingestion_policy
end
|
#post_initialize(_options) ⇒ Object
13
14
15
|
# File 'lib/wavefront-cli/serviceaccount.rb', line 13
def post_initialize(_options)
@wf_apitoken = Wavefront::ApiToken.new(mk_creds, mk_opts)
end
|
#validator_exception ⇒ Object
102
103
104
|
# File 'lib/wavefront-cli/serviceaccount.rb', line 102
def validator_exception
Wavefront::Exception::InvalidServiceAccountId
end
|