morpheus-cli 5.5.1.5 → 5.5.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/Dockerfile +1 -1
  3. data/lib/morpheus/api/api_client.rb +25 -0
  4. data/lib/morpheus/api/archive_buckets_interface.rb +1 -1
  5. data/lib/morpheus/api/body_io.rb +22 -0
  6. data/lib/morpheus/api/catalog_item_types_interface.rb +5 -1
  7. data/lib/morpheus/api/clients_interface.rb +41 -0
  8. data/lib/morpheus/api/clouds_interface.rb +21 -0
  9. data/lib/morpheus/api/instances_interface.rb +8 -1
  10. data/lib/morpheus/api/integrations_interface.rb +30 -0
  11. data/lib/morpheus/api/library_instance_types_interface.rb +15 -3
  12. data/lib/morpheus/api/network_pool_server_types_interface.rb +9 -0
  13. data/lib/morpheus/api/plugins_interface.rb +22 -0
  14. data/lib/morpheus/api/roles_interface.rb +20 -1
  15. data/lib/morpheus/api/security_package_types_interface.rb +9 -0
  16. data/lib/morpheus/api/security_packages_interface.rb +9 -0
  17. data/lib/morpheus/api/security_scans_interface.rb +9 -0
  18. data/lib/morpheus/api/servers_interface.rb +17 -17
  19. data/lib/morpheus/api/storage_providers_interface.rb +1 -1
  20. data/lib/morpheus/api/virtual_images_interface.rb +1 -23
  21. data/lib/morpheus/cli/cli_command.rb +81 -7
  22. data/lib/morpheus/cli/commands/apps.rb +28 -2
  23. data/lib/morpheus/cli/commands/archives_command.rb +2 -2
  24. data/lib/morpheus/cli/commands/blueprints_command.rb +16 -0
  25. data/lib/morpheus/cli/commands/catalog_item_types_command.rb +34 -2
  26. data/lib/morpheus/cli/commands/clients_command.rb +338 -0
  27. data/lib/morpheus/cli/commands/clouds.rb +127 -1
  28. data/lib/morpheus/cli/commands/clusters.rb +42 -12
  29. data/lib/morpheus/cli/commands/curl_command.rb +114 -135
  30. data/lib/morpheus/cli/commands/hosts.rb +108 -11
  31. data/lib/morpheus/cli/commands/instances.rb +115 -14
  32. data/lib/morpheus/cli/commands/integrations_command.rb +215 -4
  33. data/lib/morpheus/cli/commands/invoices_command.rb +20 -11
  34. data/lib/morpheus/cli/commands/jobs_command.rb +299 -190
  35. data/lib/morpheus/cli/commands/library_cluster_layouts_command.rb +16 -2
  36. data/lib/morpheus/cli/commands/library_container_scripts_command.rb +14 -0
  37. data/lib/morpheus/cli/commands/library_container_templates_command.rb +131 -48
  38. data/lib/morpheus/cli/commands/library_container_types_command.rb +17 -4
  39. data/lib/morpheus/cli/commands/library_instance_types_command.rb +85 -7
  40. data/lib/morpheus/cli/commands/library_layouts_command.rb +32 -1
  41. data/lib/morpheus/cli/commands/library_option_lists_command.rb +30 -18
  42. data/lib/morpheus/cli/commands/library_option_types_command.rb +31 -14
  43. data/lib/morpheus/cli/commands/library_spec_templates_command.rb +14 -0
  44. data/lib/morpheus/cli/commands/library_upgrades_command.rb +2 -2
  45. data/lib/morpheus/cli/commands/network_pool_server_types.rb +20 -0
  46. data/lib/morpheus/cli/commands/network_pool_servers_command.rb +55 -158
  47. data/lib/morpheus/cli/commands/network_pools_command.rb +49 -23
  48. data/lib/morpheus/cli/commands/networks_command.rb +262 -45
  49. data/lib/morpheus/cli/commands/plugins.rb +213 -0
  50. data/lib/morpheus/cli/commands/price_sets_command.rb +27 -8
  51. data/lib/morpheus/cli/commands/prices_command.rb +17 -5
  52. data/lib/morpheus/cli/commands/processes_command.rb +2 -1
  53. data/lib/morpheus/cli/commands/remote.rb +7 -10
  54. data/lib/morpheus/cli/commands/roles.rb +924 -335
  55. data/lib/morpheus/cli/commands/search_command.rb +2 -0
  56. data/lib/morpheus/cli/commands/security_groups.rb +72 -84
  57. data/lib/morpheus/cli/commands/security_package_types.rb +32 -0
  58. data/lib/morpheus/cli/commands/security_packages.rb +84 -0
  59. data/lib/morpheus/cli/commands/security_scans.rb +107 -0
  60. data/lib/morpheus/cli/commands/service_plans_command.rb +16 -14
  61. data/lib/morpheus/cli/commands/subnets_command.rb +15 -1
  62. data/lib/morpheus/cli/commands/tasks.rb +34 -1
  63. data/lib/morpheus/cli/commands/tenants_command.rb +1 -1
  64. data/lib/morpheus/cli/commands/user_settings_command.rb +11 -2
  65. data/lib/morpheus/cli/commands/users.rb +50 -9
  66. data/lib/morpheus/cli/commands/virtual_images.rb +14 -0
  67. data/lib/morpheus/cli/commands/workflows.rb +14 -0
  68. data/lib/morpheus/cli/mixins/accounts_helper.rb +6 -5
  69. data/lib/morpheus/cli/mixins/infrastructure_helper.rb +79 -0
  70. data/lib/morpheus/cli/mixins/jobs_helper.rb +4 -5
  71. data/lib/morpheus/cli/mixins/library_helper.rb +2 -0
  72. data/lib/morpheus/cli/mixins/logs_helper.rb +3 -0
  73. data/lib/morpheus/cli/mixins/monitoring_helper.rb +1 -1
  74. data/lib/morpheus/cli/mixins/print_helper.rb +29 -4
  75. data/lib/morpheus/cli/mixins/provisioning_helper.rb +38 -9
  76. data/lib/morpheus/cli/mixins/rest_command.rb +106 -8
  77. data/lib/morpheus/cli/mixins/secondary_rest_command.rb +6 -2
  78. data/lib/morpheus/cli/option_types.rb +94 -25
  79. data/lib/morpheus/cli/version.rb +1 -1
  80. data/lib/morpheus/formatters.rb +10 -1
  81. metadata +15 -2
