morpheus-cli 5.3.1 → 5.3.2.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/account_groups_interface.rb +0 -6
- data/lib/morpheus/api/accounts_interface.rb +4 -36
- data/lib/morpheus/api/api_client.rb +120 -106
- data/lib/morpheus/api/appliance_settings_interface.rb +6 -9
- data/lib/morpheus/api/approvals_interface.rb +5 -8
- data/lib/morpheus/api/apps_interface.rb +0 -7
- data/lib/morpheus/api/archive_buckets_interface.rb +9 -16
- data/lib/morpheus/api/archive_files_interface.rb +0 -6
- data/lib/morpheus/api/auth_interface.rb +4 -4
- data/lib/morpheus/api/backup_settings_interface.rb +5 -8
- data/lib/morpheus/api/blueprints_interface.rb +1 -7
- data/lib/morpheus/api/budgets_interface.rb +0 -6
- data/lib/morpheus/api/cloud_datastores_interface.rb +0 -6
- data/lib/morpheus/api/cloud_folders_interface.rb +1 -7
- data/lib/morpheus/api/cloud_policies_interface.rb +0 -6
- data/lib/morpheus/api/cloud_resource_pools_interface.rb +0 -6
- data/lib/morpheus/api/clouds_interface.rb +0 -6
- data/lib/morpheus/api/clusters_interface.rb +39 -42
- data/lib/morpheus/api/containers_interface.rb +0 -6
- data/lib/morpheus/api/custom_instance_types_interface.rb +0 -6
- data/lib/morpheus/api/cypher_interface.rb +0 -6
- data/lib/morpheus/api/datastores_interface.rb +4 -7
- data/lib/morpheus/api/deploy_interface.rb +1 -6
- data/lib/morpheus/api/environments_interface.rb +0 -6
- data/lib/morpheus/api/execute_schedules_interface.rb +0 -6
- data/lib/morpheus/api/execution_request_interface.rb +0 -6
- data/lib/morpheus/api/file_copy_request_interface.rb +2 -9
- data/lib/morpheus/api/group_policies_interface.rb +0 -6
- data/lib/morpheus/api/groups_interface.rb +0 -7
- data/lib/morpheus/api/guidance_interface.rb +9 -12
- data/lib/morpheus/api/health_interface.rb +0 -6
- data/lib/morpheus/api/image_builder_boot_scripts_interface.rb +0 -6
- data/lib/morpheus/api/image_builder_image_builds_interface.rb +0 -6
- data/lib/morpheus/api/image_builder_interface.rb +3 -9
- data/lib/morpheus/api/image_builder_preseed_scripts_interface.rb +0 -6
- data/lib/morpheus/api/instance_types_interface.rb +0 -7
- data/lib/morpheus/api/instances_interface.rb +8 -19
- data/lib/morpheus/api/integrations_interface.rb +30 -0
- data/lib/morpheus/api/invoice_line_items_interface.rb +4 -9
- data/lib/morpheus/api/jobs_interface.rb +11 -14
- data/lib/morpheus/api/key_pairs_interface.rb +0 -6
- data/lib/morpheus/api/library_cluster_layouts_interface.rb +0 -6
- data/lib/morpheus/api/library_container_scripts_interface.rb +0 -6
- data/lib/morpheus/api/library_container_templates_interface.rb +0 -6
- data/lib/morpheus/api/library_container_types_interface.rb +0 -6
- data/lib/morpheus/api/library_container_upgrades_interface.rb +0 -6
- data/lib/morpheus/api/library_instance_types_interface.rb +0 -6
- data/lib/morpheus/api/library_layouts_interface.rb +0 -6
- data/lib/morpheus/api/library_spec_template_types_interface.rb +0 -6
- data/lib/morpheus/api/library_spec_templates_interface.rb +0 -6
- data/lib/morpheus/api/license_interface.rb +0 -6
- data/lib/morpheus/api/load_balancer_pools_interface.rb +9 -0
- data/lib/morpheus/api/load_balancer_types_interface.rb +9 -0
- data/lib/morpheus/api/load_balancer_virtual_servers_interface.rb +9 -0
- data/lib/morpheus/api/load_balancers_interface.rb +4 -59
- data/lib/morpheus/api/log_settings_interface.rb +9 -12
- data/lib/morpheus/api/logs_interface.rb +0 -6
- data/lib/morpheus/api/monitoring_alerts_interface.rb +0 -6
- data/lib/morpheus/api/monitoring_apps_interface.rb +0 -6
- data/lib/morpheus/api/monitoring_checks_interface.rb +0 -6
- data/lib/morpheus/api/monitoring_contacts_interface.rb +0 -6
- data/lib/morpheus/api/monitoring_groups_interface.rb +0 -6
- data/lib/morpheus/api/monitoring_incidents_interface.rb +0 -6
- data/lib/morpheus/api/monitoring_interface.rb +6 -12
- data/lib/morpheus/api/network_domain_records_interface.rb +0 -6
- data/lib/morpheus/api/network_domains_interface.rb +0 -6
- data/lib/morpheus/api/network_groups_interface.rb +0 -6
- data/lib/morpheus/api/network_pool_ips_interface.rb +0 -6
- data/lib/morpheus/api/network_pool_servers_interface.rb +0 -6
- data/lib/morpheus/api/network_pools_interface.rb +0 -6
- data/lib/morpheus/api/network_proxies_interface.rb +0 -6
- data/lib/morpheus/api/network_routers_interface.rb +56 -6
- data/lib/morpheus/api/network_security_servers_interface.rb +6 -9
- data/lib/morpheus/api/network_services_interface.rb +0 -14
- data/lib/morpheus/api/network_subnets_interface.rb +0 -6
- data/lib/morpheus/api/network_types_interface.rb +1 -7
- data/lib/morpheus/api/networks_interface.rb +0 -6
- data/lib/morpheus/api/option_type_lists_interface.rb +18 -12
- data/lib/morpheus/api/option_types_interface.rb +0 -6
- data/lib/morpheus/api/options_interface.rb +0 -6
- data/lib/morpheus/api/packages_interface.rb +0 -6
- data/lib/morpheus/api/policies_interface.rb +1 -8
- data/lib/morpheus/api/power_schedules_interface.rb +0 -6
- data/lib/morpheus/api/price_sets_interface.rb +8 -11
- data/lib/morpheus/api/prices_interface.rb +12 -15
- data/lib/morpheus/api/processes_interface.rb +0 -6
- data/lib/morpheus/api/provision_types_interface.rb +0 -6
- data/lib/morpheus/api/provisioning_license_types_interface.rb +0 -6
- data/lib/morpheus/api/provisioning_licenses_interface.rb +0 -6
- data/lib/morpheus/api/provisioning_settings_interface.rb +6 -9
- data/lib/morpheus/api/reports_interface.rb +0 -6
- data/lib/morpheus/api/roles_interface.rb +0 -6
- data/lib/morpheus/api/secondary_read_interface.rb +25 -0
- data/lib/morpheus/api/secondary_rest_interface.rb +42 -0
- data/lib/morpheus/api/security_group_rules_interface.rb +0 -7
- data/lib/morpheus/api/security_groups_interface.rb +0 -6
- data/lib/morpheus/api/server_types_interface.rb +0 -6
- data/lib/morpheus/api/servers_interface.rb +0 -6
- data/lib/morpheus/api/service_plans_interface.rb +11 -14
- data/lib/morpheus/api/storage_providers_interface.rb +9 -16
- data/lib/morpheus/api/subnet_types_interface.rb +1 -7
- data/lib/morpheus/api/subnets_interface.rb +0 -6
- data/lib/morpheus/api/task_sets_interface.rb +0 -6
- data/lib/morpheus/api/tasks_interface.rb +0 -6
- data/lib/morpheus/api/user_groups_interface.rb +0 -6
- data/lib/morpheus/api/user_sources_interface.rb +0 -6
- data/lib/morpheus/api/users_interface.rb +0 -6
- data/lib/morpheus/api/virtual_images_interface.rb +0 -6
- data/lib/morpheus/api/whitelabel_settings_interface.rb +8 -11
- data/lib/morpheus/api/wiki_interface.rb +0 -6
- data/lib/morpheus/cli/access_token_command.rb +1 -1
- data/lib/morpheus/cli/account_groups_command.rb +4 -4
- data/lib/morpheus/cli/apps.rb +9 -9
- data/lib/morpheus/cli/archives_command.rb +5 -5
- data/lib/morpheus/cli/blueprints_command.rb +5 -5
- data/lib/morpheus/cli/boot_scripts_command.rb +1 -1
- data/lib/morpheus/cli/change_password_command.rb +4 -4
- data/lib/morpheus/cli/cli_command.rb +11 -10
- data/lib/morpheus/cli/clouds.rb +2 -2
- data/lib/morpheus/cli/clusters.rb +2 -2
- data/lib/morpheus/cli/credentials.rb +4 -11
- data/lib/morpheus/cli/environments_command.rb +1 -1
- data/lib/morpheus/cli/execute_schedules_command.rb +3 -3
- data/lib/morpheus/cli/hosts.rb +8 -8
- data/lib/morpheus/cli/image_builder_command.rb +6 -6
- data/lib/morpheus/cli/instance_types.rb +1 -1
- data/lib/morpheus/cli/instances.rb +93 -64
- data/lib/morpheus/cli/integrations_command.rb +567 -1
- data/lib/morpheus/cli/invoices_command.rb +75 -67
- data/lib/morpheus/cli/key_pairs.rb +2 -2
- data/lib/morpheus/cli/library_cluster_layouts_command.rb +2 -3
- data/lib/morpheus/cli/library_container_scripts_command.rb +4 -5
- data/lib/morpheus/cli/library_container_templates_command.rb +5 -1
- data/lib/morpheus/cli/library_container_types_command.rb +8 -9
- data/lib/morpheus/cli/library_instance_types_command.rb +6 -7
- data/lib/morpheus/cli/library_layouts_command.rb +9 -5
- data/lib/morpheus/cli/library_option_lists_command.rb +72 -20
- data/lib/morpheus/cli/library_option_types_command.rb +8 -4
- data/lib/morpheus/cli/library_spec_templates_command.rb +3 -4
- data/lib/morpheus/cli/library_upgrades_command.rb +6 -6
- data/lib/morpheus/cli/license.rb +2 -2
- data/lib/morpheus/cli/load_balancer_types.rb +37 -0
- data/lib/morpheus/cli/load_balancers.rb +149 -314
- data/lib/morpheus/cli/log_settings_command.rb +7 -3
- data/lib/morpheus/cli/login.rb +3 -1
- data/lib/morpheus/cli/mixins/load_balancers_helper.rb +156 -0
- data/lib/morpheus/cli/mixins/print_helper.rb +11 -0
- data/lib/morpheus/cli/mixins/provisioning_helper.rb +2 -2
- data/lib/morpheus/cli/mixins/rest_command.rb +657 -0
- data/lib/morpheus/cli/network_routers_command.rb +1183 -185
- data/lib/morpheus/cli/networks_command.rb +194 -101
- data/lib/morpheus/cli/option_types.rb +34 -40
- data/lib/morpheus/cli/policies_command.rb +0 -1
- data/lib/morpheus/cli/power_schedules_command.rb +3 -3
- data/lib/morpheus/cli/preseed_scripts_command.rb +1 -1
- data/lib/morpheus/cli/remote.rb +1 -1
- data/lib/morpheus/cli/roles.rb +9 -9
- data/lib/morpheus/cli/security_group_rules.rb +1 -1
- data/lib/morpheus/cli/setup.rb +0 -1
- data/lib/morpheus/cli/tenants_command.rb +21 -23
- data/lib/morpheus/cli/user_groups_command.rb +3 -3
- data/lib/morpheus/cli/user_sources_command.rb +3 -3
- data/lib/morpheus/cli/users.rb +3 -3
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/cli/virtual_images.rb +1 -1
- data/lib/morpheus/cli/whoami.rb +0 -15
- data/lib/morpheus/cli/wiki_command.rb +1 -1
- data/lib/morpheus/cli.rb +1 -0
- data/lib/morpheus/ext/string.rb +41 -0
- data/lib/morpheus/formatters.rb +4 -0
- metadata +11 -2
|
@@ -31,20 +31,16 @@ class Morpheus::Cli::InvoicesCommand
|
|
|
31
31
|
options[:show_all] = true
|
|
32
32
|
options[:show_dates] = true
|
|
33
33
|
options[:show_estimates] = true
|
|
34
|
-
|
|
35
|
-
options[:show_prices] = true
|
|
34
|
+
options[:show_costs] = true
|
|
36
35
|
end
|
|
37
36
|
opts.on('--dates', "Display Ref Start, Ref End, etc.") do |val|
|
|
38
37
|
options[:show_dates] = true
|
|
39
38
|
end
|
|
40
|
-
opts.on('--
|
|
41
|
-
options[:
|
|
39
|
+
opts.on('--costs', '--costs', "Display Costs in addition to prices" ) do
|
|
40
|
+
options[:show_costs] = true
|
|
42
41
|
end
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
# end
|
|
46
|
-
opts.on('--prices', '--prices', "Display prices: Total, Compute, Storage, Network, Extra" ) do
|
|
47
|
-
options[:show_prices] = true
|
|
42
|
+
opts.on('--estimates', '--estimates', "Display all estimated prices, from usage metering info: Compute, Memory, Storage, Network, Extra" ) do
|
|
43
|
+
options[:show_estimates] = true
|
|
48
44
|
end
|
|
49
45
|
opts.on('-t', '--type TYPE', "Filter by Ref Type eg. ComputeSite (Group), ComputeZone (Cloud), ComputeServer (Host), Instance, Container, User") do |val|
|
|
50
46
|
params['refType'] ||= []
|
|
@@ -226,42 +222,55 @@ class Morpheus::Cli::InvoicesCommand
|
|
|
226
222
|
# {"LAST COST DATE" => lambda {|it| format_local_dt(it['lastCostDate']) } },
|
|
227
223
|
# {"LAST ACTUAL DATE" => lambda {|it| format_local_dt(it['lastActualDate']) } },
|
|
228
224
|
] : []) + [
|
|
229
|
-
{"COMPUTE" => lambda {|it| format_money(it['
|
|
230
|
-
|
|
231
|
-
{"STORAGE" => lambda {|it| format_money(it['
|
|
232
|
-
{"NETWORK" => lambda {|it| format_money(it['
|
|
233
|
-
{"EXTRA" => lambda {|it| format_money(it['
|
|
234
|
-
{"MTD" => lambda {|it| format_money(it['
|
|
235
|
-
{"TOTAL" => lambda {|it|
|
|
236
|
-
format_money(it['
|
|
225
|
+
{"COMPUTE PRICE" => lambda {|it| format_money(it['computePrice'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
226
|
+
{"MEMORY PRICE" => lambda {|it| format_money(it['memoryPrice'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
227
|
+
{"STORAGE PRICE" => lambda {|it| format_money(it['storagePrice'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
228
|
+
{"NETWORK PRICE" => lambda {|it| format_money(it['networkPrice'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
229
|
+
{"EXTRA PRICE" => lambda {|it| format_money(it['extraPrice'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
230
|
+
{"MTD PRICE" => lambda {|it| format_money(it['runningPrice'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
231
|
+
{"TOTAL PRICE" => lambda {|it|
|
|
232
|
+
format_money(it['totalPrice'], 'usd', {sigdig:options[:sigdig]}) + ((it['totalCost'].to_f > 0 && it['totalCost'] != it['runningCost']) ? " (Projected)" : "")
|
|
237
233
|
} }
|
|
238
234
|
]
|
|
239
235
|
|
|
240
|
-
if options[:
|
|
236
|
+
if options[:show_costs] && json_response['masterAccount'] != false
|
|
241
237
|
columns += [
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
238
|
+
{"COMPUTE COST" => lambda {|it| format_money(it['computeCost'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
239
|
+
{"MEMORY COST" => lambda {|it| format_money(it['memoryCost']) } },
|
|
240
|
+
{"STORAGE COST" => lambda {|it| format_money(it['storageCost'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
241
|
+
{"NETWORK COST" => lambda {|it| format_money(it['networkCost'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
242
|
+
{"EXTRA COST" => lambda {|it| format_money(it['extraCost'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
243
|
+
{"MTD COST" => lambda {|it| format_money(it['runningCost'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
244
|
+
{"TOTAL COST" => lambda {|it|
|
|
245
|
+
format_money(it['totalCost'], 'usd', {sigdig:options[:sigdig]}) + ((it['totalCost'].to_f > 0 && it['totalCost'] != it['runningCost']) ? " (Projected)" : "")
|
|
246
|
+
} }
|
|
247
|
+
]
|
|
252
248
|
end
|
|
253
249
|
if options[:show_estimates]
|
|
254
250
|
columns += [
|
|
255
|
-
{"COMPUTE
|
|
256
|
-
|
|
257
|
-
{"STORAGE
|
|
258
|
-
{"NETWORK
|
|
259
|
-
{"EXTRA
|
|
260
|
-
{"MTD
|
|
261
|
-
{"TOTAL
|
|
262
|
-
format_money(it['
|
|
251
|
+
{"METERED COMPUTE PRICE" => lambda {|it| format_money(it['estimatedComputePrice'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
252
|
+
{"METERED MEMORY PRICE" => lambda {|it| format_money(it['estimatedMemoryPrice'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
253
|
+
{"METERED STORAGE PRICE" => lambda {|it| format_money(it['estimatedStoragePrice'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
254
|
+
{"METERED NETWORK PRICE" => lambda {|it| format_money(it['estimatedNetworkPrice'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
255
|
+
{"METERED EXTRA PRICE" => lambda {|it| format_money(it['estimatedExtraPrice'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
256
|
+
{"METERED MTD PRICE" => lambda {|it| format_money(it['estimatedRunningPrice'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
257
|
+
{"METERED TOTAL PRICE" => lambda {|it|
|
|
258
|
+
format_money(it['estimatedTotalPrice'], 'usd', {sigdig:options[:sigdig]}) + ((it['estimatedTotalPrice'].to_f > 0 && it['estimatedTotalPrice'] != it['estimatedRunningPrice']) ? " (Projected)" : "")
|
|
263
259
|
} },
|
|
264
260
|
]
|
|
261
|
+
if options[:show_costs] && json_response['masterAccount'] != false
|
|
262
|
+
columns += [
|
|
263
|
+
{"METERED COMPUTE COST" => lambda {|it| format_money(it['estimatedComputeCost'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
264
|
+
{"METERED MEMORY COST" => lambda {|it| format_money(it['estimatedMemoryCost'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
265
|
+
{"METERED STORAGE COST" => lambda {|it| format_money(it['estimatedStorageCost'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
266
|
+
{"METERED NETWORK COST" => lambda {|it| format_money(it['estimatedNetworkCost'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
267
|
+
{"METERED EXTRA COST" => lambda {|it| format_money(it['estimatedExtraCost'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
268
|
+
{"METERED MTD COST" => lambda {|it| format_money(it['estimatedRunningCost'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
269
|
+
{"METERED TOTAL COST" => lambda {|it|
|
|
270
|
+
format_money(it['estimatedTotalCost'], 'usd', {sigdig:options[:sigdig]}) + ((it['estimatedTotalCost'].to_f > 0 && it['estimatedTotalCost'] != it['estimatedRunningCost']) ? " (Projected)" : "")
|
|
271
|
+
} },
|
|
272
|
+
]
|
|
273
|
+
end
|
|
265
274
|
end
|
|
266
275
|
columns += [
|
|
267
276
|
{"ESTIMATE" => lambda {|it| format_boolean(it['estimate']) } },
|
|
@@ -297,18 +306,22 @@ class Morpheus::Cli::InvoicesCommand
|
|
|
297
306
|
|
|
298
307
|
if invoice_totals
|
|
299
308
|
cost_rows = [
|
|
300
|
-
{label: '
|
|
309
|
+
{label: 'Price'.upcase, compute: invoice_totals['actualComputePrice'], memory: invoice_totals['actualMemoryPrice'], storage: invoice_totals['actualStoragePrice'], network: invoice_totals['actualNetworkPrice'], license: invoice_totals['actualLicensePrice'], extra: invoice_totals['actualExtraPrice'], running: invoice_totals['actualRunningPrice'], total: invoice_totals['actualTotalPrice']},
|
|
301
310
|
]
|
|
302
|
-
if options[:
|
|
311
|
+
if options[:show_costs]
|
|
303
312
|
cost_rows += [
|
|
304
|
-
{label: '
|
|
313
|
+
{label: 'Cost'.upcase, compute: invoice_totals['actualComputeCost'], memory: invoice_totals['actualMemoryCost'], storage: invoice_totals['actualStorageCost'], network: invoice_totals['actualNetworkCost'], license: invoice_totals['actualLicenseCost'], extra: invoice_totals['actualExtraCost'], running: invoice_totals['actualRunningCost'], total: invoice_totals['actualTotalCost']}
|
|
305
314
|
]
|
|
306
315
|
end
|
|
307
316
|
if options[:show_estimates]
|
|
308
317
|
cost_rows += [
|
|
309
|
-
{label: 'Metered
|
|
310
|
-
{label: 'Metered Price'.upcase, compute: invoice_totals['estimatedComputePrice'], memory: invoice_totals['estimatedMemoryPrice'], storage: invoice_totals['estimatedStoragePrice'], network: invoice_totals['estimatedNetworkPrice'], license: invoice_totals['estimatedLicensePrice'], extra: invoice_totals['estimatedExtraPrice'], running: invoice_totals['estimatedRunningPrice'], total: invoice_totals['estimatedTotalPrice']},
|
|
318
|
+
{label: 'Metered Price'.upcase, compute: invoice_totals['estimatedComputePrice'], memory: invoice_totals['estimatedMemoryPrice'], storage: invoice_totals['estimatedStoragePrice'], network: invoice_totals['estimatedNetworkPrice'], license: invoice_totals['estimatedLicensePrice'], extra: invoice_totals['estimatedExtraPrice'], running: invoice_totals['estimatedRunningPrice'], total: invoice_totals['estimatedTotalPrice']}
|
|
311
319
|
]
|
|
320
|
+
if options[:show_costs]
|
|
321
|
+
cost_rows += [
|
|
322
|
+
{label: 'Metered Cost'.upcase, compute: invoice_totals['estimatedComputeCost'], memory: invoice_totals['estimatedMemoryCost'], storage: invoice_totals['estimatedStorageCost'], network: invoice_totals['estimatedNetworkCost'], license: invoice_totals['estimatedLicenseCost'], extra: invoice_totals['estimatedExtraCost'], running: invoice_totals['estimatedRunningCost'], total: invoice_totals['estimatedTotalCost']}
|
|
323
|
+
]
|
|
324
|
+
end
|
|
312
325
|
end
|
|
313
326
|
cost_columns = {
|
|
314
327
|
"" => lambda {|it| it[:label] },
|
|
@@ -351,16 +364,15 @@ class Morpheus::Cli::InvoicesCommand
|
|
|
351
364
|
opts.banner = subcommand_usage("[id]")
|
|
352
365
|
opts.on('-a', '--all', "Display all details, costs and prices." ) do
|
|
353
366
|
options[:show_estimates] = true
|
|
354
|
-
|
|
355
|
-
options[:show_prices] = true
|
|
367
|
+
options[:show_costs] = true
|
|
356
368
|
options[:max_line_items] = 10000
|
|
357
369
|
end
|
|
358
|
-
opts.on('--
|
|
359
|
-
options[:show_prices] = true
|
|
360
|
-
end
|
|
361
|
-
opts.on('--estimates', '--estimates', "Display all estimated costs, from usage info: Compute, Storage, Network, Extra" ) do
|
|
370
|
+
opts.on('--estimates', '--estimates', "Display all estimated prices, from usage metering info: Compute, Memory, Storage, Network, Extra" ) do
|
|
362
371
|
options[:show_estimates] = true
|
|
363
372
|
end
|
|
373
|
+
opts.on('--costs', '--costs', "Display Costs in addition to prices" ) do
|
|
374
|
+
options[:show_costs] = true
|
|
375
|
+
end
|
|
364
376
|
opts.on('--no-line-items', '--no-line-items', "Do not display line items.") do |val|
|
|
365
377
|
options[:hide_line_items] = true
|
|
366
378
|
end
|
|
@@ -514,25 +526,25 @@ EOT
|
|
|
514
526
|
print_results_pagination({total: line_items.size, size: paged_line_items.size}, {:label => "line item", :n_label => "line items"})
|
|
515
527
|
end
|
|
516
528
|
|
|
517
|
-
# cost_types = ["Costs"]
|
|
518
|
-
# cost_types << "Prices" if options[:show_prices]
|
|
519
|
-
# cost_types << "Estimates" if options[:show_estimates]
|
|
520
|
-
# print_h2 cost_types.size == 1 ? "Totals" : "Total #{anded_list(cost_types)}"
|
|
521
529
|
print_h2 "Invoice Totals"
|
|
522
530
|
|
|
523
531
|
cost_rows = [
|
|
524
|
-
{label: '
|
|
532
|
+
{label: 'Price'.upcase, compute: invoice['computePrice'], memory: invoice['memoryPrice'], storage: invoice['storagePrice'], network: invoice['networkPrice'], license: invoice['licensePrice'], extra: invoice['extraPrice'], running: invoice['runningPrice'], total: invoice['totalPrice']},
|
|
525
533
|
]
|
|
526
|
-
if options[:
|
|
534
|
+
if options[:show_costs] # && json_response['masterAccount'] != false
|
|
527
535
|
cost_rows += [
|
|
528
|
-
{label: '
|
|
536
|
+
{label: 'Cost'.upcase, compute: invoice['computeCost'], memory: invoice['memoryCost'], storage: invoice['storageCost'], network: invoice['networkCost'], license: invoice['licenseCost'], extra: invoice['extraCost'], running: invoice['runningCost'], total: invoice['totalCost']},
|
|
529
537
|
]
|
|
530
538
|
end
|
|
531
539
|
if options[:show_estimates]
|
|
532
540
|
cost_rows += [
|
|
533
|
-
{label: 'Metered
|
|
534
|
-
{label: 'Metered Price'.upcase, compute: invoice['estimatedComputePrice'], memory: invoice['estimatedMemoryPrice'], storage: invoice['estimatedStoragePrice'], network: invoice['estimatedNetworkPrice'], license: invoice['estimatedLicensePrice'], extra: invoice['estimatedExtraPrice'], running: invoice['estimatedRunningPrice'], total: invoice['estimatedTotalPrice']},
|
|
541
|
+
{label: 'Metered Price'.upcase, compute: invoice['estimatedComputePrice'], memory: invoice['estimatedMemoryPrice'], storage: invoice['estimatedStoragePrice'], network: invoice['estimatedNetworkPrice'], license: invoice['estimatedLicensePrice'], extra: invoice['estimatedExtraPrice'], running: invoice['estimatedRunningPrice'], total: invoice['estimatedTotalPrice']}
|
|
535
542
|
]
|
|
543
|
+
if options[:show_costs] # && json_response['masterAccount'] != false
|
|
544
|
+
cost_rows += [
|
|
545
|
+
{label: 'Metered Cost'.upcase, compute: invoice['estimatedComputeCost'], memory: invoice['estimatedMemoryCost'], storage: invoice['estimatedStorageCost'], network: invoice['estimatedNetworkCost'], license: invoice['estimatedLicenseCost'], extra: invoice['estimatedExtraCost'], running: invoice['estimatedRunningCost'], total: invoice['estimatedTotalCost']},
|
|
546
|
+
]
|
|
547
|
+
end
|
|
536
548
|
end
|
|
537
549
|
cost_columns = {
|
|
538
550
|
"" => lambda {|it| it[:label] },
|
|
@@ -694,16 +706,12 @@ EOT
|
|
|
694
706
|
opts.on('-a', '--all', "Display all details, costs and prices." ) do
|
|
695
707
|
options[:show_actual_costs] = true
|
|
696
708
|
options[:show_costs] = true
|
|
697
|
-
options[:show_prices] = true
|
|
698
709
|
end
|
|
699
|
-
# opts.on('--actuals', '--actuals', "Display all actual costs: Compute, Storage, Network, Extra" ) do
|
|
710
|
+
# opts.on('--actuals', '--actuals', "Display all actual costs: Compute, Memory, Storage, Network, Extra" ) do
|
|
700
711
|
# options[:show_actual_costs] = true
|
|
701
712
|
# end
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
# end
|
|
705
|
-
opts.on('--prices', '--prices', "Display prices: Total, Compute, Storage, Network, Extra" ) do
|
|
706
|
-
options[:show_prices] = true
|
|
713
|
+
opts.on('--costs', '--costs', "Display costs in addition to prices" ) do
|
|
714
|
+
options[:show_costs] = true
|
|
707
715
|
end
|
|
708
716
|
opts.on('--invoice-id ID', String, "Filter by Invoice ID") do |val|
|
|
709
717
|
params['invoiceId'] ||= []
|
|
@@ -880,9 +888,9 @@ EOT
|
|
|
880
888
|
{"USAGE" => lambda {|it| it['itemUsage'] } },
|
|
881
889
|
{"RATE" => lambda {|it| it['itemRate'] } },
|
|
882
890
|
{"UNIT" => lambda {|it| it['rateUnit'] } },
|
|
883
|
-
{"COST" => lambda {|it| format_money(it['itemCost'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
884
|
-
] + (options[:show_prices] ? [
|
|
885
891
|
{"PRICE" => lambda {|it| format_money(it['itemPrice'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
892
|
+
] + (options[:show_costs] ? [
|
|
893
|
+
{"COST" => lambda {|it| format_money(it['itemCost'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
886
894
|
{"TAX" => lambda {|it| format_money(it['itemTax'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
887
895
|
] : []) + [
|
|
888
896
|
{"ITEM ID" => lambda {|it| truncate_string_right(it['itemId'], 65) } },
|
|
@@ -915,9 +923,9 @@ EOT
|
|
|
915
923
|
invoice_totals_columns = [
|
|
916
924
|
{"Items" => lambda {|it| format_number(json_response['meta']['total']) rescue '' } },
|
|
917
925
|
#{"Usage" => lambda {|it| it['itemUsage'] } },
|
|
918
|
-
{"Cost" => lambda {|it| format_money(it['itemCost'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
919
|
-
] + (options[:show_prices] ? [
|
|
920
926
|
{"Price" => lambda {|it| format_money(it['itemPrice'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
927
|
+
] + (options[:show_costs] ? [
|
|
928
|
+
{"Cost" => lambda {|it| format_money(it['itemCost'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
921
929
|
#{"Tax" => lambda {|it| format_money(it['itemTax'], 'usd', {sigdig:options[:sigdig]}) } },
|
|
922
930
|
|
|
923
931
|
] : [])
|
|
@@ -18,8 +18,8 @@ class Morpheus::Cli::KeyPairs
|
|
|
18
18
|
|
|
19
19
|
def connect(opts)
|
|
20
20
|
@api_client = establish_remote_appliance_connection(opts)
|
|
21
|
-
@accounts_interface =
|
|
22
|
-
@key_pairs_interface =
|
|
21
|
+
@accounts_interface = @api_client.accounts
|
|
22
|
+
@key_pairs_interface = @api_client.key_pairs
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def handle(args)
|
|
@@ -41,10 +41,9 @@ class Morpheus::Cli::LibraryClusterLayoutsCommand
|
|
|
41
41
|
opts.footer = "List cluster layouts."
|
|
42
42
|
end
|
|
43
43
|
optparse.parse!(args)
|
|
44
|
+
# verify_args!(args:args, optparse:optparse, count:0)
|
|
44
45
|
if args.count > 0
|
|
45
|
-
|
|
46
|
-
puts_error "wrong number of arguments, expected 0 and got (#{args.count}) #{args.inspect}\n#{optparse}"
|
|
47
|
-
return 1
|
|
46
|
+
options[:phrase] = args.join(" ")
|
|
48
47
|
end
|
|
49
48
|
connect(options)
|
|
50
49
|
begin
|
|
@@ -9,7 +9,7 @@ class Morpheus::Cli::LibraryContainerScriptsCommand
|
|
|
9
9
|
|
|
10
10
|
def connect(opts)
|
|
11
11
|
@api_client = establish_remote_appliance_connection(opts)
|
|
12
|
-
@container_scripts_interface =
|
|
12
|
+
@container_scripts_interface = @api_client.library_container_scripts
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def handle(args)
|
|
@@ -25,12 +25,11 @@ class Morpheus::Cli::LibraryContainerScriptsCommand
|
|
|
25
25
|
opts.footer = "List container scripts."
|
|
26
26
|
end
|
|
27
27
|
optparse.parse!(args)
|
|
28
|
-
|
|
28
|
+
# verify_args!(args:args, optparse:optparse, count:0)
|
|
29
29
|
if args.count > 0
|
|
30
|
-
|
|
31
|
-
puts_error "wrong number of arguments, expected 0 and got (#{args.count}) #{args.join(', ')}\n#{optparse}"
|
|
32
|
-
return 1
|
|
30
|
+
options[:phrase] = args.join(" ")
|
|
33
31
|
end
|
|
32
|
+
connect(options)
|
|
34
33
|
begin
|
|
35
34
|
# construct payload
|
|
36
35
|
params.merge!(parse_list_options(options))
|
|
@@ -11,7 +11,7 @@ class Morpheus::Cli::LibraryContainerTemplatesCommand
|
|
|
11
11
|
|
|
12
12
|
def connect(opts)
|
|
13
13
|
@api_client = establish_remote_appliance_connection(opts)
|
|
14
|
-
@container_templates_interface =
|
|
14
|
+
@container_templates_interface = @api_client.library_container_templates
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def handle(args)
|
|
@@ -26,6 +26,10 @@ class Morpheus::Cli::LibraryContainerTemplatesCommand
|
|
|
26
26
|
build_common_options(opts, options, [:list, :json, :yaml, :csv, :fields, :dry_run, :remote])
|
|
27
27
|
end
|
|
28
28
|
optparse.parse!(args)
|
|
29
|
+
# verify_args!(args:args, optparse:optparse, count:0)
|
|
30
|
+
if args.count > 0
|
|
31
|
+
options[:phrase] = args.join(" ")
|
|
32
|
+
end
|
|
29
33
|
connect(options)
|
|
30
34
|
begin
|
|
31
35
|
[:phrase, :offset, :max, :sort, :direction, :lastUpdated].each do |k|
|
|
@@ -18,12 +18,12 @@ class Morpheus::Cli::LibraryContainerTypesCommand
|
|
|
18
18
|
|
|
19
19
|
def connect(opts)
|
|
20
20
|
@api_client = establish_remote_appliance_connection(opts)
|
|
21
|
-
@library_container_types_interface =
|
|
22
|
-
@library_layouts_interface =
|
|
23
|
-
#@library_instance_types_interface =
|
|
24
|
-
@provision_types_interface =
|
|
25
|
-
@option_types_interface =
|
|
26
|
-
#@option_type_lists_interface =
|
|
21
|
+
@library_container_types_interface = @api_client.library_container_types
|
|
22
|
+
@library_layouts_interface = @api_client.library_layouts
|
|
23
|
+
#@library_instance_types_interface = @api_client.library_instance_types
|
|
24
|
+
@provision_types_interface = @api_client.provision_types
|
|
25
|
+
@option_types_interface = @api_client.option_types
|
|
26
|
+
#@option_type_lists_interface = @api_client.option_type_lists
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def handle(args)
|
|
@@ -49,10 +49,9 @@ class Morpheus::Cli::LibraryContainerTypesCommand
|
|
|
49
49
|
opts.footer = "List node types."
|
|
50
50
|
end
|
|
51
51
|
optparse.parse!(args)
|
|
52
|
+
# verify_args!(args:args, optparse:optparse, count:0)
|
|
52
53
|
if args.count > 0
|
|
53
|
-
|
|
54
|
-
puts_error "wrong number of arguments, expected 0 and got (#{args.count}) #{args.inspect}\n#{optparse}"
|
|
55
|
-
return 1
|
|
54
|
+
options[:phrase] = args.join(" ")
|
|
56
55
|
end
|
|
57
56
|
connect(options)
|
|
58
57
|
begin
|
|
@@ -19,10 +19,10 @@ class Morpheus::Cli::LibraryInstanceTypesCommand
|
|
|
19
19
|
|
|
20
20
|
def connect(opts)
|
|
21
21
|
@api_client = establish_remote_appliance_connection(opts)
|
|
22
|
-
@library_instance_types_interface =
|
|
23
|
-
@provision_types_interface =
|
|
24
|
-
@option_types_interface =
|
|
25
|
-
@option_type_lists_interface =
|
|
22
|
+
@library_instance_types_interface = @api_client.library_instance_types
|
|
23
|
+
@provision_types_interface = @api_client.provision_types
|
|
24
|
+
@option_types_interface = @api_client.option_types
|
|
25
|
+
@option_type_lists_interface = @api_client.option_type_lists
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def handle(args)
|
|
@@ -47,10 +47,9 @@ class Morpheus::Cli::LibraryInstanceTypesCommand
|
|
|
47
47
|
opts.footer = "List instance types."
|
|
48
48
|
end
|
|
49
49
|
optparse.parse!(args)
|
|
50
|
+
# verify_args!(args:args, optparse:optparse, count:0)
|
|
50
51
|
if args.count > 0
|
|
51
|
-
|
|
52
|
-
puts_error "wrong number of arguments, expected 0 and got (#{args.count}) #{args.inspect}\n#{optparse}"
|
|
53
|
-
return 1
|
|
52
|
+
options[:phrase] = args.join(" ")
|
|
54
53
|
end
|
|
55
54
|
connect(options)
|
|
56
55
|
begin
|
|
@@ -21,14 +21,14 @@ class Morpheus::Cli::LibraryLayoutsCommand
|
|
|
21
21
|
|
|
22
22
|
def connect(opts)
|
|
23
23
|
@api_client = establish_remote_appliance_connection(opts)
|
|
24
|
-
@library_layouts_interface =
|
|
25
|
-
@library_instance_types_interface =
|
|
24
|
+
@library_layouts_interface = @api_client.library_layouts
|
|
25
|
+
@library_instance_types_interface = @api_client.library_instance_types
|
|
26
26
|
@library_container_types_interface = @api_client.library_container_types
|
|
27
27
|
@spec_templates_interface = @api_client.library_spec_templates
|
|
28
28
|
@spec_template_types_interface = @api_client.library_spec_template_types
|
|
29
|
-
@provision_types_interface =
|
|
30
|
-
@option_types_interface =
|
|
31
|
-
@option_type_lists_interface =
|
|
29
|
+
@provision_types_interface = @api_client.provision_types
|
|
30
|
+
@option_types_interface = @api_client.option_types
|
|
31
|
+
@option_type_lists_interface = @api_client.option_type_lists
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def handle(args)
|
|
@@ -59,6 +59,10 @@ class Morpheus::Cli::LibraryLayoutsCommand
|
|
|
59
59
|
opts.footer = "List layouts."
|
|
60
60
|
end
|
|
61
61
|
optparse.parse!(args)
|
|
62
|
+
# verify_args!(args:args, optparse:optparse, count:0)
|
|
63
|
+
if args.count > 0
|
|
64
|
+
options[:phrase] = args.join(" ")
|
|
65
|
+
end
|
|
62
66
|
connect(options)
|
|
63
67
|
begin
|
|
64
68
|
# construct payload
|
|
@@ -9,7 +9,7 @@ class Morpheus::Cli::LibraryOptionListsCommand
|
|
|
9
9
|
include Morpheus::Cli::LibraryHelper
|
|
10
10
|
|
|
11
11
|
set_command_name :'library-option-lists'
|
|
12
|
-
register_subcommands :list, :get, :add, :update, :remove
|
|
12
|
+
register_subcommands :list, :get, :list_items, :add, :update, :remove
|
|
13
13
|
|
|
14
14
|
def initialize()
|
|
15
15
|
# @appliance_name, @appliance_url = Morpheus::Cli::Remote.active_appliance
|
|
@@ -17,10 +17,10 @@ class Morpheus::Cli::LibraryOptionListsCommand
|
|
|
17
17
|
|
|
18
18
|
def connect(opts)
|
|
19
19
|
@api_client = establish_remote_appliance_connection(opts)
|
|
20
|
-
@library_instance_types_interface =
|
|
21
|
-
@provision_types_interface =
|
|
22
|
-
@option_types_interface =
|
|
23
|
-
@option_type_lists_interface =
|
|
20
|
+
@library_instance_types_interface = @api_client.library_instance_types
|
|
21
|
+
@provision_types_interface = @api_client.provision_types
|
|
22
|
+
@option_types_interface = @api_client.option_types
|
|
23
|
+
@option_type_lists_interface = @api_client.option_type_lists
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def handle(args)
|
|
@@ -35,6 +35,10 @@ class Morpheus::Cli::LibraryOptionListsCommand
|
|
|
35
35
|
opts.footer = "List option lists."
|
|
36
36
|
end
|
|
37
37
|
optparse.parse!(args)
|
|
38
|
+
# verify_args!(args:args, optparse:optparse, count:0)
|
|
39
|
+
if args.count > 0
|
|
40
|
+
options[:phrase] = args.join(" ")
|
|
41
|
+
end
|
|
38
42
|
connect(options)
|
|
39
43
|
begin
|
|
40
44
|
params = {}
|
|
@@ -61,16 +65,14 @@ class Morpheus::Cli::LibraryOptionListsCommand
|
|
|
61
65
|
id: option_type_list['id'],
|
|
62
66
|
name: option_type_list['name'],
|
|
63
67
|
description: option_type_list['description'],
|
|
64
|
-
type: option_type_list['type']
|
|
65
|
-
size: option_type_list['listItems'] ? option_type_list['listItems'].size : ''
|
|
68
|
+
type: ((option_type_list['type'] == 'api') ? "#{option_type_list['type']} (#{option_type_list['apiType']})" : option_type_list['type'])
|
|
66
69
|
}
|
|
67
70
|
end
|
|
68
71
|
columns = [
|
|
69
72
|
:id,
|
|
70
73
|
:name,
|
|
71
74
|
:description,
|
|
72
|
-
:type
|
|
73
|
-
:size
|
|
75
|
+
:type
|
|
74
76
|
]
|
|
75
77
|
print cyan
|
|
76
78
|
print as_pretty_table(rows, columns, options)
|
|
@@ -90,8 +92,8 @@ class Morpheus::Cli::LibraryOptionListsCommand
|
|
|
90
92
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
|
91
93
|
opts.banner = subcommand_usage("[name]")
|
|
92
94
|
build_standard_get_options(opts, options)
|
|
93
|
-
opts.on(nil,'--
|
|
94
|
-
options[:
|
|
95
|
+
opts.on(nil,'--items', "Load and display option list items") do |val|
|
|
96
|
+
options[:list_items] = true
|
|
95
97
|
end
|
|
96
98
|
opts.footer = "Get details about an option list.\n" +
|
|
97
99
|
"[name] is required. This is the name or id of an option list. Supports 1-N [name] arguments."
|
|
@@ -108,20 +110,31 @@ class Morpheus::Cli::LibraryOptionListsCommand
|
|
|
108
110
|
end
|
|
109
111
|
|
|
110
112
|
def _get(id, options)
|
|
111
|
-
|
|
113
|
+
params = {}
|
|
114
|
+
params.merge!(parse_query_options(options))
|
|
112
115
|
begin
|
|
113
116
|
@option_type_lists_interface.setopts(options)
|
|
114
117
|
if options[:dry_run]
|
|
115
118
|
if id.to_s =~ /\A\d{1,}\Z/
|
|
116
|
-
print_dry_run @option_type_lists_interface.dry.get(id.to_i)
|
|
119
|
+
print_dry_run @option_type_lists_interface.dry.get(id.to_i, params)
|
|
117
120
|
else
|
|
118
|
-
print_dry_run @option_type_lists_interface.dry.list({name: id})
|
|
121
|
+
print_dry_run @option_type_lists_interface.dry.list(params.merge({name: id}))
|
|
119
122
|
end
|
|
120
123
|
return
|
|
121
124
|
end
|
|
122
125
|
option_type_list = find_option_type_list_by_name_or_id(id)
|
|
123
126
|
return 1 if option_type_list.nil?
|
|
124
|
-
|
|
127
|
+
list_items = nil
|
|
128
|
+
if options[:list_items]
|
|
129
|
+
list_items = option_type_list['listItems']
|
|
130
|
+
if list_items.nil?
|
|
131
|
+
begin
|
|
132
|
+
list_items = @option_type_lists_interface.list_items(option_type_list['id'])['listItems']
|
|
133
|
+
rescue => e
|
|
134
|
+
puts_error "Failed to load option list items: #{e.message}"
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
125
138
|
json_response = {'optionTypeList' => option_type_list}
|
|
126
139
|
render_result = render_with_format(json_response, options, 'optionTypeList')
|
|
127
140
|
return 0 if render_result
|
|
@@ -142,12 +155,14 @@ class Morpheus::Cli::LibraryOptionListsCommand
|
|
|
142
155
|
"ID" => 'id',
|
|
143
156
|
"Name" => 'name',
|
|
144
157
|
"Description" => 'description',
|
|
145
|
-
"Type" => lambda {|it| it['type']
|
|
158
|
+
"Type" => lambda {|it| it['type'] },
|
|
159
|
+
"API Type" => lambda {|it| it['apiType'] },
|
|
146
160
|
"Source URL" => 'sourceUrl',
|
|
147
161
|
"Real Time" => lambda {|it| format_boolean it['realTime'] },
|
|
148
162
|
"Ignore SSL Errors" => lambda {|it| format_boolean it['ignoreSSLErrors'] },
|
|
149
163
|
"Source Method" => lambda {|it| it['sourceMethod'].to_s.upcase }
|
|
150
164
|
}
|
|
165
|
+
option_list_columns.delete("API Type") if option_type_list['type'] != 'api'
|
|
151
166
|
source_headers = []
|
|
152
167
|
if option_type_list['config'] && option_type_list['config']['sourceHeaders']
|
|
153
168
|
source_headers = option_type_list['config']['sourceHeaders'].collect do |header|
|
|
@@ -174,12 +189,13 @@ class Morpheus::Cli::LibraryOptionListsCommand
|
|
|
174
189
|
print reset,"#{option_type_list['requestScript']}","\n",reset
|
|
175
190
|
end
|
|
176
191
|
end
|
|
177
|
-
if options[:
|
|
178
|
-
|
|
192
|
+
if options[:list_items]
|
|
193
|
+
print_h2 "List Items"
|
|
179
194
|
if list_items && list_items.size > 0
|
|
180
|
-
print_h2 "List Items"
|
|
181
195
|
print as_pretty_table(list_items, [:name, :value], options)
|
|
182
196
|
print_results_pagination({size: list_items.size, total: list_items.size})
|
|
197
|
+
else
|
|
198
|
+
print cyan,"No list items found.",reset,"\n"
|
|
183
199
|
end
|
|
184
200
|
end
|
|
185
201
|
print reset,"\n"
|
|
@@ -189,6 +205,42 @@ class Morpheus::Cli::LibraryOptionListsCommand
|
|
|
189
205
|
end
|
|
190
206
|
end
|
|
191
207
|
|
|
208
|
+
def list_items(args)
|
|
209
|
+
params = {}
|
|
210
|
+
options = {}
|
|
211
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
|
212
|
+
opts.banner = subcommand_usage("[name]")
|
|
213
|
+
build_standard_get_options(opts, options)
|
|
214
|
+
opts.footer = "List items for an option list.\n" +
|
|
215
|
+
"[name] is required. This is the name or id of an option list."
|
|
216
|
+
end
|
|
217
|
+
optparse.parse!(args)
|
|
218
|
+
verify_args!(args:args, optparse:optparse, count:1)
|
|
219
|
+
connect(options)
|
|
220
|
+
option_type_list = find_option_type_list_by_name_or_id(args[0])
|
|
221
|
+
return 1 if option_type_list.nil?
|
|
222
|
+
|
|
223
|
+
params.merge!(parse_list_options(options))
|
|
224
|
+
@option_type_lists_interface.setopts(options)
|
|
225
|
+
if options[:dry_run]
|
|
226
|
+
print_dry_run @option_type_lists_interface.dry.list_items(option_type_list['id'], params)
|
|
227
|
+
return
|
|
228
|
+
end
|
|
229
|
+
json_response = @option_type_lists_interface.list_items(option_type_list['id'], params)
|
|
230
|
+
list_items = json_response['listItems']
|
|
231
|
+
render_response(json_response, options, "listItems") do
|
|
232
|
+
print_h2 "List Items"
|
|
233
|
+
if list_items && list_items.size > 0
|
|
234
|
+
print as_pretty_table(list_items, [:name, :value], options)
|
|
235
|
+
print_results_pagination({size: list_items.size, total: list_items.size})
|
|
236
|
+
else
|
|
237
|
+
print cyan,"No list items found.",reset,"\n"
|
|
238
|
+
end
|
|
239
|
+
print reset,"\n"
|
|
240
|
+
end
|
|
241
|
+
return 0, nil
|
|
242
|
+
end
|
|
243
|
+
|
|
192
244
|
def add(args)
|
|
193
245
|
options = {}
|
|
194
246
|
my_option_types = nil
|
|
@@ -373,7 +425,7 @@ class Morpheus::Cli::LibraryOptionListsCommand
|
|
|
373
425
|
{'dependsOnCode' => 'optionTypeList.type:rest', 'fieldName' => 'realTime', 'fieldLabel' => 'Real Time', 'type' => 'checkbox', 'defaultValue' => false, 'displayOrder' => 7},
|
|
374
426
|
{'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},
|
|
375
427
|
# sourceHeaders component (is done afterwards manually)
|
|
376
|
-
{'dependsOnCode' => 'optionTypeList.type:api', 'fieldName' => 'apiType', 'fieldLabel' => 'Option List', 'type' => 'select', 'optionSource' => 'apiOptionLists', 'required' => true, 'description' => 'The code of the api list to use, eg. clouds, servers,
|
|
428
|
+
{'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' => 9},
|
|
377
429
|
{'dependsOnCode' => 'optionTypeList.type:ldap', 'fieldName' => 'sourceUsername', 'fieldLabel' => 'Source Username', 'type' => 'text', 'description' => "An LDAP Username for use when type is 'ldap'.", 'displayOrder' => 10},
|
|
378
430
|
{'dependsOnCode' => 'optionTypeList.type:ldap', 'fieldName' => 'sourcePassword', 'fieldLabel' => 'Source Username', 'type' => 'text', 'description' => "An LDAP Password for use when type is 'ldap'.", 'displayOrder' => 11},
|
|
379
431
|
{'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' => 12},
|