morpheus-cli 5.3.2.1 → 5.3.4

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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/Dockerfile +1 -1
  3. data/lib/morpheus/api/api_client.rb +12 -0
  4. data/lib/morpheus/api/clouds_interface.rb +4 -11
  5. data/lib/morpheus/api/instances_interface.rb +18 -5
  6. data/lib/morpheus/api/load_balancer_pools_interface.rb +4 -4
  7. data/lib/morpheus/api/load_balancer_profiles_interface.rb +10 -0
  8. data/lib/morpheus/api/load_balancer_virtual_servers_interface.rb +4 -4
  9. data/lib/morpheus/api/network_routers_interface.rb +21 -0
  10. data/lib/morpheus/api/network_servers_interface.rb +42 -0
  11. data/lib/morpheus/api/rest_interface.rb +2 -1
  12. data/lib/morpheus/api/virtual_images_interface.rb +23 -2
  13. data/lib/morpheus/api/virtual_servers_interface.rb +9 -0
  14. data/lib/morpheus/cli/apps.rb +3 -2
  15. data/lib/morpheus/cli/cli_command.rb +14 -6
  16. data/lib/morpheus/cli/cli_registry.rb +55 -2
  17. data/lib/morpheus/cli/cloud_resource_pools_command.rb +170 -134
  18. data/lib/morpheus/cli/clouds.rb +22 -40
  19. data/lib/morpheus/cli/clusters.rb +51 -33
  20. data/lib/morpheus/cli/hosts.rb +0 -1
  21. data/lib/morpheus/cli/instances.rb +372 -150
  22. data/lib/morpheus/cli/invoices_command.rb +117 -133
  23. data/lib/morpheus/cli/library_cluster_layouts_command.rb +20 -0
  24. data/lib/morpheus/cli/library_option_lists_command.rb +3 -3
  25. data/lib/morpheus/cli/load_balancer_pools.rb +111 -0
  26. data/lib/morpheus/cli/load_balancer_virtual_servers.rb +136 -0
  27. data/lib/morpheus/cli/load_balancers.rb +0 -155
  28. data/lib/morpheus/cli/mixins/load_balancers_helper.rb +2 -2
  29. data/lib/morpheus/cli/mixins/provisioning_helper.rb +155 -112
  30. data/lib/morpheus/cli/mixins/rest_command.rb +53 -37
  31. data/lib/morpheus/cli/mixins/secondary_rest_command.rb +488 -0
  32. data/lib/morpheus/cli/monitoring_checks_command.rb +2 -0
  33. data/lib/morpheus/cli/network_routers_command.rb +291 -7
  34. data/lib/morpheus/cli/network_scopes_command.rb +442 -0
  35. data/lib/morpheus/cli/networks_command.rb +3 -3
  36. data/lib/morpheus/cli/option_parser.rb +25 -17
  37. data/lib/morpheus/cli/option_types.rb +42 -15
  38. data/lib/morpheus/cli/subnets_command.rb +7 -2
  39. data/lib/morpheus/cli/tasks.rb +25 -2
  40. data/lib/morpheus/cli/vdi_pools_command.rb +4 -1
  41. data/lib/morpheus/cli/version.rb +1 -1
  42. data/lib/morpheus/cli/virtual_images.rb +251 -29
  43. data/lib/morpheus/cli.rb +9 -1
  44. data/morpheus-cli.gemspec +1 -1
  45. metadata +11 -4
@@ -10,7 +10,8 @@
10
10
  # * load_balancer_column_definitions() - Column definitions for the "get" command display output.
11
11
  # * load_balancer_list_column_definitions() - Column definitions for the "list" command display output.
12
12
  #
13
- # # An example of a RestCommand for `morpheus load-balancers`.
13
+ # Example of a RestCommand for `morpheus load-balancers`.
14
+ #
14
15
  # class Morpheus::Cli::LoadBalancers
15
16
  #
16
17
  # include Morpheus::Cli::CliCommand