@@ -51,6 +51,12 @@ class Morpheus::Cli::LibraryLayoutsCommand
51
51
  opts.on('--technology VALUE', String, "Filter by technology") do |val|
52
52
  params['provisionType'] = val
53
53
  end
54
+ opts.on('-l', '--labels LABEL', String, "Filter by labels, can match any of the values") do |val|
55
+ add_query_parameter(params, 'labels', parse_labels(val))
56
+ end
57
+ opts.on('--all-labels LABEL', String, "Filter by labels, must match all of the values") do |val|
58
+ add_query_parameter(params, 'allLabels', parse_labels(val))
59
+ end
54
60
  build_common_options(opts, options, [:list, :query, :json, :yaml, :csv, :fields, :dry_run, :remote])
55
61
  opts.footer = "List layouts."
56
62
  end
@@ -173,6 +179,7 @@ EOT
173
179
  "Version" => lambda {|it| it['instanceVersion'] },
174
180
  "Description" => lambda {|it| it['description'] },
175
181
  "Technology" => lambda {|it| format_layout_technology(it) },
182
+ "Labels" => lambda {|it| format_list(it['labels'], '') },
176
183
  "Min Memory" => lambda {|it|
177
184
  if it['memoryRequirement'].to_i != 0
178
185
  (it['memoryRequirement'].to_i / (1024*1024)).to_s + " MB"
@@ -204,7 +211,18 @@ EOT
204
211
  description_cols.delete("Tfvar Secret") if !(layout['provisionType'] && layout['provisionType']['code'] == 'terraform')
205
212
  print_description_list(description_cols, layout)
206
213
 
207
-
214
+ price_sets = layout['priceSets']
215
+ if price_sets && price_sets.size > 0
216
+ print_h2 "Price Sets"
217
+ price_set_columns = [
218
+ {"ID" => lambda {|it| it['id'] } },
219
+ {"NAME" => lambda {|it| it['name'] } },
220
+ {"PRICE UNIT" => lambda {|it| it['priceUnit'] } },
221
+ ]
222
+ print as_pretty_table(price_sets, price_set_columns)
223
+ else
224
+ # print cyan,"No price sets found for this instance type.","\n",reset
225
+ end
208
226
 
209
227
  layout_evars = layout['environmentVariables']
210
228
  if layout_evars && layout_evars.size > 0
@@ -295,6 +313,9 @@ EOT
295
313
  opts.on('--name VALUE', String, "Name for this layout") do |val|
296
314
  params['name'] = val
297
315
  end
316
+ opts.on('-l', '--labels [LIST]', String, "Labels") do |val|
317
+ params['labels'] = parse_labels(val)
318
+ end
298
319
  opts.on('--version VALUE', String, "Version") do |val|
299
320
  params['instanceVersion'] = val
300
321
  end
@@ -343,6 +364,9 @@ EOT
343
364
  opts.on('--tfvar-secret VALUE', String, "Tfvar Secret name, eg. 'tfvars/dev-key'") do |val|
344
365
  params['tfvarSecret'] = val == 'null' ? nil : val
345
366
  end
367
+ opts.on('--price-sets [LIST]', Array, 'Price set(s), comma separated list of price set IDs') do |list|
368
+ params['priceSets'] = list.collect {|it| it.to_s.strip.empty? || !it.to_i ? nil : it.to_s.strip}.compact.uniq.collect {|it| {'id' => it.to_i}}
369
+ end
346
370
  add_perms_options(opts, options, layout_permission_excludes)
347
371
  build_standard_add_options(opts, options)
348
372
  opts.footer = <<-EOT
@@ -511,6 +535,9 @@ EOT
511
535
  opts.on('--name VALUE', String, "Name for this layout") do |val|
512
536
  params['name'] = val
513
537
  end
538
+ opts.on('-l', '--labels [LIST]', String, "Labels") do |val|
539
+ params['labels'] = parse_labels(val)
540
+ end
514
541
  opts.on('--version VALUE', String, "Version") do |val|
515
542
  params['instanceVersion'] = val
516
543
  end
@@ -559,6 +586,9 @@ EOT
559
586
  opts.on('--tfvar-secret VALUE', String, "Tfvar Secret name, eg. 'tfvars/dev-key'") do |val|
560
587
  params['tfvarSecret'] = val == 'null' ? nil : val
561
588
  end
589
+ opts.on('--price-sets [LIST]', Array, 'Price set(s), comma separated list of price set IDs') do |list|
590
+ params['priceSets'] = list.collect {|it| it.to_s.strip.empty? || !it.to_i ? nil : it.to_s.strip}.compact.uniq.collect {|it| {'id' => it.to_i}}
591
+ end
562
592
  add_perms_options(opts, options, layout_permission_excludes)
563
593
  build_standard_update_options(opts, options)
564
594
  opts.footer = <<-EOT
@@ -792,6 +822,7 @@ EOT
792
822
  {"VERSION" => lambda {|layout| layout['instanceVersion'] } },
793
823
  {"TECHNOLOGY" => lambda {|layout| format_layout_technology(layout) } },
794
824
  {"DESCRIPTION" => lambda {|layout| layout['description'] } },
825
+ {"LABELS" => lambda {|layout| format_list(layout['labels'], '', 3) } },
795
826
  {"OWNER" => lambda {|layout| layout['account'] ? layout['account']['name'] : '' } }
796
827
  ]
