morpheus-cli 4.0.0.1 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/morpheus/api.rb +10 -0
- data/lib/morpheus/api/api_client.rb +24 -3
- data/lib/morpheus/api/clouds_interface.rb +15 -0
- data/lib/morpheus/api/clusters_interface.rb +276 -0
- data/lib/morpheus/api/library_compute_type_layouts_interface.rb +26 -0
- data/lib/morpheus/api/logs_interface.rb +6 -0
- data/lib/morpheus/api/network_subnet_types_interface.rb +26 -0
- data/lib/morpheus/api/network_subnets_interface.rb +47 -0
- data/lib/morpheus/api/provision_types_interface.rb +6 -0
- data/lib/morpheus/api/security_groups_interface.rb +12 -3
- data/lib/morpheus/api/servers_interface.rb +15 -0
- data/lib/morpheus/api/service_plans_interface.rb +30 -0
- data/lib/morpheus/api/subnets_interface.rb +47 -0
- data/lib/morpheus/cli.rb +1 -0
- data/lib/morpheus/cli/apps.rb +20 -18
- data/lib/morpheus/cli/cli_command.rb +5 -1
- data/lib/morpheus/cli/clusters.rb +3952 -0
- data/lib/morpheus/cli/containers_command.rb +70 -2
- data/lib/morpheus/cli/hosts.rb +69 -53
- data/lib/morpheus/cli/instances.rb +33 -33
- data/lib/morpheus/cli/library_container_types_command.rb +2 -1
- data/lib/morpheus/cli/library_option_lists_command.rb +13 -8
- data/lib/morpheus/cli/mixins/accounts_helper.rb +43 -0
- data/lib/morpheus/cli/mixins/print_helper.rb +10 -2
- data/lib/morpheus/cli/mixins/provisioning_helper.rb +53 -3
- data/lib/morpheus/cli/networks_command.rb +883 -36
- data/lib/morpheus/cli/option_types.rb +37 -14
- data/lib/morpheus/cli/roles.rb +78 -77
- data/lib/morpheus/cli/user_settings_command.rb +34 -5
- data/lib/morpheus/cli/version.rb +1 -1
- metadata +10 -2
@@ -5,7 +5,6 @@ module Morpheus
|
|
5
5
|
module OptionTypes
|
6
6
|
include Term::ANSIColor
|
7
7
|
|
8
|
-
|
9
8
|
def self.confirm(message,options={})
|
10
9
|
if options[:yes] == true
|
11
10
|
return true
|
@@ -237,9 +236,19 @@ module Morpheus
|
|
237
236
|
return value
|
238
237
|
end
|
239
238
|
|
239
|
+
|
240
|
+
def self.set_last_select(obj)
|
241
|
+
Thread.current[:_last_select] = obj
|
242
|
+
end
|
243
|
+
|
244
|
+
def self.get_last_select()
|
245
|
+
Thread.current[:_last_select]
|
246
|
+
end
|
247
|
+
|
240
248
|
def self.select_prompt(option_type,api_client, api_params={}, no_prompt=false, use_value=nil)
|
241
249
|
value_found = false
|
242
250
|
value = nil
|
251
|
+
default_value = option_type['defaultValue']
|
243
252
|
# local array of options
|
244
253
|
if option_type['selectOptions']
|
245
254
|
select_options = option_type['selectOptions']
|
@@ -272,9 +281,22 @@ module Morpheus
|
|
272
281
|
print "\n"
|
273
282
|
exit 1
|
274
283
|
end
|
275
|
-
|
276
|
-
|
277
|
-
|
284
|
+
# skipSingleOption is no longer supported
|
285
|
+
# elsif !select_options.nil? && select_options.count == 1 && option_type['skipSingleOption'] == true
|
286
|
+
# value_found = true
|
287
|
+
# value = select_options[0]['value']
|
288
|
+
# if there is just one option, use it as the defaultValue
|
289
|
+
elsif !select_options.nil? && select_options.count == 1
|
290
|
+
if option_type['required'] && default_value.nil?
|
291
|
+
default_value = select_options[0]['name'] # name is prettier than value
|
292
|
+
end
|
293
|
+
elsif !select_options.nil?
|
294
|
+
if default_value.nil?
|
295
|
+
found_default_option = select_options.find {|opt| opt['isDefault'] == true }
|
296
|
+
if found_default_option
|
297
|
+
default_value = found_default_option['name'] # name is prettier than value
|
298
|
+
end
|
299
|
+
end
|
278
300
|
end
|
279
301
|
|
280
302
|
if no_prompt
|
@@ -314,18 +336,19 @@ module Morpheus
|
|
314
336
|
}
|
315
337
|
matches
|
316
338
|
}
|
317
|
-
input = Readline.readline("#{option_type['fieldLabel']}#{option_type['fieldAddOn'] ? ('(' + option_type['fieldAddOn'] + ') ') : '' }#{!option_type['required'] ? ' (optional)' : ''}#{!
|
339
|
+
input = Readline.readline("#{option_type['fieldLabel']}#{option_type['fieldAddOn'] ? ('(' + option_type['fieldAddOn'] + ') ') : '' }#{!option_type['required'] ? ' (optional)' : ''}#{!default_value.to_s.empty? ? ' ['+default_value.to_s+']' : ''} ['?' for options]: ", false).to_s
|
318
340
|
input = input.chomp.strip
|
319
|
-
if input.empty?
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
341
|
+
if input.empty? && default_value
|
342
|
+
input = default_value
|
343
|
+
end
|
344
|
+
select_option = select_options.find{|b| b['name'] == input || (!b['value'].nil? && b['value'].to_s == input) || (b['value'].nil? && input.empty?)}
|
345
|
+
if select_option
|
346
|
+
value = select_option['value']
|
347
|
+
set_last_select(select_option)
|
348
|
+
elsif !input.nil? && !input.empty?
|
349
|
+
input = '?'
|
328
350
|
end
|
351
|
+
|
329
352
|
if input == '?'
|
330
353
|
help_prompt(option_type)
|
331
354
|
display_select_options(option_type, select_options)
|
data/lib/morpheus/cli/roles.rb
CHANGED
@@ -286,10 +286,11 @@ class Morpheus::Cli::Roles
|
|
286
286
|
def add(args)
|
287
287
|
usage = "Usage: morpheus roles add [options]"
|
288
288
|
options = {}
|
289
|
+
params = {}
|
289
290
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
290
291
|
opts.banner = subcommand_usage("[options]")
|
291
292
|
build_option_type_options(opts, options, add_role_option_types)
|
292
|
-
build_common_options(opts, options, [:options, :json, :dry_run, :remote])
|
293
|
+
build_common_options(opts, options, [:options, :payload, :json, :dry_run, :remote])
|
293
294
|
end
|
294
295
|
optparse.parse!(args)
|
295
296
|
|
@@ -300,51 +301,47 @@ class Morpheus::Cli::Roles
|
|
300
301
|
account = find_account_from_options(options)
|
301
302
|
account_id = account ? account['id'] : nil
|
302
303
|
|
303
|
-
|
304
|
-
|
304
|
+
passed_options = options[:options] ? options[:options].reject {|k,v| k.is_a?(Symbol) } : {}
|
305
|
+
payload = nil
|
306
|
+
if options[:payload]
|
307
|
+
payload = options[:payload]
|
308
|
+
payload.deep_merge!({'role' => passed_options}) unless passed_options.empty?
|
309
|
+
else
|
310
|
+
# merge -O options into normally parsed options
|
311
|
+
params.deep_merge!(passed_options)
|
305
312
|
|
306
|
-
|
307
|
-
|
308
|
-
role_payload['authority'] = v_prompt['authority']
|
309
|
-
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'description', 'fieldLabel' => 'Description', 'type' => 'text', 'displayOrder' => 2}], options[:options])
|
310
|
-
role_payload['description'] = v_prompt['description']
|
313
|
+
# argh, some options depend on others here...eg. multitenant is only available when roleType == 'user'
|
314
|
+
#prompt_option_types = update_role_option_types()
|
311
315
|
|
312
|
-
|
313
|
-
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => '
|
314
|
-
role_payload['
|
315
|
-
|
316
|
-
role_payload['
|
317
|
-
end
|
316
|
+
role_payload = params
|
317
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'authority', 'fieldLabel' => 'Name', 'type' => 'text', 'required' => true, 'displayOrder' => 1}], options[:options])
|
318
|
+
role_payload['authority'] = v_prompt['authority']
|
319
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'description', 'fieldLabel' => 'Description', 'type' => 'text', 'displayOrder' => 2}], options[:options])
|
320
|
+
role_payload['description'] = v_prompt['description']
|
318
321
|
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
322
|
+
if @is_master_account
|
323
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'roleType', 'fieldLabel' => 'Type', 'type' => 'select', 'selectOptions' => role_type_options, 'defaultValue' => 'user', 'displayOrder' => 3}], options[:options])
|
324
|
+
role_payload['roleType'] = v_prompt['roleType']
|
325
|
+
else
|
326
|
+
role_payload['roleType'] = 'user'
|
327
|
+
end
|
325
328
|
|
326
|
-
|
327
|
-
if
|
328
|
-
|
329
|
-
|
329
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'baseRole', 'fieldLabel' => 'Copy From Role', 'type' => 'text', 'displayOrder' => 4}], options[:options])
|
330
|
+
if v_prompt['baseRole'].to_s != ''
|
331
|
+
base_role = find_role_by_name_or_id(account_id, v_prompt['baseRole'])
|
332
|
+
exit 1 if base_role.nil?
|
333
|
+
role_payload['baseRoleId'] = base_role['id']
|
330
334
|
end
|
331
|
-
end
|
332
335
|
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
if v_prompt['instanceLimits.maxMemory'].to_s.strip != ''
|
340
|
-
role_payload['instanceLimits']['maxMemory'] = v_prompt['instanceLimits.maxMemory'].to_i
|
341
|
-
end
|
342
|
-
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'instanceLimits.maxCpu', 'fieldLabel' => 'CPU Count', 'type' => 'text', 'displayOrder' => 10}], options[:options])
|
343
|
-
if v_prompt['instanceLimits.maxCpu'].to_s.strip != ''
|
344
|
-
role_payload['instanceLimits']['maxCpu'] = v_prompt['instanceLimits.maxCpu'].to_i
|
345
|
-
end
|
336
|
+
if @is_master_account
|
337
|
+
if role_payload['roleType'] == 'user'
|
338
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'multitenant', 'fieldLabel' => 'Multitenant', 'type' => 'checkbox', 'defaultValue' => 'off', 'description' => 'A Multitenant role is automatically copied into all existing subaccounts as well as placed into a subaccount when created. Useful for providing a set of predefined roles a Customer can use', 'displayOrder' => 5}], options[:options])
|
339
|
+
role_payload['multitenant'] = ['on','true'].include?(v_prompt['multitenant'].to_s)
|
340
|
+
end
|
341
|
+
end
|
346
342
|
|
347
|
-
|
343
|
+
payload = {"role" => role_payload}
|
344
|
+
end
|
348
345
|
@roles_interface.setopts(options)
|
349
346
|
if options[:dry_run]
|
350
347
|
print_dry_run @roles_interface.dry.create(account_id, payload)
|
@@ -358,10 +355,17 @@ class Morpheus::Cli::Roles
|
|
358
355
|
return
|
359
356
|
end
|
360
357
|
|
358
|
+
role = json_response['role']
|
359
|
+
display_name = role['authority'] rescue ''
|
361
360
|
if account
|
362
|
-
print_green_success "Added role #{
|
361
|
+
print_green_success "Added role #{display_name} to account #{account['name']}"
|
363
362
|
else
|
364
|
-
print_green_success "Added role #{
|
363
|
+
print_green_success "Added role #{display_name}"
|
364
|
+
end
|
365
|
+
|
366
|
+
get_args = [role['id']] + (options[:remote] ? ["-r",options[:remote]] : [])
|
367
|
+
if account
|
368
|
+
get_args.push "--account-id", account['id'].to_s
|
365
369
|
end
|
366
370
|
|
367
371
|
details_options = [role_payload["authority"]]
|
@@ -379,6 +383,7 @@ class Morpheus::Cli::Roles
|
|
379
383
|
def update(args)
|
380
384
|
usage = "Usage: morpheus roles update [name] [options]"
|
381
385
|
options = {}
|
386
|
+
params = {}
|
382
387
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
383
388
|
opts.banner = subcommand_usage("[name] [options]")
|
384
389
|
build_option_type_options(opts, options, update_role_option_types)
|
@@ -402,37 +407,32 @@ class Morpheus::Cli::Roles
|
|
402
407
|
role = find_role_by_name_or_id(account_id, name)
|
403
408
|
exit 1 if role.nil?
|
404
409
|
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
410
|
+
passed_options = options[:options] ? options[:options].reject {|k,v| k.is_a?(Symbol) } : {}
|
411
|
+
payload = nil
|
412
|
+
if options[:payload]
|
413
|
+
payload = options[:payload]
|
414
|
+
payload.deep_merge!({'role' => passed_options}) unless passed_options.empty?
|
415
|
+
else
|
416
|
+
# merge -O options into normally parsed options
|
417
|
+
params.deep_merge!(passed_options)
|
418
|
+
prompt_option_types = update_role_option_types()
|
419
|
+
if !@is_master_account
|
420
|
+
prompt_option_types = prompt_option_types.reject {|it| ['roleType', 'multitenant'].include?(it['fieldName']) }
|
421
|
+
end
|
422
|
+
if role['roleType'] != 'user'
|
423
|
+
prompt_option_types = prompt_option_types.reject {|it| ['multitenant'].include?(it['fieldName']) }
|
424
|
+
end
|
425
|
+
#params = Morpheus::Cli::OptionTypes.prompt(prompt_option_types, options[:options], @api_client, options[:params])
|
421
426
|
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
role_payload['instanceLimits']['maxMemory'] = params['instanceLimits.maxMemory'].to_i if params['instanceLimits.maxMemory'].to_s.strip != ''
|
429
|
-
role_payload['instanceLimits']['maxCpu'] = params['instanceLimits.maxCpu'].to_i if params['instanceLimits.maxCpu'].to_s.strip != ''
|
430
|
-
end
|
427
|
+
if params.empty?
|
428
|
+
puts optparse
|
429
|
+
option_lines = prompt_option_types.collect {|it| "\t-O #{it['fieldName']}=\"value\"" }.join("\n")
|
430
|
+
puts "\nAvailable Options:\n#{option_lines}\n\n"
|
431
|
+
exit 1
|
432
|
+
end
|
431
433
|
|
432
|
-
|
433
|
-
role_payload['multitenant'] = ['on','true'].include?(params['multitenant'].to_s)
|
434
|
+
payload = {"role" => params}
|
434
435
|
end
|
435
|
-
payload = {role: role_payload}
|
436
436
|
@roles_interface.setopts(options)
|
437
437
|
if options[:dry_run]
|
438
438
|
print_dry_run @roles_interface.dry.update(account_id, role['id'], payload)
|
@@ -444,14 +444,15 @@ class Morpheus::Cli::Roles
|
|
444
444
|
print "\n"
|
445
445
|
return
|
446
446
|
end
|
447
|
+
role = json_response['role']
|
448
|
+
display_name = role['authority'] rescue ''
|
449
|
+
print_green_success "Updated role #{display_name}"
|
447
450
|
|
448
|
-
|
449
|
-
|
450
|
-
details_options = [role_payload["authority"] || role['authority']]
|
451
|
+
get_args = [role['id']] + (options[:remote] ? ["-r",options[:remote]] : [])
|
451
452
|
if account
|
452
|
-
|
453
|
+
get_args.push "--account-id", account['id'].to_s
|
453
454
|
end
|
454
|
-
get(
|
455
|
+
get(get_args)
|
455
456
|
|
456
457
|
rescue RestClient::Exception => e
|
457
458
|
print_rest_exception(e, options)
|
@@ -1180,9 +1181,9 @@ class Morpheus::Cli::Roles
|
|
1180
1181
|
{'fieldName' => 'roleType', 'fieldLabel' => 'Role Type', 'type' => 'select', 'selectOptions' => [{'name' => 'User Role', 'value' => 'user'}, {'name' => 'Account Role', 'value' => 'account'}], 'defaultValue' => 'user', 'displayOrder' => 3},
|
1181
1182
|
{'fieldName' => 'baseRole', 'fieldLabel' => 'Copy From Role', 'type' => 'text', 'displayOrder' => 4},
|
1182
1183
|
{'fieldName' => 'multitenant', 'fieldLabel' => 'Multitenant', 'type' => 'checkbox', 'defaultValue' => 'off', 'description' => 'A Multitenant role is automatically copied into all existing subaccounts as well as placed into a subaccount when created. Useful for providing a set of predefined roles a Customer can use', 'displayOrder' => 5},
|
1183
|
-
{'fieldName' => 'instanceLimits.maxStorage', 'fieldLabel' => 'Max Storage (bytes)', 'type' => 'text', 'displayOrder' => 8},
|
1184
|
-
{'fieldName' => 'instanceLimits.maxMemory', 'fieldLabel' => 'Max Memory (bytes)', 'type' => 'text', 'displayOrder' => 9},
|
1185
|
-
{'fieldName' => 'instanceLimits.maxCpu', 'fieldLabel' => 'CPU Count', 'type' => 'text', 'displayOrder' => 10},
|
1184
|
+
# {'fieldName' => 'instanceLimits.maxStorage', 'fieldLabel' => 'Max Storage (bytes)', 'type' => 'text', 'displayOrder' => 8},
|
1185
|
+
# {'fieldName' => 'instanceLimits.maxMemory', 'fieldLabel' => 'Max Memory (bytes)', 'type' => 'text', 'displayOrder' => 9},
|
1186
|
+
# {'fieldName' => 'instanceLimits.maxCpu', 'fieldLabel' => 'CPU Count', 'type' => 'text', 'displayOrder' => 10},
|
1186
1187
|
]
|
1187
1188
|
end
|
1188
1189
|
|
@@ -28,6 +28,9 @@ class Morpheus::Cli::UserSettingsCommand
|
|
28
28
|
params = {}
|
29
29
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
30
30
|
opts.banner = subcommand_usage()
|
31
|
+
opts.on("--user-id ID", String, "User ID") do |val|
|
32
|
+
params['userId'] = val.to_s
|
33
|
+
end
|
31
34
|
build_common_options(opts, options, [:query, :json, :yaml, :csv, :fields, :dry_run, :remote])
|
32
35
|
opts.footer = "Get your user settings."
|
33
36
|
end
|
@@ -107,6 +110,9 @@ class Morpheus::Cli::UserSettingsCommand
|
|
107
110
|
params = {}
|
108
111
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
109
112
|
opts.banner = subcommand_usage("[options]")
|
113
|
+
opts.on("--user-id ID", String, "User ID") do |val|
|
114
|
+
params['userId'] = val.to_s
|
115
|
+
end
|
110
116
|
build_common_options(opts, options, [:payload, :options, :json, :dry_run, :quiet, :remote])
|
111
117
|
opts.footer = "Update your user settings."
|
112
118
|
end
|
@@ -144,7 +150,8 @@ class Morpheus::Cli::UserSettingsCommand
|
|
144
150
|
end
|
145
151
|
|
146
152
|
print_green_success "Updated user settings"
|
147
|
-
|
153
|
+
get_args = [] + (options[:remote] ? ["-r",options[:remote]] : []) + (params['userId'] ? ['--user-id', params['userId'].to_s] : [])
|
154
|
+
get(get_args)
|
148
155
|
return 0
|
149
156
|
rescue RestClient::Exception => e
|
150
157
|
print_rest_exception(e, options)
|
@@ -157,6 +164,9 @@ class Morpheus::Cli::UserSettingsCommand
|
|
157
164
|
params = {}
|
158
165
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
159
166
|
opts.banner = subcommand_usage("[file]")
|
167
|
+
opts.on("--user-id ID", String, "User ID") do |val|
|
168
|
+
params['userId'] = val.to_s
|
169
|
+
end
|
160
170
|
build_common_options(opts, options, [:json, :dry_run, :quiet, :remote])
|
161
171
|
opts.footer = "Update your avatar profile image.\n" +
|
162
172
|
"[file] is required. This is the local path of a file to upload [png|jpg|svg]."
|
@@ -194,7 +204,8 @@ class Morpheus::Cli::UserSettingsCommand
|
|
194
204
|
end
|
195
205
|
|
196
206
|
print_green_success "Updated avatar"
|
197
|
-
|
207
|
+
get_args = [] + (options[:remote] ? ["-r",options[:remote]] : []) + (params['userId'] ? ['--user-id', params['userId'].to_s] : [])
|
208
|
+
get(get_args)
|
198
209
|
return 0
|
199
210
|
rescue RestClient::Exception => e
|
200
211
|
print_rest_exception(e, options)
|
@@ -207,6 +218,9 @@ class Morpheus::Cli::UserSettingsCommand
|
|
207
218
|
params = {}
|
208
219
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
209
220
|
opts.banner = subcommand_usage("[file]")
|
221
|
+
opts.on("--user-id ID", String, "User ID") do |val|
|
222
|
+
params['userId'] = val.to_s
|
223
|
+
end
|
210
224
|
build_common_options(opts, options, [:json, :dry_run, :quiet, :remote])
|
211
225
|
opts.footer = "Remove your avatar profile image."
|
212
226
|
end
|
@@ -233,7 +247,8 @@ class Morpheus::Cli::UserSettingsCommand
|
|
233
247
|
end
|
234
248
|
|
235
249
|
print_green_success "Removed avatar"
|
236
|
-
|
250
|
+
get_args = [] + (options[:remote] ? ["-r",options[:remote]] : []) + (params['userId'] ? ['--user-id', params['userId'].to_s] : [])
|
251
|
+
get(get_args)
|
237
252
|
return 0
|
238
253
|
rescue RestClient::Exception => e
|
239
254
|
print_rest_exception(e, options)
|
@@ -247,6 +262,9 @@ class Morpheus::Cli::UserSettingsCommand
|
|
247
262
|
params = {}
|
248
263
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
249
264
|
opts.banner = subcommand_usage()
|
265
|
+
opts.on("--user-id ID", String, "User ID") do |val|
|
266
|
+
params['userId'] = val.to_s
|
267
|
+
end
|
250
268
|
build_common_options(opts, options, [:remote])
|
251
269
|
opts.footer = "View your avatar profile image.\n" +
|
252
270
|
"This opens the avatar image url with a web browser."
|
@@ -291,6 +309,9 @@ class Morpheus::Cli::UserSettingsCommand
|
|
291
309
|
params = {}
|
292
310
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
293
311
|
opts.banner = subcommand_usage("[client-id]")
|
312
|
+
opts.on("--user-id ID", String, "User ID") do |val|
|
313
|
+
params['userId'] = val.to_s
|
314
|
+
end
|
294
315
|
build_common_options(opts, options, [:payload, :options, :json, :dry_run, :quiet, :remote])
|
295
316
|
opts.footer = "Regenerate API access token for a specific client.\n" +
|
296
317
|
"[client-id] is required. This is the id of an api client."
|
@@ -326,7 +347,8 @@ class Morpheus::Cli::UserSettingsCommand
|
|
326
347
|
return 0
|
327
348
|
end
|
328
349
|
print_green_success "Regenerated #{params['clientId']} access token: #{new_access_token}"
|
329
|
-
|
350
|
+
get_args = [] + (options[:remote] ? ["-r",options[:remote]] : []) + (params['userId'] ? ['--user-id', params['userId'].to_s] : [])
|
351
|
+
get(get_args)
|
330
352
|
return 0
|
331
353
|
rescue RestClient::Exception => e
|
332
354
|
print_rest_exception(e, options)
|
@@ -340,6 +362,9 @@ class Morpheus::Cli::UserSettingsCommand
|
|
340
362
|
params = {}
|
341
363
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
342
364
|
opts.banner = subcommand_usage("[client-id]")
|
365
|
+
opts.on("--user-id ID", String, "User ID") do |val|
|
366
|
+
params['userId'] = val.to_s
|
367
|
+
end
|
343
368
|
build_common_options(opts, options, [:payload, :options, :json, :dry_run, :quiet, :remote])
|
344
369
|
opts.footer = "Clear API access token for a specific client.\n" +
|
345
370
|
"[client-id] is required. This is the id of an api client."
|
@@ -375,7 +400,8 @@ class Morpheus::Cli::UserSettingsCommand
|
|
375
400
|
if params['clientId'] == 'morph-cli'
|
376
401
|
print yellow,"Your current access token is no longer valid, you will need to login again.",reset,"\n"
|
377
402
|
end
|
378
|
-
#
|
403
|
+
# get_args = [] + (options[:remote] ? ["-r",options[:remote]] : []) + (params['userId'] ? ['--user-id', params['userId'].to_s] : [])
|
404
|
+
# get(get_args)
|
379
405
|
return 0
|
380
406
|
rescue RestClient::Exception => e
|
381
407
|
print_rest_exception(e, options)
|
@@ -389,6 +415,9 @@ class Morpheus::Cli::UserSettingsCommand
|
|
389
415
|
params = {}
|
390
416
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
391
417
|
opts.banner = subcommand_usage()
|
418
|
+
# opts.on("--user-id ID", String, "User ID") do |val|
|
419
|
+
# params['userId'] = val.to_s
|
420
|
+
# end
|
392
421
|
build_common_options(opts, options, [:query, :json, :yaml, :csv, :fields, :dry_run, :remote])
|
393
422
|
opts.footer = "List available api clients."
|
394
423
|
end
|
data/lib/morpheus/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: morpheus-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Estes
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2019-
|
14
|
+
date: 2019-10-11 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -156,6 +156,7 @@ files:
|
|
156
156
|
- README.md
|
157
157
|
- Rakefile
|
158
158
|
- bin/morpheus
|
159
|
+
- lib/morpheus/api.rb
|
159
160
|
- lib/morpheus/api/account_groups_interface.rb
|
160
161
|
- lib/morpheus/api/accounts_interface.rb
|
161
162
|
- lib/morpheus/api/api_client.rb
|
@@ -169,6 +170,7 @@ files:
|
|
169
170
|
- lib/morpheus/api/cloud_policies_interface.rb
|
170
171
|
- lib/morpheus/api/cloud_resource_pools_interface.rb
|
171
172
|
- lib/morpheus/api/clouds_interface.rb
|
173
|
+
- lib/morpheus/api/clusters_interface.rb
|
172
174
|
- lib/morpheus/api/containers_interface.rb
|
173
175
|
- lib/morpheus/api/custom_instance_types_interface.rb
|
174
176
|
- lib/morpheus/api/cypher_interface.rb
|
@@ -188,6 +190,7 @@ files:
|
|
188
190
|
- lib/morpheus/api/instance_types_interface.rb
|
189
191
|
- lib/morpheus/api/instances_interface.rb
|
190
192
|
- lib/morpheus/api/key_pairs_interface.rb
|
193
|
+
- lib/morpheus/api/library_compute_type_layouts_interface.rb
|
191
194
|
- lib/morpheus/api/library_container_scripts_interface.rb
|
192
195
|
- lib/morpheus/api/library_container_templates_interface.rb
|
193
196
|
- lib/morpheus/api/library_container_types_interface.rb
|
@@ -211,6 +214,8 @@ files:
|
|
211
214
|
- lib/morpheus/api/network_pools_interface.rb
|
212
215
|
- lib/morpheus/api/network_proxies_interface.rb
|
213
216
|
- lib/morpheus/api/network_services_interface.rb
|
217
|
+
- lib/morpheus/api/network_subnet_types_interface.rb
|
218
|
+
- lib/morpheus/api/network_subnets_interface.rb
|
214
219
|
- lib/morpheus/api/network_types_interface.rb
|
215
220
|
- lib/morpheus/api/networks_interface.rb
|
216
221
|
- lib/morpheus/api/old_cypher_interface.rb
|
@@ -228,8 +233,10 @@ files:
|
|
228
233
|
- lib/morpheus/api/security_groups_interface.rb
|
229
234
|
- lib/morpheus/api/server_types_interface.rb
|
230
235
|
- lib/morpheus/api/servers_interface.rb
|
236
|
+
- lib/morpheus/api/service_plans_interface.rb
|
231
237
|
- lib/morpheus/api/setup_interface.rb
|
232
238
|
- lib/morpheus/api/storage_providers_interface.rb
|
239
|
+
- lib/morpheus/api/subnets_interface.rb
|
233
240
|
- lib/morpheus/api/task_sets_interface.rb
|
234
241
|
- lib/morpheus/api/tasks_interface.rb
|
235
242
|
- lib/morpheus/api/user_groups_interface.rb
|
@@ -256,6 +263,7 @@ files:
|
|
256
263
|
- lib/morpheus/cli/cloud_folders_command.rb
|
257
264
|
- lib/morpheus/cli/cloud_resource_pools_command.rb
|
258
265
|
- lib/morpheus/cli/clouds.rb
|
266
|
+
- lib/morpheus/cli/clusters.rb
|
259
267
|
- lib/morpheus/cli/command_error.rb
|
260
268
|
- lib/morpheus/cli/commands/standard/alias_command.rb
|
261
269
|
- lib/morpheus/cli/commands/standard/benchmark_command.rb
|