@@ -21,7 +22,7 @@
21
22
  # # and would be the default values if not set.
22
23
  # set_rest_name :load_balancers
23
24
  # set_rest_label "Load Balancer"
24
- # set_rest_plural_label "Load Balancers"
25
+ # set_rest_label_plural "Load Balancers"
25
26
  # set_rest_object_key "load_balancer"
26
27
  # set_rest_has_type true
27
28
  # set_rest_type "load_balancer_types"
@@ -50,7 +51,7 @@ module Morpheus::Cli::RestCommand
50
51
  end
51
52
 
52
53
  def rest_name=(v)
53
- @rest_name = v
54
+ @rest_name = v.to_s
54
55
  end
55
56
 
56
57
  alias :set_rest_name :rest_name=
@@ -61,11 +62,11 @@ module Morpheus::Cli::RestCommand
61
62
  end
62
63
 
63
64
  def default_rest_key
64
- rest_name.chomp("s")
65
+ rest_name.to_s.chomp("s")
65
66
  end
66
67
 
67
68
  def rest_key=(v)
68
- @rest_key = v
69
+ @rest_key = v.to_s
69
70
  end
70
71
 
71
72
  alias :set_rest_key :rest_key=
@@ -80,7 +81,7 @@ module Morpheus::Cli::RestCommand
80
81
  end
81
82
 
82
83
  def rest_arg=(v)
83
- @rest_arg = v
84
+ @rest_arg = v.to_s
84
85
  end
85
86
 
86
87
  alias :set_rest_arg :rest_arg=
@@ -95,26 +96,26 @@ module Morpheus::Cli::RestCommand
95
96
  end
96
97
 
97
98
  def rest_label=(v)
98
- @rest_label = v
99
+ @rest_label = v.to_s
99
100
  end
100
101
 
101
102
  alias :set_rest_label :rest_label=
102
103
 
103
104
  # the plural version of the label eg. "Neat Things"
104
- def rest_plural_label
105
- @rest_plural_label || default_rest_plural_label
105
+ def rest_label_plural
106
+ @rest_label_plural || default_rest_label_plural
106
107
  end
107
108
 
108
- def default_rest_plural_label
109
+ def default_rest_label_plural
109
110
  #rest_name.to_s.split("_").collect {|it| it.to_s.capitalize }.join(" ")
110
111
  rest_label.to_s.pluralize
111
112
  end
112
113
 
113
- def rest_plural_label=(v)
114
- @rest_plural_label = v
114
+ def rest_label_plural=(v)
115
+ @rest_label_plural = v.to_s
115
116
  end
116
117
 
117
- alias :set_rest_plural_label :rest_plural_label=
118
+ alias :set_rest_label_plural :rest_label_plural=
118
119
 
119
120
  # rest_interface_name is the interface name for the resource. eg. "neat_things"
120
121
  def rest_interface_name
@@ -126,7 +127,7 @@ module Morpheus::Cli::RestCommand
126
127
  end
127
128
 
128
129
  def rest_interface_name=(v)
129
- @rest_interface_name = v
130
+ @rest_interface_name = v.to_s
130
131
  end
131
132
 
132
133
  alias :set_rest_interface_name :rest_interface_name=
@@ -158,7 +159,7 @@ module Morpheus::Cli::RestCommand
158
159
  end
159
160
 
160
161
  def rest_type_name=(v)
161
- @rest_type_name = v
162
+ @rest_type_name = v.to_s
162
163
  end
163
164
 
164
165
  alias :set_rest_type_name :rest_type_name=
@@ -175,7 +176,7 @@ module Morpheus::Cli::RestCommand
175
176
  end
176
177
 
177
178
  def rest_type_key=(v)
178
- @rest_type_key = v
179
+ @rest_type_key = v.to_s
179
180
  end
180
181
 
181
182
  alias :set_rest_type_key :rest_type_key=