797
828
  if opts[:include_fields]
@@ -25,8 +25,15 @@ class Morpheus::Cli::LibraryOptionListsCommand
25
25
 
26
26
  def list(args)
27
27
  options = {}
28
+ params = {}
28
29
  optparse = Morpheus::Cli::OptionParser.new do|opts|
29
30
  opts.banner = subcommand_usage()
31
+ opts.on('-l', '--labels LABEL', String, "Filter by labels, can match any of the values") do |val|
32
+ add_query_parameter(params, 'labels', parse_labels(val))
33
+ end
34
+ opts.on('--all-labels LABEL', String, "Filter by labels, must match all of the values") do |val|
35
+ add_query_parameter(params, 'allLabels', parse_labels(val))
36
+ end
30
37
  build_standard_list_options(opts, options)
31
38
  opts.footer = "List option lists."
32
39
  end
@@ -37,7 +44,7 @@ class Morpheus::Cli::LibraryOptionListsCommand
37
44
  end
38
45
  connect(options)
39
46
  begin
40
- params = {}
47
+
41
48
  params.merge!(parse_list_options(options))
42
49
  @option_type_lists_interface.setopts(options)
43
50
  if options[:dry_run]
@@ -60,6 +67,7 @@ class Morpheus::Cli::LibraryOptionListsCommand
60
67
  {
61
68
  id: option_type_list['id'],
62
69
  name: option_type_list['name'],
70
+ labels: option_type_list['labels'],
63
71
  description: option_type_list['description'],
64
72
  type: ((option_type_list['type'] == 'api') ? "#{option_type_list['type']} (#{option_type_list['apiType']})" : option_type_list['type'])
65
73
  }
@@ -67,6 +75,7 @@ class Morpheus::Cli::LibraryOptionListsCommand
67
75
  columns = [
68
76
  :id,
69
77
  :name,
78
+ {:labels => {:display_method => lambda {|it| format_list(it[:labels], '', 3) rescue '' }}},
70
79
  :description,
71
80
  :type
72
81
  ]
@@ -142,6 +151,7 @@ class Morpheus::Cli::LibraryOptionListsCommand
142
151
  "ID" => 'id',
143
152
  "Name" => 'name',
144
153
  "Description" => 'description',
154
+ "Labels" => lambda {|it| format_list(it['labels']) },
145
155
  "Type" => lambda {|it| it['type'].to_s.capitalize },
146
156
  }, option_type_list)
147
157
  # print_h2 "Initial Dataset"
@@ -151,6 +161,7 @@ class Morpheus::Cli::LibraryOptionListsCommand
151
161
  "ID" => 'id',
152
162
  "Name" => 'name',
153
163
  "Description" => 'description',
164
+ "Labels" => lambda {|it| format_list(it['labels']) },
154
165
  "Type" => lambda {|it| it['type'] },
155
166
  "API Type" => lambda {|it| it['apiType'] },
156
167
  "Source URL" => 'sourceUrl',
@@ -420,24 +431,25 @@ class Morpheus::Cli::LibraryOptionListsCommand
420
431
  # rest
421
432
  {'fieldName' => 'name', 'fieldLabel' => 'Name', 'type' => 'text', 'required' => true, 'displayOrder' => 1},
422
433
  {'fieldName' => 'description', 'fieldLabel' => 'Description', 'type' => 'text', 'displayOrder' => 2},
