morpheus-cli 5.3.4 → 5.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +1 -1
- data/lib/morpheus/api/account_users_interface.rb +68 -0
- data/lib/morpheus/api/api_client.rb +69 -11
- data/lib/morpheus/api/audit_interface.rb +9 -0
- data/lib/morpheus/api/catalog_item_types_interface.rb +20 -0
- data/lib/morpheus/api/health_interface.rb +37 -3
- data/lib/morpheus/api/instances_interface.rb +49 -0
- data/lib/morpheus/api/load_balancer_monitors_interface.rb +9 -0
- data/lib/morpheus/api/load_balancer_pools_interface.rb +4 -4
- data/lib/morpheus/api/load_balancer_profiles_interface.rb +4 -5
- data/lib/morpheus/api/load_balancer_virtual_servers_interface.rb +13 -4
- data/lib/morpheus/api/load_balancers_interface.rb +5 -0
- data/lib/morpheus/api/network_dhcp_relays_interface.rb +36 -0
- data/lib/morpheus/api/network_dhcp_servers_interface.rb +36 -0
- data/lib/morpheus/api/network_edge_clusters_interface.rb +26 -0
- data/lib/morpheus/api/network_routers_interface.rb +9 -0
- data/lib/morpheus/api/network_servers_interface.rb +68 -12
- data/lib/morpheus/api/network_static_routes_interface.rb +36 -0
- data/lib/morpheus/api/ping_interface.rb +2 -0
- data/lib/morpheus/api/read_interface.rb +4 -3
- data/lib/morpheus/api/rest_interface.rb +3 -3
- data/lib/morpheus/api/roles_interface.rb +7 -0
- data/lib/morpheus/api/secondary_read_interface.rb +1 -1
- data/lib/morpheus/api/secondary_rest_interface.rb +19 -19
- data/lib/morpheus/api/setup_interface.rb +4 -0
- data/lib/morpheus/api/snapshots_interface.rb +19 -0
- data/lib/morpheus/api/storage_server_types_interface.rb +14 -0
- data/lib/morpheus/api/storage_servers_interface.rb +9 -0
- data/lib/morpheus/api/storage_volume_types_interface.rb +9 -0
- data/lib/morpheus/api/storage_volumes_interface.rb +9 -0
- data/lib/morpheus/api/users_interface.rb +16 -63
- data/lib/morpheus/cli/cli_command.rb +260 -13
- data/lib/morpheus/cli/cli_registry.rb +2 -1
- data/lib/morpheus/cli/{access_token_command.rb → commands/access_token_command.rb} +1 -1
- data/lib/morpheus/cli/{account_groups_command.rb → commands/account_groups_command.rb} +0 -8
- data/lib/morpheus/cli/{activity_command.rb → commands/activity_command.rb} +0 -0
- data/lib/morpheus/cli/commands/{standard/alias_command.rb → alias_command.rb} +1 -4
- data/lib/morpheus/cli/{appliance_settings_command.rb → commands/appliance_settings_command.rb} +0 -0
- data/lib/morpheus/cli/{approvals_command.rb → commands/approvals_command.rb} +0 -0
- data/lib/morpheus/cli/{apps.rb → commands/apps.rb} +14 -87
- data/lib/morpheus/cli/{archives_command.rb → commands/archives_command.rb} +0 -6
- data/lib/morpheus/cli/commands/audit.rb +188 -0
- data/lib/morpheus/cli/{backup_jobs_command.rb → commands/backup_jobs_command.rb} +0 -0
- data/lib/morpheus/cli/{backup_settings_command.rb → commands/backup_settings_command.rb} +0 -0
- data/lib/morpheus/cli/{backups_command.rb → commands/backups_command.rb} +0 -0
- data/lib/morpheus/cli/commands/{standard/benchmark_command.rb → benchmark_command.rb} +0 -3
- data/lib/morpheus/cli/{blueprints_command.rb → commands/blueprints_command.rb} +1 -1
- data/lib/morpheus/cli/{boot_scripts_command.rb → commands/boot_scripts_command.rb} +0 -3
- data/lib/morpheus/cli/{budgets_command.rb → commands/budgets_command.rb} +0 -0
- data/lib/morpheus/cli/commands/{standard/cat_command.rb → cat_command.rb} +0 -0
- data/lib/morpheus/cli/{catalog_item_types_command.rb → commands/catalog_item_types_command.rb} +88 -0
- data/lib/morpheus/cli/{certificates_command.rb → commands/certificates_command.rb} +0 -0
- data/lib/morpheus/cli/commands/change_password_command.rb +132 -0
- data/lib/morpheus/cli/{cloud_datastores_command.rb → commands/cloud_datastores_command.rb} +0 -4
- data/lib/morpheus/cli/{cloud_folders_command.rb → commands/cloud_folders_command.rb} +0 -4
- data/lib/morpheus/cli/{cloud_resource_pools_command.rb → commands/cloud_resource_pools_command.rb} +0 -4
- data/lib/morpheus/cli/{clouds.rb → commands/clouds.rb} +0 -7
- data/lib/morpheus/cli/{clusters.rb → commands/clusters.rb} +96 -64
- data/lib/morpheus/cli/commands/{standard/coloring_command.rb → coloring_command.rb} +0 -2
- data/lib/morpheus/cli/{containers_command.rb → commands/containers_command.rb} +0 -7
- data/lib/morpheus/cli/commands/{standard/curl_command.rb → curl_command.rb} +0 -3
- data/lib/morpheus/cli/{cypher_command.rb → commands/cypher_command.rb} +0 -1
- data/lib/morpheus/cli/{dashboard_command.rb → commands/dashboard_command.rb} +0 -2
- data/lib/morpheus/cli/commands/{standard/debug_command.rb → debug_command.rb} +0 -1
- data/lib/morpheus/cli/{deploy.rb → commands/deploy.rb} +0 -1
- data/lib/morpheus/cli/{deployments.rb → commands/deployments.rb} +0 -0
- data/lib/morpheus/cli/{deploys.rb → commands/deploys.rb} +0 -1
- data/lib/morpheus/cli/{doc.rb → commands/doc.rb} +1 -1
- data/lib/morpheus/cli/commands/{standard/echo_command.rb → echo_command.rb} +0 -2
- data/lib/morpheus/cli/commands/{standard/edit_profile_command.rb → edit_profile_command.rb} +15 -4
- data/lib/morpheus/cli/commands/{standard/edit_rc_command.rb → edit_rc_command.rb} +19 -3
- data/lib/morpheus/cli/{environments_command.rb → commands/environments_command.rb} +0 -5
- data/lib/morpheus/cli/{execute_schedules_command.rb → commands/execute_schedules_command.rb} +0 -0
- data/lib/morpheus/cli/{execution_request_command.rb → commands/execution_request_command.rb} +0 -2
- data/lib/morpheus/cli/commands/{standard/exit_command.rb → exit_command.rb} +0 -2
- data/lib/morpheus/cli/{file_copy_request_command.rb → commands/file_copy_request_command.rb} +0 -4
- data/lib/morpheus/cli/{forgot_password.rb → commands/forgot_password.rb} +0 -0
- data/lib/morpheus/cli/commands/{standard/get_prompt_command.rb → get_prompt_command.rb} +0 -3
- data/lib/morpheus/cli/{groups.rb → commands/groups.rb} +0 -7
- data/lib/morpheus/cli/{guidance_command.rb → commands/guidance_command.rb} +1 -1
- data/lib/morpheus/cli/{health_command.rb → commands/health_command.rb} +104 -19
- data/lib/morpheus/cli/commands/{standard/history_command.rb → history_command.rb} +0 -3
- data/lib/morpheus/cli/{hosts.rb → commands/hosts.rb} +27 -24
- data/lib/morpheus/cli/{image_builder_command.rb → commands/image_builder_command.rb} +6 -16
- data/lib/morpheus/cli/{instance_types.rb → commands/instance_types.rb} +0 -3
- data/lib/morpheus/cli/{instances.rb → commands/instances.rb} +359 -7
- data/lib/morpheus/cli/{integrations_command.rb → commands/integrations_command.rb} +1 -12
- data/lib/morpheus/cli/{invoices_command.rb → commands/invoices_command.rb} +1 -1
- data/lib/morpheus/cli/{jobs_command.rb → commands/jobs_command.rb} +0 -0
- data/lib/morpheus/cli/{key_pairs.rb → commands/key_pairs.rb} +0 -6
- data/lib/morpheus/cli/{library_cluster_layouts_command.rb → commands/library_cluster_layouts_command.rb} +0 -4
- data/lib/morpheus/cli/{library_container_scripts_command.rb → commands/library_container_scripts_command.rb} +0 -0
- data/lib/morpheus/cli/{library_container_templates_command.rb → commands/library_container_templates_command.rb} +0 -1
- data/lib/morpheus/cli/{library_container_types_command.rb → commands/library_container_types_command.rb} +0 -4
- data/lib/morpheus/cli/{library_instance_types_command.rb → commands/library_instance_types_command.rb} +3 -4
- data/lib/morpheus/cli/{library_layouts_command.rb → commands/library_layouts_command.rb} +0 -4
- data/lib/morpheus/cli/{library_option_lists_command.rb → commands/library_option_lists_command.rb} +0 -4
- data/lib/morpheus/cli/{library_option_types_command.rb → commands/library_option_types_command.rb} +0 -4
- data/lib/morpheus/cli/{library_spec_templates_command.rb → commands/library_spec_templates_command.rb} +0 -1
- data/lib/morpheus/cli/{library_upgrades_command.rb → commands/library_upgrades_command.rb} +0 -4
- data/lib/morpheus/cli/{license.rb → commands/license.rb} +0 -3
- data/lib/morpheus/cli/commands/load_balancer_monitors.rb +70 -0
- data/lib/morpheus/cli/commands/load_balancer_pools.rb +90 -0
- data/lib/morpheus/cli/commands/load_balancer_profiles.rb +64 -0
- data/lib/morpheus/cli/{load_balancer_types.rb → commands/load_balancer_types.rb} +9 -8
- data/lib/morpheus/cli/{load_balancer_virtual_servers.rb → commands/load_balancer_virtual_servers.rb} +69 -58
- data/lib/morpheus/cli/commands/load_balancers.rb +192 -0
- data/lib/morpheus/cli/commands/{standard/log_level_command.rb → log_level_command.rb} +0 -3
- data/lib/morpheus/cli/{log_settings_command.rb → commands/log_settings_command.rb} +0 -0
- data/lib/morpheus/cli/{login.rb → commands/login.rb} +0 -5
- data/lib/morpheus/cli/commands/logout.rb +63 -0
- data/lib/morpheus/cli/{logs_command.rb → commands/logs_command.rb} +0 -3
- data/lib/morpheus/cli/commands/{standard/man_command.rb → man_command.rb} +0 -2
- data/lib/morpheus/cli/{monitoring_alerts_command.rb → commands/monitoring_alerts_command.rb} +0 -7
- data/lib/morpheus/cli/{monitoring_apps_command.rb → commands/monitoring_apps_command.rb} +0 -1
- data/lib/morpheus/cli/{monitoring_checks_command.rb → commands/monitoring_checks_command.rb} +0 -1
- data/lib/morpheus/cli/{monitoring_contacts_command.rb → commands/monitoring_contacts_command.rb} +0 -7
- data/lib/morpheus/cli/{monitoring_groups_command.rb → commands/monitoring_groups_command.rb} +0 -1
- data/lib/morpheus/cli/{monitoring_incidents_command.rb → commands/monitoring_incidents_command.rb} +0 -1
- data/lib/morpheus/cli/commands/network_dhcp_relays_command.rb +416 -0
- data/lib/morpheus/cli/commands/network_dhcp_servers_command.rb +407 -0
- data/lib/morpheus/cli/{network_domains_command.rb → commands/network_domains_command.rb} +0 -4
- data/lib/morpheus/cli/commands/network_edge_clusters_command.rb +329 -0
- data/lib/morpheus/cli/commands/network_firewalls_command.rb +823 -0
- data/lib/morpheus/cli/{network_groups_command.rb → commands/network_groups_command.rb} +0 -4
- data/lib/morpheus/cli/{network_pool_servers_command.rb → commands/network_pool_servers_command.rb} +0 -4
- data/lib/morpheus/cli/{network_pools_command.rb → commands/network_pools_command.rb} +0 -4
- data/lib/morpheus/cli/{network_proxies_command.rb → commands/network_proxies_command.rb} +0 -4
- data/lib/morpheus/cli/{network_routers_command.rb → commands/network_routers_command.rb} +96 -50
- data/lib/morpheus/cli/{network_services_command.rb → commands/network_services_command.rb} +0 -4
- data/lib/morpheus/cli/commands/network_static_routes_command.rb +451 -0
- data/lib/morpheus/cli/{network_scopes_command.rb → commands/network_transport_zones_command.rb} +102 -92
- data/lib/morpheus/cli/{networks_command.rb → commands/networks_command.rb} +20 -20
- data/lib/morpheus/cli/commands/open_command.rb +30 -0
- data/lib/morpheus/cli/commands/options.rb +98 -0
- data/lib/morpheus/cli/{packages_command.rb → commands/packages_command.rb} +0 -2
- data/lib/morpheus/cli/{ping.rb → commands/ping.rb} +3 -12
- data/lib/morpheus/cli/{policies_command.rb → commands/policies_command.rb} +2 -9
- data/lib/morpheus/cli/{power_schedules_command.rb → commands/power_schedules_command.rb} +0 -0
- data/lib/morpheus/cli/{preseed_scripts_command.rb → commands/preseed_scripts_command.rb} +0 -3
- data/lib/morpheus/cli/{price_sets_command.rb → commands/price_sets_command.rb} +0 -0
- data/lib/morpheus/cli/{prices_command.rb → commands/prices_command.rb} +7 -7
- data/lib/morpheus/cli/{processes_command.rb → commands/processes_command.rb} +0 -1
- data/lib/morpheus/cli/{projects_command.rb → commands/projects_command.rb} +0 -0
- data/lib/morpheus/cli/{provisioning_licenses_command.rb → commands/provisioning_licenses_command.rb} +0 -0
- data/lib/morpheus/cli/{provisioning_settings_command.rb → commands/provisioning_settings_command.rb} +1 -0
- data/lib/morpheus/cli/{recent_activity_command.rb → commands/recent_activity_command.rb} +0 -0
- data/lib/morpheus/cli/{remote.rb → commands/remote.rb} +21 -19
- data/lib/morpheus/cli/{reports_command.rb → commands/reports_command.rb} +0 -2
- data/lib/morpheus/cli/commands/{standard/rm_command.rb → rm_command.rb} +0 -0
- data/lib/morpheus/cli/{roles.rb → commands/roles.rb} +245 -40
- data/lib/morpheus/cli/{search_command.rb → commands/search_command.rb} +0 -0
- data/lib/morpheus/cli/{security_group_rules.rb → commands/security_group_rules.rb} +0 -5
- data/lib/morpheus/cli/{security_groups.rb → commands/security_groups.rb} +2 -8
- data/lib/morpheus/cli/{service_catalog_command.rb → commands/service_catalog_command.rb} +0 -0
- data/lib/morpheus/cli/{service_plans_command.rb → commands/service_plans_command.rb} +1 -1
- data/lib/morpheus/cli/commands/{standard/set_prompt_command.rb → set_prompt_command.rb} +0 -3
- data/lib/morpheus/cli/{setup.rb → commands/setup.rb} +1 -1
- data/lib/morpheus/cli/{shell.rb → commands/shell.rb} +4 -105
- data/lib/morpheus/cli/commands/{standard/sleep_command.rb → sleep_command.rb} +0 -2
- data/lib/morpheus/cli/commands/snapshots.rb +139 -0
- data/lib/morpheus/cli/commands/{standard/source_command.rb → source_command.rb} +0 -2
- data/lib/morpheus/cli/commands/{standard/ssl_verification_command.rb → ssl_verification_command.rb} +0 -3
- data/lib/morpheus/cli/{storage_providers_command.rb → commands/storage_providers_command.rb} +0 -4
- data/lib/morpheus/cli/commands/storage_server_types.rb +50 -0
- data/lib/morpheus/cli/commands/storage_servers.rb +122 -0
- data/lib/morpheus/cli/commands/storage_volume_types.rb +50 -0
- data/lib/morpheus/cli/commands/storage_volumes.rb +103 -0
- data/lib/morpheus/cli/{subnets_command.rb → commands/subnets_command.rb} +0 -4
- data/lib/morpheus/cli/{tasks.rb → commands/tasks.rb} +5 -9
- data/lib/morpheus/cli/commands/{standard/tee_command.rb → tee_command.rb} +0 -0
- data/lib/morpheus/cli/{tenants_command.rb → commands/tenants_command.rb} +1 -8
- data/lib/morpheus/cli/commands/{standard/update_command.rb → update_command.rb} +0 -1
- data/lib/morpheus/cli/{usage_command.rb → commands/usage_command.rb} +0 -0
- data/lib/morpheus/cli/{user_groups_command.rb → commands/user_groups_command.rb} +1 -2
- data/lib/morpheus/cli/{user_settings_command.rb → commands/user_settings_command.rb} +3 -2
- data/lib/morpheus/cli/{user_sources_command.rb → commands/user_sources_command.rb} +1 -2
- data/lib/morpheus/cli/{users.rb → commands/users.rb} +28 -35
- data/lib/morpheus/cli/{vdi_allocations_command.rb → commands/vdi_allocations_command.rb} +0 -0
- data/lib/morpheus/cli/{vdi_apps_command.rb → commands/vdi_apps_command.rb} +0 -0
- data/lib/morpheus/cli/{vdi_command.rb → commands/vdi_command.rb} +0 -0
- data/lib/morpheus/cli/{vdi_gateways_command.rb → commands/vdi_gateways_command.rb} +0 -0
- data/lib/morpheus/cli/{vdi_pools_command.rb → commands/vdi_pools_command.rb} +0 -0
- data/lib/morpheus/cli/commands/{standard/version_command.rb → version_command.rb} +0 -0
- data/lib/morpheus/cli/commands/view.rb +102 -0
- data/lib/morpheus/cli/{virtual_images.rb → commands/virtual_images.rb} +4 -5
- data/lib/morpheus/cli/{whitelabel_settings_command.rb → commands/whitelabel_settings_command.rb} +0 -1
- data/lib/morpheus/cli/{whoami.rb → commands/whoami.rb} +0 -4
- data/lib/morpheus/cli/{wiki_command.rb → commands/wiki_command.rb} +0 -5
- data/lib/morpheus/cli/{workflows.rb → commands/workflows.rb} +0 -3
- data/lib/morpheus/cli/mixins/accounts_helper.rb +5 -5
- data/lib/morpheus/cli/mixins/load_balancers_helper.rb +24 -4
- data/lib/morpheus/cli/mixins/logs_helper.rb +1 -1
- data/lib/morpheus/cli/mixins/print_helper.rb +51 -18
- data/lib/morpheus/cli/mixins/processes_helper.rb +1 -2
- data/lib/morpheus/cli/mixins/provisioning_helper.rb +96 -6
- data/lib/morpheus/cli/mixins/rest_command.rb +222 -62
- data/lib/morpheus/cli/mixins/secondary_rest_command.rb +249 -70
- data/lib/morpheus/cli/mixins/storage_servers_helper.rb +156 -0
- data/lib/morpheus/cli/mixins/storage_volumes_helper.rb +119 -0
- data/lib/morpheus/cli/option_types.rb +150 -46
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/cli.rb +5 -135
- data/lib/morpheus/ext/string.rb +29 -6
- data/lib/morpheus/routes.rb +238 -0
- data/lib/morpheus/terminal.rb +5 -6
- data/lib/morpheus/util.rb +6 -1
- metadata +174 -144
- data/lib/morpheus/cli/change_password_command.rb +0 -147
- data/lib/morpheus/cli/library.rb +0 -1
- data/lib/morpheus/cli/load_balancer_pools.rb +0 -111
- data/lib/morpheus/cli/load_balancers.rb +0 -90
- data/lib/morpheus/cli/logout.rb +0 -81
@@ -1,7 +1,3 @@
|
|
1
|
-
require 'io/console'
|
2
|
-
require 'rest_client'
|
3
|
-
require 'optparse'
|
4
|
-
require 'filesize'
|
5
1
|
require 'morpheus/cli/cli_command'
|
6
2
|
|
7
3
|
class Morpheus::Cli::Instances
|
@@ -21,12 +17,14 @@ class Morpheus::Cli::Instances
|
|
21
17
|
:logs, :stats, :stop, :start, :restart, :actions, :action, :suspend, :eject, :stop_service, :start_service, :restart_service,
|
22
18
|
:backup, :backups, :resize, :clone, :envs, :setenv, :delenv,
|
23
19
|
:lock, :unlock, :clone_image,
|
24
|
-
:security_groups, :apply_security_groups, :run_workflow,
|
20
|
+
:security_groups, :apply_security_groups, :run_workflow,
|
21
|
+
:import_snapshot, :snapshot, :snapshots, :revert_to_snapshot, :remove_all_snapshots, :remove_all_container_snapshots, :create_linked_clone,
|
25
22
|
:console, :status_check, {:containers => :list_containers},
|
26
23
|
:scaling, {:'scaling-update' => :scaling_update},
|
27
24
|
:wiki, :update_wiki,
|
28
25
|
{:exec => :execution_request},
|
29
|
-
:deploys
|
26
|
+
:deploys,
|
27
|
+
:refresh, :apply
|
30
28
|
#register_subcommands :firewall_disable, :firewall_enable
|
31
29
|
# register_subcommands {:'lb-update' => :load_balancer_update}
|
32
30
|
alias_subcommand :details, :get
|
@@ -39,7 +37,7 @@ class Morpheus::Cli::Instances
|
|
39
37
|
def connect(opts)
|
40
38
|
@api_client = establish_remote_appliance_connection(opts)
|
41
39
|
@accounts_interface = @api_client.accounts
|
42
|
-
@
|
40
|
+
@account_users_interface = @api_client.account_users
|
43
41
|
@instances_interface = @api_client.instances
|
44
42
|
@task_sets_interface = @api_client.task_sets
|
45
43
|
@logs_interface = @api_client.logs
|
@@ -55,6 +53,7 @@ class Morpheus::Cli::Instances
|
|
55
53
|
@execution_request_interface = @api_client.execution_request
|
56
54
|
@deploy_interface = @api_client.deploy
|
57
55
|
@deployments_interface = @api_client.deployments
|
56
|
+
@snapshots_interface = @api_client.snapshots
|
58
57
|
end
|
59
58
|
|
60
59
|
def handle(args)
|
@@ -81,6 +80,12 @@ class Morpheus::Cli::Instances
|
|
81
80
|
opts.on( '--created-by USER', "Alias for --owner" ) do |val|
|
82
81
|
options[:owner] = val
|
83
82
|
end
|
83
|
+
opts.on('--agent', "Show only Instances with the agent installed" ) do
|
84
|
+
params[:agentInstalled] = true
|
85
|
+
end
|
86
|
+
opts.on('--noagent', "Show only Instances with No agent" ) do
|
87
|
+
params[:agentInstalled] = false
|
88
|
+
end
|
84
89
|
opts.add_hidden_option('--created-by')
|
85
90
|
opts.on('--status STATUS', "Filter by status i.e. provisioning,running,starting,stopping") do |val|
|
86
91
|
params['status'] = (params['status'] || []) + val.to_s.split(',').collect {|s| s.strip }.select {|s| s != "" }
|
@@ -2715,6 +2720,12 @@ class Morpheus::Cli::Instances
|
|
2715
2720
|
payload["volumes"] = volumes
|
2716
2721
|
end
|
2717
2722
|
|
2723
|
+
# plan customizations
|
2724
|
+
plan_opts = prompt_service_plan_options(service_plan, options, @api_client, {}, instance)
|
2725
|
+
if plan_opts && !plan_opts.empty?
|
2726
|
+
payload['servicePlanOptions'] = plan_opts
|
2727
|
+
end
|
2728
|
+
|
2718
2729
|
# only amazon supports this option
|
2719
2730
|
# for now, always do this
|
2720
2731
|
payload["deleteOriginalVolumes"] = true
|
@@ -3358,6 +3369,223 @@ EOT
|
|
3358
3369
|
end
|
3359
3370
|
end
|
3360
3371
|
|
3372
|
+
def revert_to_snapshot(args)
|
3373
|
+
options = {}
|
3374
|
+
instance = nil
|
3375
|
+
snapshot_id = nil
|
3376
|
+
|
3377
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
3378
|
+
opts.banner = subcommand_usage("[instance]")
|
3379
|
+
opts.on("--snapshot ID", String, "Optional snapshot") do |val|
|
3380
|
+
snapshot_id = val
|
3381
|
+
end
|
3382
|
+
build_common_options(opts, options, [:auto_confirm, :json, :dry_run, :remote])
|
3383
|
+
build_standard_add_options(opts, options) #, [:options, :payload, :json, :dry_run, :remote, :quiet])
|
3384
|
+
opts.footer = "Revert an Instance to saved Snapshot previously made." + "\n" +
|
3385
|
+
"[snapshotId] is required. This is the id of the snapshot to replace the current instance."
|
3386
|
+
end
|
3387
|
+
|
3388
|
+
optparse.parse!(args)
|
3389
|
+
if args.count != 1
|
3390
|
+
raise_command_error "wrong number of arguments, expected 1 and got (#{args.count}) #{args.join(' ')}\n#{optparse}"
|
3391
|
+
end
|
3392
|
+
connect(options)
|
3393
|
+
begin
|
3394
|
+
instance = find_instance_by_name_or_id(args[0])
|
3395
|
+
unless options[:yes] || ::Morpheus::Cli::OptionTypes::confirm("Are you sure you would like to revert instance '#{instance['name']}'?", options)
|
3396
|
+
exit 1
|
3397
|
+
end
|
3398
|
+
options[:options]['instanceId'] = instance['id']
|
3399
|
+
begin
|
3400
|
+
snapshot_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'snapshotId', 'type' => 'select', 'fieldLabel' => 'Snapshot', 'optionSource' => 'instanceSnapshots', 'required' => true, 'description' => 'Select Snapshot.'}], {}, @api_client, options[:options])
|
3401
|
+
|
3402
|
+
if !snapshot_prompt['snapshotId'].to_s.empty?
|
3403
|
+
snapshot_id = snapshot_prompt['snapshotId']
|
3404
|
+
end
|
3405
|
+
rescue RestClient::Exception => e
|
3406
|
+
puts "Failed to load instance snapshots"
|
3407
|
+
end
|
3408
|
+
|
3409
|
+
@instances_interface.setopts(options)
|
3410
|
+
|
3411
|
+
payload = {}
|
3412
|
+
if options[:dry_run]
|
3413
|
+
print_dry_run @instances_interface.dry.revert_to_snapshot(instance['id'], snapshot_id, payload)
|
3414
|
+
return
|
3415
|
+
end
|
3416
|
+
|
3417
|
+
json_response = @instances_interface.revert_to_snapshot(instance['id'], snapshot_id, payload)
|
3418
|
+
if options[:json]
|
3419
|
+
puts as_json(json_response, options)
|
3420
|
+
else
|
3421
|
+
print_green_success "Snapshot revert initiated."
|
3422
|
+
end
|
3423
|
+
return 0
|
3424
|
+
|
3425
|
+
rescue RestClient::Exception => e
|
3426
|
+
print_rest_exception(e, options)
|
3427
|
+
exit 1
|
3428
|
+
end
|
3429
|
+
end
|
3430
|
+
|
3431
|
+
def remove_all_container_snapshots(args)
|
3432
|
+
options = {}
|
3433
|
+
instance = nil
|
3434
|
+
container_id = nil
|
3435
|
+
|
3436
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
3437
|
+
opts.banner = subcommand_usage("[instance]")
|
3438
|
+
opts.on("--container ID", String, "Required container") do |val|
|
3439
|
+
container_id = val
|
3440
|
+
end
|
3441
|
+
build_common_options(opts, options, [:auto_confirm, :json, :dry_run, :remote])
|
3442
|
+
opts.footer = "Remove all snapshots attached to an instances container." + "\n" +
|
3443
|
+
"[containerId] is required. This is the id of the container which removes all attached snapshots."
|
3444
|
+
end
|
3445
|
+
|
3446
|
+
optparse.parse!(args)
|
3447
|
+
if args.count != 1
|
3448
|
+
raise_command_error "wrong number of arguments, expected 1 and got (#{args.count}) #{args.join(' ')}\n#{optparse}"
|
3449
|
+
end
|
3450
|
+
connect(options)
|
3451
|
+
begin
|
3452
|
+
instance = find_instance_by_name_or_id(args[0])
|
3453
|
+
unless options[:yes] || ::Morpheus::Cli::OptionTypes::confirm("Are you sure you would like to remove all snapshots for a container?", options)
|
3454
|
+
exit 1
|
3455
|
+
end
|
3456
|
+
options[:options]['instanceId'] = instance['id']
|
3457
|
+
begin
|
3458
|
+
container_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'containerId', 'type' => 'select', 'fieldLabel' => 'Container', 'optionSource' => 'instanceContainers', 'required' => true, 'description' => 'Select Container.'}], {}, @api_client, options[:options])
|
3459
|
+
|
3460
|
+
if !container_prompt['containerId'].to_s.empty?
|
3461
|
+
container_id = container_prompt['containerId']
|
3462
|
+
end
|
3463
|
+
rescue RestClient::Exception => e
|
3464
|
+
puts "Failed to load instance containers"
|
3465
|
+
end
|
3466
|
+
|
3467
|
+
@instances_interface.setopts(options)
|
3468
|
+
|
3469
|
+
payload = {}
|
3470
|
+
if options[:dry_run]
|
3471
|
+
print_dry_run @instances_interface.dry.remove_all_container_snapshots(instance['id'], container_id, payload)
|
3472
|
+
return
|
3473
|
+
end
|
3474
|
+
|
3475
|
+
json_response = @instances_interface.remove_all_container_snapshots(instance['id'], container_id, payload)
|
3476
|
+
if options[:json]
|
3477
|
+
puts as_json(json_response, options)
|
3478
|
+
else
|
3479
|
+
print_green_success "Snapshot delete initiated."
|
3480
|
+
end
|
3481
|
+
return 0
|
3482
|
+
|
3483
|
+
rescue RestClient::Exception => e
|
3484
|
+
print_rest_exception(e, options)
|
3485
|
+
exit 1
|
3486
|
+
end
|
3487
|
+
end
|
3488
|
+
|
3489
|
+
def remove_all_snapshots(args)
|
3490
|
+
options = {}
|
3491
|
+
instance = nil
|
3492
|
+
|
3493
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
3494
|
+
opts.banner = subcommand_usage("[instance]")
|
3495
|
+
build_common_options(opts, options, [:auto_confirm, :json, :dry_run, :remote])
|
3496
|
+
opts.footer = "Remove all snapshots attached to an instance." + "\n" +
|
3497
|
+
"Warning: This will remove all snapshots across all containers of an instance."
|
3498
|
+
end
|
3499
|
+
|
3500
|
+
optparse.parse!(args)
|
3501
|
+
if args.count != 1
|
3502
|
+
raise_command_error "wrong number of arguments, expected 1 and got (#{args.count}) #{args.join(' ')}\n#{optparse}"
|
3503
|
+
end
|
3504
|
+
connect(options)
|
3505
|
+
begin
|
3506
|
+
instance = find_instance_by_name_or_id(args[0])
|
3507
|
+
unless options[:yes] || ::Morpheus::Cli::OptionTypes::confirm("Are you sure you would like to remove all snapshots for this instance?", options)
|
3508
|
+
exit 1
|
3509
|
+
end
|
3510
|
+
options[:options]['instanceId'] = instance['id']
|
3511
|
+
|
3512
|
+
@instances_interface.setopts(options)
|
3513
|
+
|
3514
|
+
payload = {}
|
3515
|
+
if options[:dry_run]
|
3516
|
+
print_dry_run @instances_interface.dry.remove_all_instance_snapshots(instance['id'], payload)
|
3517
|
+
return
|
3518
|
+
end
|
3519
|
+
|
3520
|
+
json_response = @instances_interface.remove_all_instance_snapshots(instance['id'], payload)
|
3521
|
+
if options[:json]
|
3522
|
+
puts as_json(json_response, options)
|
3523
|
+
else
|
3524
|
+
print_green_success "Snapshots attaced to instance #{instance['name']} queued for deletion."
|
3525
|
+
end
|
3526
|
+
return 0
|
3527
|
+
|
3528
|
+
rescue RestClient::Exception => e
|
3529
|
+
print_rest_exception(e, options)
|
3530
|
+
exit 1
|
3531
|
+
end
|
3532
|
+
end
|
3533
|
+
|
3534
|
+
def create_linked_clone(args)
|
3535
|
+
options = {}
|
3536
|
+
instance = nil
|
3537
|
+
snapshot_id = nil
|
3538
|
+
|
3539
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
3540
|
+
opts.banner = subcommand_usage("[instance]")
|
3541
|
+
opts.on("--snapshot ID", String, "Optional snapshot") do |val|
|
3542
|
+
snapshot_id = val
|
3543
|
+
end
|
3544
|
+
build_common_options(opts, options, [:auto_confirm, :json, :dry_run, :remote])
|
3545
|
+
opts.footer = "Create a linked clone using the selected snapshot of an Instance." + "\n" +
|
3546
|
+
"[snapshotId] is required. This is the id of the snapshot which the clone will refer to."
|
3547
|
+
end
|
3548
|
+
|
3549
|
+
optparse.parse!(args)
|
3550
|
+
if args.count != 1
|
3551
|
+
raise_command_error "wrong number of arguments, expected 1 and got (#{args.count}) #{args.join(' ')}\n#{optparse}"
|
3552
|
+
end
|
3553
|
+
connect(options)
|
3554
|
+
begin
|
3555
|
+
instance = find_instance_by_name_or_id(args[0])
|
3556
|
+
options[:options]['instanceId'] = instance['id']
|
3557
|
+
begin
|
3558
|
+
snapshot_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'snapshotId', 'type' => 'select', 'fieldLabel' => 'Snapshot', 'optionSource' => 'instanceSnapshots', 'required' => true, 'description' => 'Select Snapshot.'}], {}, @api_client, options[:options])
|
3559
|
+
|
3560
|
+
if !snapshot_prompt['snapshotId'].to_s.empty?
|
3561
|
+
snapshot_id = snapshot_prompt['snapshotId']
|
3562
|
+
end
|
3563
|
+
rescue RestClient::Exception => e
|
3564
|
+
puts "Failed to load instance snapshots"
|
3565
|
+
end
|
3566
|
+
|
3567
|
+
@instances_interface.setopts(options)
|
3568
|
+
|
3569
|
+
payload = {}
|
3570
|
+
if options[:dry_run]
|
3571
|
+
print_dry_run @instances_interface.dry.create_linked_clone(instance['id'], snapshot_id, payload)
|
3572
|
+
return
|
3573
|
+
end
|
3574
|
+
|
3575
|
+
json_response = @instances_interface.create_linked_clone(instance['id'], snapshot_id, payload)
|
3576
|
+
if options[:json]
|
3577
|
+
puts as_json(json_response, options)
|
3578
|
+
else
|
3579
|
+
print_green_success "Linked Clone creation initiated."
|
3580
|
+
end
|
3581
|
+
return 0
|
3582
|
+
|
3583
|
+
rescue RestClient::Exception => e
|
3584
|
+
print_rest_exception(e, options)
|
3585
|
+
exit 1
|
3586
|
+
end
|
3587
|
+
end
|
3588
|
+
|
3361
3589
|
|
3362
3590
|
def scaling(args)
|
3363
3591
|
options = {}
|
@@ -4130,6 +4358,9 @@ EOT
|
|
4130
4358
|
opts.on( '--name VALUE', String, "Image Name (Template Name). Default is server name + timestamp" ) do |val|
|
4131
4359
|
options[:options]['templateName'] = val
|
4132
4360
|
end
|
4361
|
+
opts.on( '--folder VALUE', String, "Folder externalId or '/' to use the root folder" ) do |val|
|
4362
|
+
options[:options]['zoneFolder'] = val
|
4363
|
+
end
|
4133
4364
|
build_standard_update_options(opts, options)
|
4134
4365
|
opts.footer = <<-EOT
|
4135
4366
|
Clone to image (template) for an instance
|
@@ -4141,6 +4372,18 @@ EOT
|
|
4141
4372
|
connect(options)
|
4142
4373
|
instance = find_instance_by_name_or_id(args[0])
|
4143
4374
|
return 1 if instance.nil?
|
4375
|
+
# need to GET provision type for hasFolders
|
4376
|
+
provision_type_code = instance['layout']['provisionTypeCode'] rescue nil
|
4377
|
+
provision_type = nil
|
4378
|
+
if provision_type_code
|
4379
|
+
provision_type = provision_types_interface.list({code:provision_type_code})['provisionTypes'][0]
|
4380
|
+
if provision_type.nil?
|
4381
|
+
print_red_alert "Provision Type not found by code #{provision_type_code}"
|
4382
|
+
exit 1
|
4383
|
+
end
|
4384
|
+
else
|
4385
|
+
provision_type = get_provision_type_for_zone_type(cloud['zoneType']['id'])
|
4386
|
+
end
|
4144
4387
|
payload = {}
|
4145
4388
|
if options[:payload]
|
4146
4389
|
payload = options[:payload]
|
@@ -4153,6 +4396,15 @@ EOT
|
|
4153
4396
|
payload['templateName'] = v_prompt['templateName']
|
4154
4397
|
end
|
4155
4398
|
end
|
4399
|
+
#if instance['layout']['provisionTypeCode'] == 'vmware'
|
4400
|
+
if provision_type && provision_type["hasFolders"]
|
4401
|
+
if payload['zoneFolder'].nil?
|
4402
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'zoneFolder', 'type' => 'select', 'optionSource' => 'vmwareFolders', 'fieldLabel' => 'Folder', 'description' => "Folder externalId or '/' to use the root folder", 'required' => true}], options[:options], @api_client, {siteId: instance['group']['id'], zoneId: instance['cloud']['id']})
|
4403
|
+
if v_prompt['zoneFolder'].to_s != ''
|
4404
|
+
payload['zoneFolder'] = v_prompt['zoneFolder']
|
4405
|
+
end
|
4406
|
+
end
|
4407
|
+
end
|
4156
4408
|
end
|
4157
4409
|
@instances_interface.setopts(options)
|
4158
4410
|
if options[:dry_run]
|
@@ -4234,6 +4486,106 @@ EOT
|
|
4234
4486
|
return 0, nil
|
4235
4487
|
end
|
4236
4488
|
|
4489
|
+
def refresh(args)
|
4490
|
+
params, payload, options = {}, {}, {}
|
4491
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
4492
|
+
opts.banner = subcommand_usage("[instance] [options]")
|
4493
|
+
build_standard_update_options(opts, options, [:auto_confirm])
|
4494
|
+
opts.footer = <<-EOT
|
4495
|
+
Refresh an instance.
|
4496
|
+
[instance] is required. This is the name or id of an instance.
|
4497
|
+
This is only supported by certain types of instances such as terraform.
|
4498
|
+
EOT
|
4499
|
+
end
|
4500
|
+
optparse.parse!(args)
|
4501
|
+
verify_args!(args:args, optparse:optparse, count:1)
|
4502
|
+
connect(options)
|
4503
|
+
|
4504
|
+
begin
|
4505
|
+
instance = find_instance_by_name_or_id(args[0])
|
4506
|
+
return 1 if instance.nil?
|
4507
|
+
# construct request
|
4508
|
+
params.merge!(parse_query_options(options))
|
4509
|
+
payload = {}
|
4510
|
+
if options[:payload]
|
4511
|
+
payload = options[:payload]
|
4512
|
+
payload.deep_merge!(parse_passed_options(options))
|
4513
|
+
else
|
4514
|
+
payload.deep_merge!(parse_passed_options(options))
|
4515
|
+
# raise_command_error "Specify at least one option to update.\n#{optparse}" if payload.empty?
|
4516
|
+
end
|
4517
|
+
unless options[:yes] || Morpheus::Cli::OptionTypes.confirm("Are you sure you want to refresh this instance: #{instance['name']}?")
|
4518
|
+
return 9, "aborted command"
|
4519
|
+
end
|
4520
|
+
@instances_interface.setopts(options)
|
4521
|
+
if options[:dry_run]
|
4522
|
+
print_dry_run @instances_interface.dry.refresh(instance["id"], params, payload)
|
4523
|
+
return
|
4524
|
+
end
|
4525
|
+
json_response = @instances_interface.refresh(instance["id"], params, payload)
|
4526
|
+
render_response(json_response, options) do
|
4527
|
+
print_green_success "Refreshing instance #{instance['name']}"
|
4528
|
+
# return _get(instance['id'], options)
|
4529
|
+
end
|
4530
|
+
return 0, nil
|
4531
|
+
rescue RestClient::Exception => e
|
4532
|
+
print_rest_exception(e, options)
|
4533
|
+
exit 1
|
4534
|
+
end
|
4535
|
+
end
|
4536
|
+
|
4537
|
+
def apply(args)
|
4538
|
+
params, payload, options = {}, {}, {}
|
4539
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
4540
|
+
opts.banner = subcommand_usage("[instance] [options]")
|
4541
|
+
build_standard_update_options(opts, options, [:auto_confirm])
|
4542
|
+
opts.footer = <<-EOT
|
4543
|
+
Apply an instance.
|
4544
|
+
[instance] is required. This is the name or id of an instance.
|
4545
|
+
This is only supported by certain types of instances such as terraform.
|
4546
|
+
EOT
|
4547
|
+
end
|
4548
|
+
optparse.parse!(args)
|
4549
|
+
verify_args!(args:args, optparse:optparse, count:1)
|
4550
|
+
connect(options)
|
4551
|
+
|
4552
|
+
begin
|
4553
|
+
instance = find_instance_by_name_or_id(args[0])
|
4554
|
+
return 1 if instance.nil?
|
4555
|
+
# construct request
|
4556
|
+
params.merge!(parse_query_options(options))
|
4557
|
+
payload = {}
|
4558
|
+
if options[:payload]
|
4559
|
+
payload = options[:payload]
|
4560
|
+
payload.deep_merge!(parse_passed_options(options))
|
4561
|
+
else
|
4562
|
+
payload.deep_merge!(parse_passed_options(options))
|
4563
|
+
# raise_command_error "Specify at least one option to update.\n#{optparse}" if payload.empty?
|
4564
|
+
end
|
4565
|
+
unless options[:yes] || Morpheus::Cli::OptionTypes.confirm("Are you sure you want to apply this instance: #{instance['name']}?")
|
4566
|
+
return 9, "aborted command"
|
4567
|
+
end
|
4568
|
+
@instances_interface.setopts(options)
|
4569
|
+
if options[:dry_run]
|
4570
|
+
print_dry_run @instances_interface.dry.apply(instance["id"], params, payload)
|
4571
|
+
return
|
4572
|
+
end
|
4573
|
+
json_response = @instances_interface.apply(instance["id"], params, payload)
|
4574
|
+
render_response(json_response, options) do
|
4575
|
+
print_green_success "Applying instance #{instance['name']}"
|
4576
|
+
# return _get(instance['id'], options)
|
4577
|
+
end
|
4578
|
+
return 0, nil
|
4579
|
+
rescue RestClient::Exception => e
|
4580
|
+
print_rest_exception(e, options)
|
4581
|
+
exit 1
|
4582
|
+
end
|
4583
|
+
end
|
4584
|
+
|
4585
|
+
# todo: print state summary
|
4586
|
+
def state_summary(args)
|
4587
|
+
end
|
4588
|
+
|
4237
4589
|
private
|
4238
4590
|
|
4239
4591
|
def find_zone_by_name_or_id(group_id, val)
|
@@ -1122,19 +1122,8 @@ EOT
|
|
1122
1122
|
|
1123
1123
|
def add_integration_object_option_types
|
1124
1124
|
[
|
1125
|
-
{'code' => 'integrationObject.type', 'shorthand' => '-t', 'switch' => 'type', 'fieldName' => 'type', 'fieldLabel' => 'Type', 'type' => 'select', 'optionSource' => 'integrationObjectTypes', 'required' => true, 'description' => "Integration Object Type eg.
|
1125
|
+
{'code' => 'integrationObject.type', 'shorthand' => '-t', 'switch' => 'type', 'fieldName' => 'type', 'fieldLabel' => 'Type', 'type' => 'select', 'optionSource' => 'integrationObjectTypes', 'required' => true, 'description' => "Integration Object Type eg. catalog", 'displayOrder' => 1},
|
1126
1126
|
# {'fieldName' => 'name', 'fieldLabel' => 'Name', 'type' => 'text', 'required' => false, 'description' => 'Display Name of the integration object, default is the name of the referenced object', 'displayOrder' => 2},
|
1127
|
-
{'dependsOnCode' => 'integrationObject.type:cloud', 'switch' => 'group', 'fieldName' => 'group', 'fieldLabel' => 'Group', 'type' => 'select', 'optionSource' => 'groups', 'required' => true, 'description' => 'Group', 'displayOrder' => 3},
|
1128
|
-
{'dependsOnCode' => 'integrationObject.type:cloud', 'switch' => 'cloud', 'fieldName' => 'cloud', 'fieldLabel' => 'Cloud', 'type' => 'select', 'optionSource' => 'clouds', 'required' => true, 'description' => 'Cloud', 'displayOrder' => 4},
|
1129
|
-
{'dependsOnCode' => 'integrationObject.type:layout', 'switch' => 'instance-type', 'fieldName' => 'instanceType', 'fieldLabel' => 'Instance Type', 'type' => 'select', 'optionSource' => 'instanceTypes', 'required' => true, 'description' => 'Instance Type', 'displayOrder' => 5},
|
1130
|
-
{'dependsOnCode' => 'integrationObject.type:layout', 'switch' => 'technology', 'fieldName' => 'zoneType', 'fieldLabel' => 'Cloud Type', 'type' => 'select', 'optionSource' => 'zoneTypes', 'required' => true, 'description' => 'Cloud Type (Technology)', 'displayOrder' => 5},
|
1131
|
-
{'dependsOnCode' => 'integrationObject.type:layout', 'switch' => 'layout', 'fieldName' => 'layout', 'fieldLabel' => 'Layout', 'type' => 'select', 'optionSource' => 'layouts', 'required' => true, 'description' => 'Layout', 'displayOrder' => 6},
|
1132
|
-
{'dependsOnCode' => 'integrationObject.type:blueprint', 'fieldName' => 'name', 'fieldLabel' => 'Catalog Item Name', 'type' => 'text', 'required' => true, 'description' => 'Display Name of the integration object', 'displayOrder' => 7},
|
1133
|
-
{'dependsOnCode' => 'integrationObject.type:blueprint', 'switch' => 'blueprint', 'fieldName' => 'blueprint', 'fieldLabel' => 'Blueprint', 'type' => 'select', 'optionSource' => 'blueprints', 'required' => true, 'description' => 'Blueprint', 'displayOrder' => 8, 'noParams' => true},
|
1134
|
-
{'dependsOnCode' => 'integrationObject.type:blueprint', 'switch' => 'group', 'fieldName' => 'group', 'fieldLabel' => 'Group', 'type' => 'select', 'optionSource' => 'groups', 'required' => true, 'description' => 'Group', 'displayOrder' => 9},
|
1135
|
-
{'dependsOnCode' => 'integrationObject.type:blueprint', 'switch' => 'default-cloud', 'fieldName' => 'defaultCloud', 'fieldLabel' => 'Default Cloud', 'type' => 'select', 'optionSource' => 'clouds', 'required' => false, 'description' => 'Default Cloud', 'displayOrder' => 10},
|
1136
|
-
{'dependsOnCode' => 'integrationObject.type:blueprint', 'switch' => 'environment', 'fieldName' => 'environment', 'fieldLabel' => 'Environment', 'type' => 'select', 'optionSource' => 'environments', 'required' => false, 'description' => 'Environment', 'displayOrder' => 11},
|
1137
|
-
{'dependsOnCode' => 'integrationObject.type:blueprint', 'switch' => 'config', 'fieldName' => 'config', 'fieldLabel' => 'Config', 'type' => 'code-editor', 'required' => true, 'description' => 'Config JSON', 'displayOrder' => 12},
|
1138
1127
|
{'dependsOnCode' => 'integrationObject.type:catalog', 'switch' => 'catalog', 'fieldName' => 'catalog', 'fieldLabel' => 'Catalog Item', 'type' => 'select', 'optionSource' => 'catalogItemTypes', 'required' => true, 'description' => 'Catalog Item', 'displayOrder' => 13},
|
1139
1128
|
]
|
1140
1129
|
end
|
File without changes
|
@@ -1,10 +1,4 @@
|
|
1
|
-
require 'io/console'
|
2
|
-
require 'rest_client'
|
3
|
-
require 'optparse'
|
4
1
|
require 'morpheus/cli/cli_command'
|
5
|
-
require 'morpheus/cli/option_types'
|
6
|
-
require 'morpheus/cli/mixins/accounts_helper'
|
7
|
-
require 'json'
|
8
2
|
|
9
3
|
class Morpheus::Cli::KeyPairs
|
10
4
|
include Morpheus::Cli::CliCommand
|
File without changes
|
@@ -1,8 +1,4 @@
|
|
1
|
-
require 'io/console'
|
2
|
-
require 'optparse'
|
3
|
-
require 'filesize'
|
4
1
|
require 'morpheus/cli/cli_command'
|
5
|
-
require 'morpheus/cli/mixins/library_helper'
|
6
2
|
|
7
3
|
class Morpheus::Cli::LibraryInstanceTypesCommand
|
8
4
|
include Morpheus::Cli::CliCommand
|
@@ -43,6 +39,9 @@ class Morpheus::Cli::LibraryInstanceTypesCommand
|
|
43
39
|
opts.on('--technology VALUE', String, "Filter by technology") do |val|
|
44
40
|
params['provisionTypeCode'] = val
|
45
41
|
end
|
42
|
+
opts.on('--featured [true|false]',String, "Filter by featured.") do |val|
|
43
|
+
params['featured'] = (val.to_s.downcase != 'false' && val.to_s.downcase != 'off')
|
44
|
+
end
|
46
45
|
build_common_options(opts, options, [:list, :query, :json, :yaml, :csv, :fields, :dry_run, :remote])
|
47
46
|
opts.footer = "List instance types."
|
48
47
|
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'morpheus/cli/cli_command'
|
2
|
+
|
3
|
+
class Morpheus::Cli::LoadBalancerMonitors
|
4
|
+
include Morpheus::Cli::CliCommand
|
5
|
+
include Morpheus::Cli::RestCommand
|
6
|
+
include Morpheus::Cli::SecondaryRestCommand
|
7
|
+
include Morpheus::Cli::LoadBalancersHelper
|
8
|
+
|
9
|
+
set_command_description "View and manage load balancer monitors."
|
10
|
+
set_command_name :'load-balancer-monitors'
|
11
|
+
register_subcommands :list, :get, :add, :update, :remove
|
12
|
+
register_interfaces :load_balancer_monitors,
|
13
|
+
:load_balancers, :load_balancer_types
|
14
|
+
|
15
|
+
set_rest_parent_name :load_balancers
|
16
|
+
|
17
|
+
# set_rest_interface_name :load_balancer_monitors
|
18
|
+
# set_parent_rest_interface_name :load_balancers
|
19
|
+
|
20
|
+
# todo: a configurable way to load the optionTypes
|
21
|
+
# option_types = loadBalancer['monitorOptionTypes']
|
22
|
+
# set_rest_has_type true
|
23
|
+
# set_rest_type :load_balancer_virtual_server_types
|
24
|
+
|
25
|
+
protected
|
26
|
+
|
27
|
+
def load_balancer_monitor_list_column_definitions(options)
|
28
|
+
{
|
29
|
+
"ID" => 'id',
|
30
|
+
"Name" => 'name',
|
31
|
+
"Monitor Type" => lambda {|it| it['monitorTypeDisplay'] || it['monitorType'] },
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
def load_balancer_monitor_column_definitions(options)
|
36
|
+
{
|
37
|
+
"ID" => 'id',
|
38
|
+
"Name" => 'name',
|
39
|
+
"Load Balancer" => lambda {|it| it['loadBalancer'] ? it['loadBalancer']['name'] : '' },
|
40
|
+
"Description" => 'description',
|
41
|
+
"Monitor Type" => lambda {|it| it['monitorTypeDisplay'] || it['monitorType'] },
|
42
|
+
"Created" => lambda {|it| format_local_dt(it['dateCreated']) },
|
43
|
+
"Updated" => lambda {|it| format_local_dt(it['lastUpdated']) }
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
def load_balancer_monitor_object_key
|
48
|
+
'loadBalancerMonitor'
|
49
|
+
end
|
50
|
+
|
51
|
+
def load_balancer_monitor_list_key
|
52
|
+
'loadBalancerMonitors'
|
53
|
+
end
|
54
|
+
|
55
|
+
def load_balancer_monitor_label
|
56
|
+
'Load Balancer Monitor'
|
57
|
+
end
|
58
|
+
|
59
|
+
def load_balancer_monitor_label_plural
|
60
|
+
'Load Balancer Monitors'
|
61
|
+
end
|
62
|
+
|
63
|
+
def load_option_types_for_load_balancer_monitor(type_record, parent_record)
|
64
|
+
load_balancer = parent_record
|
65
|
+
load_balancer_type_id = load_balancer['type']['id']
|
66
|
+
load_balancer_type = find_by_id(:load_balancer_type, load_balancer_type_id)
|
67
|
+
load_balancer_type['monitorOptionTypes']
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|