morpheus-cli 5.4.0 → 5.4.1

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.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/Dockerfile +1 -1
  3. data/lib/morpheus/api/account_users_interface.rb +68 -0
  4. data/lib/morpheus/api/api_client.rb +51 -9
  5. data/lib/morpheus/api/audit_interface.rb +9 -0
  6. data/lib/morpheus/api/instances_interface.rb +21 -0
  7. data/lib/morpheus/api/load_balancer_monitors_interface.rb +9 -0
  8. data/lib/morpheus/api/load_balancer_pools_interface.rb +4 -4
  9. data/lib/morpheus/api/load_balancer_profiles_interface.rb +4 -5
  10. data/lib/morpheus/api/load_balancer_virtual_servers_interface.rb +13 -4
  11. data/lib/morpheus/api/load_balancers_interface.rb +5 -0
  12. data/lib/morpheus/api/network_routers_interface.rb +9 -0
  13. data/lib/morpheus/api/network_static_routes_interface.rb +36 -0
  14. data/lib/morpheus/api/read_interface.rb +4 -3
  15. data/lib/morpheus/api/rest_interface.rb +3 -3
  16. data/lib/morpheus/api/secondary_read_interface.rb +1 -1
  17. data/lib/morpheus/api/secondary_rest_interface.rb +19 -19
  18. data/lib/morpheus/api/storage_server_types_interface.rb +14 -0
  19. data/lib/morpheus/api/storage_servers_interface.rb +9 -0
  20. data/lib/morpheus/api/storage_volume_types_interface.rb +9 -0
  21. data/lib/morpheus/api/storage_volumes_interface.rb +9 -0
  22. data/lib/morpheus/api/users_interface.rb +16 -63
  23. data/lib/morpheus/cli/cli_command.rb +253 -5
  24. data/lib/morpheus/cli/cli_registry.rb +1 -1
  25. data/lib/morpheus/cli/commands/alias_command.rb +1 -1
  26. data/lib/morpheus/cli/commands/apps.rb +14 -78
  27. data/lib/morpheus/cli/commands/audit.rb +188 -0
  28. data/lib/morpheus/cli/commands/blueprints_command.rb +1 -1
  29. data/lib/morpheus/cli/commands/change_password_command.rb +4 -4
  30. data/lib/morpheus/cli/commands/clusters.rb +37 -12
  31. data/lib/morpheus/cli/commands/hosts.rb +15 -15
  32. data/lib/morpheus/cli/commands/instances.rb +109 -2
  33. data/lib/morpheus/cli/commands/load_balancer_monitors.rb +71 -0
  34. data/lib/morpheus/cli/commands/load_balancer_pools.rb +30 -50
  35. data/lib/morpheus/cli/commands/load_balancer_profiles.rb +65 -0
  36. data/lib/morpheus/cli/commands/load_balancer_types.rb +9 -4
  37. data/lib/morpheus/cli/commands/load_balancer_virtual_servers.rb +77 -57
  38. data/lib/morpheus/cli/commands/load_balancers.rb +93 -6
  39. data/lib/morpheus/cli/commands/network_firewalls_command.rb +22 -5
  40. data/lib/morpheus/cli/commands/network_routers_command.rb +96 -45
  41. data/lib/morpheus/cli/commands/network_static_routes_command.rb +446 -0
  42. data/lib/morpheus/cli/commands/network_transport_zones_command.rb +4 -4
  43. data/lib/morpheus/cli/commands/open_command.rb +30 -0
  44. data/lib/morpheus/cli/commands/options.rb +98 -0
  45. data/lib/morpheus/cli/commands/policies_command.rb +1 -1
  46. data/lib/morpheus/cli/commands/prices_command.rb +7 -7
  47. data/lib/morpheus/cli/commands/remote.rb +4 -2
  48. data/lib/morpheus/cli/commands/roles.rb +1 -1
  49. data/lib/morpheus/cli/commands/shell.rb +2 -2
  50. data/lib/morpheus/cli/commands/storage_server_types.rb +50 -0
  51. data/lib/morpheus/cli/commands/storage_servers.rb +122 -0
  52. data/lib/morpheus/cli/commands/storage_volume_types.rb +50 -0
  53. data/lib/morpheus/cli/commands/storage_volumes.rb +103 -0
  54. data/lib/morpheus/cli/commands/tenants_command.rb +1 -1
  55. data/lib/morpheus/cli/commands/user_groups_command.rb +1 -1
  56. data/lib/morpheus/cli/commands/user_settings_command.rb +2 -1
  57. data/lib/morpheus/cli/commands/user_sources_command.rb +1 -1
  58. data/lib/morpheus/cli/commands/users.rb +28 -28
  59. data/lib/morpheus/cli/commands/view.rb +102 -0
  60. data/lib/morpheus/cli/mixins/accounts_helper.rb +5 -5
  61. data/lib/morpheus/cli/mixins/load_balancers_helper.rb +24 -4
  62. data/lib/morpheus/cli/mixins/print_helper.rb +50 -18
  63. data/lib/morpheus/cli/mixins/processes_helper.rb +1 -2
  64. data/lib/morpheus/cli/mixins/provisioning_helper.rb +15 -5
  65. data/lib/morpheus/cli/mixins/rest_command.rb +145 -73
  66. data/lib/morpheus/cli/mixins/secondary_rest_command.rb +174 -81
  67. data/lib/morpheus/cli/mixins/storage_servers_helper.rb +156 -0
  68. data/lib/morpheus/cli/mixins/storage_volumes_helper.rb +119 -0
  69. data/lib/morpheus/cli/option_types.rb +45 -24
  70. data/lib/morpheus/cli/version.rb +1 -1
  71. data/lib/morpheus/cli.rb +1 -0
  72. data/lib/morpheus/ext/string.rb +29 -6
  73. data/lib/morpheus/routes.rb +238 -0
  74. data/lib/morpheus/util.rb +6 -1
  75. metadata +29 -8