423
- {'code' => 'optionTypeList.type', 'fieldName' => 'type', 'fieldLabel' => 'Type', 'type' => 'select', 'selectOptions' => get_available_option_list_types, 'defaultValue' => 'rest', 'required' => true, 'description' => 'Option List Type. eg. rest, api, ldap, manual', 'displayOrder' => 3},
424
- {'fieldName' => 'visibility', 'fieldLabel' => 'Visibility', 'type' => 'select', 'selectOptions' => [{'name' => 'Private', 'value' => 'private'}, {'name' => 'Public', 'value' => 'public'}], 'defaultValue' => 'private', 'displayOrder' => 4},
425
- {'dependsOnCode' => 'optionTypeList.type:rest', 'fieldName' => 'sourceUrl', 'fieldLabel' => 'Source Url', 'type' => 'text', 'required' => true, 'description' => "A REST URL can be used to fetch list data and is cached in the appliance database.", 'displayOrder' => 5},
426
- {'dependsOnCode' => 'optionTypeList.type:rest', 'fieldName' => 'ignoreSSLErrors', 'fieldLabel' => 'Ignore SSL Errors', 'type' => 'checkbox', 'defaultValue' => false, 'displayOrder' => 6},
427
- {'dependsOnCode' => 'optionTypeList.type:rest', 'fieldName' => 'realTime', 'fieldLabel' => 'Real Time', 'type' => 'checkbox', 'defaultValue' => false, 'displayOrder' => 7},
428
- {'dependsOnCode' => 'optionTypeList.type:rest', 'fieldName' => 'sourceMethod', 'fieldLabel' => 'Source Method', 'type' => 'select', 'selectOptions' => [{'name' => 'GET', 'value' => 'GET'}, {'name' => 'POST', 'value' => 'POST'}], 'defaultValue' => 'GET', 'required' => true, 'displayOrder' => 8},
429
- {'dependsOnCode' => 'optionTypeList.type:rest|ldap', 'fieldName' => 'credential', 'fieldLabel' => 'Credentials', 'type' => 'select', 'optionSource' => 'credentials', 'description' => 'Credential ID or use "local" to specify username and password', 'displayOrder' => 9, 'defaultValue' => "local", 'required' => true, :for_help_only => true}, # hacky way to render this but not prompt for it
430
- {'dependsOnCode' => 'optionTypeList.type:rest', 'fieldName' => 'serviceUsername', 'fieldLabel' => 'Username', 'type' => 'text', 'description' => "A Basic Auth Username for use when type is 'rest'.", 'displayOrder' => 9, "credentialFieldContext" => 'credential', "credentialFieldName" => 'username', "credentialType" => "username-password,oauth2"},
431
- {'dependsOnCode' => 'optionTypeList.type:rest', 'fieldName' => 'servicePassword', 'fieldLabel' => 'Password', 'type' => 'password', 'description' => "A Basic Auth Password for use when type is 'rest'.", 'displayOrder' => 10, "credentialFieldContext" => 'credential', "credentialFieldName" => 'password', "credentialType" => "username-password,oauth2"},
434
+ {'shorthand' => '-l', 'fieldName' => 'labels', 'fieldLabel' => 'Labels', 'type' => 'text', 'required' => false, 'noPrompt' => true, 'processValue' => lambda {|val| parse_labels(val) }, 'displayOrder' => 3},
435
+ {'code' => 'optionTypeList.type', 'fieldName' => 'type', 'fieldLabel' => 'Type', 'type' => 'select', 'selectOptions' => get_available_option_list_types, 'defaultValue' => 'rest', 'required' => true, 'description' => 'Option List Type. eg. rest, api, ldap, manual', 'displayOrder' => 4},
436
+ {'fieldName' => 'visibility', 'fieldLabel' => 'Visibility', 'type' => 'select', 'selectOptions' => [{'name' => 'Private', 'value' => 'private'}, {'name' => 'Public', 'value' => 'public'}], 'defaultValue' => 'private', 'displayOrder' => 5},
437
+ {'dependsOnCode' => 'optionTypeList.type:rest', 'fieldName' => 'sourceUrl', 'fieldLabel' => 'Source Url', 'type' => 'text', 'required' => true, 'description' => "A REST URL can be used to fetch list data and is cached in the appliance database.", 'displayOrder' => 6},
438
+ {'dependsOnCode' => 'optionTypeList.type:rest', 'fieldName' => 'ignoreSSLErrors', 'fieldLabel' => 'Ignore SSL Errors', 'type' => 'checkbox', 'defaultValue' => false, 'displayOrder' => 7},
439
+ {'dependsOnCode' => 'optionTypeList.type:rest', 'fieldName' => 'realTime', 'fieldLabel' => 'Real Time', 'type' => 'checkbox', 'defaultValue' => false, 'displayOrder' => 8},
440
+ {'dependsOnCode' => 'optionTypeList.type:rest', 'fieldName' => 'sourceMethod', 'fieldLabel' => 'Source Method', 'type' => 'select', 'selectOptions' => [{'name' => 'GET', 'value' => 'GET'}, {'name' => 'POST', 'value' => 'POST'}], 'defaultValue' => 'GET', 'required' => true, 'displayOrder' => 9},
441
+ {'dependsOnCode' => 'optionTypeList.type:rest|ldap', 'fieldName' => 'credential', 'fieldLabel' => 'Credentials', 'type' => 'select', 'optionSource' => 'credentials', 'description' => 'Credential ID or use "local" to specify username and password', 'displayOrder' => 10, 'defaultValue' => "local", 'required' => true, :for_help_only => true}, # hacky way to render this but not prompt for it
442
+ {'dependsOnCode' => 'optionTypeList.type:rest', 'fieldName' => 'serviceUsername', 'fieldLabel' => 'Username', 'type' => 'text', 'description' => "A Basic Auth Username for use when type is 'rest'.", 'displayOrder' => 11, "credentialFieldContext" => 'credential', "credentialFieldName" => 'username', "credentialType" => "username-password,oauth2"},
443
+ {'dependsOnCode' => 'optionTypeList.type:rest', 'fieldName' => 'servicePassword', 'fieldLabel' => 'Password', 'type' => 'password', 'description' => "A Basic Auth Password for use when type is 'rest'.", 'displayOrder' => 12, "credentialFieldContext" => 'credential', "credentialFieldName" => 'password', "credentialType" => "username-password,oauth2"},
432
444
  # sourceHeaders component (is done afterwards manually)
