Class: WavefrontDisplay::UserGroup
- Inherits:
-
Base
- Object
- Base
- WavefrontDisplay::UserGroup
show all
- Defined in:
- lib/wavefront-cli/display/usergroup.rb
Overview
Format human-readable output for user 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_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, #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_add_role ⇒ Object
30
31
32
33
34
|
# File 'lib/wavefront-cli/display/usergroup.rb', line 30
def do_add_role
puts format("Added %<quoted_role>s to '%<group_id>s'.",
quoted_role: quoted(options[:'<role>']),
group_id: options[:'<id>']).fold(TW, 0)
end
|
#do_add_to ⇒ Object
18
19
20
21
22
|
# File 'lib/wavefront-cli/display/usergroup.rb', line 18
def do_add_to
puts format("Added %<quoted_user>s to '%<group_id>s'.",
quoted_user: quoted(options[:'<user>']),
group_id: options[:'<id>']).fold(TW, 0)
end
|
#do_delete ⇒ Object
14
15
16
|
# File 'lib/wavefront-cli/display/usergroup.rb', line 14
def do_delete
puts "Deleted user group '#{options[:'<id>']}'."
end
|
#do_list_brief ⇒ Object
10
11
12
|
# File 'lib/wavefront-cli/display/usergroup.rb', line 10
def do_list_brief
multicolumn(:id, :name, :userCount)
end
|
#do_permissions ⇒ Object
58
59
60
|
# File 'lib/wavefront-cli/display/usergroup.rb', line 58
def do_permissions
puts data[:roles].map { |r| r[:permissions] }.flatten.sort.uniq
end
|
#do_remove_from ⇒ Object
24
25
26
27
28
|
# File 'lib/wavefront-cli/display/usergroup.rb', line 24
def do_remove_from
puts format("Removed %<quoted_user>s from '%<group_id>s'.",
quoted_user: quoted(options[:'<user>']),
group_id: options[:'<id>']).fold(TW, 0)
end
|
#do_remove_role ⇒ Object
36
37
38
39
40
|
# File 'lib/wavefront-cli/display/usergroup.rb', line 36
def do_remove_role
puts format("Removed %<quoted_role>s from '%<group_id>s'.",
quoted_role: quoted(options[:'<role>']),
group_id: options[:'<id>']).fold(TW, 0)
end
|
#do_roles ⇒ Object
50
51
52
53
54
55
56
|
# File 'lib/wavefront-cli/display/usergroup.rb', line 50
def do_roles
puts(if !data.include?(:roles) || data[:roles].empty?
"Group '#{options[:'<id>']}' has no roles attached."
else
data[:roles].map { |r| r[:id] }
end)
end
|
#do_users ⇒ Object
42
43
44
45
46
47
48
|
# File 'lib/wavefront-cli/display/usergroup.rb', line 42
def do_users
puts(if !data.include?(:users) || data[:users].empty?
"No users in group '#{options[:'<id>']}'."
else
data[:users]
end)
end
|