@@ -86,6 +86,22 @@ module Morpheus::Cli::RestCommand
86
86
 
87
87
  alias :set_rest_arg :rest_arg=
88
88
 
89
+ # rest_has_name indicates a resource has a name and can be retrieved by name or id
90
+ # true by default, set to false for lookups by only id
91
+ def rest_has_name
92
+ @rest_has_name != nil ? @rest_has_name : default_rest_has_name
93
+ end
94
+
95
+ def default_rest_has_name
96
+ true
97
+ end
98
+
99
+ def rest_has_name=(v)
100
+ @rest_has_name = !!v
101
+ end
102
+
103
+ alias :set_rest_has_name :rest_has_name=
104
+
89
105
  # rest_label is the capitalized resource label eg. "Neat Thing"
90
106
  def rest_label
91
107
  @rest_label || default_rest_label
@@ -297,6 +313,10 @@ module Morpheus::Cli::RestCommand
297
313
  self.class.rest_arg
298
314
  end
299
315
 
316
+ def rest_has_name
317
+ self.class.rest_has_name
318
+ end
319
+
300
320
  def rest_label
301
321
  self.class.rest_label
302
322
  end
@@ -316,23 +336,37 @@ module Morpheus::Cli::RestCommand
316
336
  end
317
337
 
318
338
  def rest_object_key
319
- self.send("#{rest_key}_object_key")
339
+ send("#{rest_key}_object_key")
320
340
  end
321
341
 
322
342
  def rest_list_key
323
- self.send("#{rest_key}_list_key")
343
+ send("#{rest_key}_list_key")
324
344
  end
325
345
 
326
- def rest_column_definitions
327
- self.send("#{rest_key}_column_definitions")
346
+ def rest_column_definitions(options)
347
+ send("#{rest_key}_column_definitions", options)
328
348
  end
329
349
 
330
- def rest_list_column_definitions
331
- self.send("#{rest_key}_list_column_definitions")
350
+ def rest_list_column_definitions(options)
351
+ send("#{rest_key}_list_column_definitions", options)
332
352
  end