433
- {'dependsOnCode' => 'optionTypeList.type:api', 'fieldName' => 'apiType', 'fieldLabel' => 'Option List', 'type' => 'select', 'optionSource' => 'apiOptionLists', 'required' => true, 'description' => 'The code of the api option list to use, eg. clouds, environments, groups, instances, instance-wiki, networks, servicePlans, resourcePools, securityGroups, servers, server-wiki', 'displayOrder' => 10},
434
- {'dependsOnCode' => 'optionTypeList.type:rest|ldap', 'fieldName' => 'credential', 'fieldLabel' => 'Credentials', 'type' => 'select', 'optionSource' => 'credentials', 'description' => 'Credential ID or use "local" to specify username and password', 'displayOrder' => 9, 'defaultValue' => "local", 'required' => true, :for_help_only => true}, # hacky way to render this but not prompt for it
435
- {'dependsOnCode' => 'optionTypeList.type:ldap', 'fieldName' => 'serviceUsername', 'fieldLabel' => 'Username', 'type' => 'text', 'description' => "An LDAP Username for use when type is 'ldap'.", 'displayOrder' => 11, "credentialFieldContext" => 'credential', "credentialFieldName" => 'username', "credentialType" => "username-password"},
436
- {'dependsOnCode' => 'optionTypeList.type:ldap', 'fieldName' => 'servicePassword', 'fieldLabel' => 'Password', 'type' => 'password', 'description' => "An LDAP Password for use when type is 'ldap'.", 'displayOrder' => 12, "credentialFieldContext" => 'credential', "credentialFieldName" => 'password', "credentialType" => "username-password"},
437
- {'dependsOnCode' => 'optionTypeList.type:ldap', 'fieldName' => 'ldapQuery', 'fieldLabel' => 'LDAP Query', 'type' => 'text', 'description' => "LDAP Queries are standard LDAP formatted queries where different objects can be searched. Dependent parameters can be loaded into the query using the <%=phrase%> syntax.", 'displayOrder' => 13},
438
- {'dependsOnCode' => 'optionTypeList.type:rest|api|manual', 'fieldName' => 'initialDataset', 'fieldLabel' => 'Initial Dataset', 'type' => 'code-editor', 'description' => "Create an initial json dataset to be used as the collection for this option list. It should be a list containing objects with properties 'name', and 'value'. However, if there is a translation script, that will also be passed through.", 'displayOrder' => 14, 'dataType' => 'string'},
439
- {'dependsOnCode' => 'optionTypeList.type:rest|api|ldap', 'fieldName' => 'translationScript', 'fieldLabel' => 'Translation Script', 'type' => 'code-editor', 'description' => "Create a js script to translate the result data object into an Array containing objects with properties name, and value. The input data is provided as data and the result should be put on the global variable results.", 'displayOrder' => 15, 'dataType' => 'string'},
440
- {'dependsOnCode' => 'optionTypeList.type:rest|api', 'fieldName' => 'requestScript', 'fieldLabel' => 'Request Script', 'type' => 'code-editor', 'description' => "Create a js script to prepare the request. Return a data object as the body for a post, and return an array containing properties name and value for a get. The input data is provided as data and the result should be put on the global variable results.", 'displayOrder' => 16, 'dataType' => 'string'},
445
+ {'dependsOnCode' => 'optionTypeList.type:api', 'fieldName' => 'apiType', 'fieldLabel' => 'Option List', 'type' => 'select', 'optionSource' => 'apiOptionLists', 'required' => true, 'description' => 'The code of the api option list to use, eg. clouds, environments, groups, instances, instance-wiki, networks, servicePlans, resourcePools, securityGroups, servers, server-wiki', 'displayOrder' => 13},
446
+ {'dependsOnCode' => 'optionTypeList.type:rest|ldap', 'fieldName' => 'credential', 'fieldLabel' => 'Credentials', 'type' => 'select', 'optionSource' => 'credentials', 'description' => 'Credential ID or use "local" to specify username and password', 'displayOrder' => 14, 'defaultValue' => "local", 'required' => true, :for_help_only => true}, # hacky way to render this but not prompt for it
447
+ {'dependsOnCode' => 'optionTypeList.type:ldap', 'fieldName' => 'serviceUsername', 'fieldLabel' => 'Username', 'type' => 'text', 'description' => "An LDAP Username for use when type is 'ldap'.", 'displayOrder' => 15, "credentialFieldContext" => 'credential', "credentialFieldName" => 'username', "credentialType" => "username-password"},
448
+ {'dependsOnCode' => 'optionTypeList.type:ldap', 'fieldName' => 'servicePassword', 'fieldLabel' => 'Password', 'type' => 'password', 'description' => "An LDAP Password for use when type is 'ldap'.", 'displayOrder' => 16, "credentialFieldContext" => 'credential', "credentialFieldName" => 'password', "credentialType" => "username-password"},
449
+ {'dependsOnCode' => 'optionTypeList.type:ldap', 'fieldName' => 'ldapQuery', 'fieldLabel' => 'LDAP Query', 'type' => 'text', 'description' => "LDAP Queries are standard LDAP formatted queries where different objects can be searched. Dependent parameters can be loaded into the query using the <%=phrase%> syntax.", 'displayOrder' => 17},
450
+ {'dependsOnCode' => 'optionTypeList.type:rest|api|manual', 'fieldName' => 'initialDataset', 'fieldLabel' => 'Initial Dataset', 'type' => 'code-editor', 'description' => "Create an initial json dataset to be used as the collection for this option list. It should be a list containing objects with properties 'name', and 'value'. However, if there is a translation script, that will also be passed through.", 'displayOrder' => 18, 'dataType' => 'string'},
451
+ {'dependsOnCode' => 'optionTypeList.type:rest|api|ldap', 'fieldName' => 'translationScript', 'fieldLabel' => 'Translation Script', 'type' => 'code-editor', 'description' => "Create a js script to translate the result data object into an Array containing objects with properties name, and value. The input data is provided as data and the result should be put on the global variable results.", 'displayOrder' => 19, 'dataType' => 'string'},
452
+ {'dependsOnCode' => 'optionTypeList.type:rest|api', 'fieldName' => 'requestScript', 'fieldLabel' => 'Request Script', 'type' => 'code-editor', 'description' => "Create a js script to prepare the request. Return a data object as the body for a post, and return an array containing properties name and value for a get. The input data is provided as data and the result should be put on the global variable results.", 'displayOrder' => 20, 'dataType' => 'string'},
441
453
  ]
