Class: WavefrontDisplay::Account
- Inherits:
-
Base
- Object
- Base
- WavefrontDisplay::Account
show all
- Defined in:
- lib/wavefront-cli/display/account.rb
Overview
Format human-readable output for account management.
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_delete, #do_import, #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, #priority_keys, #quoted, #readable_time, #readable_time_arr, #run, #run_error, #run_list, #run_search, #search_display_keys, #search_identifier_key, #time_formats
Instance Method Details
#do_business_functions ⇒ Object
59
60
61
|
# File 'lib/wavefront-cli/display/account.rb', line 59
def do_business_functions
puts data.sort
end
|
#do_grant_to ⇒ Object
63
64
65
66
67
|
# File 'lib/wavefront-cli/display/account.rb', line 63
def do_grant_to
puts format("Granted '%<permission>s' to %<quoted_accounts>s.",
permission: options[:'<permission>'],
quoted_accounts: quoted(options[:'<account>']))
end
|
#do_group_add_to ⇒ Object
37
38
39
40
41
|
# File 'lib/wavefront-cli/display/account.rb', line 37
def do_group_add_to
puts format("Added '%<id>s' to %<quoted_group>s.",
id: options[:'<id>'],
quoted_group: quoted(options[:'<group>']))
end
|
#do_group_remove_from ⇒ Object
43
44
45
46
47
|
# File 'lib/wavefront-cli/display/account.rb', line 43
def do_group_remove_from
puts format("Removed '%<id>s' from %<quoted_group>s.",
id: options[:'<id>'],
quoted_group: quoted(options[:'<group>']))
end
|
#do_groups ⇒ Object
49
50
51
52
53
54
55
56
57
|
# File 'lib/wavefront-cli/display/account.rb', line 49
def do_groups
groups = data.fetch(:userGroups, [])
if groups.empty?
puts "'#{options[:'<id>']}' does not belong to any groups."
else
puts groups.sort
end
end
|
#do_ingestionpolicy ⇒ Object
98
99
100
101
102
103
104
105
106
|
# File 'lib/wavefront-cli/display/account.rb', line 98
def do_ingestionpolicy
policy = data.fetch(:ingestionPolicyId, [])
if policy.empty?
puts "'#{options[:'<id>']}' has no ingestion policy."
else
puts policy
end
end
|
#do_ingestionpolicy_add_to ⇒ Object
86
87
88
89
90
|
# File 'lib/wavefront-cli/display/account.rb', line 86
def do_ingestionpolicy_add_to
puts format("Added '%<policy>s' to '%<id>s'.",
id: options[:'<id>'],
policy: options[:'<policy>'])
end
|
#do_ingestionpolicy_remove_from ⇒ Object
92
93
94
95
96
|
# File 'lib/wavefront-cli/display/account.rb', line 92
def do_ingestionpolicy_remove_from
puts format("Removed '%<policy>s' from '%<id>s'.",
id: options[:'<id>'],
policy: options[:'<policy>'])
end
|
#do_invite_user ⇒ Object
108
109
110
|
# File 'lib/wavefront-cli/display/account.rb', line 108
def do_invite_user
puts format("Sent invitation to '%<id>s'.", id: options[:'<id>'])
end
|
#do_list ⇒ Object
15
16
17
18
|
# File 'lib/wavefront-cli/display/account.rb', line 15
def do_list
filter_user_list
super
end
|
#do_list_brief ⇒ Object
10
11
12
13
|
# File 'lib/wavefront-cli/display/account.rb', line 10
def do_list_brief
filter_user_list
puts(data.map { |account| account[:identifier] })
end
|
#do_permissions ⇒ Object
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/wavefront-cli/display/account.rb', line 75
def do_permissions
perms = data.fetch(:groups, [])
if perms.empty?
puts "'#{options[:'<id>']}' does not have any permissions directly " \
'attached.'
else
puts perms.sort
end
end
|
#do_revoke_from ⇒ Object
69
70
71
72
73
|
# File 'lib/wavefront-cli/display/account.rb', line 69
def do_revoke_from
puts format("Revoked '%<permission>s' from %<quoted_accounts>s.",
permission: options[:'<permission>'],
quoted_accounts: quoted(options[:'<account>']))
end
|
#do_role_add_to ⇒ Object
20
21
22
23
24
|
# File 'lib/wavefront-cli/display/account.rb', line 20
def do_role_add_to
puts format("Gave %<quoted_roles>s to '%<id>s'.",
id: options[:'<id>'],
quoted_roles: quoted(options[:'<role>']))
end
|
#do_role_remove_from ⇒ Object
26
27
28
29
30
|
# File 'lib/wavefront-cli/display/account.rb', line 26
def do_role_remove_from
puts format("Removed %<quoted_roles>s from '%<id>s'.",
id: options[:'<id>'],
quoted_roles: quoted(options[:'<role>']))
end
|
#do_roles ⇒ Object
32
33
34
35
|
# File 'lib/wavefront-cli/display/account.rb', line 32
def do_roles
roles = data.fetch(:roles, [])
puts roles.empty? ? "'#{options[:'<id>']}' has no roles." : roles
end
|