333
353
 
334
- def rest_find_by_name_or_id(name)
335
- return self.send("find_#{rest_key}_by_name_or_id", name)
354
+ def rest_find_by_name_or_id(val)
355
+ # use explicitly defined finders
356
+ # else default to new generic CliCommand method to find anything by type (singular underscore)
357
+ if rest_has_name
358
+ if respond_to?("find_#{rest_key}_by_name_or_id", true)
359
+ send("find_#{rest_key}_by_name_or_id", val)
360
+ else
361
+ find_by_name_or_id(rest_key, val)
362
+ end
363
+ else
364
+ if respond_to?("find_#{rest_key}_by_id", true)
365
+ send("find_#{rest_key}_by_id", val)
366
+ else
367
+ find_by_id(rest_key, val)
368
+ end
369
+ end
336
370
  end
337
371
 
338
372
  def rest_has_type
@@ -353,6 +387,10 @@ module Morpheus::Cli::RestCommand
353
387
  self.class.rest_type_arg
354
388
  end
355
389
 
390
+ def rest_has_name
391
+ self.class.rest_type_arg
392
+ end
393
+
356
394
  def rest_type_label
357
395
  self.class.rest_type_label
358
396
  end
@@ -370,23 +408,29 @@ module Morpheus::Cli::RestCommand
370
408
  end
371
409
 
372
410
  def rest_type_object_key
373
- self.send("#{rest_type_key}_object_key")
411
+ send("#{rest_type_key}_object_key")
374
412
  end
375
413
 
376
414
  def rest_type_list_key
377
- self.send("#{rest_type_key}_list_key")
415
+ send("#{rest_type_key}_list_key")
378
416
  end
379
417
 
380
- def rest_type_column_definitions
381
- self.send("#{rest_type_key}_column_definitions")
418
+ def rest_type_column_definitions(options)
419
+ send("#{rest_type_key}_column_definitions", options)
382
420
  end
383
421
 
384
- def rest_type_list_column_definitions
385
- self.send("#{rest_type_key}_list_column_definitions")
422
+ def rest_type_list_column_definitions(options)
423
+ send("#{rest_type_key}_list_column_definitions", options)
386
424
  end
387
425
 
388
- def rest_type_find_by_name_or_id(name)
389
- return self.send("find_#{rest_type_key}_by_name_or_id", name)
426
+ def rest_type_find_by_name_or_id(val)
427
+ # use explicately defined finders
428
+ # else default to new generic CliCommand method to find anything by type (singular underscore)
429
+ if respond_to?("find_#{rest_type_key}_by_name_or_id", true)
430
+ send("find_#{rest_type_key}_by_name_or_id", val)
431
+ else
432
+ find_by_name_or_id(rest_type_key, val)
433
+ end
390
434
  end
391
435
 
392
436
  def registered_interfaces
@@ -417,18 +461,15 @@ module Morpheus::Cli::RestCommand
417
461
  options = {}
418
462
  optparse = Morpheus::Cli::OptionParser.new do |opts|
419
463
  opts.banner = subcommand_usage("[search]")
420
- build_standard_list_options(opts, options)
421
- opts.footer = <<-EOT
464
+ build_list_options(opts, options, params)
465
+ opts.footer = <<-EOT
422
466
  List #{rest_label_plural.downcase}.
423
467
  [search] is optional. This is a search phrase to filter the results.
424
468
  EOT
425
469
  end
426
470
  optparse.parse!(args)
427
471
  connect(options)
428
- if args.count > 0
429
- options[:phrase] = args.join(" ")
430
- end
431
- params.merge!(parse_list_options(options))
472
+ parse_list_options!(args, options, params)
432
473
  rest_interface.setopts(options)
433
474
  if options[:dry_run]
434
475
  print_dry_run rest_interface.dry.list(params)
@@ -441,7 +482,7 @@ EOT
441
482
  if records.nil? || records.empty?
442
483
  print cyan,"No #{rest_label_plural.downcase} found.",reset,"\n"
