morpheus-cli 5.5.0 → 5.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +1 -1
- data/lib/morpheus/api/api_client.rb +4 -0
- data/lib/morpheus/api/clusters_interface.rb +12 -0
- data/lib/morpheus/api/network_pool_servers_interface.rb +7 -0
- data/lib/morpheus/api/scale_thresholds_interface.rb +9 -0
- data/lib/morpheus/cli/cli_command.rb +39 -20
- data/lib/morpheus/cli/commands/apps.rb +1 -1
- data/lib/morpheus/cli/commands/cloud_resource_pools_command.rb +33 -2
- data/lib/morpheus/cli/commands/clouds.rb +12 -6
- data/lib/morpheus/cli/commands/clusters.rb +66 -5
- data/lib/morpheus/cli/commands/hosts.rb +5 -1
- data/lib/morpheus/cli/commands/instances.rb +1 -1
- data/lib/morpheus/cli/commands/integrations_command.rb +1 -1
- data/lib/morpheus/cli/commands/invoices_command.rb +8 -1
- data/lib/morpheus/cli/commands/jobs_command.rb +45 -225
- data/lib/morpheus/cli/commands/library_container_types_command.rb +52 -3
- data/lib/morpheus/cli/commands/library_option_types_command.rb +56 -62
- data/lib/morpheus/cli/commands/load_balancers.rb +11 -19
- data/lib/morpheus/cli/commands/network_pool_servers_command.rb +5 -2
- data/lib/morpheus/cli/commands/roles.rb +475 -70
- data/lib/morpheus/cli/commands/scale_thresholds.rb +103 -0
- data/lib/morpheus/cli/commands/tasks.rb +19 -12
- data/lib/morpheus/cli/commands/user_sources_command.rb +107 -39
- data/lib/morpheus/cli/commands/users.rb +10 -10
- data/lib/morpheus/cli/commands/view.rb +1 -0
- data/lib/morpheus/cli/commands/workflows.rb +21 -14
- data/lib/morpheus/cli/error_handler.rb +13 -4
- data/lib/morpheus/cli/mixins/accounts_helper.rb +1 -1
- data/lib/morpheus/cli/mixins/execution_request_helper.rb +1 -1
- data/lib/morpheus/cli/mixins/infrastructure_helper.rb +3 -3
- data/lib/morpheus/cli/mixins/jobs_helper.rb +173 -0
- data/lib/morpheus/cli/mixins/print_helper.rb +120 -38
- data/lib/morpheus/cli/mixins/provisioning_helper.rb +1 -3
- data/lib/morpheus/cli/mixins/rest_command.rb +41 -14
- data/lib/morpheus/cli/option_types.rb +68 -37
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/logging.rb +6 -8
- metadata +6 -4
@@ -4,6 +4,7 @@ class Morpheus::Cli::LoadBalancers
|
|
4
4
|
include Morpheus::Cli::CliCommand
|
5
5
|
include Morpheus::Cli::RestCommand
|
6
6
|
include Morpheus::Cli::LoadBalancersHelper
|
7
|
+
include Morpheus::Cli::ProvisioningHelper
|
7
8
|
|
8
9
|
set_command_description "View and manage load balancers."
|
9
10
|
set_command_name :'load-balancers'
|
@@ -17,10 +18,12 @@ class Morpheus::Cli::LoadBalancers
|
|
17
18
|
register_interfaces :load_balancers, :load_balancer_types
|
18
19
|
set_rest_has_type true
|
19
20
|
# set_rest_type :load_balancer_types
|
21
|
+
set_rest_perms_config({enabled:true, excludes:['plans', 'visibility']})
|
20
22
|
|
21
23
|
def render_response_for_get(json_response, options)
|
22
24
|
render_response(json_response, options, rest_object_key) do
|
23
25
|
record = json_response[rest_object_key]
|
26
|
+
options[:exclude_username] = record['username'].nil?
|
24
27
|
print_h1 rest_label, [], options
|
25
28
|
print cyan
|
26
29
|
print_description_list(rest_column_definitions(options), record, options)
|
@@ -94,19 +97,7 @@ EOT
|
|
94
97
|
|
95
98
|
# filtering for NSX-T only
|
96
99
|
def rest_list_types()
|
97
|
-
rest_type_interface.list({max:10000, creatable:true})[rest_type_list_key].reject {|it| it['code'] == 'nsx-t'}
|
98
|
-
end
|
99
|
-
|
100
|
-
def load_balancer_type_list_to_options(type_list)
|
101
|
-
type_list.reject {|it| it['code'] != 'nsx-t'}.collect {|it| {'name' => it['name'], 'value' => it['code']} }
|
102
|
-
end
|
103
|
-
|
104
|
-
def add_load_balancer_footer_addn
|
105
|
-
"#{bold}Available for NSX-T load balancers only#{reset}"
|
106
|
-
end
|
107
|
-
|
108
|
-
def update_load_balancer_footer_addn
|
109
|
-
"#{bold}Available for NSX-T load balancers only#{reset}"
|
100
|
+
rest_type_interface.list({max:10000, creatable:true})[rest_type_list_key] # .reject {|it| it['code'] == 'nsx-t'}
|
110
101
|
end
|
111
102
|
|
112
103
|
def load_balancer_list_column_definitions(options)
|
@@ -120,7 +111,7 @@ EOT
|
|
120
111
|
end
|
121
112
|
|
122
113
|
def load_balancer_column_definitions(options)
|
123
|
-
{
|
114
|
+
columns = {
|
124
115
|
"ID" => 'id',
|
125
116
|
"Name" => 'name',
|
126
117
|
"Description" => 'description',
|
@@ -130,13 +121,14 @@ EOT
|
|
130
121
|
"IP" => 'ip',
|
131
122
|
"Host" => 'host',
|
132
123
|
"Port" => 'port',
|
133
|
-
"
|
134
|
-
|
135
|
-
|
136
|
-
|
124
|
+
"Price" => lambda {|it| it['price'].nil? ? 'No pricing configured' : "#{format_money(it['price']['price'], it['price']['currency'])} / #{it['price']['unit'].capitalize}"},
|
125
|
+
"Provider ID" => 'externalId'
|
126
|
+
}
|
127
|
+
columns.merge!({"Username" => 'username'}) if !options[:exclude_username]
|
128
|
+
columns.merge({
|
137
129
|
"Created" => lambda {|it| format_local_dt(it['dateCreated']) },
|
138
130
|
"Updated" => lambda {|it| format_local_dt(it['lastUpdated']) }
|
139
|
-
}
|
131
|
+
})
|
140
132
|
end
|
141
133
|
|
142
134
|
# overridden to work with name or code
|
@@ -209,10 +209,13 @@ class Morpheus::Cli::NetworkPoolServersCommand
|
|
209
209
|
print_red_alert "Pool Server Type not found by id '#{options['type']}'"
|
210
210
|
return 1
|
211
211
|
end
|
212
|
-
payload['networkPoolServer']['type'] = {'id' => network_type_id.to_i }
|
213
212
|
|
214
|
-
|
213
|
+
payload['networkPoolServer']['type'] = {'id' => network_type_id.to_i }
|
215
214
|
|
215
|
+
# prompt options
|
216
|
+
network_pool_server_type = @network_pool_servers_interface.get_type(network_type_id.to_i)['networkPoolServerType']
|
217
|
+
option_result = Morpheus::Cli::OptionTypes.prompt(network_pool_server_type['optionTypes'], options[:options].deep_merge({:context_map => {'networkPoolServer' => ''}}), @api_client, {}, options[:no_prompt], true)
|
218
|
+
payload['networkPoolServer'].deep_merge!(option_result)
|
216
219
|
end
|
217
220
|
|
218
221
|
@network_pool_servers_interface.setopts(options)
|