morpheus-cli 5.3.2.3 → 5.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Dockerfile +1 -1
- data/lib/morpheus/api/account_users_interface.rb +68 -0
- data/lib/morpheus/api/api_client.rb +75 -8
- data/lib/morpheus/api/audit_interface.rb +9 -0
- data/lib/morpheus/api/clouds_interface.rb +4 -11
- data/lib/morpheus/api/health_interface.rb +37 -3
- data/lib/morpheus/api/instances_interface.rb +39 -5
- data/lib/morpheus/api/load_balancer_monitors_interface.rb +9 -0
- data/lib/morpheus/api/load_balancer_profiles_interface.rb +9 -0
- data/lib/morpheus/api/load_balancer_virtual_servers_interface.rb +9 -0
- 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 +30 -0
- data/lib/morpheus/api/network_servers_interface.rb +98 -0
- data/lib/morpheus/api/network_static_routes_interface.rb +36 -0
- data/lib/morpheus/api/read_interface.rb +4 -3
- data/lib/morpheus/api/rest_interface.rb +5 -4
- 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/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/api/virtual_images_interface.rb +23 -2
- data/lib/morpheus/api/virtual_servers_interface.rb +9 -0
- data/lib/morpheus/cli/cli_command.rb +274 -19
- data/lib/morpheus/cli/cli_registry.rb +56 -2
- 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} +17 -89
- 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} +0 -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} +170 -138
- data/lib/morpheus/cli/{clouds.rb → commands/clouds.rb} +22 -47
- data/lib/morpheus/cli/{clusters.rb → commands/clusters.rb} +86 -49
- 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} +15 -25
- data/lib/morpheus/cli/{image_builder_command.rb → commands/image_builder_command.rb} +2 -8
- data/lib/morpheus/cli/{instance_types.rb → commands/instance_types.rb} +0 -3
- data/lib/morpheus/cli/{instances.rb → commands/instances.rb} +473 -150
- data/lib/morpheus/cli/{integrations_command.rb → commands/integrations_command.rb} +0 -0
- data/lib/morpheus/cli/{invoices_command.rb → commands/invoices_command.rb} +118 -134
- 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} +20 -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} +0 -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} +3 -7
- 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 +71 -0
- data/lib/morpheus/cli/commands/load_balancer_pools.rb +91 -0
- data/lib/morpheus/cli/commands/load_balancer_profiles.rb +65 -0
- data/lib/morpheus/cli/{load_balancer_types.rb → commands/load_balancer_types.rb} +9 -8
- data/lib/morpheus/cli/commands/load_balancer_virtual_servers.rb +156 -0
- data/lib/morpheus/cli/commands/load_balancers.rb +176 -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} +2 -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} +387 -57
- 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 +446 -0
- data/lib/morpheus/cli/commands/network_transport_zones_command.rb +452 -0
- data/lib/morpheus/cli/{networks_command.rb → commands/networks_command.rb} +21 -21
- 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} +0 -7
- data/lib/morpheus/cli/{policies_command.rb → commands/policies_command.rb} +1 -8
- 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} +0 -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} +5 -9
- 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} +0 -6
- 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} +0 -0
- 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} +0 -0
- 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/{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} +7 -6
- data/lib/morpheus/cli/{tasks.rb → commands/tasks.rb} +25 -6
- 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} +2 -1
- 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} +4 -1
- 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} +251 -33
- 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 +26 -6
- 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 +167 -110
- data/lib/morpheus/cli/mixins/rest_command.rb +268 -94
- data/lib/morpheus/cli/mixins/secondary_rest_command.rb +668 -0
- 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_parser.rb +25 -17
- data/lib/morpheus/cli/option_types.rb +137 -52
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/cli.rb +6 -128
- 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
- data/morpheus-cli.gemspec +1 -1
- metadata +183 -149
- data/lib/morpheus/cli/change_password_command.rb +0 -147
- data/lib/morpheus/cli/library.rb +0 -1
- data/lib/morpheus/cli/load_balancers.rb +0 -245
- data/lib/morpheus/cli/logout.rb +0 -81
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require 'morpheus/cli/cli_command'
|
|
2
|
+
|
|
3
|
+
class Morpheus::Cli::StorageServerTypes
|
|
4
|
+
include Morpheus::Cli::CliCommand
|
|
5
|
+
include Morpheus::Cli::RestCommand
|
|
6
|
+
include Morpheus::Cli::StorageServersHelper
|
|
7
|
+
|
|
8
|
+
set_command_description "View storage server types"
|
|
9
|
+
set_command_name :'storage-server-types'
|
|
10
|
+
register_subcommands :list, :get
|
|
11
|
+
|
|
12
|
+
# register_interfaces :storage_server_types
|
|
13
|
+
|
|
14
|
+
protected
|
|
15
|
+
|
|
16
|
+
def storage_server_type_list_column_definitions(options)
|
|
17
|
+
{
|
|
18
|
+
"ID" => 'id',
|
|
19
|
+
"Name" => 'name',
|
|
20
|
+
"Code" => 'code',
|
|
21
|
+
"Description" => 'description',
|
|
22
|
+
}
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def storage_server_type_column_definitions(options)
|
|
26
|
+
{
|
|
27
|
+
"ID" => 'id',
|
|
28
|
+
"Name" => 'name',
|
|
29
|
+
"Code" => 'code',
|
|
30
|
+
"Description" => 'description',
|
|
31
|
+
"Creatable" => lambda {|it| format_boolean(it['creatable']) },
|
|
32
|
+
"Create Namespaces" => lambda {|it| format_boolean(it['createNamespaces']) },
|
|
33
|
+
"Create Groups" => lambda {|it| format_boolean(it['createGroups']) },
|
|
34
|
+
"Create Hosts" => lambda {|it| format_boolean(it['createHosts']) },
|
|
35
|
+
"Create Disks" => lambda {|it| format_boolean(it['createDisks']) },
|
|
36
|
+
"Has Namespaces" => lambda {|it| format_boolean(it['hasNamespaces']) },
|
|
37
|
+
"Has Groups" => lambda {|it| format_boolean(it['hasGroups']) },
|
|
38
|
+
"Has Hosts" => lambda {|it| format_boolean(it['hasHosts']) },
|
|
39
|
+
"Has Disks" => lambda {|it| format_boolean(it['hasDisks']) },
|
|
40
|
+
"Has File Browser" => lambda {|it| format_boolean(it['hasFileBrowser']) },
|
|
41
|
+
}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# overridden to support name or code
|
|
45
|
+
def find_storage_server_type_by_name_or_id(name)
|
|
46
|
+
storage_server_type_for_name_or_id(name)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
require 'morpheus/cli/cli_command'
|
|
2
|
+
|
|
3
|
+
class Morpheus::Cli::StorageServers
|
|
4
|
+
include Morpheus::Cli::CliCommand
|
|
5
|
+
include Morpheus::Cli::RestCommand
|
|
6
|
+
include Morpheus::Cli::StorageServersHelper
|
|
7
|
+
|
|
8
|
+
set_command_name :'storage-servers'
|
|
9
|
+
set_command_description "View and manage storage servers."
|
|
10
|
+
register_subcommands :list, :get, :add, :update, :remove
|
|
11
|
+
|
|
12
|
+
# RestCommand settings
|
|
13
|
+
register_interfaces :storage_servers, :storage_server_types
|
|
14
|
+
set_rest_has_type true
|
|
15
|
+
# set_rest_type :storage_server_types
|
|
16
|
+
|
|
17
|
+
def render_response_for_get(json_response, options)
|
|
18
|
+
render_response(json_response, options, rest_object_key) do
|
|
19
|
+
record = json_response[rest_object_key]
|
|
20
|
+
print_h1 rest_label, [], options
|
|
21
|
+
print cyan
|
|
22
|
+
print_description_list(rest_column_definitions(options), record, options)
|
|
23
|
+
# show Storage Server Configuration
|
|
24
|
+
config = record['config']
|
|
25
|
+
if config && !config.empty?
|
|
26
|
+
print_h2 "Configuration"
|
|
27
|
+
print_description_list(config.keys, config)
|
|
28
|
+
end
|
|
29
|
+
print reset,"\n"
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
protected
|
|
34
|
+
|
|
35
|
+
def storage_server_list_column_definitions(options)
|
|
36
|
+
{
|
|
37
|
+
"ID" => 'id',
|
|
38
|
+
"Name" => 'name',
|
|
39
|
+
"Type" => lambda {|it| it['type'] ? it['type']['name'] : '' },
|
|
40
|
+
"Service URL" => lambda {|it| it['serviceUrl'] },
|
|
41
|
+
"Tenants" => lambda {|it|
|
|
42
|
+
if it['tenants'] && !it['tenants'].empty?
|
|
43
|
+
it['tenants'].collect {|account| account['name'] }.join(', ')
|
|
44
|
+
else
|
|
45
|
+
it['owner'] ? it['owner']['name'] : (it['account'] ? it['account']['name'] : nil)
|
|
46
|
+
end
|
|
47
|
+
},
|
|
48
|
+
"Status" => lambda {|it| format_storage_server_status(it) },
|
|
49
|
+
}
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def storage_server_column_definitions(options)
|
|
53
|
+
{
|
|
54
|
+
"ID" => 'id',
|
|
55
|
+
"Name" => 'name',
|
|
56
|
+
"Description" => 'description',
|
|
57
|
+
"Type" => lambda {|it| it['type'] ? it['type']['name'] : '' },
|
|
58
|
+
"Service URL" => lambda {|it| it['serviceUrl'] },
|
|
59
|
+
"Service Username" => lambda {|it| it['serviceUsername'] },
|
|
60
|
+
"Tenants" => lambda {|it| it['tenants'].collect {|account| account['name'] }.join(', ') },
|
|
61
|
+
"Owner" => lambda {|it| it['owner'] ? it['owner']['name'] : (it['account'] ? it['account']['name'] : nil) },
|
|
62
|
+
"Enabled" => lambda {|it| format_boolean(it['enabled']) },
|
|
63
|
+
"Status" => lambda {|it| format_storage_server_status(it) },
|
|
64
|
+
"Created" => lambda {|it| format_local_dt(it['dateCreated']) },
|
|
65
|
+
"Updated" => lambda {|it| format_local_dt(it['lastUpdated']) }
|
|
66
|
+
}
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# overridden to work with name or code
|
|
70
|
+
# nope, api works with name=code now too
|
|
71
|
+
# def find_storage_server_type_by_name_or_id(name)
|
|
72
|
+
# storage_server_type_for_name_or_id(name)
|
|
73
|
+
# end
|
|
74
|
+
|
|
75
|
+
def add_storage_server_option_types()
|
|
76
|
+
[
|
|
77
|
+
{'fieldName' => 'name', 'fieldLabel' => 'Name', 'type' => 'text', 'required' => true},
|
|
78
|
+
{'fieldName' => 'description', 'fieldLabel' => 'Description', 'type' => 'text', 'required' => false},
|
|
79
|
+
{'fieldName' => 'enabled', 'fieldLabel' => 'Enabled', 'type' => 'checkbox', 'required' => false, 'defaultValue' => true},
|
|
80
|
+
# {'fieldName' => 'type', 'fieldLabel' => 'Storage Server Type', 'type' => 'select', 'optionSource' => 'storageServerTypes', 'required' => true},
|
|
81
|
+
]
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def add_storage_server_advanced_option_types()
|
|
85
|
+
[
|
|
86
|
+
{'fieldName' => 'visibility', 'fieldLabel' => 'Visibility', 'fieldGroup' => 'Advanced', 'type' => 'select', 'selectOptions' => [{'name' => 'Private', 'value' => 'private'},{'name' => 'Public', 'value' => 'public'}], 'required' => false, 'description' => 'Visibility', 'category' => 'permissions'},
|
|
87
|
+
{'fieldName' => 'tenants', 'fieldLabel' => 'Tenants', 'fieldGroup' => 'Advanced', 'type' => 'multiSelect', 'optionSource' => lambda { |api_client, api_params|
|
|
88
|
+
api_client.options.options_for_source("allTenants", {})['data']
|
|
89
|
+
}},
|
|
90
|
+
]
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def update_storage_server_option_types()
|
|
94
|
+
[
|
|
95
|
+
{'fieldName' => 'name', 'fieldLabel' => 'Name', 'type' => 'text'},
|
|
96
|
+
{'fieldName' => 'description', 'fieldLabel' => 'Description', 'type' => 'text'},
|
|
97
|
+
{'fieldName' => 'enabled', 'fieldLabel' => 'Enabled', 'type' => 'checkbox'},
|
|
98
|
+
]
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def update_storage_server_advanced_option_types()
|
|
102
|
+
add_storage_server_advanced_option_types()
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def format_storage_server_status(storage_server, return_color=cyan)
|
|
106
|
+
out = ""
|
|
107
|
+
status_string = storage_server['status']
|
|
108
|
+
if storage_server['enabled'] == false
|
|
109
|
+
out << "#{red}DISABLED#{return_color}"
|
|
110
|
+
elsif status_string.nil? || status_string.empty? || status_string == "unknown"
|
|
111
|
+
out << "#{white}UNKNOWN#{return_color}"
|
|
112
|
+
elsif status_string == 'ok'
|
|
113
|
+
out << "#{green}#{status_string.upcase}#{return_color}"
|
|
114
|
+
elsif status_string == 'syncing'
|
|
115
|
+
out << "#{yellow}#{status_string.upcase}#{return_color}"
|
|
116
|
+
else
|
|
117
|
+
out << "#{red}#{status_string ? status_string.upcase : 'N/A'}#{storage_server['statusMessage'] ? "#{return_color} - #{storage_server['statusMessage']}" : ''}#{return_color}"
|
|
118
|
+
end
|
|
119
|
+
out
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require 'morpheus/cli/cli_command'
|
|
2
|
+
|
|
3
|
+
class Morpheus::Cli::StorageVolumeTypes
|
|
4
|
+
include Morpheus::Cli::CliCommand
|
|
5
|
+
include Morpheus::Cli::RestCommand
|
|
6
|
+
include Morpheus::Cli::StorageVolumesHelper
|
|
7
|
+
|
|
8
|
+
set_command_name :'storage-volume-types'
|
|
9
|
+
register_subcommands :list, :get
|
|
10
|
+
|
|
11
|
+
# register_interfaces :storage_volume_types
|
|
12
|
+
|
|
13
|
+
protected
|
|
14
|
+
|
|
15
|
+
def build_list_options(opts, options, params)
|
|
16
|
+
opts.on('--name VALUE', String, "Filter by name") do |val|
|
|
17
|
+
params['name'] = val
|
|
18
|
+
end
|
|
19
|
+
opts.on('--category VALUE', String, "Filter by category") do |val|
|
|
20
|
+
params['category'] = val
|
|
21
|
+
end
|
|
22
|
+
# build_standard_list_options(opts, options)
|
|
23
|
+
super
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def storage_volume_type_list_column_definitions(options)
|
|
27
|
+
{
|
|
28
|
+
"ID" => 'id',
|
|
29
|
+
"Name" => 'name',
|
|
30
|
+
"Code" => 'code',
|
|
31
|
+
"Description" => 'description',
|
|
32
|
+
}
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def storage_volume_type_column_definitions(options)
|
|
36
|
+
{
|
|
37
|
+
"ID" => 'id',
|
|
38
|
+
"Name" => 'name',
|
|
39
|
+
"Code" => 'code',
|
|
40
|
+
"Description" => 'description',
|
|
41
|
+
}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# overridden to support name or code
|
|
45
|
+
def find_storage_volume_type_by_name_or_id(name)
|
|
46
|
+
storage_volume_type_for_name_or_id(name)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
require 'morpheus/cli/cli_command'
|
|
2
|
+
|
|
3
|
+
class Morpheus::Cli::StorageVolumes
|
|
4
|
+
include Morpheus::Cli::CliCommand
|
|
5
|
+
include Morpheus::Cli::RestCommand
|
|
6
|
+
include Morpheus::Cli::StorageVolumesHelper
|
|
7
|
+
|
|
8
|
+
set_command_name :'storage-volumes'
|
|
9
|
+
set_command_description "View and manage storage volumes."
|
|
10
|
+
register_subcommands %w{list get add remove}
|
|
11
|
+
|
|
12
|
+
# RestCommand settings
|
|
13
|
+
register_interfaces :storage_volumes, :storage_volume_types
|
|
14
|
+
set_rest_has_type true
|
|
15
|
+
|
|
16
|
+
protected
|
|
17
|
+
|
|
18
|
+
def build_list_options(opts, options, params)
|
|
19
|
+
opts.on('--storage-server VALUE', String, "Storage Server Name or ID") do |val|
|
|
20
|
+
options[:storage_server] = val
|
|
21
|
+
end
|
|
22
|
+
opts.on('-t', '--type TYPE', "Filter by type") do |val|
|
|
23
|
+
params['type'] = val
|
|
24
|
+
end
|
|
25
|
+
opts.on('--name VALUE', String, "Filter by name") do |val|
|
|
26
|
+
params['name'] = val
|
|
27
|
+
end
|
|
28
|
+
opts.on('--category VALUE', String, "Filter by category") do |val|
|
|
29
|
+
params['category'] = val
|
|
30
|
+
end
|
|
31
|
+
# build_standard_list_options(opts, options)
|
|
32
|
+
super
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def parse_list_options!(args, options, params)
|
|
36
|
+
parse_parameter_as_resource_id!(:storage_server, options, params)
|
|
37
|
+
super
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def storage_volume_list_column_definitions(options)
|
|
41
|
+
{
|
|
42
|
+
"ID" => 'id',
|
|
43
|
+
"Name" => 'name',
|
|
44
|
+
"Type" => lambda {|it| it['type'] ? it['type']['name'] : '' },
|
|
45
|
+
"Source" => lambda {|it| format_storage_volume_source(it) },
|
|
46
|
+
"Storage" => lambda {|it| format_bytes(it['maxStorage']) },
|
|
47
|
+
"Status" => lambda {|it| format_storage_volume_status(it) },
|
|
48
|
+
}
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def storage_volume_column_definitions(options)
|
|
52
|
+
{
|
|
53
|
+
"ID" => 'id',
|
|
54
|
+
"Name" => 'name',
|
|
55
|
+
"Description" => 'description',
|
|
56
|
+
"Type" => lambda {|it| it['type'] ? it['type']['name'] : '' },
|
|
57
|
+
"Owner" => lambda {|it| it['owner'] ? it['owner']['name'] : (it['account'] ? it['account']['name'] : nil) },
|
|
58
|
+
"Cloud" => lambda {|it| it['zone']['name'] rescue '' },
|
|
59
|
+
"Datastore" => lambda {|it| it['datastore']['name'] rescue '' },
|
|
60
|
+
"Storage Group" => lambda {|it| it['storageGroup']['name'] rescue '' },
|
|
61
|
+
"Storage Server" => lambda {|it| it['storageServer']['name'] rescue '' },
|
|
62
|
+
"Source" => lambda {|it| format_storage_volume_source(it) },
|
|
63
|
+
"Storage" => lambda {|it| format_bytes(it['maxStorage']) },
|
|
64
|
+
"Status" => lambda {|it| format_storage_volume_status(it) },
|
|
65
|
+
}
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# overridden to work with name or code
|
|
69
|
+
# nope, api works with name=code now too
|
|
70
|
+
# def find_storage_volume_type_by_name_or_id(name)
|
|
71
|
+
# storage_volume_type_for_name_or_id(name)
|
|
72
|
+
# end
|
|
73
|
+
|
|
74
|
+
def add_storage_volume_option_types()
|
|
75
|
+
[
|
|
76
|
+
{'fieldContext' => 'storageServer', 'fieldName' => 'id', 'fieldLabel' => 'Storage Server', 'type' => 'select', 'optionSource' => 'storageServers', 'optionParams' => {'createType' => 'block'}, 'required' => true},
|
|
77
|
+
{'fieldContext' => 'storageGroup', 'fieldName' => 'id', 'fieldLabel' => 'Storage Group', 'type' => 'select', 'optionSource' => 'storageGroups', 'required' => true},
|
|
78
|
+
{'shorthand' => '-t', 'fieldName' => 'type', 'fieldLabel' => 'Storage Volume Type', 'type' => 'select', 'optionSource' => 'storageVolumeTypes', 'required' => true},
|
|
79
|
+
{'fieldName' => 'name', 'fieldLabel' => 'Name', 'type' => 'text', 'required' => true},
|
|
80
|
+
]
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def update_storage_volume_option_types()
|
|
84
|
+
[
|
|
85
|
+
{'fieldName' => 'name', 'fieldLabel' => 'Name', 'type' => 'text'},
|
|
86
|
+
]
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def load_option_types_for_storage_volume(type_record, parent_record)
|
|
90
|
+
storage_volume_type = type_record
|
|
91
|
+
option_types = storage_volume_type['optionTypes']
|
|
92
|
+
# ughhh, all this to change a label for API which uses bytes and not MB
|
|
93
|
+
if option_types
|
|
94
|
+
size_option_type = option_types.find {|it| it['fieldName'] == 'maxStorage' }
|
|
95
|
+
if size_option_type
|
|
96
|
+
#size_option_type['fieldLabel'] = "Volume Size (bytes)"
|
|
97
|
+
size_option_type['fieldAddOn'] = "bytes"
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
return option_types
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
end
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
require 'rest_client'
|
|
2
|
-
require 'optparse'
|
|
3
|
-
require 'filesize'
|
|
4
1
|
require 'morpheus/cli/cli_command'
|
|
5
|
-
require 'morpheus/cli/mixins/infrastructure_helper'
|
|
6
2
|
|
|
7
3
|
class Morpheus::Cli::SubnetsCommand
|
|
8
4
|
include Morpheus::Cli::CliCommand
|
|
@@ -350,8 +346,13 @@ class Morpheus::Cli::SubnetsCommand
|
|
|
350
346
|
if subnet_type_option_types && subnet_type_option_types.size > 0
|
|
351
347
|
# prompt for option types
|
|
352
348
|
subnet_type_params = Morpheus::Cli::OptionTypes.prompt(subnet_type_option_types,options[:options],@api_client, {networkId: network['id'], zoneId: network['zone']['id']})
|
|
353
|
-
|
|
354
|
-
|
|
349
|
+
if subnet_type_params['subnet']
|
|
350
|
+
payload['subnet'].deep_merge!(subnet_type_params['subnet'])
|
|
351
|
+
end
|
|
352
|
+
if subnet_type_params['config']
|
|
353
|
+
payload['subnet']['config'] ||= {}
|
|
354
|
+
payload['subnet']['config'].deep_merge!(subnet_type_params['config'])
|
|
355
|
+
end
|
|
355
356
|
else
|
|
356
357
|
# DEFAULT INPUTS
|
|
357
358
|
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
# require 'yaml'
|
|
2
|
-
require 'io/console'
|
|
3
|
-
require 'rest_client'
|
|
4
|
-
require 'optparse'
|
|
5
1
|
require 'morpheus/cli/cli_command'
|
|
6
2
|
|
|
7
3
|
class Morpheus::Cli::Tasks
|
|
@@ -198,7 +194,14 @@ class Morpheus::Cli::Tasks
|
|
|
198
194
|
end
|
|
199
195
|
else
|
|
200
196
|
task_option_types << optionType
|
|
201
|
-
task_option_columns << {(optionType['fieldLabel']) => lambda {|it|
|
|
197
|
+
task_option_columns << {(optionType['fieldLabel']) => lambda {|it|
|
|
198
|
+
value = task['taskOptions'][optionType['code']] || task['taskOptions'][optionType['fieldName']] || optionType['defaultValue']
|
|
199
|
+
if optionType['type'] == 'checkbox'
|
|
200
|
+
value.to_s.empty? ? 'off' : value.to_s
|
|
201
|
+
else
|
|
202
|
+
value.to_s
|
|
203
|
+
end
|
|
204
|
+
} }
|
|
202
205
|
end
|
|
203
206
|
end
|
|
204
207
|
else
|
|
@@ -430,6 +433,10 @@ class Morpheus::Cli::Tasks
|
|
|
430
433
|
if it['fieldContext'].nil? || it['fieldContext'] == ''
|
|
431
434
|
it['fieldContext'] = 'taskOptions'
|
|
432
435
|
end
|
|
436
|
+
# taskOptions should prompt for code instead of fieldName, oy vey
|
|
437
|
+
if it['fieldContext'] == 'taskOptions'
|
|
438
|
+
it['fieldName'] = it['code']
|
|
439
|
+
end
|
|
433
440
|
end
|
|
434
441
|
end
|
|
435
442
|
# inject file_params into options for file-content prompt
|
|
@@ -444,8 +451,20 @@ class Morpheus::Cli::Tasks
|
|
|
444
451
|
end
|
|
445
452
|
end
|
|
446
453
|
# prompt
|
|
454
|
+
|
|
455
|
+
# tasks are different in that they use the optionType code instead of fieldName for the key values
|
|
447
456
|
input_options = Morpheus::Cli::OptionTypes.prompt(task_option_types, options[:options],@api_client, options[:params])
|
|
448
|
-
|
|
457
|
+
# flatten taskOptions as serverside expects
|
|
458
|
+
if input_options['taskOptions']
|
|
459
|
+
input_options['taskOptions'] = Morpheus::RestClient.grails_params(input_options['taskOptions'])
|
|
460
|
+
# remove "off" checkbox values, like the UI does
|
|
461
|
+
input_options['taskOptions'].keys.each do |k|
|
|
462
|
+
if input_options['taskOptions'][k] == "off"
|
|
463
|
+
input_options['taskOptions'].delete(k)
|
|
464
|
+
end
|
|
465
|
+
end
|
|
466
|
+
end
|
|
467
|
+
payload.deep_merge!({'task' => input_options}) unless input_options.empty?
|
|
449
468
|
|
|
450
469
|
|
|
451
470
|
# Target Options
|
|
File without changes
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
# require 'yaml'
|
|
2
|
-
require 'io/console'
|
|
3
|
-
require 'rest_client'
|
|
4
|
-
require 'optparse'
|
|
5
1
|
require 'morpheus/cli/cli_command'
|
|
6
|
-
require 'morpheus/cli/option_types'
|
|
7
|
-
require 'morpheus/cli/mixins/accounts_helper'
|
|
8
|
-
require 'json'
|
|
9
2
|
|
|
10
3
|
class Morpheus::Cli::TenantsCommand
|
|
11
4
|
include Morpheus::Cli::CliCommand
|
|
@@ -25,7 +18,7 @@ class Morpheus::Cli::TenantsCommand
|
|
|
25
18
|
|
|
26
19
|
def connect(opts)
|
|
27
20
|
@api_client = establish_remote_appliance_connection(opts)
|
|
28
|
-
@
|
|
21
|
+
@account_users_interface = @api_client.account_users
|
|
29
22
|
@accounts_interface = @api_client.accounts
|
|
30
23
|
@roles_interface = @api_client.roles
|
|
31
24
|
end
|
|
File without changes
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
require 'morpheus/cli/cli_command'
|
|
2
|
-
require 'morpheus/cli/mixins/accounts_helper'
|
|
3
2
|
|
|
4
3
|
class Morpheus::Cli::UserGroupsCommand
|
|
5
4
|
include Morpheus::Cli::CliCommand
|
|
@@ -13,7 +12,7 @@ class Morpheus::Cli::UserGroupsCommand
|
|
|
13
12
|
def connect(opts)
|
|
14
13
|
@api_client = establish_remote_appliance_connection(opts)
|
|
15
14
|
@user_groups_interface = @api_client.user_groups
|
|
16
|
-
@
|
|
15
|
+
@account_users_interface = @api_client.account_users
|
|
17
16
|
@accounts_interface = @api_client.accounts
|
|
18
17
|
end
|
|
19
18
|
|
|
@@ -17,7 +17,8 @@ class Morpheus::Cli::UserSettingsCommand
|
|
|
17
17
|
def connect(opts)
|
|
18
18
|
@api_client = establish_remote_appliance_connection(opts)
|
|
19
19
|
@user_settings_interface = @api_client.user_settings
|
|
20
|
-
@
|
|
20
|
+
@accounts_interface = @api_client.accounts
|
|
21
|
+
@account_users_interface = @api_client.account_users
|
|
21
22
|
end
|
|
22
23
|
|
|
23
24
|
def handle(args)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
require 'morpheus/cli/cli_command'
|
|
2
|
-
require 'morpheus/cli/mixins/accounts_helper'
|
|
3
2
|
|
|
4
3
|
class Morpheus::Cli::UserSourcesCommand
|
|
5
4
|
include Morpheus::Cli::CliCommand
|
|
@@ -22,7 +21,7 @@ class Morpheus::Cli::UserSourcesCommand
|
|
|
22
21
|
@api_client = establish_remote_appliance_connection(opts)
|
|
23
22
|
@user_sources_interface = @api_client.user_sources
|
|
24
23
|
@accounts_interface = @api_client.accounts
|
|
25
|
-
@
|
|
24
|
+
@account_users_interface = @api_client.account_users
|
|
26
25
|
end
|
|
27
26
|
|
|
28
27
|
def handle(args)
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
# require 'yaml'
|
|
2
|
-
require 'io/console'
|
|
3
|
-
require 'rest_client'
|
|
4
|
-
require 'optparse'
|
|
5
1
|
require 'morpheus/cli/cli_command'
|
|
6
|
-
require 'morpheus/cli/option_types'
|
|
7
|
-
require 'morpheus/cli/mixins/accounts_helper'
|
|
8
|
-
require 'json'
|
|
9
2
|
|
|
10
3
|
class Morpheus::Cli::Users
|
|
11
4
|
include Morpheus::Cli::CliCommand
|
|
@@ -22,7 +15,7 @@ class Morpheus::Cli::Users
|
|
|
22
15
|
|
|
23
16
|
def connect(opts)
|
|
24
17
|
@api_client = establish_remote_appliance_connection(opts)
|
|
25
|
-
@
|
|
18
|
+
@account_users_interface = @api_client.account_users
|
|
26
19
|
@accounts_interface = @api_client.accounts
|
|
27
20
|
@roles_interface = @api_client.roles
|
|
28
21
|
end
|
|
@@ -62,12 +55,12 @@ class Morpheus::Cli::Users
|
|
|
62
55
|
account_id = account ? account['id'] : nil
|
|
63
56
|
params['global'] = true if options[:global]
|
|
64
57
|
params.merge!(parse_list_options(options))
|
|
65
|
-
@
|
|
58
|
+
@account_users_interface.setopts(options)
|
|
66
59
|
if options[:dry_run]
|
|
67
|
-
print_dry_run @
|
|
60
|
+
print_dry_run @account_users_interface.dry.list(account_id, params)
|
|
68
61
|
return 0, nil
|
|
69
62
|
end
|
|
70
|
-
json_response = @
|
|
63
|
+
json_response = @account_users_interface.list(account_id, params)
|
|
71
64
|
render_response(json_response, options, "users") do
|
|
72
65
|
users = json_response['users']
|
|
73
66
|
title = "Morpheus Users"
|
|
@@ -110,12 +103,12 @@ class Morpheus::Cli::Users
|
|
|
110
103
|
account_id = account ? account['id'] : nil
|
|
111
104
|
params['global'] = true if options[:global]
|
|
112
105
|
params.merge!(parse_list_options(options))
|
|
113
|
-
@
|
|
106
|
+
@account_users_interface.setopts(options)
|
|
114
107
|
if options[:dry_run]
|
|
115
|
-
print_dry_run @
|
|
108
|
+
print_dry_run @account_users_interface.dry.list(account_id, params)
|
|
116
109
|
return
|
|
117
110
|
end
|
|
118
|
-
json_response = @
|
|
111
|
+
json_response = @account_users_interface.list(account_id, params)
|
|
119
112
|
# print number only
|
|
120
113
|
if json_response['meta'] && json_response['meta']['total']
|
|
121
114
|
print cyan, json_response['meta']['total'], reset, "\n"
|
|
@@ -202,12 +195,12 @@ EOT
|
|
|
202
195
|
account = find_account_from_options(options)
|
|
203
196
|
account_id = account ? account['id'] : nil
|
|
204
197
|
params['global'] = true if options[:global]
|
|
205
|
-
@
|
|
198
|
+
@account_users_interface.setopts(options)
|
|
206
199
|
if options[:dry_run]
|
|
207
200
|
if args[0].to_s =~ /\A\d{1,}\Z/
|
|
208
|
-
print_dry_run @
|
|
201
|
+
print_dry_run @account_users_interface.dry.get(account_id, args[0].to_i, params)
|
|
209
202
|
else
|
|
210
|
-
print_dry_run @
|
|
203
|
+
print_dry_run @account_users_interface.dry.list(account_id, params.merge({username: args[0]}))
|
|
211
204
|
end
|
|
212
205
|
return
|
|
213
206
|
end
|
|
@@ -220,7 +213,7 @@ EOT
|
|
|
220
213
|
user_id = user['id']
|
|
221
214
|
end
|
|
222
215
|
# always get by id, index does not return 'access'
|
|
223
|
-
json_response = @
|
|
216
|
+
json_response = @account_users_interface.get(account_id, user_id, params)
|
|
224
217
|
user = json_response['user']
|
|
225
218
|
render_response(json_response, options, "user") do
|
|
226
219
|
is_tenant_account = current_account['id'] != user['account']['id']
|
|
@@ -230,7 +223,7 @@ EOT
|
|
|
230
223
|
|
|
231
224
|
# backward compatibility
|
|
232
225
|
if user['access'].nil? && options[:include_features_access]
|
|
233
|
-
user_feature_permissions_json = @
|
|
226
|
+
user_feature_permissions_json = @account_users_interface.feature_permissions(account_id, user['id'])
|
|
234
227
|
user_feature_permissions = user_feature_permissions_json['permissions'] || user_feature_permissions_json['featurePermissions']
|
|
235
228
|
|
|
236
229
|
if user_feature_permissions
|
|
@@ -315,15 +308,15 @@ EOT
|
|
|
315
308
|
params['global'] = true if options[:global]
|
|
316
309
|
user = find_user_by_username_or_id(account_id, args[0], params)
|
|
317
310
|
return 1 if user.nil?
|
|
318
|
-
@
|
|
311
|
+
@account_users_interface.setopts(options)
|
|
319
312
|
if options[:dry_run]
|
|
320
|
-
print_dry_run @
|
|
313
|
+
print_dry_run @account_users_interface.dry.permissions(account_id, user['id'])
|
|
321
314
|
return
|
|
322
315
|
end
|
|
323
316
|
|
|
324
317
|
is_tenant_account = current_account['id'] != user['account']['id']
|
|
325
318
|
|
|
326
|
-
json_response = @
|
|
319
|
+
json_response = @account_users_interface.permissions(account_id, user['id'])
|
|
327
320
|
|
|
328
321
|
# backward compatibility
|
|
329
322
|
if !json_response['permissions'].nil?
|
|
@@ -467,12 +460,12 @@ EOT
|
|
|
467
460
|
puts as_json(payload, options)
|
|
468
461
|
return 0
|
|
469
462
|
end
|
|
470
|
-
@
|
|
463
|
+
@account_users_interface.setopts(options)
|
|
471
464
|
if options[:dry_run]
|
|
472
|
-
print_dry_run @
|
|
465
|
+
print_dry_run @account_users_interface.dry.create(account_id, payload)
|
|
473
466
|
return
|
|
474
467
|
end
|
|
475
|
-
json_response = @
|
|
468
|
+
json_response = @account_users_interface.create(account_id, payload)
|
|
476
469
|
if options[:json]
|
|
477
470
|
print JSON.pretty_generate(json_response)
|
|
478
471
|
print "\n"
|
|
@@ -552,12 +545,12 @@ EOT
|
|
|
552
545
|
end
|
|
553
546
|
end
|
|
554
547
|
|
|
555
|
-
@
|
|
548
|
+
@account_users_interface.setopts(options)
|
|
556
549
|
if options[:dry_run]
|
|
557
|
-
print_dry_run @
|
|
550
|
+
print_dry_run @account_users_interface.dry.update(account_id, user['id'], payload)
|
|
558
551
|
return
|
|
559
552
|
end
|
|
560
|
-
json_response = @
|
|
553
|
+
json_response = @account_users_interface.update(account_id, user['id'], payload)
|
|
561
554
|
user = json_response['user']
|
|
562
555
|
if options[:json]
|
|
563
556
|
print JSON.pretty_generate(json_response)
|
|
@@ -652,12 +645,12 @@ EOT
|
|
|
652
645
|
}
|
|
653
646
|
|
|
654
647
|
end
|
|
655
|
-
@
|
|
648
|
+
@account_users_interface.setopts(options)
|
|
656
649
|
if options[:dry_run]
|
|
657
|
-
print_dry_run @
|
|
650
|
+
print_dry_run @account_users_interface.dry.update(account_id, user['id'], payload)
|
|
658
651
|
return
|
|
659
652
|
end
|
|
660
|
-
json_response = @
|
|
653
|
+
json_response = @account_users_interface.update(account_id, user['id'], payload)
|
|
661
654
|
render_response(json_response, optparse, "user") do
|
|
662
655
|
print_green_success "Updated password for user #{user['username']}"
|
|
663
656
|
end
|
|
@@ -691,12 +684,12 @@ EOT
|
|
|
691
684
|
unless options[:yes] || Morpheus::Cli::OptionTypes.confirm("Are you sure you want to delete the user #{user['username']}?")
|
|
692
685
|
exit 9, "arborted"
|
|
693
686
|
end
|
|
694
|
-
@
|
|
687
|
+
@account_users_interface.setopts(options)
|
|
695
688
|
if options[:dry_run]
|
|
696
|
-
print_dry_run @
|
|
689
|
+
print_dry_run @account_users_interface.dry.destroy(account_id, user['id'])
|
|
697
690
|
return 0
|
|
698
691
|
end
|
|
699
|
-
json_response = @
|
|
692
|
+
json_response = @account_users_interface.destroy(account_id, user['id'])
|
|
700
693
|
|
|
701
694
|
if options[:json]
|
|
702
695
|
print JSON.pretty_generate(json_response)
|
|
@@ -766,7 +759,7 @@ EOT
|
|
|
766
759
|
end
|
|
767
760
|
end
|
|
768
761
|
|
|
769
|
-
available_roles = @
|
|
762
|
+
available_roles = @account_users_interface.available_roles(account_id, user_id)['roles']
|
|
770
763
|
|
|
771
764
|
if available_roles.empty?
|
|
772
765
|
print_red_alert "No available roles found."
|
|
File without changes
|
|
File without changes
|
|
File without changes
|