morpheus-cli 5.5.1.4 → 5.5.2
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/Dockerfile +1 -1
- data/lib/morpheus/api/api_client.rb +25 -0
- data/lib/morpheus/api/archive_buckets_interface.rb +1 -1
- data/lib/morpheus/api/body_io.rb +22 -0
- data/lib/morpheus/api/catalog_item_types_interface.rb +5 -1
- data/lib/morpheus/api/clients_interface.rb +41 -0
- data/lib/morpheus/api/clouds_interface.rb +21 -0
- data/lib/morpheus/api/instances_interface.rb +8 -1
- data/lib/morpheus/api/integrations_interface.rb +30 -0
- data/lib/morpheus/api/library_instance_types_interface.rb +15 -3
- data/lib/morpheus/api/network_pool_server_types_interface.rb +9 -0
- data/lib/morpheus/api/plugins_interface.rb +22 -0
- data/lib/morpheus/api/roles_interface.rb +20 -1
- data/lib/morpheus/api/security_package_types_interface.rb +9 -0
- data/lib/morpheus/api/security_packages_interface.rb +9 -0
- data/lib/morpheus/api/security_scans_interface.rb +9 -0
- data/lib/morpheus/api/servers_interface.rb +17 -17
- data/lib/morpheus/api/storage_providers_interface.rb +1 -1
- data/lib/morpheus/api/virtual_images_interface.rb +1 -23
- data/lib/morpheus/cli/cli_command.rb +81 -7
- data/lib/morpheus/cli/commands/apps.rb +28 -2
- data/lib/morpheus/cli/commands/archives_command.rb +2 -2
- data/lib/morpheus/cli/commands/blueprints_command.rb +16 -0
- data/lib/morpheus/cli/commands/catalog_item_types_command.rb +34 -2
- data/lib/morpheus/cli/commands/clients_command.rb +338 -0
- data/lib/morpheus/cli/commands/clouds.rb +127 -1
- data/lib/morpheus/cli/commands/clusters.rb +42 -12
- data/lib/morpheus/cli/commands/curl_command.rb +114 -135
- data/lib/morpheus/cli/commands/hosts.rb +108 -11
- data/lib/morpheus/cli/commands/instances.rb +115 -14
- data/lib/morpheus/cli/commands/integrations_command.rb +215 -4
- data/lib/morpheus/cli/commands/invoices_command.rb +20 -11
- data/lib/morpheus/cli/commands/jobs_command.rb +299 -190
- data/lib/morpheus/cli/commands/library_cluster_layouts_command.rb +16 -2
- data/lib/morpheus/cli/commands/library_container_scripts_command.rb +14 -0
- data/lib/morpheus/cli/commands/library_container_templates_command.rb +131 -48
- data/lib/morpheus/cli/commands/library_container_types_command.rb +17 -4
- data/lib/morpheus/cli/commands/library_instance_types_command.rb +85 -7
- data/lib/morpheus/cli/commands/library_layouts_command.rb +32 -1
- data/lib/morpheus/cli/commands/library_option_lists_command.rb +30 -18
- data/lib/morpheus/cli/commands/library_option_types_command.rb +31 -14
- data/lib/morpheus/cli/commands/library_spec_templates_command.rb +14 -0
- data/lib/morpheus/cli/commands/library_upgrades_command.rb +2 -2
- data/lib/morpheus/cli/commands/network_pool_server_types.rb +20 -0
- data/lib/morpheus/cli/commands/network_pool_servers_command.rb +55 -158
- data/lib/morpheus/cli/commands/network_pools_command.rb +49 -23
- data/lib/morpheus/cli/commands/networks_command.rb +262 -45
- data/lib/morpheus/cli/commands/plugins.rb +213 -0
- data/lib/morpheus/cli/commands/price_sets_command.rb +40 -10
- data/lib/morpheus/cli/commands/prices_command.rb +17 -5
- data/lib/morpheus/cli/commands/processes_command.rb +2 -1
- data/lib/morpheus/cli/commands/remote.rb +7 -10
- data/lib/morpheus/cli/commands/roles.rb +924 -335
- data/lib/morpheus/cli/commands/search_command.rb +2 -0
- data/lib/morpheus/cli/commands/security_groups.rb +72 -84
- data/lib/morpheus/cli/commands/security_package_types.rb +32 -0
- data/lib/morpheus/cli/commands/security_packages.rb +84 -0
- data/lib/morpheus/cli/commands/security_scans.rb +107 -0
- data/lib/morpheus/cli/commands/service_plans_command.rb +16 -14
- data/lib/morpheus/cli/commands/subnets_command.rb +15 -1
- data/lib/morpheus/cli/commands/tasks.rb +34 -1
- data/lib/morpheus/cli/commands/tenants_command.rb +1 -1
- data/lib/morpheus/cli/commands/user_settings_command.rb +11 -2
- data/lib/morpheus/cli/commands/users.rb +50 -9
- data/lib/morpheus/cli/commands/virtual_images.rb +14 -0
- data/lib/morpheus/cli/commands/workflows.rb +14 -0
- data/lib/morpheus/cli/mixins/accounts_helper.rb +6 -5
- data/lib/morpheus/cli/mixins/infrastructure_helper.rb +79 -0
- data/lib/morpheus/cli/mixins/jobs_helper.rb +4 -5
- data/lib/morpheus/cli/mixins/library_helper.rb +2 -0
- data/lib/morpheus/cli/mixins/logs_helper.rb +3 -0
- data/lib/morpheus/cli/mixins/monitoring_helper.rb +1 -1
- data/lib/morpheus/cli/mixins/print_helper.rb +29 -4
- data/lib/morpheus/cli/mixins/provisioning_helper.rb +38 -9
- data/lib/morpheus/cli/mixins/rest_command.rb +106 -8
- data/lib/morpheus/cli/mixins/secondary_rest_command.rb +6 -2
- data/lib/morpheus/cli/option_types.rb +94 -25
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/formatters.rb +10 -1
- metadata +15 -2
|
@@ -33,6 +33,12 @@ class Morpheus::Cli::LibraryClusterLayoutsCommand
|
|
|
33
33
|
opts.on('--technology VALUE', String, "Filter by technology") do |val|
|
|
34
34
|
params['provisionType'] = val
|
|
35
35
|
end
|
|
36
|
+
opts.on('-l', '--labels LABEL', String, "Filter by labels, can match any of the values") do |val|
|
|
37
|
+
add_query_parameter(params, 'labels', parse_labels(val))
|
|
38
|
+
end
|
|
39
|
+
opts.on('--all-labels LABEL', String, "Filter by labels, must match all of the values") do |val|
|
|
40
|
+
add_query_parameter(params, 'allLabels', parse_labels(val))
|
|
41
|
+
end
|
|
36
42
|
build_common_options(opts, options, [:list, :query, :json, :yaml, :csv, :fields, :dry_run, :remote])
|
|
37
43
|
opts.footer = "List cluster layouts."
|
|
38
44
|
end
|
|
@@ -77,10 +83,11 @@ class Morpheus::Cli::LibraryClusterLayoutsCommand
|
|
|
77
83
|
name: layout['name'],
|
|
78
84
|
cloud_type: layout_cloud_type(layout),
|
|
79
85
|
version: layout['computeVersion'],
|
|
80
|
-
description: layout['description']
|
|
86
|
+
description: layout['description'],
|
|
87
|
+
labels: format_list(layout['labels'], '', 3)
|
|
81
88
|
}
|
|
82
89
|
end
|
|
83
|
-
print as_pretty_table(rows, [:id, :name, :cloud_type, :version, :description], options)
|
|
90
|
+
print as_pretty_table(rows, [:id, :name, :cloud_type, :version, :description, :labels], options)
|
|
84
91
|
print_results_pagination(json_response, {:label => "node type", :n_label => "node types"})
|
|
85
92
|
end
|
|
86
93
|
print reset,"\n"
|
|
@@ -153,6 +160,7 @@ class Morpheus::Cli::LibraryClusterLayoutsCommand
|
|
|
153
160
|
"Cloud Type" => lambda {|it| layout_cloud_type(it)},
|
|
154
161
|
"Cluster Type" => lambda {|it| it['groupType'] ? it['groupType']['name'] : nil},
|
|
155
162
|
"Technology" => lambda {|it| it['provisionType'] ? it['provisionType']['code'] : nil},
|
|
163
|
+
"Labels" => lambda {|it| format_list(it['labels'], '') },
|
|
156
164
|
"Minimum Memory" => lambda {|it| printable_byte_size(it['memoryRequirement'])},
|
|
157
165
|
"Workflow" => lambda {|it| it['taskSets'] && it['taskSets'].count > 0 ? it['taskSets'][0]['name'] : nil},
|
|
158
166
|
"Description" => lambda {|it| it['description']},
|
|
@@ -220,6 +228,9 @@ class Morpheus::Cli::LibraryClusterLayoutsCommand
|
|
|
220
228
|
opts.on('-n', '--name VALUE', String, "Name for this cluster layout") do |val|
|
|
221
229
|
params['name'] = val
|
|
222
230
|
end
|
|
231
|
+
opts.on('-l', '--labels [LIST]', String, "Labels") do |val|
|
|
232
|
+
params['labels'] = parse_labels(val)
|
|
233
|
+
end
|
|
223
234
|
opts.on('-D', '--description VALUE', String, "Description") do |val|
|
|
224
235
|
params['description'] = val
|
|
225
236
|
end
|
|
@@ -487,6 +498,9 @@ class Morpheus::Cli::LibraryClusterLayoutsCommand
|
|
|
487
498
|
opts.on('-n', '--name VALUE', String, "Name for this cluster layout") do |val|
|
|
488
499
|
params['name'] = val
|
|
489
500
|
end
|
|
501
|
+
opts.on('-l', '--labels [LIST]', String, "Labels") do |val|
|
|
502
|
+
params['labels'] = parse_labels(val)
|
|
503
|
+
end
|
|
490
504
|
opts.on('-D', '--description VALUE', String, "Description") do |val|
|
|
491
505
|
params['description'] = val
|
|
492
506
|
end
|
|
@@ -21,6 +21,12 @@ class Morpheus::Cli::LibraryContainerScriptsCommand
|
|
|
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 container scripts."
|
|
26
32
|
end
|
|
@@ -119,6 +125,7 @@ class Morpheus::Cli::LibraryContainerScriptsCommand
|
|
|
119
125
|
description_cols = {
|
|
120
126
|
"ID" => lambda {|it| it['id'] },
|
|
121
127
|
"Name" => lambda {|it| it['name'] },
|
|
128
|
+
"Labels" => lambda {|it| format_list(it['labels']) rescue '' },
|
|
122
129
|
"Type" => lambda {|it| format_container_script_type(it['scriptType']) },
|
|
123
130
|
"Phase" => lambda {|it| format_container_script_phase(it['scriptPhase']) },
|
|
124
131
|
"Run As User" => lambda {|it| it['runAsUser'] },
|
|
@@ -151,6 +158,9 @@ class Morpheus::Cli::LibraryContainerScriptsCommand
|
|
|
151
158
|
opts.on('--name VALUE', String, "Name") do |val|
|
|
152
159
|
params['name'] = val
|
|
153
160
|
end
|
|
161
|
+
opts.on('-l', '--labels [LIST]', String, "Labels") do |val|
|
|
162
|
+
params['labels'] = parse_labels(val)
|
|
163
|
+
end
|
|
154
164
|
opts.on('-t', '--type TYPE', "Script Type. i.e. bash, powershell. Default is bash.") do |val|
|
|
155
165
|
params['scriptType'] = val
|
|
156
166
|
end
|
|
@@ -242,6 +252,9 @@ class Morpheus::Cli::LibraryContainerScriptsCommand
|
|
|
242
252
|
opts.on('--name VALUE', String, "Name") do |val|
|
|
243
253
|
params['name'] = val
|
|
244
254
|
end
|
|
255
|
+
opts.on('-l', '--labels [LIST]', String, "Labels") do |val|
|
|
256
|
+
params['labels'] = parse_labels(val)
|
|
257
|
+
end
|
|
245
258
|
opts.on('-t', '--type TYPE', "Script Type. i.e. bash, powershell. Default is bash.") do |val|
|
|
246
259
|
params['scriptType'] = val
|
|
247
260
|
end
|
|
@@ -411,6 +424,7 @@ class Morpheus::Cli::LibraryContainerScriptsCommand
|
|
|
411
424
|
columns = [
|
|
412
425
|
{"ID" => lambda {|container_script| container_script['id'] } },
|
|
413
426
|
{"NAME" => lambda {|container_script| container_script['name'] } },
|
|
427
|
+
{"LABELS" => lambda {|it| format_list(it['labels'], '', 3) rescue '' }},
|
|
414
428
|
{"TYPE" => lambda {|container_script| format_container_script_type(container_script['scriptType']) } },
|
|
415
429
|
{"PHASE" => lambda {|container_script| format_container_script_phase(container_script['scriptPhase']) } },
|
|
416
430
|
{"OWNER" => lambda {|container_script| container_script['account'] ? container_script['account']['name'] : '' } },
|
|
@@ -22,6 +22,12 @@ class Morpheus::Cli::LibraryContainerTemplatesCommand
|
|
|
22
22
|
params = {}
|
|
23
23
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
|
24
24
|
opts.banner = subcommand_usage()
|
|
25
|
+
opts.on('-l', '--labels LABEL', String, "Filter by labels, can match any of the values") do |val|
|
|
26
|
+
add_query_parameter(params, 'labels', parse_labels(val))
|
|
27
|
+
end
|
|
28
|
+
opts.on('--all-labels LABEL', String, "Filter by labels, must match all of the values") do |val|
|
|
29
|
+
add_query_parameter(params, 'allLabels', parse_labels(val))
|
|
30
|
+
end
|
|
25
31
|
build_common_options(opts, options, [:list, :json, :yaml, :csv, :fields, :dry_run, :remote])
|
|
26
32
|
end
|
|
27
33
|
optparse.parse!(args)
|
|
@@ -128,11 +134,13 @@ class Morpheus::Cli::LibraryContainerTemplatesCommand
|
|
|
128
134
|
description_cols = {
|
|
129
135
|
"ID" => lambda {|it| it['id'] },
|
|
130
136
|
"Name" => lambda {|it| it['name'] },
|
|
137
|
+
"Labels" => lambda {|it| format_list(it['labels']) rescue '' },
|
|
131
138
|
"File Name" => lambda {|it| it['fileName'] },
|
|
132
139
|
"File Path" => lambda {|it| it['filePath'] },
|
|
133
|
-
"Setting Category" => lambda {|it| it['settingCategory'] },
|
|
134
|
-
"Setting Name" => lambda {|it| it['settingName'] },
|
|
135
140
|
"Phase" => lambda {|it| it['templatePhase'] },
|
|
141
|
+
"File Owner" => lambda {|it| it['fileOwner'] },
|
|
142
|
+
"Setting Name" => lambda {|it| it['settingName'] },
|
|
143
|
+
"Setting Category" => lambda {|it| it['settingCategory'] },
|
|
136
144
|
"Owner" => lambda {|it| it['account'] ? it['account']['name'] : '' },
|
|
137
145
|
# "Enabled" => lambda {|it| format_boolean it['enabled'] },
|
|
138
146
|
"Created" => lambda {|it| format_local_dt(it['dateCreated']) },
|
|
@@ -156,33 +164,32 @@ class Morpheus::Cli::LibraryContainerTemplatesCommand
|
|
|
156
164
|
|
|
157
165
|
def add(args)
|
|
158
166
|
options = {}
|
|
159
|
-
params = {
|
|
167
|
+
params = {}
|
|
160
168
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
|
161
169
|
opts.banner = subcommand_usage("[name]")
|
|
162
170
|
opts.on('--name VALUE', String, "Name") do |val|
|
|
163
171
|
params['name'] = val
|
|
164
172
|
end
|
|
173
|
+
opts.on('-l', '--labels [LIST]', String, "Labels") do |val|
|
|
174
|
+
params['labels'] = parse_labels(val)
|
|
175
|
+
end
|
|
176
|
+
opts.on('--file-name VALUE', String, "File Name") do |val|
|
|
177
|
+
params['fileName'] = val
|
|
178
|
+
end
|
|
165
179
|
opts.on('--fileName VALUE', String, "File Name") do |val|
|
|
166
180
|
params['fileName'] = val
|
|
167
181
|
end
|
|
168
|
-
opts.
|
|
182
|
+
opts.add_hidden_option('--fileName')
|
|
183
|
+
opts.on('--file-path VALUE', String, "File Path") do |val|
|
|
169
184
|
params['filePath'] = val
|
|
170
185
|
end
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
# end
|
|
174
|
-
# opts.on('--description VALUE', String, "Description") do |val|
|
|
175
|
-
# params['description'] = val
|
|
176
|
-
# end
|
|
177
|
-
opts.on('--phase [start|stop|postProvision]', String, "Template Phase. Default is 'provision'") do |val|
|
|
178
|
-
params['scriptPhase'] = val
|
|
186
|
+
opts.on('--filePath VALUE', String, "File Path") do |val|
|
|
187
|
+
params['filePath'] = val
|
|
179
188
|
end
|
|
180
|
-
opts.
|
|
181
|
-
|
|
189
|
+
opts.add_hidden_option('--filePath')
|
|
190
|
+
opts.on('--phase [preProvision|provision|postProvision]', String, "Template Phase. Default is 'provision'") do |val|
|
|
191
|
+
params['templatePhase'] = val
|
|
182
192
|
end
|
|
183
|
-
# opts.on('--enabled [on|off]', String, "Can be used to disable it") do |val|
|
|
184
|
-
# options['enabled'] = !(val.to_s == 'off' || val.to_s == 'false')
|
|
185
|
-
# end
|
|
186
193
|
opts.on('--template TEXT', String, "Contents of the template.") do |val|
|
|
187
194
|
params['template'] = val
|
|
188
195
|
end
|
|
@@ -205,31 +212,51 @@ class Morpheus::Cli::LibraryContainerTemplatesCommand
|
|
|
205
212
|
# params['filePath'] = File.dirname(full_filename)
|
|
206
213
|
# end
|
|
207
214
|
end
|
|
215
|
+
opts.on('--file-owner VALUE', String, "File Owner") do |val|
|
|
216
|
+
params['fileOwner'] = val
|
|
217
|
+
end
|
|
218
|
+
opts.on('--fileOwner VALUE', String, "File Owner") do |val|
|
|
219
|
+
params['fileOwner'] = val
|
|
220
|
+
end
|
|
221
|
+
opts.add_hidden_option('--fileOwner')
|
|
222
|
+
opts.on('--setting-name VALUE', String, "Setting Name") do |val|
|
|
223
|
+
params['settingName'] = val
|
|
224
|
+
end
|
|
225
|
+
opts.on('--settingName VALUE', String, "Setting Name") do |val|
|
|
226
|
+
params['settingName'] = val
|
|
227
|
+
end
|
|
228
|
+
opts.add_hidden_option('--settingName')
|
|
229
|
+
opts.on('--setting-category VALUE', String, "Setting Category") do |val|
|
|
230
|
+
params['settingCategory'] = val
|
|
231
|
+
end
|
|
232
|
+
opts.on('--settingCategory VALUE', String, "Setting Category") do |val|
|
|
233
|
+
params['settingCategory'] = val
|
|
234
|
+
end
|
|
235
|
+
opts.add_hidden_option('--settingCategory')
|
|
208
236
|
build_common_options(opts, options, [:options, :payload, :json, :dry_run, :remote, :quiet])
|
|
209
237
|
opts.footer = "Create a new file template." + "\n" +
|
|
210
238
|
"[name] is required and can be passed as --name instead."
|
|
211
239
|
end
|
|
212
240
|
optparse.parse!(args)
|
|
213
|
-
|
|
214
|
-
print_error Morpheus::Terminal.angry_prompt
|
|
215
|
-
puts_error "wrong number of arguments, expected 0-1 and got (#{args.count}) #{args.inspect}\n#{optparse}"
|
|
216
|
-
return 1
|
|
217
|
-
end
|
|
241
|
+
verify_args!(args:args, optparse:optparse, max:1)
|
|
218
242
|
# support [name] as first argument
|
|
219
243
|
if args[0]
|
|
220
244
|
params['name'] = args[0]
|
|
221
245
|
end
|
|
222
246
|
connect(options)
|
|
223
247
|
begin
|
|
224
|
-
# construct payload
|
|
225
248
|
payload = nil
|
|
249
|
+
arbitrary_options = options[:options] ? options[:options].reject {|k,v| k.is_a?(Symbol) } : {}
|
|
250
|
+
create_payload = {}
|
|
251
|
+
create_payload.deep_merge!(params)
|
|
252
|
+
create_payload.deep_merge!(arbitrary_options)
|
|
226
253
|
if options[:payload]
|
|
227
254
|
payload = options[:payload]
|
|
255
|
+
payload.deep_merge!({'containerTemplate' => create_payload}) unless create_payload.empty?
|
|
228
256
|
else
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
payload = {'containerTemplate' => params}
|
|
257
|
+
prompt_result = Morpheus::Cli::OptionTypes.prompt(add_container_template_option_types, params.deep_merge(options[:options] || {}), @api_client)
|
|
258
|
+
create_payload.deep_merge!(prompt_result)
|
|
259
|
+
payload = {'containerTemplate' => create_payload}
|
|
233
260
|
end
|
|
234
261
|
@container_templates_interface.setopts(options)
|
|
235
262
|
if options[:dry_run]
|
|
@@ -260,25 +287,26 @@ class Morpheus::Cli::LibraryContainerTemplatesCommand
|
|
|
260
287
|
opts.on('--name VALUE', String, "Name") do |val|
|
|
261
288
|
params['name'] = val
|
|
262
289
|
end
|
|
290
|
+
opts.on('-l', '--labels [LIST]', String, "Labels") do |val|
|
|
291
|
+
params['labels'] = parse_labels(val)
|
|
292
|
+
end
|
|
293
|
+
opts.on('--file-name VALUE', String, "File Name") do |val|
|
|
294
|
+
params['fileName'] = val
|
|
295
|
+
end
|
|
263
296
|
opts.on('--fileName VALUE', String, "File Name") do |val|
|
|
264
297
|
params['fileName'] = val
|
|
265
298
|
end
|
|
299
|
+
opts.add_hidden_option('--fileName')
|
|
300
|
+
opts.on('--file-path VALUE', String, "File Path") do |val|
|
|
301
|
+
params['filePath'] = val
|
|
302
|
+
end
|
|
266
303
|
opts.on('--filePath VALUE', String, "File Path") do |val|
|
|
267
304
|
params['filePath'] = val
|
|
268
305
|
end
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
# opts.on('--description VALUE', String, "Description") do |val|
|
|
273
|
-
# params['description'] = val
|
|
274
|
-
# end
|
|
275
|
-
opts.on('--phase [start|stop]', String, "Template Phase") do |val|
|
|
276
|
-
params['scriptPhase'] = val
|
|
306
|
+
opts.add_hidden_option('--filePath')
|
|
307
|
+
opts.on('--phase [preProvision|provision|postProvision]', String, "Template Phase. Default is 'provision'") do |val|
|
|
308
|
+
params['templatePhase'] = val
|
|
277
309
|
end
|
|
278
|
-
|
|
279
|
-
# opts.on('--enabled [on|off]', String, "Can be used to disable it") do |val|
|
|
280
|
-
# options['enabled'] = !(val.to_s == 'off' || val.to_s == 'false')
|
|
281
|
-
# end
|
|
282
310
|
opts.on('--template TEXT', String, "Contents of the template.") do |val|
|
|
283
311
|
params['template'] = val
|
|
284
312
|
end
|
|
@@ -291,22 +319,53 @@ class Morpheus::Cli::LibraryContainerTemplatesCommand
|
|
|
291
319
|
exit 1
|
|
292
320
|
end
|
|
293
321
|
end
|
|
322
|
+
opts.on('--file-owner VALUE', String, "File Owner") do |val|
|
|
323
|
+
params['fileOwner'] = val
|
|
324
|
+
end
|
|
325
|
+
opts.on('--fileOwner VALUE', String, "File Owner") do |val|
|
|
326
|
+
params['fileOwner'] = val
|
|
327
|
+
end
|
|
328
|
+
opts.add_hidden_option('--fileOwner')
|
|
329
|
+
opts.on('--setting-name VALUE', String, "Setting Name") do |val|
|
|
330
|
+
params['settingName'] = val
|
|
331
|
+
end
|
|
332
|
+
opts.on('--settingName VALUE', String, "Setting Name") do |val|
|
|
333
|
+
params['settingName'] = val
|
|
334
|
+
end
|
|
335
|
+
opts.add_hidden_option('--settingName')
|
|
336
|
+
opts.on('--setting-category VALUE', String, "Setting Category") do |val|
|
|
337
|
+
params['settingCategory'] = val
|
|
338
|
+
end
|
|
339
|
+
opts.on('--settingCategory VALUE', String, "Setting Category") do |val|
|
|
340
|
+
params['settingCategory'] = val
|
|
341
|
+
end
|
|
294
342
|
build_common_options(opts, options, [:options, :payload, :json, :dry_run, :remote, :quiet])
|
|
295
343
|
opts.footer = "Update a file template." + "\n" +
|
|
296
344
|
"[name] is required. This is the name or id of a file template."
|
|
297
345
|
end
|
|
298
346
|
optparse.parse!(args)
|
|
299
|
-
|
|
300
|
-
print_error Morpheus::Terminal.angry_prompt
|
|
301
|
-
puts_error "wrong number of arguments, expected 1 and got (#{args.count}) #{args.inspect}\n#{optparse}"
|
|
302
|
-
return 1
|
|
303
|
-
end
|
|
347
|
+
verify_args!(args:args, optparse:optparse, count:1)
|
|
304
348
|
connect(options)
|
|
305
349
|
begin
|
|
306
350
|
container_template = find_container_template_by_name_or_id(args[0])
|
|
307
351
|
if container_template.nil?
|
|
308
352
|
return 1
|
|
309
353
|
end
|
|
354
|
+
|
|
355
|
+
payload = nil
|
|
356
|
+
arbitrary_options = options[:options] ? options[:options].reject {|k,v| k.is_a?(Symbol) } : {}
|
|
357
|
+
update_payload = {}
|
|
358
|
+
update_payload.deep_merge!(params)
|
|
359
|
+
update_payload.deep_merge!(arbitrary_options)
|
|
360
|
+
if options[:payload]
|
|
361
|
+
payload = options[:payload]
|
|
362
|
+
payload.deep_merge!({'containerTemplate' => update_payload}) unless update_payload.empty?
|
|
363
|
+
else
|
|
364
|
+
prompt_result = Morpheus::Cli::OptionTypes.no_prompt(update_container_template_option_types, params.deep_merge(options[:options] || {}), @api_client)
|
|
365
|
+
update_payload.deep_merge!(prompt_result)
|
|
366
|
+
payload = {'containerTemplate' => update_payload}
|
|
367
|
+
end
|
|
368
|
+
|
|
310
369
|
# construct payload
|
|
311
370
|
payload = nil
|
|
312
371
|
if options[:payload]
|
|
@@ -343,10 +402,7 @@ class Morpheus::Cli::LibraryContainerTemplatesCommand
|
|
|
343
402
|
build_common_options(opts, options, [:json, :dry_run, :quiet, :auto_confirm])
|
|
344
403
|
end
|
|
345
404
|
optparse.parse!(args)
|
|
346
|
-
|
|
347
|
-
puts optparse
|
|
348
|
-
return 127
|
|
349
|
-
end
|
|
405
|
+
verify_args!(args:args, optparse:optparse, count:1)
|
|
350
406
|
connect(options)
|
|
351
407
|
|
|
352
408
|
begin
|
|
@@ -427,6 +483,7 @@ class Morpheus::Cli::LibraryContainerTemplatesCommand
|
|
|
427
483
|
columns = [
|
|
428
484
|
{"ID" => lambda {|container_template| container_template['id'] } },
|
|
429
485
|
{"NAME" => lambda {|container_template| container_template['name'] } },
|
|
486
|
+
{"LABELS" => lambda {|it| format_list(it['labels'], '', 3) rescue '' }},
|
|
430
487
|
{"FILE NAME" => lambda {|container_template| container_template['fileName'] } },
|
|
431
488
|
{"FILE PATH" => lambda {|container_template| container_template['filePath'] } },
|
|
432
489
|
{"SETTING CATEGORY" => lambda {|container_template| container_template['settingCategory'] } },
|
|
@@ -439,5 +496,31 @@ class Morpheus::Cli::LibraryContainerTemplatesCommand
|
|
|
439
496
|
print as_pretty_table(container_templates, columns, opts)
|
|
440
497
|
end
|
|
441
498
|
|
|
499
|
+
def add_container_template_option_types()
|
|
500
|
+
[
|
|
501
|
+
{'fieldName' => 'name', 'fieldLabel' => 'Name', 'type' => 'text', 'required' => true},
|
|
502
|
+
{'fieldName' => 'fileName', 'fieldLabel' => 'File Name', 'type' => 'text', 'required' => true},
|
|
503
|
+
{'fieldName' => 'filePath', 'fieldLabel' => 'File Path', 'type' => 'text', 'required' => false},
|
|
504
|
+
{'fieldName' => 'templatePhase', 'fieldLabel' => 'Phase', 'type' => 'select', 'optionSource' => 'containerTemplatePhases', 'defaultValue' => 'provision', 'required' => true},
|
|
505
|
+
{'fieldName' => 'template', 'fieldLabel' => 'Template', 'type' => 'code-editor', 'required' => true},
|
|
506
|
+
{'fieldName' => 'fileOwner', 'fieldLabel' => 'File Owner', 'type' => 'text'},
|
|
507
|
+
{'fieldName' => 'settingName', 'fieldLabel' => 'Setting Name', 'type' => 'text'},
|
|
508
|
+
{'fieldName' => 'settingCategory', 'fieldLabel' => 'Setting Category', 'type' => 'text'},
|
|
509
|
+
]
|
|
510
|
+
end
|
|
511
|
+
|
|
512
|
+
def add_container_template_advanced_option_types()
|
|
513
|
+
[]
|
|
514
|
+
end
|
|
515
|
+
|
|
516
|
+
def update_container_template_option_types()
|
|
517
|
+
option_types = add_container_template_option_types.collect {|it| it.delete('required'); it.delete('defaultValue'); it.delete('dependsOnCode'); it }
|
|
518
|
+
option_types.reject! {|it| it['fieldName'] == 'type' }
|
|
519
|
+
option_types
|
|
520
|
+
end
|
|
521
|
+
|
|
522
|
+
def update_container_template_advanced_option_types()
|
|
523
|
+
add_container_template_advanced_option_types().collect {|it| it.delete('required'); it.delete('defaultValue'); it.delete('dependsOnCode'); it }
|
|
524
|
+
end
|
|
442
525
|
|
|
443
526
|
end
|
|
@@ -41,6 +41,12 @@ class Morpheus::Cli::LibraryContainerTypesCommand
|
|
|
41
41
|
opts.on('--category VALUE', String, "Filter by category") do |val|
|
|
42
42
|
params['category'] = val
|
|
43
43
|
end
|
|
44
|
+
opts.on('-l', '--labels LABEL', String, "Filter by labels, can match any of the values") do |val|
|
|
45
|
+
add_query_parameter(params, 'labels', parse_labels(val))
|
|
46
|
+
end
|
|
47
|
+
opts.on('--all-labels LABEL', String, "Filter by labels, must match all of the values") do |val|
|
|
48
|
+
add_query_parameter(params, 'allLabels', parse_labels(val))
|
|
49
|
+
end
|
|
44
50
|
build_common_options(opts, options, [:list, :query, :json, :yaml, :csv, :fields, :dry_run, :remote])
|
|
45
51
|
opts.footer = "List node types."
|
|
46
52
|
end
|
|
@@ -151,6 +157,7 @@ class Morpheus::Cli::LibraryContainerTypesCommand
|
|
|
151
157
|
"Name" => lambda {|it| it['name'] },
|
|
152
158
|
"Short Name" => lambda {|it| it['shortName'] },
|
|
153
159
|
"Version" => lambda {|it| it['containerVersion'] },
|
|
160
|
+
"Labels" => lambda {|it| format_list(it['labels'], '', 3) },
|
|
154
161
|
"Technology" => lambda {|it| format_container_type_technology(it) },
|
|
155
162
|
"Category" => lambda {|it| it['category'] },
|
|
156
163
|
"Virtual Image" => lambda {|it|
|
|
@@ -246,6 +253,9 @@ class Morpheus::Cli::LibraryContainerTypesCommand
|
|
|
246
253
|
opts.on('--name VALUE', String, "Name for this node type") do |val|
|
|
247
254
|
params['name'] = val
|
|
248
255
|
end
|
|
256
|
+
opts.on('-l', '--labels [LIST]', String, "Labels") do |val|
|
|
257
|
+
params['labels'] = parse_labels(val)
|
|
258
|
+
end
|
|
249
259
|
opts.on('--shortName VALUE', String, "Short Name") do |val|
|
|
250
260
|
params['shortName'] = val
|
|
251
261
|
end
|
|
@@ -396,14 +406,14 @@ class Morpheus::Cli::LibraryContainerTypesCommand
|
|
|
396
406
|
|
|
397
407
|
# SCRIPTS
|
|
398
408
|
if script_ids
|
|
399
|
-
params['scripts'] = script_ids.collect {|it| it.to_i }
|
|
409
|
+
params['scripts'] = script_ids.collect {|it| it.to_i }
|
|
400
410
|
else
|
|
401
411
|
# prompt
|
|
402
412
|
end
|
|
403
413
|
|
|
404
414
|
# FILE TEMPLATES
|
|
405
415
|
if file_template_ids
|
|
406
|
-
params['templates'] = file_template_ids.collect {|it| it.to_i }
|
|
416
|
+
params['templates'] = file_template_ids.collect {|it| it.to_i }
|
|
407
417
|
else
|
|
408
418
|
# prompt
|
|
409
419
|
end
|
|
@@ -455,6 +465,9 @@ class Morpheus::Cli::LibraryContainerTypesCommand
|
|
|
455
465
|
opts.on('--name VALUE', String, "Name for this layout") do |val|
|
|
456
466
|
params['name'] = val
|
|
457
467
|
end
|
|
468
|
+
opts.on('-l', '--labels [LIST]', String, "Labels") do |val|
|
|
469
|
+
params['labels'] = parse_labels(val)
|
|
470
|
+
end
|
|
458
471
|
opts.on('--shortName VALUE', String, "Short Name") do |val|
|
|
459
472
|
params['shortName'] = val
|
|
460
473
|
end
|
|
@@ -547,14 +560,14 @@ class Morpheus::Cli::LibraryContainerTypesCommand
|
|
|
547
560
|
|
|
548
561
|
# SCRIPTS
|
|
549
562
|
if script_ids
|
|
550
|
-
params['scripts'] = script_ids.collect {|it| it.to_i }
|
|
563
|
+
params['scripts'] = script_ids.collect {|it| it.to_i }
|
|
551
564
|
else
|
|
552
565
|
# prompt
|
|
553
566
|
end
|
|
554
567
|
|
|
555
568
|
# FILE TEMPLATES
|
|
556
569
|
if file_template_ids
|
|
557
|
-
params['templates'] = file_template_ids.collect {|it| it.to_i }
|
|
570
|
+
params['templates'] = file_template_ids.collect {|it| it.to_i }
|
|
558
571
|
else
|
|
559
572
|
# prompt
|
|
560
573
|
end
|
|
@@ -6,7 +6,7 @@ class Morpheus::Cli::LibraryInstanceTypesCommand
|
|
|
6
6
|
|
|
7
7
|
set_command_name :'library-instance-types'
|
|
8
8
|
register_subcommands :list, :get, :add, :update, :remove
|
|
9
|
-
register_subcommands({:'update-logo' => :update_logo})
|
|
9
|
+
register_subcommands({:'update-logo' => :update_logo,:'update-dark-logo' => :update_dark_logo})
|
|
10
10
|
register_subcommands({:'toggle-featured' => :toggle_featured})
|
|
11
11
|
|
|
12
12
|
def initialize()
|
|
@@ -42,6 +42,12 @@ class Morpheus::Cli::LibraryInstanceTypesCommand
|
|
|
42
42
|
opts.on('--featured [true|false]',String, "Filter by featured.") do |val|
|
|
43
43
|
params['featured'] = (val.to_s.downcase != 'false' && val.to_s.downcase != 'off')
|
|
44
44
|
end
|
|
45
|
+
opts.on('-l', '--labels LABEL', String, "Filter by labels, can match any of the values") do |val|
|
|
46
|
+
add_query_parameter(params, 'labels', parse_labels(val))
|
|
47
|
+
end
|
|
48
|
+
opts.on('--all-labels LABEL', String, "Filter by labels, must match all of the values") do |val|
|
|
49
|
+
add_query_parameter(params, 'allLabels', parse_labels(val))
|
|
50
|
+
end
|
|
45
51
|
build_common_options(opts, options, [:list, :query, :json, :yaml, :csv, :fields, :dry_run, :remote])
|
|
46
52
|
opts.footer = "List instance types."
|
|
47
53
|
end
|
|
@@ -147,6 +153,7 @@ class Morpheus::Cli::LibraryInstanceTypesCommand
|
|
|
147
153
|
"Code" => lambda {|it| it['code'] },
|
|
148
154
|
"Description" => lambda {|it| it['description'] },
|
|
149
155
|
"Technology" => lambda {|it| format_instance_type_technology(it) },
|
|
156
|
+
"Labels" => lambda {|it| format_list(it['labels'], '') },
|
|
150
157
|
"Category" => lambda {|it| it['category'].to_s.capitalize },
|
|
151
158
|
# "Logo" => lambda {|it| it['logo'].to_s },
|
|
152
159
|
"Visiblity" => lambda {|it| it['visibility'].to_s.capitalize },
|
|
@@ -179,6 +186,19 @@ class Morpheus::Cli::LibraryInstanceTypesCommand
|
|
|
179
186
|
# print cyan,"No option types found for this layout.","\n",reset
|
|
180
187
|
end
|
|
181
188
|
|
|
189
|
+
price_sets = instance_type['priceSets']
|
|
190
|
+
if price_sets && price_sets.size > 0
|
|
191
|
+
print_h2 "Price Sets"
|
|
192
|
+
price_set_columns = [
|
|
193
|
+
{"ID" => lambda {|it| it['id'] } },
|
|
194
|
+
{"NAME" => lambda {|it| it['name'] } },
|
|
195
|
+
{"PRICE UNIT" => lambda {|it| it['priceUnit'] } },
|
|
196
|
+
]
|
|
197
|
+
print as_pretty_table(price_sets, price_set_columns)
|
|
198
|
+
else
|
|
199
|
+
# print cyan,"No price sets found for this instance type.","\n",reset
|
|
200
|
+
end
|
|
201
|
+
|
|
182
202
|
instance_type_evars = instance_type['environmentVariables']
|
|
183
203
|
if instance_type_evars && instance_type_evars.size > 0
|
|
184
204
|
print_h2 "Environment Variables"
|
|
@@ -223,7 +243,8 @@ class Morpheus::Cli::LibraryInstanceTypesCommand
|
|
|
223
243
|
{"TECHNOLOGY" => lambda {|layout|
|
|
224
244
|
layout['provisionType'] ? layout['provisionType']['name'] : ''
|
|
225
245
|
} },
|
|
226
|
-
{"DESCRIPTION" => lambda {|layout| layout['description'] } }
|
|
246
|
+
{"DESCRIPTION" => lambda {|layout| layout['description'] } },
|
|
247
|
+
{"LABELS" => lambda {|layout| format_list(layout['labels'], '') } }
|
|
227
248
|
]
|
|
228
249
|
print as_pretty_table(instance_type_layouts, layout_columns)
|
|
229
250
|
else
|
|
@@ -252,6 +273,12 @@ class Morpheus::Cli::LibraryInstanceTypesCommand
|
|
|
252
273
|
params['optionTypes'] = list.collect {|it| it.to_s.strip.empty? ? nil : it.to_s.strip }.compact.uniq
|
|
253
274
|
end
|
|
254
275
|
end
|
|
276
|
+
opts.on('-l', '--labels [LIST]', String, "Labels") do |val|
|
|
277
|
+
params['labels'] = parse_labels(val)
|
|
278
|
+
end
|
|
279
|
+
opts.on('--price-sets [LIST]', Array, 'Price set(s), comma separated list of price set IDs') do |list|
|
|
280
|
+
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}}
|
|
281
|
+
end
|
|
255
282
|
build_common_options(opts, options, [:options, :payload, :json, :dry_run, :remote])
|
|
256
283
|
opts.footer = "Create a new instance type."
|
|
257
284
|
end
|
|
@@ -344,6 +371,9 @@ class Morpheus::Cli::LibraryInstanceTypesCommand
|
|
|
344
371
|
optparse = Morpheus::Cli::OptionParser.new do|opts|
|
|
345
372
|
opts.banner = subcommand_usage("[name] [options]")
|
|
346
373
|
build_option_type_options(opts, options, update_instance_type_option_types())
|
|
374
|
+
opts.on('-l', '--labels [LIST]', String, "Labels") do |val|
|
|
375
|
+
params['labels'] = parse_labels(val)
|
|
376
|
+
end
|
|
347
377
|
build_common_options(opts, options, [:options, :json, :dry_run, :remote])
|
|
348
378
|
opts.on('--option-types [x,y,z]', Array, "List of Option Type IDs") do |list|
|
|
349
379
|
if list.nil?
|
|
@@ -352,6 +382,9 @@ class Morpheus::Cli::LibraryInstanceTypesCommand
|
|
|
352
382
|
params['optionTypes'] = list.collect {|it| it.to_s.strip.empty? ? nil : it.to_s.strip }.compact.uniq
|
|
353
383
|
end
|
|
354
384
|
end
|
|
385
|
+
opts.on('--price-sets [LIST]', Array, 'Price set(s), comma separated list of price set IDs') do |list|
|
|
386
|
+
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}}
|
|
387
|
+
end
|
|
355
388
|
opts.footer = "Update an instance type." + "\n" +
|
|
356
389
|
"[name] is required. This is the name or id of a instance type."
|
|
357
390
|
end
|
|
@@ -478,10 +511,7 @@ class Morpheus::Cli::LibraryInstanceTypesCommand
|
|
|
478
511
|
"[file] is required. This is the path of the logo file"
|
|
479
512
|
end
|
|
480
513
|
optparse.parse!(args)
|
|
481
|
-
|
|
482
|
-
puts optparse
|
|
483
|
-
exit 1
|
|
484
|
-
end
|
|
514
|
+
verify_args!(args:args, optparse:optparse, count:2)
|
|
485
515
|
connect(options)
|
|
486
516
|
layout_id = args[0]
|
|
487
517
|
filename = args[1]
|
|
@@ -490,7 +520,7 @@ class Morpheus::Cli::LibraryInstanceTypesCommand
|
|
|
490
520
|
exit 1 if instance_type.nil?
|
|
491
521
|
logo_file = nil
|
|
492
522
|
if filename == 'null'
|
|
493
|
-
|
|
523
|
+
logo_file = 'null' # clear it
|
|
494
524
|
else
|
|
495
525
|
filename = File.expand_path(filename)
|
|
496
526
|
if !File.exists?(filename)
|
|
@@ -517,6 +547,54 @@ class Morpheus::Cli::LibraryInstanceTypesCommand
|
|
|
517
547
|
end
|
|
518
548
|
end
|
|
519
549
|
|
|
550
|
+
def update_dark_logo(args)
|
|
551
|
+
options = {}
|
|
552
|
+
params = {}
|
|
553
|
+
filename = nil
|
|
554
|
+
optparse = Morpheus::Cli::OptionParser.new do|opts|
|
|
555
|
+
opts.banner = subcommand_usage("[name] [file]")
|
|
556
|
+
build_common_options(opts, options, [:json, :dry_run, :remote])
|
|
557
|
+
opts.footer = "Update the dark logo for an instance type." + "\n" +
|
|
558
|
+
"[name] is required. This is the name or id of a instance type." + "\n" +
|
|
559
|
+
"[file] is required. This is the path of the dark logo file"
|
|
560
|
+
end
|
|
561
|
+
optparse.parse!(args)
|
|
562
|
+
verify_args!(args:args, optparse:optparse, count:2)
|
|
563
|
+
connect(options)
|
|
564
|
+
layout_id = args[0]
|
|
565
|
+
filename = args[1]
|
|
566
|
+
begin
|
|
567
|
+
instance_type = find_instance_type_by_name_or_id(layout_id)
|
|
568
|
+
exit 1 if instance_type.nil?
|
|
569
|
+
dark_logo_file = nil
|
|
570
|
+
if filename == 'null'
|
|
571
|
+
dark_logo_file = 'null' # clear it
|
|
572
|
+
else
|
|
573
|
+
filename = File.expand_path(filename)
|
|
574
|
+
if !File.exists?(filename)
|
|
575
|
+
print_red_alert "File not found: #{filename}"
|
|
576
|
+
exit 1
|
|
577
|
+
end
|
|
578
|
+
dark_logo_file = File.new(filename, 'rb')
|
|
579
|
+
end
|
|
580
|
+
@library_instance_types_interface.setopts(options)
|
|
581
|
+
if options[:dry_run]
|
|
582
|
+
print_dry_run @library_instance_types_interface.dry.update_logo(instance_type['id'], nil, dark_logo_file)
|
|
583
|
+
return
|
|
584
|
+
end
|
|
585
|
+
json_response = @library_instance_types_interface.update_logo(instance_type['id'], nil, dark_logo_file)
|
|
586
|
+
if options[:json]
|
|
587
|
+
print JSON.pretty_generate(json_response), "\n"
|
|
588
|
+
return 0
|
|
589
|
+
end
|
|
590
|
+
print_green_success "Updated Instance Type #{instance_type['name']} dark logo"
|
|
591
|
+
_get(instance_type['id'], options)
|
|
592
|
+
rescue RestClient::Exception => e
|
|
593
|
+
print_rest_exception(e, options)
|
|
594
|
+
return 1
|
|
595
|
+
end
|
|
596
|
+
end
|
|
597
|
+
|
|
520
598
|
def remove(args)
|
|
521
599
|
options = {}
|
|
522
600
|
optparse = Morpheus::Cli::OptionParser.new do|opts|
|