Class: WavefrontDisplay::ServiceAccount
- Inherits:
-
Base
- Object
- Base
- WavefrontDisplay::ServiceAccount
show all
- Defined in:
- lib/wavefront-cli/display/serviceaccount.rb
Overview
Format human-readable output for service account commands.
Constant Summary
WavefrontCli::Constants::ALL_PAGE_SIZE, WavefrontCli::Constants::DEFAULT_CONFIG, WavefrontCli::Constants::DEFAULT_OPTS, WavefrontCli::Constants::EVENT_STATE_DIR, WavefrontCli::Constants::HUMAN_TIME_FORMAT, WavefrontCli::Constants::HUMAN_TIME_FORMAT_MS, WavefrontCli::Constants::SEARCH_SPLIT
Instance Attribute Summary
Attributes inherited from Base
#data, #options, #raw
Instance Method Summary
collapse
Methods inherited from Base
#_prioritize_keys, #display_brief_freetext_results, #do_import, #do_list, #do_list_fields, #do_queries, #do_search, #do_search_brief, #do_search_fields, #do_tag_add, #do_tag_clear, #do_tag_delete, #do_tag_pathsearch, #do_tag_set, #do_tags, #do_undelete, #drop_fields, #filter_data, #filter_fields_as_arr, #freetext_keys, #friendly_name, #human_time, #index_of_final_item, #initialize, #key_width, #long_output, #multicolumn, #pagination_line, #prioritize_keys, #quoted, #readable_time, #readable_time_arr, #run, #run_error, #run_list, #run_search, #search_display_keys, #time_formats
Instance Method Details
#do_activate ⇒ Object
22
23
24
|
# File 'lib/wavefront-cli/display/serviceaccount.rb', line 22
def do_activate
puts format("Activated service account '#{options[:'<id>']}'.")
end
|
#do_apitoken_delete ⇒ Object
75
76
77
|
# File 'lib/wavefront-cli/display/serviceaccount.rb', line 75
def do_apitoken_delete
puts format("Deleted API token '#{options[:'<token_id>']}'.")
end
|
#do_apitoken_list ⇒ Object
67
68
69
70
71
72
73
|
# File 'lib/wavefront-cli/display/serviceaccount.rb', line 67
def do_apitoken_list
if data.empty?
puts 'Account does not have any API tokens.'
else
multicolumn(:tokenID, :tokenName)
end
end
|
#do_deactivate ⇒ Object
26
27
28
|
# File 'lib/wavefront-cli/display/serviceaccount.rb', line 26
def do_deactivate
puts format("Deactivated service account '#{options[:'<id>']}'.")
end
|
#do_delete ⇒ Object
79
80
81
82
|
# File 'lib/wavefront-cli/display/serviceaccount.rb', line 79
def do_delete
puts format("Deleted #{friendly_name} %<quoted_account>s.",
quoted_account: quoted(options[:'<account>']))
end
|
#do_describe ⇒ Object
10
11
12
|
# File 'lib/wavefront-cli/display/serviceaccount.rb', line 10
def do_describe
long_output
end
|
#do_grant ⇒ Object
57
58
59
60
|
# File 'lib/wavefront-cli/display/serviceaccount.rb', line 57
def do_grant
puts format("Granted '%<perm>s' to '%<account>s'.",
perm: options[:'<permission>'], account: options[:'<id>'])
end
|
#do_groups ⇒ Object
Also known as:
do_join, do_leave
30
31
32
33
34
35
36
|
# File 'lib/wavefront-cli/display/serviceaccount.rb', line 30
def do_groups
if data[:userGroups].empty?
puts 'Account does not belong to any groups.'
else
data[:userGroups].each { |u| puts format('%<id>s (%<name>s)', u) }
end
end
|
#do_ingestionpolicy ⇒ Object
49
50
51
52
53
54
55
|
# File 'lib/wavefront-cli/display/serviceaccount.rb', line 49
def do_ingestionpolicy
if data[:ingestionPolicy].empty?
puts 'Account does not have an ingestion policy attached.'
else
puts format('%<id>s (%<name>s)', data[:ingestionPolicy])
end
end
|
#do_list_brief ⇒ Object
14
15
16
17
18
19
20
|
# File 'lib/wavefront-cli/display/serviceaccount.rb', line 14
def do_list_brief
if data.empty?
puts 'You have no service accounts.'
else
multicolumn(:identifier, :description)
end
end
|
#do_revoke ⇒ Object
62
63
64
65
|
# File 'lib/wavefront-cli/display/serviceaccount.rb', line 62
def do_revoke
puts format("Revoked '%<perm>s' from '%<account>s'.",
perm: options[:'<permission>'], account: options[:'<id>'])
end
|
#do_roles ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/wavefront-cli/display/serviceaccount.rb', line 38
def do_roles
if data[:roles].empty?
puts 'Account does not have any roles attached.'
else
data[:roles].each { |r| puts format('%<id>s (%<name>s)', r) }
end
end
|
#priority_keys ⇒ Object
88
89
90
|
# File 'lib/wavefront-cli/display/serviceaccount.rb', line 88
def priority_keys
%i[identifier]
end
|
#search_identifier_key ⇒ Object
84
85
86
|
# File 'lib/wavefront-cli/display/serviceaccount.rb', line 84
def search_identifier_key
:identifier
end
|