@@ -190,7 +191,7 @@ module Morpheus::Cli::RestCommand
190
191
  end
191
192
 
192
193
  def rest_type_arg=(v)
193
- @rest_type_arg = v
194
+ @rest_type_arg = v.to_s
194
195
  end
195
196
 
196
197
  alias :set_rest_type_arg :rest_type_arg=
@@ -205,26 +206,26 @@ module Morpheus::Cli::RestCommand
205
206
  end
206
207
 
207
208
  def rest_type_label=(v)
208
- @rest_type_label = v
209
+ @rest_type_label = v.to_s
209
210
  end
210
211
 
211
212
  alias :set_rest_type_label :rest_type_label=
212
213
 
213
214
  # the plural version of the label eg. "Neat Things"
214
- def rest_type_plural_label
215
- @rest_type_plural_label || default_rest_type_plural_label
215
+ def rest_type_label_plural
216
+ @rest_type_label_plural || default_rest_type_label_plural
216
217
  end
217
218
 
218
- def default_rest_type_plural_label
219
+ def default_rest_type_label_plural
219
220
  #rest_type_name.to_s.split("_").collect {|it| it.to_s.capitalize }.join(" ")
220
221
  rest_type_label.to_s.pluralize
221
222
  end
222
223
 
223
- def rest_type_plural_label=(v)
224
- @rest_type_plural_label = v
224
+ def rest_type_label_plural=(v)
225
+ @rest_type_label_plural = v.to_s
225
226
  end
226
227
 
227
- alias :set_rest_type_plural_label :rest_type_plural_label=
228
+ alias :set_rest_type_label_plural :rest_type_label_plural=
228
229
 
229
230
  # the name of the default interface, matches the rest name eg. "neat_things"
230
231
  def rest_type_interface_name
@@ -236,7 +237,7 @@ module Morpheus::Cli::RestCommand
236
237
  end
237
238
 
238
239
  def rest_type_interface_name=(v)
239
- @rest_type_interface_name = v
240
+ @rest_type_interface_name = v.to_s
240
241
  end
241
242
 
242
243
  alias :set_rest_type_interface_name :rest_type_interface_name=
@@ -247,7 +248,7 @@ module Morpheus::Cli::RestCommand
247
248
  def register_interfaces(*interfaces)
248
249
  @registered_interfaces ||= []
249
250
  interfaces.flatten.each do |it|
250
- @registered_interfaces << it.to_sym
251
+ @registered_interfaces << it.to_s
251
252
  end
252
253
  # put the default rest_interface first
253
254
  if rest_interface_name && !@registered_interfaces.include?(rest_interface_name)
@@ -300,8 +301,8 @@ module Morpheus::Cli::RestCommand
300
301
  self.class.rest_label
301
302
  end
302
303
 
303
- def rest_plural_label
304
- self.class.rest_plural_label
304
+ def rest_label_plural
305
+ self.class.rest_label_plural
305
306
  end
306
307
 
307
308
  def rest_interface_name
@@ -356,8 +357,8 @@ module Morpheus::Cli::RestCommand
356
357
  self.class.rest_type_label
357
358
  end
358
359
 
359
- def rest_type_plural_label
360
- self.class.rest_type_plural_label
360
+ def rest_type_label_plural
361
+ self.class.rest_type_label_plural
361
362
  end
362
363
 
363
364
  def rest_type_interface_name
@@ -415,9 +416,12 @@ module Morpheus::Cli::RestCommand
415
416
  params = {}
416
417
  options = {}
417
418
  optparse = Morpheus::Cli::OptionParser.new do |opts|
418
- opts.banner = subcommand_usage()
419
+ opts.banner = subcommand_usage("[search]")
419
420
  build_standard_list_options(opts, options)
420
- opts.footer = "List #{rest_plural_label.downcase}."
421
+ opts.footer = <<-EOT
422
+ List #{rest_label_plural.downcase}.
423
+ [search] is optional. This is a search phrase to filter the results.
424
+ EOT
421
425
  end
