wavefront-cli 6.1.0 → 8.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +9 -7
- data/.travis.yml +4 -5
- data/HISTORY.md +34 -1
- data/README.md +3 -4
- data/lib/wavefront-cli/account.rb +119 -0
- data/lib/wavefront-cli/alert.rb +29 -0
- data/lib/wavefront-cli/base.rb +10 -12
- data/lib/wavefront-cli/cloudintegration.rb +12 -0
- data/lib/wavefront-cli/commands/.rubocop.yml +12 -6
- data/lib/wavefront-cli/commands/account.rb +61 -0
- data/lib/wavefront-cli/commands/alert.rb +1 -0
- data/lib/wavefront-cli/commands/base.rb +1 -1
- data/lib/wavefront-cli/commands/cloudintegration.rb +4 -1
- data/lib/wavefront-cli/commands/query.rb +4 -1
- data/lib/wavefront-cli/commands/role.rb +44 -0
- data/lib/wavefront-cli/commands/spy.rb +0 -5
- data/lib/wavefront-cli/commands/usergroup.rb +7 -11
- data/lib/wavefront-cli/commands/write.rb +7 -2
- data/lib/wavefront-cli/config.rb +3 -1
- data/lib/wavefront-cli/controller.rb +6 -66
- data/lib/wavefront-cli/display/account.rb +122 -0
- data/lib/wavefront-cli/display/alert.rb +8 -0
- data/lib/wavefront-cli/display/base.rb +1 -1
- data/lib/wavefront-cli/display/cloudintegration.rb +15 -2
- data/lib/wavefront-cli/display/printer/long.rb +7 -2
- data/lib/wavefront-cli/display/query.rb +24 -0
- data/lib/wavefront-cli/display/role.rb +66 -0
- data/lib/wavefront-cli/display/settings.rb +1 -0
- data/lib/wavefront-cli/display/usergroup.rb +18 -14
- data/lib/wavefront-cli/event.rb +2 -0
- data/lib/wavefront-cli/exception_handler.rb +87 -0
- data/lib/wavefront-cli/externallink.rb +4 -6
- data/lib/wavefront-cli/helpers/load_file.rb +1 -1
- data/lib/wavefront-cli/opt_handler.rb +5 -3
- data/lib/wavefront-cli/output/hcl/base.rb +1 -1
- data/lib/wavefront-cli/query.rb +13 -7
- data/lib/wavefront-cli/role.rb +54 -0
- data/lib/wavefront-cli/serviceaccount.rb +0 -6
- data/lib/wavefront-cli/spy.rb +0 -8
- data/lib/wavefront-cli/usergroup.rb +8 -8
- data/lib/wavefront-cli/version.rb +1 -1
- data/lib/wavefront-cli/write.rb +33 -11
- data/spec/.rubocop.yml +13 -6
- data/spec/support/minitest_assertions.rb +2 -4
- data/spec/test_mixins/delete.rb +1 -2
- data/spec/wavefront-cli/account_spec.rb +303 -0
- data/spec/wavefront-cli/alert_spec.rb +28 -0
- data/spec/wavefront-cli/cloudintegration_spec.rb +19 -6
- data/spec/wavefront-cli/commands/write_spec.rb +1 -1
- data/spec/wavefront-cli/config_spec.rb +1 -1
- data/spec/wavefront-cli/controller_spec.rb +2 -0
- data/spec/wavefront-cli/event_spec.rb +1 -1
- data/spec/wavefront-cli/output/csv/query_spec.rb +1 -1
- data/spec/wavefront-cli/output/wavefront/query_spec.rb +2 -2
- data/spec/wavefront-cli/query_spec.rb +20 -3
- data/spec/wavefront-cli/role_spec.rb +187 -0
- data/spec/wavefront-cli/serviceaccount_spec.rb +3 -3
- data/spec/wavefront-cli/usergroup_spec.rb +48 -43
- data/spec/wavefront-cli/write_spec.rb +44 -0
- data/wavefront-cli.gemspec +6 -6
- metadata +27 -36
- data/lib/wavefront-cli/commands/user.rb +0 -54
- data/lib/wavefront-cli/display/user.rb +0 -103
- data/lib/wavefront-cli/user.rb +0 -92
- data/spec/wavefront-cli/resources/responses/user-list.json +0 -1
- data/spec/wavefront-cli/user_spec.rb +0 -311
@@ -8,6 +8,7 @@ class WavefrontCommandAlert < WavefrontCommandBase
|
|
8
8
|
def _commands
|
9
9
|
["list #{CMN} [-al] [-O fields] [-o offset] [-L limit]",
|
10
10
|
"firing #{CMN} [-o offset] [-L limit]",
|
11
|
+
"affected #{CMN} hosts [<id>]",
|
11
12
|
"snoozed #{CMN} [-o offset] [-L limit]",
|
12
13
|
"describe #{CMN} [-v version] <id>",
|
13
14
|
"delete #{CMN} <id>",
|
@@ -26,7 +26,10 @@ class WavefrontCommandCloudintegration < WavefrontCommandBase
|
|
26
26
|
"disable #{CMN} <id>",
|
27
27
|
"dump #{CMN}",
|
28
28
|
"import #{CMN} [-uU] <file>",
|
29
|
-
"search #{CMN} [-al] [-o offset] [-L limit] [-O fields] <condition>..."
|
29
|
+
"search #{CMN} [-al] [-o offset] [-L limit] [-O fields] <condition>...",
|
30
|
+
"awsid #{CMN} generate",
|
31
|
+
"awsid #{CMN} delete <external_id>",
|
32
|
+
"awsid #{CMN} confirm <external_id>"]
|
30
33
|
end
|
31
34
|
|
32
35
|
def _options
|
@@ -12,7 +12,7 @@ class WavefrontCommandQuery < WavefrontCommandBase
|
|
12
12
|
def _commands
|
13
13
|
['aliases [-DV] [-c file] [-P profile]',
|
14
14
|
"#{CMN} [-g granularity] [-s time] [-e time] " \
|
15
|
-
'[-
|
15
|
+
'[-ikvCGKOW] [-S mode] [-N name] [-p points] [-F options] <query>',
|
16
16
|
"raw #{CMN} [-H host] [-s time] [-e time] " \
|
17
17
|
'[-F options] <metric>',
|
18
18
|
"run #{CMN} [-g granularity] [-s time] [-e time] " \
|
@@ -36,6 +36,9 @@ class WavefrontCommandQuery < WavefrontCommandBase
|
|
36
36
|
'-F, --format-opts=STRING comma-separated options to pass to ' \
|
37
37
|
'output formatter',
|
38
38
|
'-k, --nospark do not show sparkline',
|
39
|
+
'-C, --nocache do not use the query cache',
|
40
|
+
'-K, --nostrict allow points outside the query window',
|
41
|
+
'-G, --histogram-view use histogram view rather than metric',
|
39
42
|
'-W, --nowarn do not show API warning messages']
|
40
43
|
end
|
41
44
|
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'base'
|
4
|
+
|
5
|
+
# Define the 'role' command.
|
6
|
+
#
|
7
|
+
class WavefrontCommandRole < WavefrontCommandBase
|
8
|
+
def _commands
|
9
|
+
["list #{CMN} [-al] [-O fields] [-o offset] [-L limit]",
|
10
|
+
"describe #{CMN} <id>",
|
11
|
+
"create #{CMN} [-d description] [-p permission...] <name>",
|
12
|
+
"delete #{CMN} <id>",
|
13
|
+
"dump #{CMN}",
|
14
|
+
"import #{CMN} [-uU] <file>",
|
15
|
+
"set #{CMN} <key=value> <id>",
|
16
|
+
"accounts #{CMN} <id>",
|
17
|
+
"groups #{CMN} <id>",
|
18
|
+
"permissions #{CMN} <id>",
|
19
|
+
"give #{CMN} <id> to <member>...",
|
20
|
+
"take #{CMN} <id> from <member>...",
|
21
|
+
"grant #{CMN} <permission> to <id>",
|
22
|
+
"revoke #{CMN} <permission> from <id>",
|
23
|
+
"search #{CMN} [-al] [-o offset] [-L limit] [-O fields] <condition>..."]
|
24
|
+
end
|
25
|
+
|
26
|
+
def _options
|
27
|
+
[common_options,
|
28
|
+
"-l, --long list #{things} in detail",
|
29
|
+
"-a, --all list all #{things}",
|
30
|
+
"-o, --offset=n start from nth #{thing}",
|
31
|
+
"-L, --limit=COUNT number of #{things} to list",
|
32
|
+
'-O, --fields=F1,F2,... only show given fields',
|
33
|
+
"-u, --update update an existing #{thing}",
|
34
|
+
"-U, --upsert import new or update existing #{thing}",
|
35
|
+
"-d, --description=STRING description of #{thing}",
|
36
|
+
'-p, --permission=STRING Wavefront permission']
|
37
|
+
end
|
38
|
+
|
39
|
+
def postscript
|
40
|
+
"A role 'member' can be an account ID or a usergroup ID. 'wf settings " \
|
41
|
+
"list permissions' will give you a list of all currently supported " \
|
42
|
+
'permissions.'.fold(TW, 0)
|
43
|
+
end
|
44
|
+
end
|
@@ -34,9 +34,4 @@ class WavefrontCommandSpy < WavefrontCommandBase
|
|
34
34
|
'-T, --tag-key=TAG only show metrics with the given point tag key',
|
35
35
|
'-y, --type=STRING one of METRIC, SPAN, HOST, or STRING']
|
36
36
|
end
|
37
|
-
|
38
|
-
def postscript
|
39
|
-
"\nNOTE: This command uses the unofficial 'spy' API endpoint, which " \
|
40
|
-
'is not guaranteed to remain stable.'.cmd_fold(TW, 0)
|
41
|
-
end
|
42
37
|
end
|
@@ -24,17 +24,18 @@ class WavefrontCommandUsergroup < WavefrontCommandBase
|
|
24
24
|
def _commands
|
25
25
|
["list #{CMN} [-al] [-O fields] [-o offset] [-L limit]",
|
26
26
|
"describe #{CMN} <id>",
|
27
|
-
"create #{CMN} [-
|
27
|
+
"create #{CMN} [-r role_id...] <name>",
|
28
28
|
"delete #{CMN} <id>",
|
29
29
|
"dump #{CMN}",
|
30
30
|
"import #{CMN} [-uU] <file>",
|
31
31
|
"set #{CMN} <key=value> <id>",
|
32
|
+
"add to #{CMN} <id> <user>...",
|
33
|
+
"remove from #{CMN} <id> <user>...",
|
32
34
|
"users #{CMN} <id>",
|
35
|
+
"add role #{CMN} <id> <role>...",
|
36
|
+
"remove role #{CMN} <id> <role>...",
|
37
|
+
"roles #{CMN} <id>",
|
33
38
|
"permissions #{CMN} <id>",
|
34
|
-
"add user #{CMN} <id> <user>...",
|
35
|
-
"remove user #{CMN} <id> <user>...",
|
36
|
-
"grant #{CMN} <permission> to <id>",
|
37
|
-
"revoke #{CMN} <permission> from <id>",
|
38
39
|
"search #{CMN} [-al] [-o offset] [-L limit] [-O fields] <condition>..."]
|
39
40
|
end
|
40
41
|
|
@@ -47,11 +48,6 @@ class WavefrontCommandUsergroup < WavefrontCommandBase
|
|
47
48
|
'-O, --fields=F1,F2,... only show given fields',
|
48
49
|
"-u, --update update an existing #{thing}",
|
49
50
|
"-U, --upsert import new or update existing #{thing}",
|
50
|
-
'-
|
51
|
-
end
|
52
|
-
|
53
|
-
def postscript
|
54
|
-
"'wf settings list permissions' will give you a list of all " \
|
55
|
-
'currently supported permissions.'.fold(TW, 0)
|
51
|
+
'-r, --role-id=STRING Wavefront role ID']
|
56
52
|
end
|
57
53
|
end
|
@@ -18,7 +18,9 @@ class WavefrontCommandWrite < WavefrontCommandBase
|
|
18
18
|
'<metric> [--] <val>...',
|
19
19
|
'file [-DnViq] [-c file] [-P profile] [-E proxy] [-H host] ' \
|
20
20
|
'[-p port] [-F infileformat] [-m metric] [-T tag...] [-I interval] ' \
|
21
|
-
'[-u method] [-S socket] <file>'
|
21
|
+
'[-u method] [-S socket] <file>',
|
22
|
+
'noise [-DnViq] [-P profile] [-E proxy] [-H host] [-p port] ' \
|
23
|
+
'[-T tag...] [-I interval] [-x value] [-X value] <metric>']
|
22
24
|
end
|
23
25
|
|
24
26
|
def _options
|
@@ -33,9 +35,12 @@ class WavefrontCommandWrite < WavefrontCommandBase
|
|
33
35
|
'a file will be assigned. If the file contains a metric name, ' \
|
34
36
|
'the two will be dot-concatenated, with this value first',
|
35
37
|
'-i, --delta increment metric by given value',
|
36
|
-
"-I, --interval=INTERVAL interval of distribution (default 'm')"
|
38
|
+
"-I, --interval=INTERVAL interval of distribution (default 'm'), or " \
|
39
|
+
'time in seconds between noise values (default 1)',
|
37
40
|
'-u, --using=METHOD method by which to send points',
|
38
41
|
'-S, --socket=FILE Unix datagram socket',
|
42
|
+
'-x, --min=NUMERIC lower bound of random values (default -10)',
|
43
|
+
'-X, --max=NUMERIC upper bound of random values (default 10)',
|
39
44
|
"-q, --quiet don't report the points sent summary " \
|
40
45
|
'(unless there were errors)']
|
41
46
|
end
|
data/lib/wavefront-cli/config.rb
CHANGED
@@ -36,11 +36,13 @@ module WavefrontCli
|
|
36
36
|
|
37
37
|
RX = /^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/.freeze
|
38
38
|
|
39
|
+
# rubocop:disable Lint/MissingSuper
|
39
40
|
def initialize(options)
|
40
41
|
@options = options
|
41
42
|
@config_file = _config_file
|
42
43
|
@profile = options[:'<profile>'] || 'default'
|
43
44
|
end
|
45
|
+
# rubocop:enable Lint/MissingSuper
|
44
46
|
|
45
47
|
def do_location
|
46
48
|
puts config_file
|
@@ -144,7 +146,7 @@ module WavefrontCli
|
|
144
146
|
# catch a ctrl-d
|
145
147
|
#
|
146
148
|
def read_input
|
147
|
-
|
149
|
+
$stdin.gets.strip
|
148
150
|
rescue NoMethodError
|
149
151
|
abort "\nInput aborted at user request."
|
150
152
|
end
|
@@ -17,6 +17,7 @@ require_relative 'version'
|
|
17
17
|
require_relative 'constants'
|
18
18
|
require_relative 'exception'
|
19
19
|
require_relative 'opt_handler'
|
20
|
+
require_relative 'exception_handler'
|
20
21
|
require_relative 'stdlib/string'
|
21
22
|
|
22
23
|
CMD_DIR = Pathname.new(__dir__) + 'commands'
|
@@ -28,6 +29,7 @@ class WavefrontCliController
|
|
28
29
|
attr_reader :args, :usage, :opts, :cmds, :tw
|
29
30
|
|
30
31
|
include WavefrontCli::Constants
|
32
|
+
include WavefrontCli::ExceptionMixins
|
31
33
|
|
32
34
|
def initialize(args)
|
33
35
|
@args = args
|
@@ -107,12 +109,8 @@ class WavefrontCliController
|
|
107
109
|
#
|
108
110
|
def cli_class(cmd, opts)
|
109
111
|
load_cli_class(cmd, opts)
|
110
|
-
rescue
|
111
|
-
|
112
|
-
rescue WavefrontCli::Exception::InvalidInput => e
|
113
|
-
abort "Invalid input. #{e.message}"
|
114
|
-
rescue RuntimeError => e
|
115
|
-
abort "Unable to run command. #{e.message}."
|
112
|
+
rescue StandardError => e
|
113
|
+
exception_handler(e)
|
116
114
|
end
|
117
115
|
|
118
116
|
def load_cli_class(cmd, opts)
|
@@ -120,68 +118,12 @@ class WavefrontCliController
|
|
120
118
|
Object.const_get('WavefrontCli').const_get(cmds[cmd].sdk_class).new(opts)
|
121
119
|
end
|
122
120
|
|
123
|
-
# rubocop:disable Metrics/MethodLength
|
124
|
-
# rubocop:disable Metrics/AbcSize
|
125
121
|
def run_command(cli_class_obj)
|
126
122
|
cli_class_obj.validate_opts
|
127
123
|
cli_class_obj.run
|
128
|
-
rescue Interrupt
|
129
|
-
abort "\nOperation aborted at user request."
|
130
|
-
rescue WavefrontCli::Exception::ConfigFileNotFound => e
|
131
|
-
abort "Configuration file #{e}' not found."
|
132
|
-
rescue WavefrontCli::Exception::CredentialError => e
|
133
|
-
handle_missing_credentials(e)
|
134
|
-
rescue WavefrontCli::Exception::MandatoryValue
|
135
|
-
abort 'A value must be supplied.'
|
136
|
-
rescue Wavefront::Exception::NetworkTimeout
|
137
|
-
abort 'Connection timed out.'
|
138
|
-
rescue Wavefront::Exception::InvalidPermission => e
|
139
|
-
abort "'#{e}' is not a valid privilege."
|
140
|
-
rescue Wavefront::Exception::InvalidUserGroupId => e
|
141
|
-
abort "'#{e}' is not a valid user group id."
|
142
|
-
rescue WavefrontCli::Exception::InvalidValue => e
|
143
|
-
abort "Invalid value for #{e}."
|
144
|
-
rescue WavefrontCli::Exception::ProfileExists => e
|
145
|
-
abort "Profile '#{e}' already exists."
|
146
|
-
rescue WavefrontCli::Exception::ProfileNotFound => e
|
147
|
-
abort "Profile '#{e}' not found."
|
148
|
-
rescue WavefrontCli::Exception::FileNotFound
|
149
|
-
abort 'File not found.'
|
150
|
-
rescue WavefrontCli::Exception::InsufficientData => e
|
151
|
-
abort "Insufficient data. #{e.message}"
|
152
|
-
rescue WavefrontCli::Exception::InvalidQuery => e
|
153
|
-
abort "Invalid query. API message: '#{e.message}'."
|
154
|
-
rescue WavefrontCli::Exception::SystemError => e
|
155
|
-
abort "Host system error. #{e.message}"
|
156
|
-
rescue WavefrontCli::Exception::UnparseableInput => e
|
157
|
-
abort "Cannot parse input. #{e.message}"
|
158
|
-
rescue WavefrontCli::Exception::UnparseableSearchPattern
|
159
|
-
abort 'Searches require a key, a value, and a match operator.'
|
160
|
-
rescue WavefrontCli::Exception::UnsupportedFileFormat
|
161
|
-
abort 'Unsupported file format.'
|
162
|
-
rescue WavefrontCli::Exception::UnsupportedOperation => e
|
163
|
-
abort "Unsupported operation.\n#{e.message}"
|
164
|
-
rescue WavefrontCli::Exception::UnsupportedOutput => e
|
165
|
-
abort e.message
|
166
|
-
rescue WavefrontCli::Exception::UnsupportedNoop
|
167
|
-
abort 'Multiple API call operations cannot be performed as no-ops.'
|
168
|
-
rescue WavefrontCli::Exception::UserGroupNotFound => e
|
169
|
-
abort "Cannot find user group '#{e.message}'."
|
170
|
-
rescue Wavefront::Exception::UnsupportedWriter => e
|
171
|
-
abort "Unsupported writer '#{e.message}'."
|
172
|
-
rescue WavefrontCli::Exception::UserError => e
|
173
|
-
abort "User error: #{e.message}."
|
174
|
-
rescue WavefrontCli::Exception::ImpossibleSearch
|
175
|
-
abort 'Search on non-existent key. Please use a top-level field.'
|
176
|
-
rescue Wavefront::Exception::InvalidSamplingValue
|
177
|
-
abort 'Sampling rates must be between 0 and 0.05.'
|
178
124
|
rescue StandardError => e
|
179
|
-
|
180
|
-
backtrace_message(e)
|
181
|
-
abort
|
125
|
+
exception_handler(e)
|
182
126
|
end
|
183
|
-
# rubocop:enable Metrics/MethodLength
|
184
|
-
# rubocop:enable Metrics/AbcSize
|
185
127
|
|
186
128
|
def backtrace_message(err)
|
187
129
|
if opts[:debug]
|
@@ -235,8 +177,6 @@ class WavefrontCliController
|
|
235
177
|
# return [Hash] h with modified keys
|
236
178
|
#
|
237
179
|
def sanitize_keys(options)
|
238
|
-
options.
|
239
|
-
r[k.to_s.delete('-').to_sym] = v
|
240
|
-
end
|
180
|
+
options.transform_keys { |k| k.to_s.delete('-').to_sym }
|
241
181
|
end
|
242
182
|
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'base'
|
4
|
+
|
5
|
+
module WavefrontDisplay
|
6
|
+
#
|
7
|
+
# Format human-readable output for account management.
|
8
|
+
#
|
9
|
+
class Account < Base
|
10
|
+
def do_list_brief
|
11
|
+
filter_user_list
|
12
|
+
puts(data.map { |account| account[:identifier] })
|
13
|
+
end
|
14
|
+
|
15
|
+
def do_list
|
16
|
+
filter_user_list
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
def do_role_add_to
|
21
|
+
puts format("Gave %<quoted_roles>s to '%<id>s'.",
|
22
|
+
id: options[:'<id>'],
|
23
|
+
quoted_roles: quoted(options[:'<role>']))
|
24
|
+
end
|
25
|
+
|
26
|
+
def do_role_remove_from
|
27
|
+
puts format("Removed %<quoted_roles>s from '%<id>s'.",
|
28
|
+
id: options[:'<id>'],
|
29
|
+
quoted_roles: quoted(options[:'<role>']))
|
30
|
+
end
|
31
|
+
|
32
|
+
def do_roles
|
33
|
+
roles = data.fetch(:roles, [])
|
34
|
+
puts roles.empty? ? "'#{options[:'<id>']}' has no roles." : roles
|
35
|
+
end
|
36
|
+
|
37
|
+
def do_group_add_to
|
38
|
+
puts format("Added '%<id>s' to %<quoted_group>s.",
|
39
|
+
id: options[:'<id>'],
|
40
|
+
quoted_group: quoted(options[:'<group>']))
|
41
|
+
end
|
42
|
+
|
43
|
+
def do_group_remove_from
|
44
|
+
puts format("Removed '%<id>s' from %<quoted_group>s.",
|
45
|
+
id: options[:'<id>'],
|
46
|
+
quoted_group: quoted(options[:'<group>']))
|
47
|
+
end
|
48
|
+
|
49
|
+
def do_groups
|
50
|
+
groups = data.fetch(:userGroups, [])
|
51
|
+
|
52
|
+
if groups.empty?
|
53
|
+
puts "'#{options[:'<id>']}' does not belong to any groups."
|
54
|
+
else
|
55
|
+
puts groups.sort
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def do_business_functions
|
60
|
+
puts data.sort
|
61
|
+
end
|
62
|
+
|
63
|
+
def do_grant_to
|
64
|
+
puts format("Granted '%<permission>s' to %<quoted_accounts>s.",
|
65
|
+
permission: options[:'<permission>'],
|
66
|
+
quoted_accounts: quoted(options[:'<account>']))
|
67
|
+
end
|
68
|
+
|
69
|
+
def do_revoke_from
|
70
|
+
puts format("Revoked '%<permission>s' from %<quoted_accounts>s.",
|
71
|
+
permission: options[:'<permission>'],
|
72
|
+
quoted_accounts: quoted(options[:'<account>']))
|
73
|
+
end
|
74
|
+
|
75
|
+
def do_permissions
|
76
|
+
perms = data.fetch(:groups, [])
|
77
|
+
|
78
|
+
if perms.empty?
|
79
|
+
puts "'#{options[:'<id>']}' does not have any permissions directly " \
|
80
|
+
'attached.'
|
81
|
+
else
|
82
|
+
puts perms.sort
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def do_ingestionpolicy_add_to
|
87
|
+
puts format("Added '%<policy>s' to '%<id>s'.",
|
88
|
+
id: options[:'<id>'],
|
89
|
+
policy: options[:'<policy>'])
|
90
|
+
end
|
91
|
+
|
92
|
+
def do_ingestionpolicy_remove_from
|
93
|
+
puts format("Removed '%<policy>s' from '%<id>s'.",
|
94
|
+
id: options[:'<id>'],
|
95
|
+
policy: options[:'<policy>'])
|
96
|
+
end
|
97
|
+
|
98
|
+
def do_ingestionpolicy
|
99
|
+
policy = data.fetch(:ingestionPolicyId, [])
|
100
|
+
|
101
|
+
if policy.empty?
|
102
|
+
puts "'#{options[:'<id>']}' has no ingestion policy."
|
103
|
+
else
|
104
|
+
puts policy
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def do_invite_user
|
109
|
+
puts format("Sent invitation to '%<id>s'.", id: options[:'<id>'])
|
110
|
+
end
|
111
|
+
|
112
|
+
private
|
113
|
+
|
114
|
+
def filter_user_list
|
115
|
+
if options[:user]
|
116
|
+
data.delete_if { |a| a[:identifier].start_with?('sa::') }
|
117
|
+
elsif options[:service]
|
118
|
+
data.delete_if { |a| !a[:identifier].start_with?('sa::') }
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|