mtncloud-cli 1.0.0
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 +7 -0
- data/.dockerignore +20 -0
- data/.github/pull_request_template.md +14 -0
- data/.github/workflows/ci.yml +56 -0
- data/.github/workflows/release.yml +46 -0
- data/.gitignore +25 -0
- data/CLAUDE.md +24 -0
- data/CONTRIBUTING.md +91 -0
- data/Dockerfile +19 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +23 -0
- data/README.md +187 -0
- data/Rakefile +26 -0
- data/bin/mcs +3 -0
- data/bin/mtncloud +27 -0
- data/lib/mtncloud/api/account_groups_interface.rb +48 -0
- data/lib/mtncloud/api/account_users_interface.rb +68 -0
- data/lib/mtncloud/api/accounts_interface.rb +9 -0
- data/lib/mtncloud/api/activity_interface.rb +9 -0
- data/lib/mtncloud/api/affinity_groups_interface.rb +46 -0
- data/lib/mtncloud/api/api_client.rb +1091 -0
- data/lib/mtncloud/api/appliance_settings_interface.rb +49 -0
- data/lib/mtncloud/api/approvals_interface.rb +32 -0
- data/lib/mtncloud/api/apps_interface.rb +180 -0
- data/lib/mtncloud/api/archive_buckets_interface.rb +116 -0
- data/lib/mtncloud/api/archive_files_interface.rb +173 -0
- data/lib/mtncloud/api/audit_interface.rb +9 -0
- data/lib/mtncloud/api/auth_interface.rb +58 -0
- data/lib/mtncloud/api/backup_jobs_interface.rb +13 -0
- data/lib/mtncloud/api/backup_restores_interface.rb +27 -0
- data/lib/mtncloud/api/backup_results_interface.rb +32 -0
- data/lib/mtncloud/api/backup_service_types_interface.rb +9 -0
- data/lib/mtncloud/api/backup_services_interface.rb +9 -0
- data/lib/mtncloud/api/backup_settings_interface.rb +20 -0
- data/lib/mtncloud/api/backup_types_interface.rb +9 -0
- data/lib/mtncloud/api/backups_interface.rb +21 -0
- data/lib/mtncloud/api/billing_interface.rb +34 -0
- data/lib/mtncloud/api/blueprints_interface.rb +70 -0
- data/lib/mtncloud/api/body_io.rb +22 -0
- data/lib/mtncloud/api/budgets_interface.rb +48 -0
- data/lib/mtncloud/api/catalog_item_types_interface.rb +29 -0
- data/lib/mtncloud/api/certificate_types_interface.rb +14 -0
- data/lib/mtncloud/api/certificates_interface.rb +9 -0
- data/lib/mtncloud/api/clients_interface.rb +41 -0
- data/lib/mtncloud/api/cloud_datastores_interface.rb +48 -0
- data/lib/mtncloud/api/cloud_folders_interface.rb +41 -0
- data/lib/mtncloud/api/cloud_policies_interface.rb +41 -0
- data/lib/mtncloud/api/cloud_resource_pools_interface.rb +66 -0
- data/lib/mtncloud/api/clouds_interface.rb +217 -0
- data/lib/mtncloud/api/clusters_interface.rb +471 -0
- data/lib/mtncloud/api/containers_interface.rb +145 -0
- data/lib/mtncloud/api/credential_types_interface.rb +9 -0
- data/lib/mtncloud/api/credentials_interface.rb +9 -0
- data/lib/mtncloud/api/custom_instance_types_interface.rb +99 -0
- data/lib/mtncloud/api/cypher_interface.rb +51 -0
- data/lib/mtncloud/api/dashboard_interface.rb +14 -0
- data/lib/mtncloud/api/datastores_interface.rb +21 -0
- data/lib/mtncloud/api/deploy_interface.rb +44 -0
- data/lib/mtncloud/api/deployments_interface.rb +79 -0
- data/lib/mtncloud/api/distributed_workers_interface.rb +41 -0
- data/lib/mtncloud/api/email_templates_interface.rb +53 -0
- data/lib/mtncloud/api/environments_interface.rb +48 -0
- data/lib/mtncloud/api/execute_schedules_interface.rb +71 -0
- data/lib/mtncloud/api/execution_request_interface.rb +27 -0
- data/lib/mtncloud/api/file_copy_request_interface.rb +68 -0
- data/lib/mtncloud/api/forgot_password_interface.rb +17 -0
- data/lib/mtncloud/api/group_policies_interface.rb +41 -0
- data/lib/mtncloud/api/groups_interface.rb +73 -0
- data/lib/mtncloud/api/guidance_interface.rb +44 -0
- data/lib/mtncloud/api/guidance_settings_interface.rb +17 -0
- data/lib/mtncloud/api/health_interface.rb +100 -0
- data/lib/mtncloud/api/host_vm_groups_interface.rb +37 -0
- data/lib/mtncloud/api/hub_interface.rb +25 -0
- data/lib/mtncloud/api/image_builder_boot_scripts_interface.rb +41 -0
- data/lib/mtncloud/api/image_builder_image_builds_interface.rb +73 -0
- data/lib/mtncloud/api/image_builder_interface.rb +20 -0
- data/lib/mtncloud/api/image_builder_preseed_scripts_interface.rb +41 -0
- data/lib/mtncloud/api/instance_types_interface.rb +20 -0
- data/lib/mtncloud/api/instances_interface.rb +453 -0
- data/lib/mtncloud/api/integration_types_interface.rb +14 -0
- data/lib/mtncloud/api/integrations_interface.rb +74 -0
- data/lib/mtncloud/api/invoice_line_items_interface.rb +9 -0
- data/lib/mtncloud/api/invoices_interface.rb +28 -0
- data/lib/mtncloud/api/jobs_interface.rb +83 -0
- data/lib/mtncloud/api/key_pairs_interface.rb +57 -0
- data/lib/mtncloud/api/library_cluster_layouts_interface.rb +47 -0
- data/lib/mtncloud/api/library_cluster_packages_interface.rb +60 -0
- data/lib/mtncloud/api/library_container_scripts_interface.rb +43 -0
- data/lib/mtncloud/api/library_container_templates_interface.rb +43 -0
- data/lib/mtncloud/api/library_container_types_interface.rb +59 -0
- data/lib/mtncloud/api/library_container_upgrades_interface.rb +60 -0
- data/lib/mtncloud/api/library_instance_types_interface.rb +74 -0
- data/lib/mtncloud/api/library_layouts_interface.rb +69 -0
- data/lib/mtncloud/api/library_operating_systems_interface.rb +63 -0
- data/lib/mtncloud/api/library_spec_template_types_interface.rb +43 -0
- data/lib/mtncloud/api/library_spec_templates_interface.rb +43 -0
- data/lib/mtncloud/api/license_interface.rb +30 -0
- data/lib/mtncloud/api/load_balancer_monitors_interface.rb +9 -0
- data/lib/mtncloud/api/load_balancer_pool_nodes_interface.rb +8 -0
- data/lib/mtncloud/api/load_balancer_pools_interface.rb +9 -0
- data/lib/mtncloud/api/load_balancer_pools_secondary_interface.rb +9 -0
- data/lib/mtncloud/api/load_balancer_profiles_interface.rb +9 -0
- data/lib/mtncloud/api/load_balancer_types_interface.rb +9 -0
- data/lib/mtncloud/api/load_balancer_virtual_servers_interface.rb +18 -0
- data/lib/mtncloud/api/load_balancers_interface.rb +14 -0
- data/lib/mtncloud/api/log_settings_interface.rb +44 -0
- data/lib/mtncloud/api/logs_interface.rb +37 -0
- data/lib/mtncloud/api/migrations_interface.rb +49 -0
- data/lib/mtncloud/api/monitoring_alerts_interface.rb +39 -0
- data/lib/mtncloud/api/monitoring_apps_interface.rb +69 -0
- data/lib/mtncloud/api/monitoring_checks_interface.rb +103 -0
- data/lib/mtncloud/api/monitoring_contacts_interface.rb +41 -0
- data/lib/mtncloud/api/monitoring_groups_interface.rb +77 -0
- data/lib/mtncloud/api/monitoring_incidents_interface.rb +107 -0
- data/lib/mtncloud/api/monitoring_interface.rb +35 -0
- data/lib/mtncloud/api/monitoring_settings_interface.rb +21 -0
- data/lib/mtncloud/api/network_dhcp_relays_interface.rb +36 -0
- data/lib/mtncloud/api/network_dhcp_servers_interface.rb +36 -0
- data/lib/mtncloud/api/network_domain_records_interface.rb +41 -0
- data/lib/mtncloud/api/network_domains_interface.rb +41 -0
- data/lib/mtncloud/api/network_edge_clusters_interface.rb +26 -0
- data/lib/mtncloud/api/network_floating_ips_interface.rb +40 -0
- data/lib/mtncloud/api/network_groups_interface.rb +41 -0
- data/lib/mtncloud/api/network_pool_ips_interface.rb +41 -0
- data/lib/mtncloud/api/network_pool_server_types_interface.rb +9 -0
- data/lib/mtncloud/api/network_pool_servers_interface.rb +48 -0
- data/lib/mtncloud/api/network_pools_interface.rb +41 -0
- data/lib/mtncloud/api/network_proxies_interface.rb +41 -0
- data/lib/mtncloud/api/network_routers_interface.rb +181 -0
- data/lib/mtncloud/api/network_security_server_types_interface.rb +9 -0
- data/lib/mtncloud/api/network_security_servers_interface.rb +27 -0
- data/lib/mtncloud/api/network_server_groups_interface.rb +7 -0
- data/lib/mtncloud/api/network_server_types_interface.rb +9 -0
- data/lib/mtncloud/api/network_servers_interface.rb +102 -0
- data/lib/mtncloud/api/network_services_interface.rb +63 -0
- data/lib/mtncloud/api/network_static_routes_interface.rb +36 -0
- data/lib/mtncloud/api/network_subnets_interface.rb +42 -0
- data/lib/mtncloud/api/network_types_interface.rb +20 -0
- data/lib/mtncloud/api/networks_interface.rb +48 -0
- data/lib/mtncloud/api/option_type_forms_interface.rb +9 -0
- data/lib/mtncloud/api/option_type_lists_interface.rb +53 -0
- data/lib/mtncloud/api/option_types_interface.rb +41 -0
- data/lib/mtncloud/api/options_interface.rb +17 -0
- data/lib/mtncloud/api/packages_interface.rb +112 -0
- data/lib/mtncloud/api/ping_interface.rb +22 -0
- data/lib/mtncloud/api/plugins_interface.rb +22 -0
- data/lib/mtncloud/api/policies_interface.rb +56 -0
- data/lib/mtncloud/api/power_schedules_interface.rb +71 -0
- data/lib/mtncloud/api/price_sets_interface.rb +39 -0
- data/lib/mtncloud/api/prices_interface.rb +71 -0
- data/lib/mtncloud/api/processes_interface.rb +40 -0
- data/lib/mtncloud/api/projects_interface.rb +33 -0
- data/lib/mtncloud/api/provision_types_interface.rb +24 -0
- data/lib/mtncloud/api/provisioning_license_types_interface.rb +31 -0
- data/lib/mtncloud/api/provisioning_licenses_interface.rb +60 -0
- data/lib/mtncloud/api/provisioning_settings_interface.rb +26 -0
- data/lib/mtncloud/api/read_interface.rb +24 -0
- data/lib/mtncloud/api/reports_interface.rb +70 -0
- data/lib/mtncloud/api/resource_pool_groups_interface.rb +51 -0
- data/lib/mtncloud/api/rest_interface.rb +37 -0
- data/lib/mtncloud/api/roles_interface.rb +151 -0
- data/lib/mtncloud/api/scale_thresholds_interface.rb +9 -0
- data/lib/mtncloud/api/search_interface.rb +13 -0
- data/lib/mtncloud/api/secondary_read_interface.rb +25 -0
- data/lib/mtncloud/api/secondary_rest_interface.rb +42 -0
- data/lib/mtncloud/api/security_group_rules_interface.rb +35 -0
- data/lib/mtncloud/api/security_groups_interface.rb +56 -0
- data/lib/mtncloud/api/security_package_types_interface.rb +9 -0
- data/lib/mtncloud/api/security_packages_interface.rb +9 -0
- data/lib/mtncloud/api/security_scans_interface.rb +9 -0
- data/lib/mtncloud/api/server_devices_interface.rb +30 -0
- data/lib/mtncloud/api/server_types_interface.rb +20 -0
- data/lib/mtncloud/api/servers_interface.rb +230 -0
- data/lib/mtncloud/api/service_catalog_interface.rb +89 -0
- data/lib/mtncloud/api/service_plans_interface.rb +62 -0
- data/lib/mtncloud/api/setup_interface.rb +46 -0
- data/lib/mtncloud/api/snapshots_interface.rb +19 -0
- data/lib/mtncloud/api/storage_datastores_interface.rb +44 -0
- data/lib/mtncloud/api/storage_providers_interface.rb +151 -0
- data/lib/mtncloud/api/storage_server_types_interface.rb +14 -0
- data/lib/mtncloud/api/storage_servers_interface.rb +9 -0
- data/lib/mtncloud/api/storage_volume_types_interface.rb +9 -0
- data/lib/mtncloud/api/storage_volumes_interface.rb +24 -0
- data/lib/mtncloud/api/subnet_types_interface.rb +20 -0
- data/lib/mtncloud/api/subnets_interface.rb +41 -0
- data/lib/mtncloud/api/support_bundles_interface.rb +46 -0
- data/lib/mtncloud/api/system_types_interface.rb +13 -0
- data/lib/mtncloud/api/systems_interface.rb +55 -0
- data/lib/mtncloud/api/task_sets_interface.rb +52 -0
- data/lib/mtncloud/api/tasks_interface.rb +66 -0
- data/lib/mtncloud/api/tokens_interface.rb +39 -0
- data/lib/mtncloud/api/usage_interface.rb +18 -0
- data/lib/mtncloud/api/user_groups_interface.rb +59 -0
- data/lib/mtncloud/api/user_settings_interface.rb +90 -0
- data/lib/mtncloud/api/user_sources_interface.rb +99 -0
- data/lib/mtncloud/api/users_interface.rb +33 -0
- data/lib/mtncloud/api/vdi_allocations_interface.rb +9 -0
- data/lib/mtncloud/api/vdi_apps_interface.rb +9 -0
- data/lib/mtncloud/api/vdi_gateways_interface.rb +9 -0
- data/lib/mtncloud/api/vdi_interface.rb +28 -0
- data/lib/mtncloud/api/vdi_pools_interface.rb +19 -0
- data/lib/mtncloud/api/virtual_images_interface.rb +210 -0
- data/lib/mtncloud/api/virtual_servers_interface.rb +9 -0
- data/lib/mtncloud/api/virtual_switches_interface.rb +9 -0
- data/lib/mtncloud/api/whitelabel_settings_interface.rb +57 -0
- data/lib/mtncloud/api/whoami_interface.rb +13 -0
- data/lib/mtncloud/api/wiki_interface.rb +48 -0
- data/lib/mtncloud/api.rb +12 -0
- data/lib/mtncloud/benchmarking.rb +259 -0
- data/lib/mtncloud/cli/cli_command.rb +2281 -0
- data/lib/mtncloud/cli/cli_registry.rb +337 -0
- data/lib/mtncloud/cli/commands/access_token_command.rb +201 -0
- data/lib/mtncloud/cli/commands/account_groups_command.rb +530 -0
- data/lib/mtncloud/cli/commands/activity_command.rb +149 -0
- data/lib/mtncloud/cli/commands/affinity_groups_command.rb +554 -0
- data/lib/mtncloud/cli/commands/alias_command.rb +278 -0
- data/lib/mtncloud/cli/commands/appliance_settings_command.rb +382 -0
- data/lib/mtncloud/cli/commands/approvals_command.rb +236 -0
- data/lib/mtncloud/cli/commands/apps.rb +2549 -0
- data/lib/mtncloud/cli/commands/archives_command.rb +2161 -0
- data/lib/mtncloud/cli/commands/audit.rb +188 -0
- data/lib/mtncloud/cli/commands/backup_jobs_command.rb +366 -0
- data/lib/mtncloud/cli/commands/backup_restores_command.rb +144 -0
- data/lib/mtncloud/cli/commands/backup_results_command.rb +149 -0
- data/lib/mtncloud/cli/commands/backup_services_command.rb +44 -0
- data/lib/mtncloud/cli/commands/backup_settings_command.rb +184 -0
- data/lib/mtncloud/cli/commands/backup_types_command.rb +53 -0
- data/lib/mtncloud/cli/commands/backups_command.rb +674 -0
- data/lib/mtncloud/cli/commands/benchmark_command.rb +458 -0
- data/lib/mtncloud/cli/commands/blueprints_command.rb +2297 -0
- data/lib/mtncloud/cli/commands/boot_scripts_command.rb +379 -0
- data/lib/mtncloud/cli/commands/budgets_command.rb +754 -0
- data/lib/mtncloud/cli/commands/cat_command.rb +45 -0
- data/lib/mtncloud/cli/commands/catalog_item_types_command.rb +858 -0
- data/lib/mtncloud/cli/commands/certificates_command.rb +575 -0
- data/lib/mtncloud/cli/commands/change_password_command.rb +132 -0
- data/lib/mtncloud/cli/commands/clients_command.rb +331 -0
- data/lib/mtncloud/cli/commands/cloud_datastores_command.rb +543 -0
- data/lib/mtncloud/cli/commands/cloud_folders_command.rb +512 -0
- data/lib/mtncloud/cli/commands/cloud_resource_pools_command.rb +870 -0
- data/lib/mtncloud/cli/commands/clouds.rb +2037 -0
- data/lib/mtncloud/cli/commands/clouds_types.rb +140 -0
- data/lib/mtncloud/cli/commands/cluster_types.rb +179 -0
- data/lib/mtncloud/cli/commands/clusters.rb +5855 -0
- data/lib/mtncloud/cli/commands/coloring_command.rb +82 -0
- data/lib/mtncloud/cli/commands/containers_command.rb +967 -0
- data/lib/mtncloud/cli/commands/credential_types_command.rb +36 -0
- data/lib/mtncloud/cli/commands/credentials_command.rb +124 -0
- data/lib/mtncloud/cli/commands/curl_command.rb +168 -0
- data/lib/mtncloud/cli/commands/cypher_command.rb +587 -0
- data/lib/mtncloud/cli/commands/dashboard_command.rb +300 -0
- data/lib/mtncloud/cli/commands/debug_command.rb +75 -0
- data/lib/mtncloud/cli/commands/deploy.rb +485 -0
- data/lib/mtncloud/cli/commands/deployments.rb +923 -0
- data/lib/mtncloud/cli/commands/deploys.rb +485 -0
- data/lib/mtncloud/cli/commands/distributed_workers_command.rb +282 -0
- data/lib/mtncloud/cli/commands/echo_command.rb +61 -0
- data/lib/mtncloud/cli/commands/edit_profile_command.rb +57 -0
- data/lib/mtncloud/cli/commands/edit_rc_command.rb +77 -0
- data/lib/mtncloud/cli/commands/email_templates_command.rb +373 -0
- data/lib/mtncloud/cli/commands/environments_command.rb +401 -0
- data/lib/mtncloud/cli/commands/execute_schedules_command.rb +735 -0
- data/lib/mtncloud/cli/commands/execution_request_command.rb +333 -0
- data/lib/mtncloud/cli/commands/exit_command.rb +34 -0
- data/lib/mtncloud/cli/commands/file_copy_request_command.rb +352 -0
- data/lib/mtncloud/cli/commands/forgot_password.rb +133 -0
- data/lib/mtncloud/cli/commands/get_prompt_command.rb +36 -0
- data/lib/mtncloud/cli/commands/groups.rb +818 -0
- data/lib/mtncloud/cli/commands/guidance_command.rb +529 -0
- data/lib/mtncloud/cli/commands/guidance_settings.rb +148 -0
- data/lib/mtncloud/cli/commands/health_command.rb +1046 -0
- data/lib/mtncloud/cli/commands/history_command.rb +60 -0
- data/lib/mtncloud/cli/commands/host_vm_groups_command.rb +423 -0
- data/lib/mtncloud/cli/commands/hosts.rb +2986 -0
- data/lib/mtncloud/cli/commands/hub.rb +215 -0
- data/lib/mtncloud/cli/commands/image_builder_command.rb +1197 -0
- data/lib/mtncloud/cli/commands/instance_types.rb +163 -0
- data/lib/mtncloud/cli/commands/instances.rb +5813 -0
- data/lib/mtncloud/cli/commands/integrations_command.rb +1412 -0
- data/lib/mtncloud/cli/commands/invoices_command.rb +1151 -0
- data/lib/mtncloud/cli/commands/jobs_command.rb +998 -0
- data/lib/mtncloud/cli/commands/key_pairs.rb +470 -0
- data/lib/mtncloud/cli/commands/library_cluster_layouts_command.rb +901 -0
- data/lib/mtncloud/cli/commands/library_cluster_packages_command.rb +552 -0
- data/lib/mtncloud/cli/commands/library_container_scripts_command.rb +446 -0
- data/lib/mtncloud/cli/commands/library_container_templates_command.rb +526 -0
- data/lib/mtncloud/cli/commands/library_container_types_command.rb +698 -0
- data/lib/mtncloud/cli/commands/library_forms_command.rb +625 -0
- data/lib/mtncloud/cli/commands/library_instance_types_command.rb +668 -0
- data/lib/mtncloud/cli/commands/library_layouts_command.rb +849 -0
- data/lib/mtncloud/cli/commands/library_operating_systems_command.rb +671 -0
- data/lib/mtncloud/cli/commands/library_option_lists_command.rb +503 -0
- data/lib/mtncloud/cli/commands/library_option_types_command.rb +329 -0
- data/lib/mtncloud/cli/commands/library_spec_templates_command.rb +547 -0
- data/lib/mtncloud/cli/commands/library_upgrades_command.rb +596 -0
- data/lib/mtncloud/cli/commands/license.rb +475 -0
- data/lib/mtncloud/cli/commands/load_balancer_monitors.rb +70 -0
- data/lib/mtncloud/cli/commands/load_balancer_pool_nodes.rb +87 -0
- data/lib/mtncloud/cli/commands/load_balancer_pools.rb +129 -0
- data/lib/mtncloud/cli/commands/load_balancer_profiles.rb +64 -0
- data/lib/mtncloud/cli/commands/load_balancer_types.rb +38 -0
- data/lib/mtncloud/cli/commands/load_balancer_virtual_servers.rb +147 -0
- data/lib/mtncloud/cli/commands/load_balancers.rb +189 -0
- data/lib/mtncloud/cli/commands/log_level_command.rb +54 -0
- data/lib/mtncloud/cli/commands/log_settings_command.rb +443 -0
- data/lib/mtncloud/cli/commands/login.rb +148 -0
- data/lib/mtncloud/cli/commands/logout.rb +63 -0
- data/lib/mtncloud/cli/commands/logs_command.rb +140 -0
- data/lib/mtncloud/cli/commands/man_command.rb +409 -0
- data/lib/mtncloud/cli/commands/migrations.rb +453 -0
- data/lib/mtncloud/cli/commands/monitoring_alerts_command.rb +791 -0
- data/lib/mtncloud/cli/commands/monitoring_apps_command.rb +716 -0
- data/lib/mtncloud/cli/commands/monitoring_checks_command.rb +766 -0
- data/lib/mtncloud/cli/commands/monitoring_contacts_command.rb +339 -0
- data/lib/mtncloud/cli/commands/monitoring_groups_command.rb +674 -0
- data/lib/mtncloud/cli/commands/monitoring_incidents_command.rb +835 -0
- data/lib/mtncloud/cli/commands/monitoring_settings.rb +212 -0
- data/lib/mtncloud/cli/commands/network_dhcp_relays_command.rb +375 -0
- data/lib/mtncloud/cli/commands/network_dhcp_servers_command.rb +366 -0
- data/lib/mtncloud/cli/commands/network_domains_command.rb +896 -0
- data/lib/mtncloud/cli/commands/network_edge_clusters_command.rb +288 -0
- data/lib/mtncloud/cli/commands/network_firewalls_command.rb +783 -0
- data/lib/mtncloud/cli/commands/network_floating_ips.rb +147 -0
- data/lib/mtncloud/cli/commands/network_groups_command.rb +654 -0
- data/lib/mtncloud/cli/commands/network_pool_server_types.rb +20 -0
- data/lib/mtncloud/cli/commands/network_pool_servers_command.rb +318 -0
- data/lib/mtncloud/cli/commands/network_pools_command.rb +903 -0
- data/lib/mtncloud/cli/commands/network_proxies_command.rb +578 -0
- data/lib/mtncloud/cli/commands/network_routers_command.rb +2628 -0
- data/lib/mtncloud/cli/commands/network_security_server_types.rb +20 -0
- data/lib/mtncloud/cli/commands/network_server_groups_command.rb +222 -0
- data/lib/mtncloud/cli/commands/network_server_types_command.rb +20 -0
- data/lib/mtncloud/cli/commands/network_servers_command.rb +398 -0
- data/lib/mtncloud/cli/commands/network_services_command.rb +198 -0
- data/lib/mtncloud/cli/commands/network_static_routes_command.rb +451 -0
- data/lib/mtncloud/cli/commands/network_transport_zones_command.rb +412 -0
- data/lib/mtncloud/cli/commands/networks_command.rb +1692 -0
- data/lib/mtncloud/cli/commands/open_command.rb +30 -0
- data/lib/mtncloud/cli/commands/options.rb +231 -0
- data/lib/mtncloud/cli/commands/packages_command.rb +822 -0
- data/lib/mtncloud/cli/commands/ping.rb +242 -0
- data/lib/mtncloud/cli/commands/plugins.rb +214 -0
- data/lib/mtncloud/cli/commands/policies_command.rb +990 -0
- data/lib/mtncloud/cli/commands/power_schedules_command.rb +731 -0
- data/lib/mtncloud/cli/commands/preseed_scripts_command.rb +378 -0
- data/lib/mtncloud/cli/commands/price_sets_command.rb +557 -0
- data/lib/mtncloud/cli/commands/prices_command.rb +692 -0
- data/lib/mtncloud/cli/commands/processes_command.rb +469 -0
- data/lib/mtncloud/cli/commands/projects_command.rb +537 -0
- data/lib/mtncloud/cli/commands/provisioning_licenses_command.rb +509 -0
- data/lib/mtncloud/cli/commands/provisioning_settings_command.rb +238 -0
- data/lib/mtncloud/cli/commands/recent_activity_command.rb +171 -0
- data/lib/mtncloud/cli/commands/remote.rb +1818 -0
- data/lib/mtncloud/cli/commands/reports_command.rb +724 -0
- data/lib/mtncloud/cli/commands/resource_pool_groups_command.rb +586 -0
- data/lib/mtncloud/cli/commands/rm_command.rb +14 -0
- data/lib/mtncloud/cli/commands/roles.rb +3120 -0
- data/lib/mtncloud/cli/commands/scale_thresholds.rb +103 -0
- data/lib/mtncloud/cli/commands/search_command.rb +184 -0
- data/lib/mtncloud/cli/commands/security_group_rules.rb +230 -0
- data/lib/mtncloud/cli/commands/security_groups.rb +1294 -0
- data/lib/mtncloud/cli/commands/security_package_types.rb +32 -0
- data/lib/mtncloud/cli/commands/security_packages.rb +84 -0
- data/lib/mtncloud/cli/commands/security_scans.rb +107 -0
- data/lib/mtncloud/cli/commands/self_service_command.rb +17 -0
- data/lib/mtncloud/cli/commands/server_devices_command.rb +207 -0
- data/lib/mtncloud/cli/commands/service_catalog_command.rb +1528 -0
- data/lib/mtncloud/cli/commands/service_plans_command.rb +895 -0
- data/lib/mtncloud/cli/commands/set_prompt_command.rb +51 -0
- data/lib/mtncloud/cli/commands/setup.rb +423 -0
- data/lib/mtncloud/cli/commands/shell.rb +717 -0
- data/lib/mtncloud/cli/commands/sleep_command.rb +43 -0
- data/lib/mtncloud/cli/commands/snapshots.rb +156 -0
- data/lib/mtncloud/cli/commands/source_command.rb +30 -0
- data/lib/mtncloud/cli/commands/ssl_verification_command.rb +47 -0
- data/lib/mtncloud/cli/commands/storage_datastores.rb +457 -0
- data/lib/mtncloud/cli/commands/storage_providers_command.rb +1401 -0
- data/lib/mtncloud/cli/commands/storage_server_types.rb +45 -0
- data/lib/mtncloud/cli/commands/storage_servers.rb +116 -0
- data/lib/mtncloud/cli/commands/storage_volume_types.rb +45 -0
- data/lib/mtncloud/cli/commands/storage_volumes.rb +236 -0
- data/lib/mtncloud/cli/commands/subnets_command.rb +819 -0
- data/lib/mtncloud/cli/commands/support_bundles_command.rb +606 -0
- data/lib/mtncloud/cli/commands/systems.rb +1203 -0
- data/lib/mtncloud/cli/commands/tasks.rb +1391 -0
- data/lib/mtncloud/cli/commands/tee_command.rb +14 -0
- data/lib/mtncloud/cli/commands/tenants_command.rb +315 -0
- data/lib/mtncloud/cli/commands/tokens_command.rb +391 -0
- data/lib/mtncloud/cli/commands/update_command.rb +46 -0
- data/lib/mtncloud/cli/commands/usage_command.rb +203 -0
- data/lib/mtncloud/cli/commands/user_groups_command.rb +512 -0
- data/lib/mtncloud/cli/commands/user_settings_command.rb +849 -0
- data/lib/mtncloud/cli/commands/user_sources_command.rb +1065 -0
- data/lib/mtncloud/cli/commands/users.rb +897 -0
- data/lib/mtncloud/cli/commands/vdi_allocations_command.rb +159 -0
- data/lib/mtncloud/cli/commands/vdi_apps_command.rb +317 -0
- data/lib/mtncloud/cli/commands/vdi_command.rb +359 -0
- data/lib/mtncloud/cli/commands/vdi_gateways_command.rb +290 -0
- data/lib/mtncloud/cli/commands/vdi_pools_command.rb +574 -0
- data/lib/mtncloud/cli/commands/version_command.rb +38 -0
- data/lib/mtncloud/cli/commands/view.rb +107 -0
- data/lib/mtncloud/cli/commands/virtual_images.rb +1362 -0
- data/lib/mtncloud/cli/commands/virtual_switches_command.rb +336 -0
- data/lib/mtncloud/cli/commands/whitelabel_settings_command.rb +653 -0
- data/lib/mtncloud/cli/commands/whoami.rb +323 -0
- data/lib/mtncloud/cli/commands/wiki_command.rb +448 -0
- data/lib/mtncloud/cli/commands/workflows.rb +1022 -0
- data/lib/mtncloud/cli/credentials.rb +482 -0
- data/lib/mtncloud/cli/dot_file.rb +180 -0
- data/lib/mtncloud/cli/error_handler.rb +307 -0
- data/lib/mtncloud/cli/errors.rb +53 -0
- data/lib/mtncloud/cli/expression_parser.rb +153 -0
- data/lib/mtncloud/cli/mixins/accounts_helper.rb +484 -0
- data/lib/mtncloud/cli/mixins/affinity_helper.rb +118 -0
- data/lib/mtncloud/cli/mixins/backups_helper.rb +200 -0
- data/lib/mtncloud/cli/mixins/deployments_helper.rb +163 -0
- data/lib/mtncloud/cli/mixins/execution_request_helper.rb +50 -0
- data/lib/mtncloud/cli/mixins/infrastructure_helper.rb +966 -0
- data/lib/mtncloud/cli/mixins/jobs_helper.rb +202 -0
- data/lib/mtncloud/cli/mixins/library_helper.rb +539 -0
- data/lib/mtncloud/cli/mixins/load_balancers_helper.rb +176 -0
- data/lib/mtncloud/cli/mixins/logs_helper.rb +131 -0
- data/lib/mtncloud/cli/mixins/monitoring_helper.rb +876 -0
- data/lib/mtncloud/cli/mixins/networks_helper.rb +62 -0
- data/lib/mtncloud/cli/mixins/operations_helper.rb +41 -0
- data/lib/mtncloud/cli/mixins/option_source_helper.rb +254 -0
- data/lib/mtncloud/cli/mixins/print_helper.rb +1631 -0
- data/lib/mtncloud/cli/mixins/processes_helper.rb +286 -0
- data/lib/mtncloud/cli/mixins/prompt_helper.rb +136 -0
- data/lib/mtncloud/cli/mixins/provisioning_helper.rb +2963 -0
- data/lib/mtncloud/cli/mixins/remote_helper.rb +139 -0
- data/lib/mtncloud/cli/mixins/rest_command.rb +994 -0
- data/lib/mtncloud/cli/mixins/secondary_rest_command.rb +700 -0
- data/lib/mtncloud/cli/mixins/storage_servers_helper.rb +93 -0
- data/lib/mtncloud/cli/mixins/storage_volumes_helper.rb +76 -0
- data/lib/mtncloud/cli/mixins/vdi_helper.rb +246 -0
- data/lib/mtncloud/cli/mixins/whoami_helper.rb +73 -0
- data/lib/mtncloud/cli/option_parser.rb +127 -0
- data/lib/mtncloud/cli/option_types.rb +1622 -0
- data/lib/mtncloud/cli/version.rb +6 -0
- data/lib/mtncloud/cli.rb +105 -0
- data/lib/mtncloud/currency.rb +184 -0
- data/lib/mtncloud/ext/hash.rb +109 -0
- data/lib/mtncloud/ext/nil_class.rb +5 -0
- data/lib/mtncloud/ext/rest_client.rb +37 -0
- data/lib/mtncloud/ext/string.rb +66 -0
- data/lib/mtncloud/formatters.rb +511 -0
- data/lib/mtncloud/logging.rb +185 -0
- data/lib/mtncloud/morpkg.rb +119 -0
- data/lib/mtncloud/rest_client.rb +104 -0
- data/lib/mtncloud/routes.rb +304 -0
- data/lib/mtncloud/terminal.rb +528 -0
- data/lib/mtncloud/util.rb +29 -0
- data/lib/mtncloud.rb +5 -0
- data/mtncloud-cli.gemspec +38 -0
- data/test/api/affinity_groups_interface_test.rb +43 -0
- data/test/api/clients_interface_test.rb +23 -0
- data/test/api/clouds_interface_test.rb +67 -0
- data/test/api/containers_interface_test.rb +68 -0
- data/test/api/host_vm_groups_interface_test.rb +35 -0
- data/test/api/instances_interface_test.rb +22 -0
- data/test/api/network_routers_interface_test.rb +22 -0
- data/test/api/systems_interface_test.rb +26 -0
- data/test/api/whoami_interface_test.rb +14 -0
- data/test/branding_test.rb +160 -0
- data/test/cli/access_token_test.rb +36 -0
- data/test/cli/affinity_groups_cloud_cluster_scope_test.rb +270 -0
- data/test/cli/affinity_groups_cluster_scope_test.rb +171 -0
- data/test/cli/affinity_groups_test.rb +57 -0
- data/test/cli/affinity_groups_violations_scope_test.rb +141 -0
- data/test/cli/affinity_helper_test.rb +367 -0
- data/test/cli/auth_test.rb +88 -0
- data/test/cli/backups_test.rb +212 -0
- data/test/cli/cli_test.rb +48 -0
- data/test/cli/clients_test.rb +45 -0
- data/test/cli/clusters_uuid_test.rb +146 -0
- data/test/cli/containers_test.rb +92 -0
- data/test/cli/distributed_workers_test.rb +68 -0
- data/test/cli/help_test.rb +25 -0
- data/test/cli/host_vm_groups_cluster_scope_test.rb +187 -0
- data/test/cli/host_vm_groups_test.rb +63 -0
- data/test/cli/infrastructure_helper_cluster_resolver_test.rb +250 -0
- data/test/cli/instances_test.rb +37 -0
- data/test/cli/man_test.rb +14 -0
- data/test/cli/migrations_test.rb +39 -0
- data/test/cli/network_routers_test.rb +65 -0
- data/test/cli/remote_test.rb +89 -0
- data/test/cli/roles_test.rb +47 -0
- data/test/cli/shell_test.rb +81 -0
- data/test/cli/storage_volumes_test.rb +79 -0
- data/test/cli/systems_test.rb +206 -0
- data/test/cli/version_test.rb +23 -0
- data/test/cli/view_test.rb +55 -0
- data/test/cli/whoami_test.rb +17 -0
- data/test/mtncloud_test.rb +16 -0
- data/test/test_case.rb +342 -0
- data/test/test_config.rb +137 -0
- data/test/test_data_helper.rb +97 -0
- metadata +807 -0
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
require 'mtncloud/cli/cli_command'
|
|
2
|
+
|
|
3
|
+
class MtnCloud::Cli::License
|
|
4
|
+
include MtnCloud::Cli::CliCommand
|
|
5
|
+
|
|
6
|
+
register_subcommands :get, :install, :uninstall, :test
|
|
7
|
+
# deprecated
|
|
8
|
+
register_subcommands :decode, :apply
|
|
9
|
+
|
|
10
|
+
set_subcommands_hidden :decode, :apply
|
|
11
|
+
|
|
12
|
+
#alias_subcommand :details, :get
|
|
13
|
+
|
|
14
|
+
def initialize()
|
|
15
|
+
# @appliance_name, @appliance_url = MtnCloud::Cli::Remote.active_appliance
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def connect(opts)
|
|
19
|
+
@api_client = establish_remote_appliance_connection(opts)
|
|
20
|
+
@license_interface = @api_client.license
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def handle(args)
|
|
24
|
+
handle_subcommand(args)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def get(args)
|
|
28
|
+
options = {}
|
|
29
|
+
params = {}
|
|
30
|
+
optparse = MtnCloud::Cli::OptionParser.new do |opts|
|
|
31
|
+
opts.banner = subcommand_usage()
|
|
32
|
+
build_common_options(opts, options, [:json, :yaml, :fields, :dry_run, :remote])
|
|
33
|
+
opts.footer = "Get details about the currently installed license.\n" +
|
|
34
|
+
"This information includes license features and limits.\n" +
|
|
35
|
+
"The actual secret license key value will never be returned."
|
|
36
|
+
end
|
|
37
|
+
optparse.parse!(args)
|
|
38
|
+
if args.count > 0
|
|
39
|
+
raise_command_error "wrong number of arguments, expected 0 and got (#{args.count}) #{args.join(' ')}\n#{optparse}"
|
|
40
|
+
end
|
|
41
|
+
connect(options)
|
|
42
|
+
|
|
43
|
+
# make api request
|
|
44
|
+
@license_interface.setopts(options)
|
|
45
|
+
if options[:dry_run]
|
|
46
|
+
print_dry_run @license_interface.dry.get()
|
|
47
|
+
return 0, nil
|
|
48
|
+
end
|
|
49
|
+
json_response = @license_interface.get()
|
|
50
|
+
render_response(json_response, options) do
|
|
51
|
+
license = json_response['license']
|
|
52
|
+
current_usage = json_response['currentUsage'] || {}
|
|
53
|
+
print_h1 "License"
|
|
54
|
+
if license.nil?
|
|
55
|
+
print "#{yellow}No license currently installed#{reset}\n\n"
|
|
56
|
+
else
|
|
57
|
+
print_license_details(json_response)
|
|
58
|
+
licenses = json_response['installedLicenses']
|
|
59
|
+
if licenses
|
|
60
|
+
print_installed_licenses(licenses, options)
|
|
61
|
+
end
|
|
62
|
+
print_h2 "Current Usage", [], options
|
|
63
|
+
print_license_usage(license, current_usage)
|
|
64
|
+
print reset,"\n"
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def apply(args)
|
|
70
|
+
print_error "#{yellow}DEPRECATION WARNING: `license apply` has been deprecated and replaced with `license install`. Please use `license install` instead.#{reset}\n"
|
|
71
|
+
install(args)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def install(args)
|
|
75
|
+
options = {}
|
|
76
|
+
account_name = nil
|
|
77
|
+
optparse = MtnCloud::Cli::OptionParser.new do |opts|
|
|
78
|
+
opts.banner = subcommand_usage("[key]")
|
|
79
|
+
opts.on('-a', '--add', "Stack this license on top of existing licenses. Without this option all existing licenses will be replaced." ) do
|
|
80
|
+
options[:options]['installAction'] = 'add'
|
|
81
|
+
end
|
|
82
|
+
opts.on('--stack', '--stack', "Alias for --add" ) do
|
|
83
|
+
options[:options]['installAction'] = 'add'
|
|
84
|
+
end
|
|
85
|
+
opts.on('--replace', '--replace', "Replace existing licenses with this new license. This is the default behavior." ) do
|
|
86
|
+
options[:options]['installAction'] = 'replace'
|
|
87
|
+
end
|
|
88
|
+
build_standard_add_options(opts, options)
|
|
89
|
+
opts.footer = "Install a new license key.\n" +
|
|
90
|
+
"This will potentially change the enabled features and capabilities of your appliance."
|
|
91
|
+
end
|
|
92
|
+
optparse.parse!(args)
|
|
93
|
+
verify_args!(args:args, optparse:optparse, min:0, max:1)
|
|
94
|
+
connect(options)
|
|
95
|
+
payload = {}
|
|
96
|
+
if options[:payload]
|
|
97
|
+
payload = options[:payload]
|
|
98
|
+
payload.deep_merge!(parse_passed_options(options))
|
|
99
|
+
else
|
|
100
|
+
payload.deep_merge!(parse_passed_options(options))
|
|
101
|
+
if args[0]
|
|
102
|
+
key = args[0].strip
|
|
103
|
+
else
|
|
104
|
+
v_prompt = MtnCloud::Cli::OptionTypes.prompt([{'fieldName' => 'licenseKey', 'fieldLabel' => 'License Key', 'type' => 'text', 'required' => true}], options[:options])
|
|
105
|
+
key = v_prompt['licenseKey'].to_s.strip
|
|
106
|
+
end
|
|
107
|
+
payload['license'] = key
|
|
108
|
+
# Stack Licenses?
|
|
109
|
+
# load current licenses to see if this prompt is required
|
|
110
|
+
json_response = @license_interface.get()
|
|
111
|
+
licenses = json_response['installedLicenses']
|
|
112
|
+
if licenses && !(licenses.size == 1 && key.index(licenses[0]['keyId']) == 0)
|
|
113
|
+
install_actions = [{'name' => 'Add', 'value' => 'add'},{'name' => 'Replace', 'value' => 'replace'}]
|
|
114
|
+
payload['installAction'] = MtnCloud::Cli::OptionTypes.prompt([{'fieldName' => 'installAction', 'fieldLabel' => 'Install Action', 'type' => 'select', 'selectOptions' => install_actions, 'required' => true, 'defaultValue' => 'replace', 'description' => "Install action to perform. Use add to stack this license on top of existing licenses. Use replace (default) to remove any existing license(s)."}], options[:options])['installAction']
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
@license_interface.setopts(options)
|
|
118
|
+
if options[:dry_run]
|
|
119
|
+
print_dry_run @license_interface.dry.install(payload)
|
|
120
|
+
return 0
|
|
121
|
+
end
|
|
122
|
+
json_response = @license_interface.install(payload)
|
|
123
|
+
render_response(json_response, options) do
|
|
124
|
+
print_green_success "License installed!"
|
|
125
|
+
get([] + (options[:remote] ? ["-r",options[:remote]] : []))
|
|
126
|
+
end
|
|
127
|
+
return 0, nil
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def decode(args)
|
|
131
|
+
print_error "#{yellow}DEPRECATION WARNING: `license decode` has been deprecated and replaced with `license test`. Please use `license test` instead.#{reset}\n"
|
|
132
|
+
test(args)
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def test(args)
|
|
136
|
+
options = {}
|
|
137
|
+
optparse = MtnCloud::Cli::OptionParser.new do |opts|
|
|
138
|
+
opts.banner = subcommand_usage("[key]")
|
|
139
|
+
opts.on('-a', '--add', "Stack this license on top of existing licenses. Without this option all existing licenses will be replaced." ) do
|
|
140
|
+
options[:options]['installAction'] = 'add'
|
|
141
|
+
end
|
|
142
|
+
opts.on('--stack', '--stack', "Alias for --add" ) do
|
|
143
|
+
options[:options]['installAction'] = 'add'
|
|
144
|
+
end
|
|
145
|
+
opts.on('--replace', '--replace', "Replace existing licenses with this new license. This is the default behavior." ) do
|
|
146
|
+
options[:options]['installAction'] = 'replace'
|
|
147
|
+
end
|
|
148
|
+
build_standard_add_options(opts, options, [:fields])
|
|
149
|
+
opts.footer = "Test a license key.\n" +
|
|
150
|
+
"This is a way to decode and view a license key before installing it."
|
|
151
|
+
end
|
|
152
|
+
optparse.parse!(args)
|
|
153
|
+
if args.count > 1
|
|
154
|
+
raise_command_error "wrong number of arguments, expected 0-1 and got (#{args.count}) #{args.join(' ')}\n#{optparse}"
|
|
155
|
+
end
|
|
156
|
+
connect(options)
|
|
157
|
+
payload = {}
|
|
158
|
+
if options[:payload]
|
|
159
|
+
payload = options[:payload]
|
|
160
|
+
payload.deep_merge!(parse_passed_options(options))
|
|
161
|
+
else
|
|
162
|
+
payload.deep_merge!(parse_passed_options(options))
|
|
163
|
+
key = nil
|
|
164
|
+
if args[0]
|
|
165
|
+
key = args[0].strip
|
|
166
|
+
else
|
|
167
|
+
v_prompt = MtnCloud::Cli::OptionTypes.prompt([{'fieldName' => 'licenseKey', 'fieldLabel' => 'License Key', 'type' => 'text', 'required' => true}], options[:options])
|
|
168
|
+
key = v_prompt['licenseKey'] || ''
|
|
169
|
+
end
|
|
170
|
+
payload['license'] = key
|
|
171
|
+
# Stack Licenses?
|
|
172
|
+
# load current licenses to see if this prompt is required
|
|
173
|
+
json_response = @license_interface.get()
|
|
174
|
+
licenses = json_response['installedLicenses']
|
|
175
|
+
if licenses && !(licenses.size == 1 && key.index(licenses[0]['keyId']) == 0)
|
|
176
|
+
install_actions = [{'name' => 'Add', 'value' => 'add'},{'name' => 'Replace', 'value' => 'replace'}]
|
|
177
|
+
payload['installAction'] = MtnCloud::Cli::OptionTypes.prompt([{'fieldName' => 'installAction', 'fieldLabel' => 'Install Action', 'type' => 'select', 'selectOptions' => install_actions, 'required' => true, 'defaultValue' => 'replace', 'description' => "Install action to perform. Use add to stack this license on top of existing licenses. Use replace (default) to remove any existing license(s)."}], options[:options])['installAction']
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
@license_interface.setopts(options)
|
|
181
|
+
if options[:dry_run]
|
|
182
|
+
print_dry_run @license_interface.dry.test(payload)
|
|
183
|
+
return
|
|
184
|
+
end
|
|
185
|
+
json_response = @license_interface.test(payload)
|
|
186
|
+
render_response(json_response, options) do
|
|
187
|
+
license = json_response['license']
|
|
188
|
+
current_usage = json_response['currentUsage'] || {}
|
|
189
|
+
# all good
|
|
190
|
+
print_h1 "License"
|
|
191
|
+
print_license_details(json_response)
|
|
192
|
+
licenses = json_response['installedLicenses']
|
|
193
|
+
if licenses
|
|
194
|
+
print_installed_licenses(licenses, options)
|
|
195
|
+
end
|
|
196
|
+
print_h2 "License Usage", [], options
|
|
197
|
+
print_license_usage(license, current_usage)
|
|
198
|
+
print reset,"\n"
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
def uninstall(args)
|
|
203
|
+
options = {}
|
|
204
|
+
params = {}
|
|
205
|
+
optparse = MtnCloud::Cli::OptionParser.new do |opts|
|
|
206
|
+
opts.banner = subcommand_usage("[key ID]")
|
|
207
|
+
opts.on('--key KEY', String, "License Key ID to uninstall (only the first 8 characters are required to identify license to uninstall). By default all licenses are uninstalled.") do |val|
|
|
208
|
+
options[:key] = val.to_s
|
|
209
|
+
end
|
|
210
|
+
build_common_options(opts, options, [:auto_confirm, :json, :yaml, :dry_run, :remote])
|
|
211
|
+
opts.footer = "Uninstall license key(s).\n" +
|
|
212
|
+
"Use [key] or --key to uninstall only the specified license key.\n" +
|
|
213
|
+
"By default all currently installed license keys are uninstalled.\n" +
|
|
214
|
+
"The function of the remote appliance will be restricted without a license installed.\n" +
|
|
215
|
+
"Be careful using this."
|
|
216
|
+
end
|
|
217
|
+
optparse.parse!(args)
|
|
218
|
+
verify_args!(args:args, optparse:optparse, min:0, max:1)
|
|
219
|
+
connect(options)
|
|
220
|
+
key_id = nil
|
|
221
|
+
if args[0] || options[:key]
|
|
222
|
+
key_id = (args[0] || options[:key])[0..7]
|
|
223
|
+
end
|
|
224
|
+
# load current licenses to prompt user which to uninstall
|
|
225
|
+
json_response = @license_interface.get()
|
|
226
|
+
licenses = json_response['installedLicenses'] # || [json_response['licenses']]
|
|
227
|
+
if key_id
|
|
228
|
+
# appliance version < 8.0.4 does not return installedLicenses list
|
|
229
|
+
if licenses.nil?
|
|
230
|
+
raise_command_error "Appliance version does not support uninstalling specific keys"
|
|
231
|
+
end
|
|
232
|
+
matching_license = licenses.find {|it| it['keyId'] == key_id }
|
|
233
|
+
if matching_license.nil?
|
|
234
|
+
raise_command_error "Unable to find installed license key '#{key_id}'"
|
|
235
|
+
end
|
|
236
|
+
params['keyId'] = key_id
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
unless options[:quiet]
|
|
240
|
+
print cyan,"#{bold}WARNING!#{reset}#{cyan} You are about to uninstall your license key (#{key_id ? key_id : 'ALL'})",reset,"\n"
|
|
241
|
+
print yellow, "Be careful using this. Make sure you have a copy of your key somewhere if you intend to use it again.",reset, "\n"
|
|
242
|
+
print "\n"
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
unless options[:yes] || ::MtnCloud::Cli::OptionTypes::confirm("Are you sure you want to uninstall the license key (#{key_id ? key_id : 'ALL'}) for remote #{@appliance_name} - #{@appliance_url}?")
|
|
246
|
+
return 9, "command aborted"
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
@license_interface.setopts(options)
|
|
250
|
+
if options[:dry_run]
|
|
251
|
+
print_dry_run @license_interface.dry.uninstall(params)
|
|
252
|
+
return
|
|
253
|
+
end
|
|
254
|
+
json_response = @license_interface.uninstall(params)
|
|
255
|
+
|
|
256
|
+
render_response(json_response, options) do
|
|
257
|
+
print_green_success "License uninstalled!"
|
|
258
|
+
end
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
def format_product_tier(license)
|
|
263
|
+
product_tier = license['productTier'] || 'capacity'
|
|
264
|
+
if product_tier == 'capacity'
|
|
265
|
+
'Capacity'
|
|
266
|
+
elsif product_tier == 'essentials'
|
|
267
|
+
'Essentials'
|
|
268
|
+
elsif product_tier == 'pro'
|
|
269
|
+
'Pro'
|
|
270
|
+
elsif product_tier == 'enterprise'
|
|
271
|
+
'Enterprise'
|
|
272
|
+
elsif product_tier == 'msp'
|
|
273
|
+
'Service Provider'
|
|
274
|
+
else
|
|
275
|
+
product_tier.to_s.capitalize
|
|
276
|
+
end
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
def format_limit_type(license)
|
|
280
|
+
limit_type = license['limitType'] || 'workload'
|
|
281
|
+
if limit_type == 'standard' || limit_type == 'metrics'
|
|
282
|
+
'Standard'
|
|
283
|
+
else
|
|
284
|
+
limit_type.to_s.capitalize
|
|
285
|
+
end
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
def format_limit(max, used)
|
|
289
|
+
formatted_max = max.to_i > 0 ? format_number(max) : "Unlimited"
|
|
290
|
+
if used
|
|
291
|
+
formatted_used = format_number(used)
|
|
292
|
+
"#{formatted_used} / #{formatted_max}"
|
|
293
|
+
else
|
|
294
|
+
"#{formatted_max}"
|
|
295
|
+
end
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
def format_limit_bytes(max, used)
|
|
299
|
+
formatted_max = max.to_i > 0 ? format_bytes(max) : "Unlimited"
|
|
300
|
+
if used
|
|
301
|
+
formatted_used = format_bytes(used)
|
|
302
|
+
"#{formatted_used} / #{formatted_max}"
|
|
303
|
+
else
|
|
304
|
+
"#{formatted_max}"
|
|
305
|
+
end
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
def print_license_details(json_response)
|
|
309
|
+
license = json_response['license']
|
|
310
|
+
licenses = json_response['installedLicenses']
|
|
311
|
+
current_usage = json_response['currentUsage'] || {}
|
|
312
|
+
description_cols = {
|
|
313
|
+
"Key ID" => lambda {|it| licenses ? licenses.collect {|li| li['keyId'] }.join(", ") : it['keyId'] },
|
|
314
|
+
"Account" => 'accountName',
|
|
315
|
+
"Product Tier" => lambda {|it| format_product_tier(it) },
|
|
316
|
+
"Start Date" => lambda {|it| format_local_dt(it['startDate']) },
|
|
317
|
+
"End Date" => lambda {|it|
|
|
318
|
+
if it['endDate']
|
|
319
|
+
end_date = parse_time(it['endDate']) rescue nil
|
|
320
|
+
if end_date && Time.now > end_date
|
|
321
|
+
format_local_dt(it['endDate']).to_s + red + ' (expired)' + cyan
|
|
322
|
+
else
|
|
323
|
+
format_local_dt(it['endDate']).to_s + ' (' + format_duration(Time.now, it['endDate']).to_s + ')'
|
|
324
|
+
end
|
|
325
|
+
else
|
|
326
|
+
'Never'
|
|
327
|
+
end
|
|
328
|
+
},
|
|
329
|
+
"Version" => lambda {|it| it["licenseVersion"] },
|
|
330
|
+
"Multi-Tenant" => lambda {|it| format_boolean it["multiTenant"] },
|
|
331
|
+
"White Label" => lambda {|it| format_boolean it["whitelabel"] },
|
|
332
|
+
"Stats Reporting" => lambda {|it| format_boolean it["reportStatus"] },
|
|
333
|
+
"Hard Limit" => lambda {|it| format_boolean it["hardLimit"] },
|
|
334
|
+
"Limit Type" => lambda {|it| format_limit_type(it) },
|
|
335
|
+
}
|
|
336
|
+
description_cols.delete("Key ID") if !license['keyId']
|
|
337
|
+
description_cols.delete("Multi-Tenant") if !license['multiTenant']
|
|
338
|
+
description_cols.delete("White Label") if !license['whitelabel']
|
|
339
|
+
|
|
340
|
+
if license['zoneTypes'] && license['zoneTypes'].size > 0
|
|
341
|
+
description_cols["Included Clouds"] = lambda {|it| it['zoneTypes'].join(', ') }
|
|
342
|
+
elsif license['zoneTypesExcluded'] && license['zoneTypesExcluded'].size > 0
|
|
343
|
+
description_cols["Excluded Clouds"] = lambda {|it| it['zoneTypesExcluded'].join(', ') }
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
if license['taskTypes'] && license['taskTypes'].size > 0
|
|
347
|
+
description_cols["Included Tasks"] = lambda {|it| it['taskTypes'].join(', ') }
|
|
348
|
+
elsif license['taskTypesExcluded'] && license['taskTypesExcluded'].size > 0
|
|
349
|
+
description_cols["Excluded Tasks"] = lambda {|it| it['taskTypesExcluded'].join(', ') }
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
print_description_list(description_cols, license)
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
def print_license_usage(license, current_usage)
|
|
356
|
+
unlimited_label = "Unlimited"
|
|
357
|
+
# unlimited_label = "∞"
|
|
358
|
+
if license['limitType'] == 'standard'
|
|
359
|
+
# new standard metrics limit
|
|
360
|
+
used_managed_servers = current_usage['managedServers']
|
|
361
|
+
used_discovered_servers = current_usage['discoveredServers']
|
|
362
|
+
used_hosts = current_usage['hosts']
|
|
363
|
+
used_mvm = current_usage['mvm']
|
|
364
|
+
used_mvm_sockets = current_usage['mvmSockets']
|
|
365
|
+
used_sockets = current_usage['sockets'].to_f.round(1)
|
|
366
|
+
used_iac = current_usage['iac']
|
|
367
|
+
used_xaas = current_usage['xaas']
|
|
368
|
+
used_executions = current_usage['executions']
|
|
369
|
+
used_distributed_workers = current_usage['distributedWorkers']
|
|
370
|
+
used_discovered_objects = current_usage['discoveredObjects']
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
max_managed_servers = license["maxManagedServers"]
|
|
374
|
+
max_discovered_servers = license['maxDiscoveredServers']
|
|
375
|
+
max_hosts = license['maxHosts']
|
|
376
|
+
max_mvm = license['maxMvm']
|
|
377
|
+
max_mvm_sockets = license['maxMvmSockets']
|
|
378
|
+
max_sockets = license['maxSockets']
|
|
379
|
+
max_iac = license['maxIac']
|
|
380
|
+
max_xaas = license['maxXaas']
|
|
381
|
+
max_executions = license['maxExecutions']
|
|
382
|
+
max_distributed_workers = license['maxDistributedWorkers']
|
|
383
|
+
max_discovered_objects = license['maxDiscoveredObjects']
|
|
384
|
+
label_width = 20
|
|
385
|
+
chart_opts = {max_bars: 20, unlimited_label: '0%', percent_sigdig: 0}
|
|
386
|
+
out = ""
|
|
387
|
+
out << cyan + "Sockets".rjust(label_width, ' ') + ": " + generate_usage_bar(used_sockets, max_sockets, chart_opts) + cyan + used_sockets.to_s.rjust(8, ' ') + " / " + (max_sockets ? max_sockets.to_s : unlimited_label).to_s.ljust(15, ' ') + "\n"
|
|
388
|
+
out << cyan + "Managed Servers".rjust(label_width, ' ') + ": " + generate_usage_bar(used_managed_servers, max_managed_servers, chart_opts) + cyan + used_managed_servers.to_s.rjust(8, ' ') + " / " + (max_managed_servers ? max_managed_servers.to_s : unlimited_label).to_s.ljust(15, ' ') + "\n"
|
|
389
|
+
out << cyan + "Discovered Servers".rjust(label_width, ' ') + ": " + generate_usage_bar(used_discovered_servers, max_discovered_servers, chart_opts) + cyan + used_discovered_servers.to_s.rjust(8, ' ') + " / " + (max_discovered_servers ? max_discovered_servers.to_s : unlimited_label).to_s.ljust(15, ' ') + "\n"
|
|
390
|
+
out << cyan + "Hosts".rjust(label_width, ' ') + ": " + generate_usage_bar(used_hosts, max_hosts, chart_opts) + cyan + used_hosts.to_s.rjust(8, ' ') + " / " + (max_hosts ? max_hosts.to_s : unlimited_label).to_s.ljust(15, ' ') + "\n"
|
|
391
|
+
out << cyan + "HPE VM Hosts".rjust(label_width, ' ') + ": " + generate_usage_bar(used_mvm, max_mvm, chart_opts) + cyan + used_mvm.to_s.rjust(8, ' ') + " / " + (max_mvm ? max_mvm.to_s : unlimited_label).to_s.ljust(15, ' ') + "\n"
|
|
392
|
+
out << cyan + "HPE VM Sockets".rjust(label_width, ' ') + ": " + generate_usage_bar(used_mvm_sockets, max_mvm_sockets, chart_opts) + cyan + used_mvm_sockets.to_s.rjust(8, ' ') + " / " + (max_mvm_sockets ? max_mvm_sockets.to_s : unlimited_label).to_s.ljust(15, ' ') + "\n"
|
|
393
|
+
out << cyan + "Iac Deployments".rjust(label_width, ' ') + ": " + generate_usage_bar(used_iac, max_iac, chart_opts) + cyan + used_iac.to_s.rjust(8, ' ') + " / " + (max_iac ? max_iac.to_s : unlimited_label).to_s.ljust(15, ' ') + "\n"
|
|
394
|
+
out << cyan + "Xaas Instances".rjust(label_width, ' ') + ": " + generate_usage_bar(used_xaas, max_xaas, chart_opts) + cyan + used_xaas.to_s.rjust(8, ' ') + " / " + (max_xaas ? max_xaas.to_s : unlimited_label).to_s.ljust(15, ' ') + "\n"
|
|
395
|
+
out << cyan + "Executions".rjust(label_width, ' ') + ": " + generate_usage_bar(used_executions, max_executions, chart_opts) + cyan + used_executions.to_s.rjust(8, ' ') + " / " + (max_executions ? max_executions.to_s : unlimited_label).to_s.ljust(15, ' ') + "\n"
|
|
396
|
+
out << cyan + "Distributed Workers".rjust(label_width, ' ') + ": " + generate_usage_bar(used_distributed_workers, max_distributed_workers, chart_opts) + cyan + used_distributed_workers.to_s.rjust(8, ' ') + " / " + (max_distributed_workers ? max_distributed_workers.to_s : unlimited_label).to_s.ljust(15, ' ') + "\n"
|
|
397
|
+
#out << cyan + "Discovered Objects".rjust(label_width, ' ') + ": " + generate_usage_bar(used_discovered_objects, max_discovered_objects, chart_opts) + cyan + used_discovered_objects.to_s.rjust(8, ' ') + " / " + (max_discovered_objects.to_i > 0 ? max_discovered_objects.to_s : unlimited_label).to_s.ljust(15, ' ') + "\n"
|
|
398
|
+
print out
|
|
399
|
+
else
|
|
400
|
+
# old workloads limit
|
|
401
|
+
used_memory = current_usage['memory']
|
|
402
|
+
used_storage = current_usage['storage']
|
|
403
|
+
used_workloads = current_usage['workloads']
|
|
404
|
+
max_memory = license['maxMemory'].to_i
|
|
405
|
+
max_storage = license['maxStorage'].to_i
|
|
406
|
+
max_workloads = license['maxInstances'].to_i
|
|
407
|
+
label_width = 15
|
|
408
|
+
chart_opts = {max_bars: 20, unlimited_label: '0%', percent_sigdig: 0}
|
|
409
|
+
out = ""
|
|
410
|
+
out << cyan + "Workloads".rjust(label_width, ' ') + ": " + generate_usage_bar(used_workloads, max_workloads, chart_opts) + cyan + used_workloads.to_s.rjust(15, ' ') + " / " + (max_workloads.to_i > 0 ? max_workloads.to_s : unlimited_label).to_s.ljust(15, ' ') + "\n"
|
|
411
|
+
out << cyan + "Memory".rjust(label_width, ' ') + ": " + generate_usage_bar(used_memory, max_memory, chart_opts) + cyan + Filesize.from("#{used_memory} B").pretty.strip.rjust(15, ' ') + " / " + (max_memory.to_i > 0 ? Filesize.from("#{max_memory} B").pretty : unlimited_label).strip.ljust(15, ' ') + "\n"
|
|
412
|
+
out << cyan + "Storage".rjust(label_width, ' ') + ": " + generate_usage_bar(used_storage, max_storage, chart_opts) + cyan + Filesize.from("#{used_storage} B").pretty.strip.rjust(15, ' ') + " / " + (max_storage.to_i > 0 ? Filesize.from("#{max_storage} B").pretty : unlimited_label).strip.ljust(15, ' ') + "\n"
|
|
413
|
+
print out
|
|
414
|
+
end
|
|
415
|
+
end
|
|
416
|
+
|
|
417
|
+
# todo: use this to dry print_license_usage
|
|
418
|
+
def format_limit(label, used, max, opts={})
|
|
419
|
+
unlimited_label = "Unlimited"
|
|
420
|
+
# unlimited_label = "∞"
|
|
421
|
+
label_width = opts[:label_width] || 15
|
|
422
|
+
chart_opts = {max_bars: 20, unlimited_label: '0%', percent_sigdig: 0}
|
|
423
|
+
chart_opts.merge!(opts[:chart_opts]) if opts[:chart_opts]
|
|
424
|
+
cyan + label.rjust(label_width, ' ') + ": " + generate_usage_bar(used, max, chart_opts) + cyan + used.to_s.rjust(label_width, ' ') + " / " + (max.to_i > 0 ? max.to_s : unlimited_label).to_s.ljust(label_width, ' ') + "\n"
|
|
425
|
+
end
|
|
426
|
+
|
|
427
|
+
def print_installed_licenses(licenses, options)
|
|
428
|
+
print_h2 "Installed Licenses", [], options
|
|
429
|
+
license_columns = {
|
|
430
|
+
"Key ID" => 'keyId',
|
|
431
|
+
"Account" => 'accountName',
|
|
432
|
+
"Product Tier" => lambda {|it| format_product_tier(it) },
|
|
433
|
+
"Start Date" => lambda {|it| format_local_dt(it['startDate']) },
|
|
434
|
+
"End Date" => lambda {|it|
|
|
435
|
+
if it['endDate']
|
|
436
|
+
end_date = parse_time(it['endDate']) rescue nil
|
|
437
|
+
if end_date && Time.now > end_date
|
|
438
|
+
format_local_dt(it['endDate']).to_s + red + ' (expired)' + cyan
|
|
439
|
+
else
|
|
440
|
+
format_local_dt(it['endDate']).to_s + ' (' + format_duration(Time.now, it['endDate']).to_s + ')'
|
|
441
|
+
end
|
|
442
|
+
else
|
|
443
|
+
'Never'
|
|
444
|
+
end
|
|
445
|
+
},
|
|
446
|
+
"Version" => lambda {|it| it["licenseVersion"] },
|
|
447
|
+
"Multi-Tenant" => lambda {|it| format_boolean it["multiTenant"] },
|
|
448
|
+
"White Label" => lambda {|it| format_boolean it["whitelabel"] },
|
|
449
|
+
"Stats Reporting" => lambda {|it| format_boolean it["reportStatus"] },
|
|
450
|
+
"Hard Limit" => lambda {|it| format_boolean it["hardLimit"] },
|
|
451
|
+
"Limit Type" => lambda {|it| format_limit_type(it) },
|
|
452
|
+
}
|
|
453
|
+
if licenses[0] && licenses[0]['limitType'] == 'workload'
|
|
454
|
+
license_columns.merge!({
|
|
455
|
+
"Workloads" => 'maxInstances'
|
|
456
|
+
})
|
|
457
|
+
else
|
|
458
|
+
license_columns.merge!({
|
|
459
|
+
"Sockets" => 'maxSockets',
|
|
460
|
+
"HPE VM Sockets" => 'maxMvmSockets',
|
|
461
|
+
"Managed Servers" => 'maxManagedServers',
|
|
462
|
+
"Discovered Servers" => 'maxDiscoveredServers',
|
|
463
|
+
"Hosts" => 'maxHosts',
|
|
464
|
+
"HPE VM Hosts" => 'maxMvm',
|
|
465
|
+
"Iac Deployments" => 'maxIac',
|
|
466
|
+
"Xaas Instances" => 'maxXaas',
|
|
467
|
+
"Executions" => 'maxExecutions',
|
|
468
|
+
"Distributed Workers" => 'maxDistributedWorkers',
|
|
469
|
+
# "Discovered Objects" => 'maxDiscoveredObjects'
|
|
470
|
+
})
|
|
471
|
+
end
|
|
472
|
+
print as_pretty_table(licenses, license_columns, options)
|
|
473
|
+
end
|
|
474
|
+
|
|
475
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
require 'mtncloud/cli/cli_command'
|
|
2
|
+
|
|
3
|
+
class MtnCloud::Cli::LoadBalancerMonitors
|
|
4
|
+
include MtnCloud::Cli::CliCommand
|
|
5
|
+
include MtnCloud::Cli::RestCommand
|
|
6
|
+
include MtnCloud::Cli::SecondaryRestCommand
|
|
7
|
+
include MtnCloud::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
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
require 'mtncloud/cli/cli_command'
|
|
2
|
+
|
|
3
|
+
class MtnCloud::Cli::LoadBalancerPoolNodes
|
|
4
|
+
include MtnCloud::Cli::CliCommand
|
|
5
|
+
include MtnCloud::Cli::RestCommand
|
|
6
|
+
include MtnCloud::Cli::SecondaryRestCommand
|
|
7
|
+
include MtnCloud::Cli::LoadBalancersHelper
|
|
8
|
+
|
|
9
|
+
set_command_description "View and manage load balancer pool member nodes."
|
|
10
|
+
set_command_name :'load-balancer-pool-nodes'
|
|
11
|
+
|
|
12
|
+
set_rest_key :load_balancer_node
|
|
13
|
+
set_rest_parent_name :load_balancer_pools
|
|
14
|
+
set_rest_option_context_map({'loadBalancerNode' => ''})
|
|
15
|
+
|
|
16
|
+
register_subcommands :list, :get, :add, :update, :remove
|
|
17
|
+
register_interfaces :load_balancer_types, :load_balancer_pools
|
|
18
|
+
|
|
19
|
+
protected
|
|
20
|
+
|
|
21
|
+
def load_balancer_node_list_column_definitions(options)
|
|
22
|
+
{
|
|
23
|
+
"ID" => 'id',
|
|
24
|
+
"Status" => 'status',
|
|
25
|
+
"Name" => 'name',
|
|
26
|
+
"IP Address" => 'ipAddress',
|
|
27
|
+
"Port" => 'port'
|
|
28
|
+
}
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def load_balancer_node_column_definitions(options)
|
|
32
|
+
{
|
|
33
|
+
"ID" => 'id',
|
|
34
|
+
"Name" => 'name',
|
|
35
|
+
"Description" => 'description',
|
|
36
|
+
"State" => lambda {|it| it['config']['adminState']},
|
|
37
|
+
"IP Address" => 'ipAddress',
|
|
38
|
+
"Port" => 'port',
|
|
39
|
+
"Weight" => 'weight',
|
|
40
|
+
"Backup Member" => lambda {|it| format_boolean it['config']['backupMember']},
|
|
41
|
+
"Max Concurrent Connections" => lambda {|it| it['config']['maxConcurrentConnections']}
|
|
42
|
+
}
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def load_balancer_node_object_key
|
|
46
|
+
'loadBalancerNode'
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def load_balancer_node_list_key
|
|
50
|
+
'loadBalancerNodes'
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def load_balancer_node_label
|
|
54
|
+
'Load Balancer Node'
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def load_balancer_node_label_plural
|
|
58
|
+
'Load Balancer Nodes'
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def format_load_balancer_pool_status(record, return_color=cyan)
|
|
62
|
+
out = ""
|
|
63
|
+
status_string = record['status']
|
|
64
|
+
if status_string.nil? || status_string.empty? || status_string == "unknown"
|
|
65
|
+
out << "#{white}UNKNOWN#{return_color}"
|
|
66
|
+
elsif status_string == 'ok'
|
|
67
|
+
out << "#{green}#{status_string.upcase}#{return_color}"
|
|
68
|
+
elsif status_string == 'warning'
|
|
69
|
+
out << "#{yellow}#{status_string.upcase}#{return_color}"
|
|
70
|
+
else
|
|
71
|
+
out << "#{red}#{status_string ? status_string.upcase : 'N/A'}#{record['statusMessage'] ? "#{return_color} - #{record['statusMessage']}" : ''}#{return_color}"
|
|
72
|
+
end
|
|
73
|
+
out
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def load_option_types_for_load_balancer_node(type_record, parent_record)
|
|
77
|
+
load_balancer_pool = parent_record
|
|
78
|
+
load_balancer_type = find_by_id(:load_balancer_type, load_balancer_pool['loadBalancer']['type']['id'])
|
|
79
|
+
load_balancer_type['nodeOptionTypes']
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def find_load_balancer_node_by_name_or_id(parent_id, val)
|
|
83
|
+
(@load_balancer_pool_nodes_interface.get(parent_id, val)['loadBalancerNode']) rescue nil
|
|
84
|
+
end
|
|
85
|
+
## using CliCommand's generic find_by methods
|
|
86
|
+
|
|
87
|
+
end
|