442
454
 
443
455
  end
@@ -25,19 +25,26 @@ class Morpheus::Cli::LibraryOptionTypesCommand
25
25
 
26
26
  def list(args)
27
27
  options = {}
28
+ params = {}
28
29
  optparse = Morpheus::Cli::OptionParser.new do |opts|
29
30
  opts.banner = subcommand_usage()
31
+ opts.on('-l', '--labels LABEL', String, "Filter by labels, can match any of the values") do |val|
32
+ add_query_parameter(params, 'labels', parse_labels(val))
33
+ end
34
+ opts.on('--all-labels LABEL', String, "Filter by labels, must match all of the values") do |val|
35
+ add_query_parameter(params, 'allLabels', parse_labels(val))
36
+ end
30
37
  build_standard_list_options(opts, options)
31
38
  opts.footer = "List option types."
32
39
  end
33
40
  optparse.parse!(args)
34
41
  # verify_args!(args:args, optparse:optparse, count:0)
35
42
  if args.count > 0
36
- options[:phrase] = args.join(" ")
43
+ params[:phrase] = args.join(" ")
37
44
  end
38
45
  connect(options)
39
46
 
40
- params = {}
47
+
41
48
  params.merge!(parse_list_options(options))
42
49
  @option_types_interface.setopts(options)
43
50
  if options[:dry_run]
@@ -60,6 +67,7 @@ class Morpheus::Cli::LibraryOptionTypesCommand
60
67
  id: option_type['id'],
61
68
  name: option_type['name'],
62
69
  type: option_type['type'],
70
+ labels: option_type['labels'],
63
71
  fieldLabel: option_type['fieldLabel'],
64
72
  fieldName: option_type['fieldName'],
65
73
  default: option_type['defaultValue'],
