Class: WavefrontCommandUser

Inherits:
WavefrontCommandBase show all
Defined in:
lib/wavefront-cli/commands/user.rb

Overview

Define the user command.

Instance Method Summary collapse

Methods inherited from WavefrontCommandBase

#acl_commands, #commands, #common_options, #docopt, #global_option_text, #global_options, #opt_row, #option_column_width, #options, #sdk_class, #sdk_file, #tag_commands, #thing, #things, #word

Instance Method Details

#_commandsObject

delete uses a different string because it accepts multiples. Adding ellipsis to <id> causes everything else to expect an array.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/wavefront-cli/commands/user.rb', line 16

def _commands
  ["list #{CMN} [-l] [-O fields]",
   "describe #{CMN} <id>",
   "create #{CMN} [-e] [-m permission...] [-g group...] <id>",
   "invite #{CMN} [-m permission...] [-g group...] <id>",
   "delete #{CMN} <user>...",
   "dump #{CMN}",
   "import #{CMN} [-u] <file>",
   "groups #{CMN} <id>",
   "privileges #{CMN} <id>",
   "join #{CMN} <id> <group>...",
   "leave #{CMN} <id> <group>...",
   "grant #{CMN} <privilege> to <id>",
   "revoke #{CMN} <privilege> from <id>",
   "business functions #{CMN} <id>",
   "validate #{CMN} [-l] <user>...",
   "search #{CMN} [-al] [-o offset] [-L limit] [-O fields] <condition>..."]
end

#_optionsObject



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/wavefront-cli/commands/user.rb', line 35

def _options
  [common_options,
   "-l, --long               list #{things} in detail",
   "-a, --all                list all #{things}",
   "-o, --offset=n           start from nth #{thing}",
   "-L, --limit=COUNT        number of #{things} to list",
   '-O, --fields=F1,F2,...   only show given fields',
   "-u, --update             update an existing #{thing}",
   "-e, --email              send e-mail to #{thing} on account creation",
   "-m, --permission=STRING  give #{thing} this permission",
   "-g, --group=STRING       add #{thing} to this user group"]
end

#descriptionObject



8
9
10
# File 'lib/wavefront-cli/commands/user.rb', line 8

def description
  "view and manage Wavefront #{things}"
end

#postscriptObject



48
49
50
51
52
# File 'lib/wavefront-cli/commands/user.rb', line 48

def postscript
  'If your account does not have RBAC enabled, you must grant user ' \
  "permissions with '-m'. For a list of permissions, see " \
  "'wf usergroup --help'.".fold(TW, 0)
end