443
484
  else
444
- print as_pretty_table(records, rest_list_column_definitions.upcase_keys!, options)
485
+ print as_pretty_table(records, rest_list_column_definitions(options).upcase_keys!, options)
445
486
  print_results_pagination(json_response) if json_response['meta']
446
487
  end
447
488
  print reset,"\n"
@@ -454,27 +495,25 @@ EOT
454
495
  options = {}
455
496
  optparse = Morpheus::Cli::OptionParser.new do |opts|
456
497
  opts.banner = subcommand_usage("[#{rest_arg}]")
457
- build_standard_get_options(opts, options)
498
+ build_get_options(opts, options, params)
458
499
  opts.footer = <<-EOT
459
500
  Get details about #{a_or_an(rest_label)} #{rest_label.downcase}.
460
- [#{rest_arg}] is required. This is the name or id of #{a_or_an(rest_label)} #{rest_label.downcase}.
501
+ [#{rest_arg}] is required. This is the #{rest_has_name ? 'name or id' : 'id'} of #{a_or_an(rest_label)} #{rest_label.downcase}.
461
502
  EOT
462
503
  end
463
504
  optparse.parse!(args)
464
505
  verify_args!(args:args, optparse:optparse, min:1)
465
506
  connect(options)
466
- params.merge!(parse_query_options(options))
467
- id_list = parse_id_list(args)
468
- return run_command_for_each_arg(id_list) do |arg|
469
- _get(arg, params, options)
470
- end
507
+ parse_get_options!(args, options, params)
508
+ id = args.join(" ")
509
+ _get(id, params, options)
471
510
  end
472
511
 
473
512
  def _get(id, params, options)
474
- if id !~ /\A\d{1,}\Z/
513
+ if id !~ /\A\d{1,}\Z/ && rest_has_name
475
514
  record = rest_find_by_name_or_id(id)
476
515
  if record.nil?
477
- raise_command_error "#{rest_label} not found for name '#{id}'"
516
+ return 1, "#{rest_label} not found for '#{id}'"
478
517
  end
479
518
  id = record['id']
480
519
  end
@@ -493,8 +532,14 @@ EOT
493
532
  record = json_response[rest_object_key]
494
533
  print_h1 rest_label, [], options
495
534
  print cyan
496
- print_description_list(rest_column_definitions, record, options)
497
- # show config settings...
535
+ print_description_list(rest_column_definitions(options), record, options)
536
+ # # could always show config eh? or maybe only with --config if that is nicer.
537
+ # # config = record['config'].is_a?(Hash) && !record['config'].empty?
538
+ # if config && !config.empty?
539
+ # print_h2 "Configuration"
540
+ # print_description_list(config.keys, config)
541
+ # end
542
+ # Option Types
498
543
  if record['optionTypes'] && record['optionTypes'].size > 0
499
544
  print_h2 "Option Types", options
500
545
  print format_option_types_table(record['optionTypes'], options, rest_object_key)
@@ -507,19 +552,18 @@ EOT
507
552
  record_type = nil
508
553
  record_type_id = nil
509
554
  options = {}
555
+ option_types = respond_to?("add_#{rest_key}_option_types", true) ? send("add_#{rest_key}_option_types") : []
556
+ advanced_option_types = respond_to?("add_#{rest_key}_advanced_option_types", true) ? send("add_#{rest_key}_advanced_option_types") : []
557
+ type_option_type = option_types.find {|it| it['fieldName'] == 'type'}
510
558
  optparse = Morpheus::Cli::OptionParser.new do |opts|
511
559
  opts.banner = subcommand_usage("[#{rest_arg}]")
512
- if rest_has_type
560
+ if rest_has_type && type_option_type.nil?
513
561
  opts.on( '-t', "--#{rest_type_arg} TYPE", "#{rest_type_label}" ) do |val|
514
562
  record_type_id = val
515
563
  end
516
564
  end
517
- if self.class.method_defined?("add_#{rest_key}_option_types")
518
- build_option_type_options(opts, options, self.send("add_#{rest_key}_option_types"))
519
- end
520
- if self.class.method_defined?("add_#{rest_key}_advanced_option_types")
521
- build_option_type_options(opts, options, self.send("add_#{rest_key}_advanced_option_types"))
522
- end
565
+ build_option_type_options(opts, options, option_types)
566
+ build_option_type_options(opts, options, advanced_option_types)
523
567
  build_standard_add_options(opts, options)
524
568
  opts.footer = <<-EOT
525
569
  Create a new #{rest_label.downcase}.
@@ -530,22 +574,26 @@ EOT
530
574
  # todo: make supporting args[0] optional and more flexible
531
575
  # for now args[0] is assumed to be the 'name'
532
576
  record_name = nil
533
- if args[0] # && rest_has_name
534
- record_name = args[0]
577
+ if rest_has_name
578
+ if args.count > 0
579
+ record_name = args.join(" ")
580
+ end
581
+ verify_args!(args:args, optparse:optparse, min:0, max: 1)
582
+ else
583
+ verify_args!(args:args, optparse:optparse, count: 0)
535
584
  end
536
- verify_args!(args:args, optparse:optparse, min:0, max: 1)
537
585
  connect(options)
538
586
  # load or prompt for type
539
- if rest_has_type
587
+ if rest_has_type && type_option_type.nil?
540
588
  if record_type_id.nil?
541
589
  #raise_command_error "#{rest_type_label} is required.\n#{optparse}"
542
- type_list = rest_type_interface.list({max:10000})[rest_type_list_key]
590
+ type_list = rest_type_interface.list({max:10000, creatable:true})[rest_type_list_key]
543
591
  type_dropdown_options = type_list.collect {|it| {'name' => it['name'], 'value' => it['code']} }
544
592
  record_type_id = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'type', 'fieldLabel' => rest_type_label, 'type' => 'select', 'selectOptions' => type_dropdown_options, 'required' => true}], options[:options], @api_client)['type']