@@ -71,9 +79,10 @@ class Morpheus::Cli::LibraryOptionTypesCommand
71
79
  print as_pretty_table(rows, [
72
80
  :id,
73
81
  :name,
82
+ {:labels => {:display_method => lambda {|it| format_list(it[:labels], '', 3) rescue '' }}},
74
83
  :type,
75
- {:fieldLabel => {:display_name => "Field Label"} },
76
- {:fieldName => {:display_name => "Field Name"} },
84
+ {:fieldLabel => {:display_name => "FIELD LABEL"} },
85
+ {:fieldName => {:display_name => "FIELD NAME"} },
77
86
  :default,
78
87
  :required,
79
88
  :export,
@@ -126,6 +135,7 @@ class Morpheus::Cli::LibraryOptionTypesCommand
126
135
  columns = {
127
136
  "ID" => 'id',
128
137
  "Name" => 'name',
138
+ "Labels" => lambda {|it| format_list(it['labels']) rescue '' },
129
139
  "Description" => 'description',
130
140
  "Field Label" => 'fieldLabel',
131
141
  # "Field Context" => 'fieldContext',
@@ -151,6 +161,9 @@ class Morpheus::Cli::LibraryOptionTypesCommand
151
161
  options = {}
152
162
  optparse = Morpheus::Cli::OptionParser.new do |opts|
153
163
  opts.banner = subcommand_usage("[options]")
164
+ opts.on('-l', '--labels [LIST]', String, "Labels") do |val|
165
+ options[:options]['labels'] = parse_labels(val)
166
+ end
154
167
  build_option_type_options(opts, options, new_option_type_option_types)
155
168
  build_standard_add_options(opts, options)
156
169
  opts.footer = "Create a new option type."
@@ -195,6 +208,9 @@ class Morpheus::Cli::LibraryOptionTypesCommand
195
208
  options = {}
196
209
  optparse = Morpheus::Cli::OptionParser.new do |opts|
197
210
  opts.banner = subcommand_usage("[name] [options]")
211
+ opts.on('-l', '--labels [LIST]', String, "Labels") do |val|
212
+ options[:options]['labels'] = parse_labels(val)
213
+ end
198
214
  build_option_type_options(opts, options, update_option_type_option_types)
199
215
  build_standard_update_options(opts, options)
200
216
  opts.footer = "Update an option type.\n" +
@@ -286,16 +302,17 @@ class Morpheus::Cli::LibraryOptionTypesCommand
286
302
  [
287
303
  {'fieldName' => 'name', 'fieldLabel' => 'Name', 'type' => 'text', 'required' => true, 'displayOrder' => 1},
288
304
  {'fieldName' => 'description', 'fieldLabel' => 'Description', 'type' => 'text', 'displayOrder' => 2},
289
- {'fieldName' => 'fieldName', 'fieldLabel' => 'Field Name', 'type' => 'text', 'required' => true, 'description' => 'This is the input property that the value gets assigned to.', 'displayOrder' => 3},
290
- {'code' => 'optionType.type', 'fieldName' => 'type', 'fieldLabel' => 'Type', 'type' => 'select', 'selectOptions' => [{'name' => 'Text', 'value' => 'text'}, {'name' => 'Password', 'value' => 'password'}, {'name' => 'Number', 'value' => 'number'}, {'name' => 'Checkbox', 'value' => 'checkbox'}, {'name' => 'Select', 'value' => 'select'}, {'name' => 'Hidden', 'value' => 'hidden'}], 'defaultValue' => 'text', 'required' => true, 'displayOrder' => 4},
291
- {'fieldName' => 'optionList', 'fieldLabel' => 'Option List', 'type' => 'select', 'optionSource' => 'optionTypeLists', 'required' => true, 'dependsOnCode' => 'optionType.type:select', 'description' => "The Option List to be the source of options when type is 'select'.", 'displayOrder' => 5},
292
- {'fieldName' => 'fieldLabel', 'fieldLabel' => 'Field Label', 'type' => 'text', 'required' => true, 'description' => 'This is the input label that shows typically to the left of a custom option.', 'displayOrder' => 6},
293
- {'fieldName' => 'placeHolder', 'fieldLabel' => 'Placeholder', 'type' => 'text', 'displayOrder' => 7},
294
- {'fieldName' => 'helpBlock', 'fieldLabel' => 'Help Block', 'type' => 'text', 'description' => 'This is the explaination of the input that shows typically underneath the option.', 'displayOrder' => 8},
295
- {'fieldName' => 'defaultValue', 'fieldLabel' => 'Default Value', 'type' => 'text', 'displayOrder' => 9},
296
- {'fieldName' => 'required', 'fieldLabel' => 'Required', 'type' => 'checkbox', 'defaultValue' => false, 'displayOrder' => 10},
297
- {'fieldName' => 'exportMeta', 'fieldLabel' => 'Export As Tag', 'type' => 'checkbox', 'defaultValue' => false, 'description' => 'Export as Tag.', 'displayOrder' => 11},
298
- {'fieldName' => 'verifyPattern', 'fieldLabel' => 'Verify Pattern', 'type' => 'text', 'dependsOnCode' => 'optionType.type:text', 'description' => 'A regexp string that validates the input, use (?i) to make the matcher case insensitive', 'displayOrder' => 12},
305
+ {'shorthand' => '-l', 'fieldName' => 'labels', 'fieldLabel' => 'Labels', 'type' => 'text', 'required' => false, 'noPrompt' => true, 'processValue' => lambda {|val| parse_labels(val) }, 'displayOrder' => 3},
306
+ {'fieldName' => 'fieldName', 'fieldLabel' => 'Field Name', 'type' => 'text', 'required' => true, 'description' => 'This is the input property that the value gets assigned to.', 'displayOrder' => 4},
307
+ {'code' => 'optionType.type', 'fieldName' => 'type', 'fieldLabel' => 'Type', 'type' => 'select', 'selectOptions' => [{'name' => 'Text', 'value' => 'text'}, {'name' => 'Password', 'value' => 'password'}, {'name' => 'Number', 'value' => 'number'}, {'name' => 'Checkbox', 'value' => 'checkbox'}, {'name' => 'Select', 'value' => 'select'}, {'name' => 'Hidden', 'value' => 'hidden'}], 'defaultValue' => 'text', 'required' => true, 'displayOrder' => 5},
308
+ {'fieldName' => 'optionList', 'fieldLabel' => 'Option List', 'type' => 'select', 'optionSource' => 'optionTypeLists', 'required' => true, 'dependsOnCode' => 'optionType.type:select', 'description' => "The Option List to be the source of options when type is 'select'.", 'displayOrder' => 6},
309
+ {'fieldName' => 'fieldLabel', 'fieldLabel' => 'Field Label', 'type' => 'text', 'required' => true, 'description' => 'This is the input label that shows typically to the left of a custom option.', 'displayOrder' => 7},
310
+ {'fieldName' => 'placeHolder', 'fieldLabel' => 'Placeholder', 'type' => 'text', 'displayOrder' => 8},
311
+ {'fieldName' => 'helpBlock', 'fieldLabel' => 'Help Block', 'type' => 'text', 'description' => 'This is the explaination of the input that shows typically underneath the option.', 'displayOrder' => 9},
312
+ {'fieldName' => 'defaultValue', 'fieldLabel' => 'Default Value', 'type' => 'text', 'displayOrder' => 10},
313
+ {'fieldName' => 'required', 'fieldLabel' => 'Required', 'type' => 'checkbox', 'defaultValue' => false, 'displayOrder' => 11},
314
+ {'fieldName' => 'exportMeta', 'fieldLabel' => 'Export As Tag', 'type' => 'checkbox', 'defaultValue' => false, 'description' => 'Export as Tag.', 'displayOrder' => 12},
315
+ {'fieldName' => 'verifyPattern', 'fieldLabel' => 'Verify Pattern', 'type' => 'text', 'dependsOnCode' => 'optionType.type:text', 'description' => 'A regexp string that validates the input, use (?i) to make the matcher case insensitive', 'displayOrder' => 13},
299
316
  ]
300
317
  end
301
318
 
@@ -21,6 +21,12 @@ class Morpheus::Cli::LibrarySpecTemplatesCommand
21
21
  params = {}
22
22
  optparse = Morpheus::Cli::OptionParser.new do |opts|
23
23
  opts.banner = subcommand_usage()
24
+ opts.on('-l', '--labels LABEL', String, "Filter by labels, can match any of the values") do |val|
25
+ add_query_parameter(params, 'labels', parse_labels(val))
26
+ end
27
+ opts.on('--all-labels LABEL', String, "Filter by labels, must match all of the values") do |val|
28
+ add_query_parameter(params, 'allLabels', parse_labels(val))
29
+ end
24
30
  build_common_options(opts, options, [:list, :query, :json, :yaml, :csv, :fields, :dry_run, :remote])
25
31
  opts.footer = "List spec templates."
26
32
  end
@@ -54,6 +60,7 @@ class Morpheus::Cli::LibrarySpecTemplatesCommand
54
60
  columns = [
55
61
  {"ID" => lambda {|resource_spec| resource_spec['id'] } },
56
62
  {"NAME" => lambda {|resource_spec| resource_spec['name'] } },
63
+ {"LABELS" => lambda {|it| format_list(it['labels'], '', 3) rescue '' }},
57
64
  {"TYPE" => lambda {|resource_spec| resource_spec['type']['name'] rescue '' } },
58
65
  {"SOURCE" => lambda {|resource_spec| resource_spec['file']['sourceType'] rescue '' } },
59
66
  {"CREATED" => lambda {|resource_spec| format_local_dt(resource_spec['dateCreated']) } },
@@ -121,6 +128,7 @@ class Morpheus::Cli::LibrarySpecTemplatesCommand
121
128
  description_cols = {
122
129
  "ID" => lambda {|it| it['id'] },
123
130
  "Name" => lambda {|it| it['name'] },
131
+ "Labels" => lambda {|it| format_list(it['labels'], '', 3) rescue '' },
124
132
  "Type" => lambda {|it| it['type']['name'] rescue '' },
125
133
  "Source" => lambda {|it| it['file']['sourceType'] rescue '' },
126
134
  #"Owner" => lambda {|it| it['account'] ? it['account']['name'] : '' },
@@ -183,6 +191,9 @@ class Morpheus::Cli::LibrarySpecTemplatesCommand
183
191
  opts.on('--name VALUE', String, "Name") do |val|
184
192
  params['name'] = val
185
193
  end
194
+ opts.on('-l', '--labels [LIST]', String, "Labels") do |val|
195
+ params['labels'] = parse_labels(val)
196
+ end
186
197
  opts.on('-t', '--type TYPE', "Spec Template Type. i.e. arm, cloudFormation, helm, kubernetes, oneview, terraform, ucs") do |val|
187
198
  template_type = val.to_s
188
199
  end
@@ -336,6 +347,9 @@ class Morpheus::Cli::LibrarySpecTemplatesCommand
336
347
  opts.on('--name VALUE', String, "Name") do |val|
337
348
  params['name'] = val
338
349
  end
350
+ opts.on('-l', '--labels [LIST]', String, "Labels") do |val|
351
+ params['labels'] = parse_labels(val)
352
+ end
339
353
  opts.on('-t', '--type TYPE', "Spec Template Type. kubernetes, helm, terraform, cloudFormation") do |val|
340
354
  template_type = val.to_s
341
355
  end
@@ -429,14 +429,14 @@ class Morpheus::Cli::LibraryUpgradesCommand
429
429
 
430
430
  # OPTION TYPES
431
431
  if option_type_ids
432
- params['optionTypes'] = option_type_ids.collect {|it| it.to_i }.select { |it| it != 0 }
432
+ params['optionTypes'] = option_type_ids.collect {|it| it.to_i }
433
433
  else
434
434
  # prompt
435
435
  end
436
436
 
437
437
  # NODE TYPES
438
438
  if node_type_ids
439
- params['containerTypes'] = node_type_ids.collect {|it| it.to_i }.select { |it| it != 0 }
439
+ params['containerTypes'] = node_type_ids.collect {|it| it.to_i }
440
440
  else
441
441
  # prompt
442
442
  end
@@ -0,0 +1,20 @@
1
+ require 'morpheus/cli/cli_command'
2
+
3
+ class Morpheus::Cli::NetworkPoolServerTypes
4
+ include Morpheus::Cli::CliCommand
5
+ include Morpheus::Cli::RestCommand
6
+ include Morpheus::Cli::InfrastructureHelper
7
+
8
+ set_command_description "View network pool server types"
9
+ set_command_name :'network-pool-server-types'
10
+ register_subcommands :list, :get
11
+
12
+ # hidden in favor of get-type and list-types
13
+ set_command_hidden
14
+
15
+ # register_interfaces :network_pool_server_types
16
+
17
+ protected
18
+
19
+ end
20
+