422
426
  optparse.parse!(args)
423
427
  connect(options)
@@ -433,9 +437,9 @@ module Morpheus::Cli::RestCommand
433
437
  json_response = rest_interface.list(params)
434
438
  render_response(json_response, options, rest_list_key) do
435
439
  records = json_response[rest_list_key]
436
- print_h1 "Morpheus #{rest_plural_label}"
440
+ print_h1 "Morpheus #{rest_label_plural}"
437
441
  if records.nil? || records.empty?
438
- print cyan,"No #{rest_plural_label.downcase} found.",reset,"\n"
442
+ print cyan,"No #{rest_label_plural.downcase} found.",reset,"\n"
439
443
  else
440
444
  print as_pretty_table(records, rest_list_column_definitions.upcase_keys!, options)
441
445
  print_results_pagination(json_response) if json_response['meta']
@@ -449,7 +453,7 @@ module Morpheus::Cli::RestCommand
449
453
  params = {}
450
454
  options = {}
451
455
  optparse = Morpheus::Cli::OptionParser.new do |opts|
452
- opts.banner = subcommand_usage("[type]")
456
+ opts.banner = subcommand_usage("[#{rest_arg}]")
453
457
  build_standard_get_options(opts, options)
454
458
  opts.footer = <<-EOT
455
459
  Get details about #{a_or_an(rest_label)} #{rest_label.downcase}.
@@ -504,17 +508,21 @@ EOT
504
508
  options = {}
505
509
  optparse = Morpheus::Cli::OptionParser.new do |opts|
506
510
  if rest_has_type
507
- opts.banner = subcommand_usage("[name] -t TYPE")
511
+ opts.banner = subcommand_usage("[#{rest_arg}] -t TYPE")
508
512
  opts.on( '-t', "--#{rest_type_arg} TYPE", "#{rest_type_label}" ) do |val|
509
513
  record_type_id = val
510
514
  end
511
515
  else
512
- opts.banner = subcommand_usage("[name]")
516
+ opts.banner = subcommand_usage("[#{rest_arg}]")
513
517
  end
514
518
  # if defined?(add_#{rest_key}_option_types)
515
519
  # build_option_type_options(opts, options, add_#{rest_key}_option_types)
516
520
  # end
517
521
  build_standard_add_options(opts, options)
522
+ opts.footer = <<-EOT
523
+ Create a new #{rest_label.downcase}.
524
+ [#{rest_arg}] is required. This is the name of the new #{rest_label.downcase}.
525
+ EOT
518
526
  end
519
527
  optparse.parse!(args)
520
528
  # todo: make supporting args[0] optional and more flexible
@@ -592,6 +600,10 @@ EOT
592
600
  optparse = Morpheus::Cli::OptionParser.new do |opts|
593
601
  opts.banner = subcommand_usage("[#{rest_arg}] [options]")
594
602
  build_standard_update_options(opts, options)
603
+ opts.footer = <<-EOT
604
+ Update an existing #{rest_label.downcase}.
605
+ [#{rest_arg}] is required. This is the name or id of #{a_or_an(rest_label)} #{rest_label.downcase}.
606
+ EOT
595
607
  end
596
608
  optparse.parse!(args)
597
609
  verify_args!(args:args, optparse:optparse, count:1)
@@ -629,6 +641,10 @@ EOT
629
641
  optparse = Morpheus::Cli::OptionParser.new do |opts|
630
642
  opts.banner = subcommand_usage("[#{rest_arg}]")
631
643
  build_standard_remove_options(opts, options)
644
+ opts.footer = <<-EOT
645
+ Delete an existing #{rest_label.downcase}.
646
+ [#{rest_arg}] is required. This is the name or id of #{a_or_an(rest_label)} #{rest_label.downcase}.
647
+ EOT
632
648
  end
633
649
  optparse.parse!(args)
634
650
  verify_args!(args:args, optparse:optparse, count:1)