545
593
  end
546
594
  record_type = rest_type_find_by_name_or_id(record_type_id)
547
595
  if record_type.nil?
548
- raise_command_error "#{rest_type_label} not found for '#{record_type_id}'.\n#{optparse}"
596
+ return 1, "#{rest_type_label} not found for '#{record_type_id}"
549
597
  end
550
598
  end
551
599
  passed_options = parse_passed_options(options)
@@ -568,15 +616,32 @@ EOT
568
616
  options[:params]['type'] = record_type['code']
569
617
  end
570
618
  record_payload.deep_merge!(passed_options)
571
- if self.class.method_defined?("add_#{rest_key}_option_types")
572
- add_option_types = self.send("add_#{rest_key}_option_types")
573
- v_prompt = Morpheus::Cli::OptionTypes.prompt(add_option_types, options[:options], @api_client, options[:params])
619
+ if option_types && !option_types.empty?
620
+ v_prompt = Morpheus::Cli::OptionTypes.prompt(option_types, options[:options], @api_client, options[:params])
574
621
  v_prompt.deep_compact!
575
622
  v_prompt.booleanize! # 'on' => true
576
623
  record_payload.deep_merge!(v_prompt)
577
624
  end
578
625
  # options by type
579
- my_option_types = record_type ? record_type['optionTypes'] : nil
626
+ if rest_has_type && record_type.nil?
627
+ type_value = record_payload['type'].is_a?(Hash) ? record_payload['type']['id'] : record_payload['type']
628
+ if type_value
629
+ record_type = rest_type_find_by_name_or_id(type_value)
630
+ if record_type.nil?
631
+ return 1, "#{rest_type_label} not found for '#{type_value}"
632
+ end
633
+ end
634
+ # reload the type by id to get all the details ie. optionTypes
635
+ if record_type && record_type['optionTypes'].nil?
636
+ record_type = rest_type_find_by_name_or_id(record_type['id'])
637
+ end
638
+ end
639
+ my_option_types = nil
640
+ if respond_to?("load_option_types_for_#{rest_key}", true)
641
+ my_option_types = send("load_option_types_for_#{rest_key}", record_type, nil)
642
+ else
643
+ my_option_types = record_type ? record_type['optionTypes'] : nil
644
+ end
580
645
  if my_option_types && !my_option_types.empty?
581
646
  # remove redundant fieldContext
582
647
  my_option_types.each do |option_type|
@@ -584,15 +649,15 @@ EOT
584
649
  option_type['fieldContext'] = nil
585
650
  end
586
651
  end
587
- v_prompt = Morpheus::Cli::OptionTypes.prompt(my_option_types, options[:options], @api_client, options[:params])
652
+ api_params = (options[:params] || {}).merge(record_payload)
653
+ v_prompt = Morpheus::Cli::OptionTypes.prompt(my_option_types, options[:options], @api_client, api_params)
588
654
  v_prompt.deep_compact!
589
655
  v_prompt.booleanize! # 'on' => true
590
656
  record_payload.deep_merge!(v_prompt)
591
657
  end
592
658
  # advanced options (uses no_prompt)
593
- if self.class.method_defined?("add_#{rest_key}_advanced_option_types")
594
- add_advanced_option_types = self.send("add_#{rest_key}_advanced_option_types")
595
- v_prompt = Morpheus::Cli::OptionTypes.no_prompt(add_advanced_option_types, options[:options], @api_client, options[:params])
659
+ if advanced_option_types && !advanced_option_types.empty?
660
+ v_prompt = Morpheus::Cli::OptionTypes.no_prompt(advanced_option_types, options[:options], @api_client, options[:params])
596
661
  v_prompt.deep_compact!
597
662
  v_prompt.booleanize! # 'on' => true
598
663
  record_payload.deep_merge!(v_prompt)
@@ -618,18 +683,16 @@ EOT
618
683
  record_type = nil
619
684
  record_type_id = nil
620
685
  options = {}
686
+ option_types = respond_to?("update_#{rest_key}_option_types", true) ? send("update_#{rest_key}_option_types") : []
687
+ advanced_option_types = respond_to?("update_#{rest_key}_advanced_option_types", true) ? send("update_#{rest_key}_advanced_option_types") : []
621
688
  optparse = Morpheus::Cli::OptionParser.new do |opts|
622
689
  opts.banner = subcommand_usage("[#{rest_arg}] [options]")
623
- if self.class.method_defined?("update_#{rest_key}_option_types")
624
- build_option_type_options(opts, options, self.send("update_#{rest_key}_option_types"))
625
- end
626
- if self.class.method_defined?("update_#{rest_key}_advanced_option_types")
627
- build_option_type_options(opts, options, self.send("update_#{rest_key}_advanced_option_types"))
628
- end
690
+ build_option_type_options(opts, options, option_types)
691
+ build_option_type_options(opts, options, advanced_option_types)
629
692
  build_standard_update_options(opts, options)
630
693
  opts.footer = <<-EOT
631
694
  Update an existing #{rest_label.downcase}.
632
- [#{rest_arg}] is required. This is the name or id of #{a_or_an(rest_label)} #{rest_label.downcase}.
695
+ [#{rest_arg}] is required. This is the #{rest_has_name ? 'name or id' : 'id'} of #{a_or_an(rest_label)} #{rest_label.downcase}.
633
696
  EOT
634
697
  end
635
698
  optparse.parse!(args)
@@ -644,7 +707,11 @@ EOT
644
707
  record_type_id = record['type']['id']
645
708
  record_type = rest_type_find_by_name_or_id(record_type_id)
646
709
  if record_type.nil?
647
- raise_command_error "#{rest_type_label} not found for '#{record_type_id}'.\n#{optparse}"
710
+ return 1, "#{rest_type_label} not found for '#{record_type_id}"
711
+ end
712
+ # reload the type by id to get all the details ie. optionTypes
713
+ if record_type['optionTypes'].nil?
714
+ record_type = rest_type_find_by_name_or_id(record_type['id'])
648
715
  end
649
716
  end
650
717
  passed_options = parse_passed_options(options)
@@ -663,15 +730,20 @@ EOT
663
730
  options[:params]['type'] = record_type['code']
664
731
  end
665
732
  # update options without prompting by default
666
- if self.class.method_defined?("update_#{rest_key}_option_types")
667
- update_option_types = self.send("update_#{rest_key}_option_types")
668
- v_prompt = Morpheus::Cli::OptionTypes.no_prompt(update_option_types, options[:options], @api_client, options[:params])
733
+ if option_types && !option_types.empty?
734
+ api_params = (options[:params] || {}).merge(record_payload) # need to merge in values from record too, ughhh
735
+ v_prompt = Morpheus::Cli::OptionTypes.no_prompt(option_types, options[:options], @api_client, api_params)
669
736
  v_prompt.deep_compact!
670
737
  v_prompt.booleanize! # 'on' => true
671
738
  record_payload.deep_merge!(v_prompt)
672
739
  end
673
740
  # options by type
674
- my_option_types = record_type ? record_type['optionTypes'] : nil
741
+ my_option_types = nil
742
+ if respond_to?("load_option_types_for_#{rest_key}", true)
743
+ my_option_types = send("load_option_types_for_#{rest_key}", record_type, nil)
744
+ else
745
+ my_option_types = record_type ? record_type['optionTypes'] : nil
746
+ end
675
747
  if my_option_types && !my_option_types.empty?
676
748
  # remove redundant fieldContext
677
749
  # make them optional for updates
@@ -684,15 +756,15 @@ EOT
684
756
  option_type.delete('required')
685
757
  option_type.delete('defaultValue')
686
758
  end
687
- v_prompt = Morpheus::Cli::OptionTypes.no_prompt(my_option_types, options[:options], @api_client, options[:params])
759
+ api_params = (options[:params] || {}).merge(record_payload) # need to merge in values from record too, ughhh
760
+ v_prompt = Morpheus::Cli::OptionTypes.no_prompt(my_option_types, options[:options], @api_client, api_params)
688
761
  v_prompt.deep_compact!
689
762
  v_prompt.booleanize! # 'on' => true
690
763
  record_payload.deep_merge!(v_prompt)
691
764
  end
692
765
  # advanced options
693
- if self.class.method_defined?("update_#{rest_key}_advanced_option_types")
694
- update_advanced_option_types = self.send("update_#{rest_key}_advanced_option_types")
695
- v_prompt = Morpheus::Cli::OptionTypes.no_prompt(update_advanced_option_types, options[:options], @api_client, options[:params])
766
+ if advanced_option_types && !advanced_option_types.empty?
767
+ v_prompt = Morpheus::Cli::OptionTypes.no_prompt(advanced_option_types, options[:options], @api_client, options[:params])
696
768
  v_prompt.deep_compact!
697
769
  v_prompt.booleanize! # 'on' => true
698
770
  record_payload.deep_merge!(v_prompt)
@@ -729,7 +801,7 @@ EOT
729
801
  build_standard_remove_options(opts, options)
730
802
  opts.footer = <<-EOT
731
803
  Delete an existing #{rest_label.downcase}.
732
- [#{rest_arg}] is required. This is the name or id of #{a_or_an(rest_label)} #{rest_label.downcase}.
804
+ [#{rest_arg}] is required. This is the #{rest_has_name ? 'name or id' : 'id'} of #{a_or_an(rest_label)} #{rest_label.downcase}.
733
805
  EOT
734
806
  end
735
807
  optparse.parse!(args)
@@ -745,7 +817,7 @@ EOT
745
817
  end
746
818
  rest_interface.setopts(options)
747
819
  if options[:dry_run]
748
- print_dry_run rest_interface.dry.destroy(record['id'])
820
+ print_dry_run rest_interface.dry.destroy(record['id'], params)
749
821
  return 0, nil
750
822
  end
751
823
  json_response = rest_interface.destroy(record['id'], params)