morpheus-cli 3.6.9 → 3.6.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/morpheus/api/api_client.rb +0 -4
- data/lib/morpheus/api/deploy_interface.rb +12 -8
- data/lib/morpheus/cli.rb +0 -1
- data/lib/morpheus/cli/access_token_command.rb +3 -4
- data/lib/morpheus/cli/account_groups_command.rb +8 -3
- data/lib/morpheus/cli/apps.rb +10 -5
- data/lib/morpheus/cli/archives_command.rb +20 -6
- data/lib/morpheus/cli/boot_scripts_command.rb +5 -2
- data/lib/morpheus/cli/change_password_command.rb +1 -1
- data/lib/morpheus/cli/cli_command.rb +2 -4
- data/lib/morpheus/cli/cloud_datastores_command.rb +3 -2
- data/lib/morpheus/cli/commands/standard/alias_command.rb +10 -14
- data/lib/morpheus/cli/commands/standard/history_command.rb +0 -20
- data/lib/morpheus/cli/commands/standard/man_command.rb +8 -8
- data/lib/morpheus/cli/containers_command.rb +9 -1
- data/lib/morpheus/cli/credentials.rb +2 -1
- data/lib/morpheus/cli/cypher_command.rb +10 -2
- data/lib/morpheus/cli/dashboard_command.rb +1 -0
- data/lib/morpheus/cli/deployments.rb +5 -1
- data/lib/morpheus/cli/deploys.rb +26 -9
- data/lib/morpheus/cli/execute_schedules_command.rb +9 -1
- data/lib/morpheus/cli/execution_request_command.rb +3 -2
- data/lib/morpheus/cli/file_copy_request_command.rb +3 -2
- data/lib/morpheus/cli/hosts.rb +8 -6
- data/lib/morpheus/cli/image_builder_command.rb +14 -10
- data/lib/morpheus/cli/instance_types.rb +2 -1
- data/lib/morpheus/cli/instances.rb +9 -4
- data/lib/morpheus/cli/key_pairs.rb +33 -21
- data/lib/morpheus/cli/library_container_scripts_command.rb +5 -2
- data/lib/morpheus/cli/library_container_templates_command.rb +5 -2
- data/lib/morpheus/cli/library_container_types_command.rb +5 -3
- data/lib/morpheus/cli/library_instance_types_command.rb +6 -2
- data/lib/morpheus/cli/library_layouts_command.rb +5 -3
- data/lib/morpheus/cli/library_option_lists_command.rb +5 -1
- data/lib/morpheus/cli/library_option_types_command.rb +5 -0
- data/lib/morpheus/cli/library_upgrades_command.rb +5 -3
- data/lib/morpheus/cli/license.rb +3 -0
- data/lib/morpheus/cli/load_balancers.rb +10 -1
- data/lib/morpheus/cli/mixins/processes_helper.rb +10 -4
- data/lib/morpheus/cli/monitoring_apps_command.rb +32 -26
- data/lib/morpheus/cli/monitoring_checks_command.rb +35 -27
- data/lib/morpheus/cli/monitoring_contacts_command.rb +19 -16
- data/lib/morpheus/cli/monitoring_groups_command.rb +32 -26
- data/lib/morpheus/cli/monitoring_incidents_command.rb +39 -30
- data/lib/morpheus/cli/network_domains_command.rb +5 -2
- data/lib/morpheus/cli/network_groups_command.rb +5 -2
- data/lib/morpheus/cli/network_pool_servers_command.rb +5 -2
- data/lib/morpheus/cli/network_pools_command.rb +5 -2
- data/lib/morpheus/cli/network_proxies_command.rb +5 -2
- data/lib/morpheus/cli/network_services_command.rb +1 -0
- data/lib/morpheus/cli/networks_command.rb +5 -2
- data/lib/morpheus/cli/packages_command.rb +6 -3
- data/lib/morpheus/cli/policies_command.rb +17 -3
- data/lib/morpheus/cli/power_schedules_command.rb +9 -1
- data/lib/morpheus/cli/preseed_scripts_command.rb +5 -2
- data/lib/morpheus/cli/processes_command.rb +17 -6
- data/lib/morpheus/cli/recent_activity_command.rb +1 -0
- data/lib/morpheus/cli/remote.rb +1 -0
- data/lib/morpheus/cli/roles.rb +14 -5
- data/lib/morpheus/cli/security_group_rules.rb +8 -4
- data/lib/morpheus/cli/security_groups.rb +4 -0
- data/lib/morpheus/cli/shell.rb +13 -23
- data/lib/morpheus/cli/storage_providers_command.rb +12 -6
- data/lib/morpheus/cli/tasks.rb +6 -0
- data/lib/morpheus/cli/tenants_command.rb +13 -9
- data/lib/morpheus/cli/user_groups_command.rb +7 -1
- data/lib/morpheus/cli/user_settings_command.rb +7 -1
- data/lib/morpheus/cli/user_sources_command.rb +10 -8
- data/lib/morpheus/cli/users.rb +7 -2
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/cli/virtual_images.rb +8 -1
- data/lib/morpheus/cli/whoami.rb +34 -15
- data/lib/morpheus/cli/workflows.rb +5 -0
- data/lib/morpheus/formatters.rb +4 -0
- data/lib/morpheus/rest_client.rb +6 -1
- metadata +2 -4
- data/lib/morpheus/api/app_templates_interface.rb +0 -64
- data/lib/morpheus/cli/app_templates.rb +0 -2019
@@ -63,7 +63,7 @@ class Morpheus::Cli::LibraryLayoutsCommand
|
|
63
63
|
end
|
64
64
|
|
65
65
|
params.merge!(parse_list_options(options))
|
66
|
-
|
66
|
+
@library_layouts_interface.setopts(options)
|
67
67
|
if options[:dry_run]
|
68
68
|
print_dry_run @library_layouts_interface.dry.list(instance_type_id, params)
|
69
69
|
return
|
@@ -123,6 +123,7 @@ class Morpheus::Cli::LibraryLayoutsCommand
|
|
123
123
|
def _get(id, options)
|
124
124
|
instance_type_id = nil
|
125
125
|
begin
|
126
|
+
@library_layouts_interface.setopts(options)
|
126
127
|
if options[:dry_run]
|
127
128
|
if id.to_s =~ /\A\d{1,}\Z/
|
128
129
|
print_dry_run @library_layouts_interface.dry.get(instance_type_id, id.to_i)
|
@@ -380,7 +381,7 @@ class Morpheus::Cli::LibraryLayoutsCommand
|
|
380
381
|
payload = {'instanceTypeLayout' => params}
|
381
382
|
|
382
383
|
end
|
383
|
-
|
384
|
+
@library_layouts_interface.setopts(options)
|
384
385
|
if options[:dry_run]
|
385
386
|
print_dry_run @library_layouts_interface.dry.create(instance_type_id, payload)
|
386
387
|
return
|
@@ -486,7 +487,7 @@ class Morpheus::Cli::LibraryLayoutsCommand
|
|
486
487
|
payload = {'instanceTypeLayout' => params}
|
487
488
|
|
488
489
|
end
|
489
|
-
|
490
|
+
@library_layouts_interface.setopts(options)
|
490
491
|
if options[:dry_run]
|
491
492
|
print_dry_run @library_layouts_interface.dry.update(nil, layout['id'], payload)
|
492
493
|
return
|
@@ -528,6 +529,7 @@ class Morpheus::Cli::LibraryLayoutsCommand
|
|
528
529
|
unless Morpheus::Cli::OptionTypes.confirm("Are you sure you want to delete the instance type #{layout['name']}?", options)
|
529
530
|
exit
|
530
531
|
end
|
532
|
+
@library_layouts_interface.setopts(options)
|
531
533
|
if options[:dry_run]
|
532
534
|
print_dry_run @library_layouts_interface.dry.destroy(nil, layout['id'])
|
533
535
|
return
|
@@ -39,7 +39,7 @@ class Morpheus::Cli::LibraryOptionListsCommand
|
|
39
39
|
begin
|
40
40
|
params = {}
|
41
41
|
params.merge!(parse_list_options(options))
|
42
|
-
|
42
|
+
@option_type_lists_interface.setopts(options)
|
43
43
|
if options[:dry_run]
|
44
44
|
print_dry_run @option_type_lists_interface.dry.list(params)
|
45
45
|
return
|
@@ -101,6 +101,7 @@ class Morpheus::Cli::LibraryOptionListsCommand
|
|
101
101
|
|
102
102
|
connect(options)
|
103
103
|
begin
|
104
|
+
@option_type_lists_interface.setopts(options)
|
104
105
|
if options[:dry_run]
|
105
106
|
if args[0].to_s =~ /\A\d{1,}\Z/
|
106
107
|
print_dry_run @option_type_lists_interface.dry.get(args[0].to_i)
|
@@ -230,6 +231,7 @@ class Morpheus::Cli::LibraryOptionListsCommand
|
|
230
231
|
list_payload = params
|
231
232
|
payload = {'optionTypeList' => list_payload}
|
232
233
|
end
|
234
|
+
@option_type_lists_interface.setopts(options)
|
233
235
|
if options[:dry_run]
|
234
236
|
print_dry_run @option_type_lists_interface.dry.create(payload)
|
235
237
|
return
|
@@ -299,6 +301,7 @@ class Morpheus::Cli::LibraryOptionListsCommand
|
|
299
301
|
list_payload = params
|
300
302
|
payload = {'optionTypeList' => list_payload}
|
301
303
|
end
|
304
|
+
@option_type_lists_interface.setopts(options)
|
302
305
|
if options[:dry_run]
|
303
306
|
print_dry_run @option_type_lists_interface.dry.update(option_type_list['id'], payload)
|
304
307
|
return
|
@@ -337,6 +340,7 @@ class Morpheus::Cli::LibraryOptionListsCommand
|
|
337
340
|
unless Morpheus::Cli::OptionTypes.confirm("Are you sure you want to delete the option type #{option_type_list['name']}?", options)
|
338
341
|
exit
|
339
342
|
end
|
343
|
+
@option_type_lists_interface.setopts(options)
|
340
344
|
if options[:dry_run]
|
341
345
|
print_dry_run @option_type_lists_interface.dry.destroy(option_type_list['id'])
|
342
346
|
return
|
@@ -39,6 +39,7 @@ class Morpheus::Cli::LibraryOptionTypesCommand
|
|
39
39
|
begin
|
40
40
|
params = {}
|
41
41
|
params.merge!(parse_list_options(options))
|
42
|
+
@option_types_interface.setopts(options)
|
42
43
|
if options[:dry_run]
|
43
44
|
print_dry_run @option_types_interface.dry.list(params)
|
44
45
|
return
|
@@ -109,6 +110,7 @@ class Morpheus::Cli::LibraryOptionTypesCommand
|
|
109
110
|
|
110
111
|
def _get(id, options)
|
111
112
|
begin
|
113
|
+
@option_types_interface.setopts(options)
|
112
114
|
if options[:dry_run]
|
113
115
|
if id.to_s =~ /\A\d{1,}\Z/
|
114
116
|
print_dry_run @option_types_interface.dry.get(id.to_i)
|
@@ -171,6 +173,7 @@ class Morpheus::Cli::LibraryOptionTypesCommand
|
|
171
173
|
end
|
172
174
|
option_type_payload = params
|
173
175
|
payload = {optionType: option_type_payload}
|
176
|
+
@option_types_interface.setopts(options)
|
174
177
|
if options[:dry_run]
|
175
178
|
print_dry_run @option_types_interface.dry.create(payload)
|
176
179
|
return
|
@@ -217,6 +220,7 @@ class Morpheus::Cli::LibraryOptionTypesCommand
|
|
217
220
|
end
|
218
221
|
option_type_payload = params
|
219
222
|
payload = {optionType: option_type_payload}
|
223
|
+
@option_types_interface.setopts(options)
|
220
224
|
if options[:dry_run]
|
221
225
|
print_dry_run @option_types_interface.dry.update(option_type['id'], payload)
|
222
226
|
return
|
@@ -255,6 +259,7 @@ class Morpheus::Cli::LibraryOptionTypesCommand
|
|
255
259
|
unless Morpheus::Cli::OptionTypes.confirm("Are you sure you want to delete the option type #{option_type['name']}?", options)
|
256
260
|
exit
|
257
261
|
end
|
262
|
+
@option_types_interface.setopts(options)
|
258
263
|
if options[:dry_run]
|
259
264
|
print_dry_run @option_types_interface.dry.destroy(option_type['id'])
|
260
265
|
return
|
@@ -68,7 +68,7 @@ class Morpheus::Cli::LibraryUpgradesCommand
|
|
68
68
|
end
|
69
69
|
|
70
70
|
params.merge!(parse_list_options(options))
|
71
|
-
|
71
|
+
@library_container_upgrades_interface.setopts(options)
|
72
72
|
if options[:dry_run]
|
73
73
|
print_dry_run @library_container_upgrades_interface.dry.list(instance_type_id, params)
|
74
74
|
return
|
@@ -132,6 +132,7 @@ class Morpheus::Cli::LibraryUpgradesCommand
|
|
132
132
|
exit 1 if instance_type.nil?
|
133
133
|
instance_type_id = instance_type['id']
|
134
134
|
begin
|
135
|
+
@library_container_upgrades_interface.setopts(options)
|
135
136
|
if options[:dry_run]
|
136
137
|
if id.to_s =~ /\A\d{1,}\Z/
|
137
138
|
print_dry_run @library_container_upgrades_interface.dry.get(instance_type_id, upgrade_id.to_i)
|
@@ -347,7 +348,7 @@ class Morpheus::Cli::LibraryUpgradesCommand
|
|
347
348
|
# any other options or custom option types?
|
348
349
|
|
349
350
|
end
|
350
|
-
|
351
|
+
@library_container_upgrades_interface.setopts(options)
|
351
352
|
if options[:dry_run]
|
352
353
|
print_dry_run @library_container_upgrades_interface.dry.create(instance_type_id, payload)
|
353
354
|
return
|
@@ -452,7 +453,7 @@ class Morpheus::Cli::LibraryUpgradesCommand
|
|
452
453
|
payload = {'upgrade' => params}
|
453
454
|
|
454
455
|
end
|
455
|
-
|
456
|
+
@library_container_upgrades_interface.setopts(options)
|
456
457
|
if options[:dry_run]
|
457
458
|
print_dry_run @library_container_upgrades_interface.dry.update(nil, upgrade['id'], payload)
|
458
459
|
return
|
@@ -494,6 +495,7 @@ class Morpheus::Cli::LibraryUpgradesCommand
|
|
494
495
|
unless Morpheus::Cli::OptionTypes.confirm("Are you sure you want to delete the upgrade #{upgrade['name']}?", options)
|
495
496
|
exit
|
496
497
|
end
|
498
|
+
@library_container_upgrades_interface.setopts(options)
|
497
499
|
if options[:dry_run]
|
498
500
|
print_dry_run @library_container_upgrades_interface.dry.destroy(nil, upgrade['id'])
|
499
501
|
return
|
data/lib/morpheus/cli/license.rb
CHANGED
@@ -33,6 +33,7 @@ class Morpheus::Cli::License
|
|
33
33
|
optparse.parse!(args)
|
34
34
|
connect(options)
|
35
35
|
begin
|
36
|
+
@license_interface.setopts(options)
|
36
37
|
if options[:dry_run]
|
37
38
|
print_dry_run @license_interface.dry.get()
|
38
39
|
return
|
@@ -91,6 +92,7 @@ class Morpheus::Cli::License
|
|
91
92
|
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'licenseKey', 'fieldLabel' => 'License Key', 'type' => 'text', 'required' => true}], options[:options])
|
92
93
|
key = v_prompt['licenseKey'] || ''
|
93
94
|
end
|
95
|
+
@license_interface.setopts(options)
|
94
96
|
if options[:dry_run]
|
95
97
|
print_dry_run @license_interface.dry.apply(key)
|
96
98
|
return 0
|
@@ -127,6 +129,7 @@ class Morpheus::Cli::License
|
|
127
129
|
key = v_prompt['licenseKey'] || ''
|
128
130
|
end
|
129
131
|
begin
|
132
|
+
@license_interface.setopts(options)
|
130
133
|
if options[:dry_run]
|
131
134
|
print_dry_run @license_interface.dry.decode(key)
|
132
135
|
return
|
@@ -38,6 +38,7 @@ class Morpheus::Cli::LoadBalancers
|
|
38
38
|
[:phrase, :offset, :max, :sort, :direction].each do |k|
|
39
39
|
params[k] = options[k] unless options[k].nil?
|
40
40
|
end
|
41
|
+
@load_balancers_interface.setopts(options)
|
41
42
|
if options[:dry_run]
|
42
43
|
print_dry_run @load_balancers_interface.dry.get(params)
|
43
44
|
return
|
@@ -90,6 +91,7 @@ class Morpheus::Cli::LoadBalancers
|
|
90
91
|
lb_name = args[0]
|
91
92
|
connect(options)
|
92
93
|
begin
|
94
|
+
@load_balancers_interface.setopts(options)
|
93
95
|
if options[:dry_run]
|
94
96
|
if lb_name.to_s =~ /\A\d{1,}\Z/
|
95
97
|
print_dry_run @load_balancers_interface.dry.get(lb_name.to_i)
|
@@ -200,6 +202,7 @@ class Morpheus::Cli::LoadBalancers
|
|
200
202
|
task_payload['taskOptions'].merge!(params['taskOptions'])
|
201
203
|
end
|
202
204
|
payload = {task: task_payload}
|
205
|
+
@load_balancers_interface.setopts(options)
|
203
206
|
if options[:dry_run]
|
204
207
|
print_dry_run @load_balancers_interface.dry.update(task['id'], payload)
|
205
208
|
return
|
@@ -229,6 +232,7 @@ class Morpheus::Cli::LoadBalancers
|
|
229
232
|
optparse.parse!(args)
|
230
233
|
connect(options)
|
231
234
|
begin
|
235
|
+
@load_balancers_interface.setopts(options)
|
232
236
|
if options[:dry_run]
|
233
237
|
print_dry_run @load_balancers_interface.dry.load_balancer_types()
|
234
238
|
return
|
@@ -287,9 +291,13 @@ class Morpheus::Cli::LoadBalancers
|
|
287
291
|
end
|
288
292
|
|
289
293
|
payload = {loadBalancer: {name: lb_name, type: {code: lb_type['code'], id: lb_type['id']}}}
|
290
|
-
|
291
294
|
# todo: The options available here are specific by type...
|
292
295
|
#input_options = Morpheus::Cli::OptionTypes.prompt(lb_type['optionTypes'],options[:options],@api_client, options[:params])
|
296
|
+
@load_balancers_interface.setopts(options)
|
297
|
+
if options[:dry_run]
|
298
|
+
print_dry_run @load_balancers_interface.dry.create(payload)
|
299
|
+
return
|
300
|
+
end
|
293
301
|
json_response = @load_balancers_interface.create(payload)
|
294
302
|
if options[:json]
|
295
303
|
print JSON.pretty_generate(json_response)
|
@@ -321,6 +329,7 @@ class Morpheus::Cli::LoadBalancers
|
|
321
329
|
unless options[:yes] || Morpheus::Cli::OptionTypes.confirm("Are you sure you want to delete the load balancer #{lb['name']}?")
|
322
330
|
exit
|
323
331
|
end
|
332
|
+
@load_balancers_interface.setopts(options)
|
324
333
|
if options[:dry_run]
|
325
334
|
print_dry_run @load_balancers_interface.dry.destroy(lb['id'])
|
326
335
|
return
|
@@ -89,10 +89,13 @@ module Morpheus::Cli::ProcessesHelper
|
|
89
89
|
end
|
90
90
|
|
91
91
|
# decolorize, remove newlines and truncate for table cell
|
92
|
-
def format_process_error(process, max_length=
|
92
|
+
def format_process_error(process, max_length=20, return_color=cyan)
|
93
|
+
#return max_length ? truncate_string(process['error'], max_length) : process['error']
|
93
94
|
out = ""
|
94
95
|
if process['error']
|
95
|
-
lines = process['error'].split("\n").collect {|line| reset + "#{line.to_s.strip}" }
|
96
|
+
# lines = process['error'].split("\n").collect {|line| reset + "#{line.to_s.strip}" }
|
97
|
+
# lines = process['error'].split("\n").collect {|line| "#{line.to_s.strip}" }
|
98
|
+
lines = [process['error']]
|
96
99
|
out = lines.join(" ")
|
97
100
|
if max_length
|
98
101
|
out = truncate_string(out, max_length)
|
@@ -103,10 +106,13 @@ module Morpheus::Cli::ProcessesHelper
|
|
103
106
|
end
|
104
107
|
|
105
108
|
# decolorize, remove newlines and truncate for table cell
|
106
|
-
def format_process_output(process, max_length=
|
109
|
+
def format_process_output(process, max_length=20, return_color=cyan)
|
110
|
+
return max_length ? truncate_string(process['output'], max_length) : process['output']
|
107
111
|
out = ""
|
108
112
|
if process['output']
|
109
|
-
lines = process['output'].split("\n").collect {|line| reset + "#{line.to_s.strip}" }
|
113
|
+
# lines = process['output'].split("\n").collect {|line| reset + "#{line.to_s.strip}" }
|
114
|
+
# lines = process['error'].split("\n").collect {|line| "#{line.to_s.strip}" }
|
115
|
+
lines = [process['output']]
|
110
116
|
out = lines.join(" ")
|
111
117
|
if max_length
|
112
118
|
out = truncate_string(out, max_length)
|
@@ -14,7 +14,7 @@ class Morpheus::Cli::MonitoringAppsCommand
|
|
14
14
|
|
15
15
|
def connect(opts)
|
16
16
|
@api_client = establish_remote_appliance_connection(opts)
|
17
|
-
@
|
17
|
+
@monitoring_apps_interface = Morpheus::APIClient.new(@access_token,nil,nil, @appliance_url).monitoring.apps
|
18
18
|
end
|
19
19
|
|
20
20
|
def handle(args)
|
@@ -37,13 +37,13 @@ class Morpheus::Cli::MonitoringAppsCommand
|
|
37
37
|
[:phrase, :offset, :max, :sort, :direction, :lastUpdated].each do |k|
|
38
38
|
params[k] = options[k] unless options[k].nil?
|
39
39
|
end
|
40
|
-
|
40
|
+
@monitoring_apps_interface.setopts(options)
|
41
41
|
if options[:dry_run]
|
42
|
-
print_dry_run @
|
42
|
+
print_dry_run @monitoring_apps_interface.dry.list(params)
|
43
43
|
return
|
44
44
|
end
|
45
45
|
|
46
|
-
json_response = @
|
46
|
+
json_response = @monitoring_apps_interface.list(params)
|
47
47
|
if options[:json]
|
48
48
|
puts as_json(json_response, options, "monitorApps")
|
49
49
|
return 0
|
@@ -109,12 +109,12 @@ class Morpheus::Cli::MonitoringAppsCommand
|
|
109
109
|
|
110
110
|
begin
|
111
111
|
monitor_app = find_monitoring_app_by_name_or_id(id)
|
112
|
-
|
112
|
+
@monitoring_apps_interface.setopts(options)
|
113
113
|
if options[:dry_run]
|
114
|
-
print_dry_run @
|
114
|
+
print_dry_run @monitoring_apps_interface.dry.get(monitor_app['id'])
|
115
115
|
return
|
116
116
|
end
|
117
|
-
json_response = @
|
117
|
+
json_response = @monitoring_apps_interface.get(monitor_app['id'])
|
118
118
|
monitor_app = json_response['monitorApp']
|
119
119
|
if options[:json]
|
120
120
|
puts as_json(json_response, options, "monitorApp")
|
@@ -180,7 +180,7 @@ class Morpheus::Cli::MonitoringAppsCommand
|
|
180
180
|
if options[:show_history]
|
181
181
|
# history_items = json_response["history"]
|
182
182
|
# gotta go get it
|
183
|
-
history_json_response = @
|
183
|
+
history_json_response = @monitoring_apps_interface.history(monitor_app["id"], {})
|
184
184
|
history_items = history_json_response["history"] || history_json_response["events"] || history_json_response["issues"]
|
185
185
|
issues = history_items
|
186
186
|
if history_items && !history_items.empty?
|
@@ -233,13 +233,13 @@ class Morpheus::Cli::MonitoringAppsCommand
|
|
233
233
|
params[k] = options[k] unless options[k].nil?
|
234
234
|
end
|
235
235
|
# JD: lastUpdated 500ing, checks don't have that property ? =o Fix it!
|
236
|
-
|
236
|
+
@monitoring_apps_interface.setopts(options)
|
237
237
|
if options[:dry_run]
|
238
|
-
print_dry_run @
|
238
|
+
print_dry_run @monitoring_apps_interface.dry.history(monitor_app['id'], params)
|
239
239
|
return
|
240
240
|
end
|
241
241
|
|
242
|
-
json_response = @
|
242
|
+
json_response = @monitoring_apps_interface.history(monitor_app['id'], params)
|
243
243
|
if options[:json]
|
244
244
|
puts as_json(json_response, options, "history")
|
245
245
|
return 0
|
@@ -334,11 +334,12 @@ class Morpheus::Cli::MonitoringAppsCommand
|
|
334
334
|
# todo: prompt?
|
335
335
|
payload = {'monitorApp' => params}
|
336
336
|
end
|
337
|
+
@monitoring_apps_interface.setopts(options)
|
337
338
|
if options[:dry_run]
|
338
|
-
print_dry_run @
|
339
|
+
print_dry_run @monitoring_apps_interface.dry.create(payload)
|
339
340
|
return
|
340
341
|
end
|
341
|
-
json_response = @
|
342
|
+
json_response = @monitoring_apps_interface.create(payload)
|
342
343
|
if options[:json]
|
343
344
|
puts as_json(json_response, options)
|
344
345
|
elsif !options[:quiet]
|
@@ -416,11 +417,12 @@ class Morpheus::Cli::MonitoringAppsCommand
|
|
416
417
|
# todo: prompt?
|
417
418
|
payload = {'monitorApp' => params}
|
418
419
|
end
|
420
|
+
@monitoring_apps_interface.setopts(options)
|
419
421
|
if options[:dry_run]
|
420
|
-
print_dry_run @
|
422
|
+
print_dry_run @monitoring_apps_interface.dry.update(monitor_app["id"], payload)
|
421
423
|
return
|
422
424
|
end
|
423
|
-
json_response = @
|
425
|
+
json_response = @monitoring_apps_interface.update(monitor_app["id"], payload)
|
424
426
|
if options[:json]
|
425
427
|
puts as_json(json_response, options)
|
426
428
|
elsif !options[:quiet]
|
@@ -461,11 +463,12 @@ class Morpheus::Cli::MonitoringAppsCommand
|
|
461
463
|
else
|
462
464
|
payload = params
|
463
465
|
end
|
466
|
+
@monitoring_apps_interface.setopts(options)
|
464
467
|
if options[:dry_run]
|
465
|
-
print_dry_run @
|
468
|
+
print_dry_run @monitoring_apps_interface.dry.quarantine(monitor_app["id"], payload)
|
466
469
|
return 0
|
467
470
|
end
|
468
|
-
json_response = @
|
471
|
+
json_response = @monitoring_apps_interface.quarantine(monitor_app["id"], payload)
|
469
472
|
if options[:json]
|
470
473
|
puts as_json(json_response, options)
|
471
474
|
elsif !options[:quiet]
|
@@ -508,11 +511,12 @@ class Morpheus::Cli::MonitoringAppsCommand
|
|
508
511
|
else
|
509
512
|
payload = params
|
510
513
|
end
|
514
|
+
@monitoring_apps_interface.setopts(options)
|
511
515
|
if options[:dry_run]
|
512
|
-
print_dry_run @
|
516
|
+
print_dry_run @monitoring_apps_interface.dry.quarantine(monitor_app["id"], payload)
|
513
517
|
return 0
|
514
518
|
end
|
515
|
-
json_response = @
|
519
|
+
json_response = @monitoring_apps_interface.quarantine(monitor_app["id"], payload)
|
516
520
|
if options[:json]
|
517
521
|
puts as_json(json_response, options)
|
518
522
|
elsif !options[:quiet]
|
@@ -551,11 +555,12 @@ class Morpheus::Cli::MonitoringAppsCommand
|
|
551
555
|
else
|
552
556
|
payload = params
|
553
557
|
end
|
558
|
+
@monitoring_apps_interface.setopts(options)
|
554
559
|
if options[:dry_run]
|
555
|
-
print_dry_run @
|
560
|
+
print_dry_run @monitoring_apps_interface.dry.quarantine_all(payload)
|
556
561
|
return 0
|
557
562
|
end
|
558
|
-
json_response = @
|
563
|
+
json_response = @monitoring_apps_interface.quarantine_all(payload)
|
559
564
|
if options[:json]
|
560
565
|
puts as_json(json_response, options)
|
561
566
|
elsif !options[:quiet]
|
@@ -596,11 +601,12 @@ class Morpheus::Cli::MonitoringAppsCommand
|
|
596
601
|
else
|
597
602
|
payload = params
|
598
603
|
end
|
604
|
+
@monitoring_apps_interface.setopts(options)
|
599
605
|
if options[:dry_run]
|
600
|
-
print_dry_run @
|
606
|
+
print_dry_run @monitoring_apps_interface.dry.quarantine_all(payload)
|
601
607
|
return 0
|
602
608
|
end
|
603
|
-
json_response = @
|
609
|
+
json_response = @monitoring_apps_interface.quarantine_all(payload)
|
604
610
|
if options[:json]
|
605
611
|
puts as_json(json_response, options)
|
606
612
|
elsif !options[:quiet]
|
@@ -640,13 +646,13 @@ class Morpheus::Cli::MonitoringAppsCommand
|
|
640
646
|
# }
|
641
647
|
# payload['monitorApp'].merge!(monitor_app)
|
642
648
|
payload = params
|
643
|
-
|
649
|
+
@monitoring_apps_interface.setopts(options)
|
644
650
|
if options[:dry_run]
|
645
|
-
print_dry_run @
|
651
|
+
print_dry_run @monitoring_apps_interface.dry.destroy(monitor_app["id"])
|
646
652
|
return
|
647
653
|
end
|
648
654
|
|
649
|
-
json_response = @
|
655
|
+
json_response = @monitoring_apps_interface.destroy(monitor_app["id"])
|
650
656
|
if options[:json]
|
651
657
|
puts as_json(json_response, options)
|
652
658
|
elsif !options[:quiet]
|
@@ -14,7 +14,7 @@ class Morpheus::Cli::MonitoringChecksCommand
|
|
14
14
|
|
15
15
|
def connect(opts)
|
16
16
|
@api_client = establish_remote_appliance_connection(opts)
|
17
|
-
@
|
17
|
+
@monitoring_checks_interface = Morpheus::APIClient.new(@access_token,nil,nil, @appliance_url).monitoring.checks
|
18
18
|
end
|
19
19
|
|
20
20
|
def handle(args)
|
@@ -41,11 +41,12 @@ class Morpheus::Cli::MonitoringChecksCommand
|
|
41
41
|
[:phrase, :offset, :max, :sort, :direction, :lastUpdated].each do |k|
|
42
42
|
params[k] = options[k] unless options[k].nil?
|
43
43
|
end
|
44
|
+
@monitoring_checks_interface.setopts(options)
|
44
45
|
if options[:dry_run]
|
45
|
-
print_dry_run @
|
46
|
+
print_dry_run @monitoring_checks_interface.dry.list(params)
|
46
47
|
return
|
47
48
|
end
|
48
|
-
json_response = @
|
49
|
+
json_response = @monitoring_checks_interface.list(params)
|
49
50
|
if options[:json]
|
50
51
|
puts as_json(json_response, options, "checks")
|
51
52
|
return 0
|
@@ -110,12 +111,12 @@ class Morpheus::Cli::MonitoringChecksCommand
|
|
110
111
|
|
111
112
|
begin
|
112
113
|
check = find_check_by_name_or_id(id)
|
113
|
-
|
114
|
+
@monitoring_checks_interface.setopts(options)
|
114
115
|
if options[:dry_run]
|
115
|
-
print_dry_run @
|
116
|
+
print_dry_run @monitoring_checks_interface.dry.get(check['id'])
|
116
117
|
return
|
117
118
|
end
|
118
|
-
json_response = @
|
119
|
+
json_response = @monitoring_checks_interface.get(check['id'])
|
119
120
|
check = json_response['check']
|
120
121
|
if options[:json]
|
121
122
|
puts as_json(json_response, options, 'check')
|
@@ -207,7 +208,7 @@ class Morpheus::Cli::MonitoringChecksCommand
|
|
207
208
|
if options[:show_history]
|
208
209
|
# history_items = json_response["history"]
|
209
210
|
# gotta go get it
|
210
|
-
history_json_response = @
|
211
|
+
history_json_response = @monitoring_checks_interface.history(check["id"], {})
|
211
212
|
history_items = history_json_response["history"] || history_json_response["events"] || history_json_response["issues"]
|
212
213
|
issues = history_items
|
213
214
|
if history_items && !history_items.empty?
|
@@ -260,13 +261,13 @@ class Morpheus::Cli::MonitoringChecksCommand
|
|
260
261
|
params[k] = options[k] unless options[k].nil?
|
261
262
|
end
|
262
263
|
# JD: lastUpdated 500ing, checks don't have that property ? =o Fix it!
|
263
|
-
|
264
|
+
@monitoring_checks_interface.setopts(options)
|
264
265
|
if options[:dry_run]
|
265
|
-
print_dry_run @
|
266
|
+
print_dry_run @monitoring_checks_interface.dry.history(check['id'], params)
|
266
267
|
return
|
267
268
|
end
|
268
269
|
|
269
|
-
json_response = @
|
270
|
+
json_response = @monitoring_checks_interface.history(check['id'], params)
|
270
271
|
if options[:json]
|
271
272
|
puts as_json(json_response, options, "history")
|
272
273
|
return 0
|
@@ -356,11 +357,12 @@ class Morpheus::Cli::MonitoringChecksCommand
|
|
356
357
|
# todo: load option types based on type and prompt
|
357
358
|
payload = {'check' => params}
|
358
359
|
end
|
360
|
+
@monitoring_checks_interface.setopts(options)
|
359
361
|
if options[:dry_run]
|
360
|
-
print_dry_run @
|
362
|
+
print_dry_run @monitoring_checks_interface.dry.create(payload)
|
361
363
|
return
|
362
364
|
end
|
363
|
-
json_response = @
|
365
|
+
json_response = @monitoring_checks_interface.create(payload)
|
364
366
|
if options[:json]
|
365
367
|
puts as_json(json_response, options)
|
366
368
|
elsif !options[:quiet]
|
@@ -422,11 +424,12 @@ class Morpheus::Cli::MonitoringChecksCommand
|
|
422
424
|
# todo: prompt?
|
423
425
|
payload = {'check' => params}
|
424
426
|
end
|
427
|
+
@monitoring_checks_interface.setopts(options)
|
425
428
|
if options[:dry_run]
|
426
|
-
print_dry_run @
|
429
|
+
print_dry_run @monitoring_checks_interface.dry.update(check["id"], payload)
|
427
430
|
return
|
428
431
|
end
|
429
|
-
json_response = @
|
432
|
+
json_response = @monitoring_checks_interface.update(check["id"], payload)
|
430
433
|
if options[:json]
|
431
434
|
puts as_json(json_response, options)
|
432
435
|
elsif !options[:quiet]
|
@@ -468,11 +471,12 @@ class Morpheus::Cli::MonitoringChecksCommand
|
|
468
471
|
else
|
469
472
|
payload = params
|
470
473
|
end
|
474
|
+
@monitoring_checks_interface.setopts(options)
|
471
475
|
if options[:dry_run]
|
472
|
-
print_dry_run @
|
476
|
+
print_dry_run @monitoring_checks_interface.dry.quarantine(check["id"], payload)
|
473
477
|
return 0
|
474
478
|
end
|
475
|
-
json_response = @
|
479
|
+
json_response = @monitoring_checks_interface.quarantine(check["id"], payload)
|
476
480
|
if options[:json]
|
477
481
|
puts as_json(json_response, options)
|
478
482
|
elsif !options[:quiet]
|
@@ -515,11 +519,12 @@ class Morpheus::Cli::MonitoringChecksCommand
|
|
515
519
|
else
|
516
520
|
payload = params
|
517
521
|
end
|
522
|
+
@monitoring_checks_interface.setopts(options)
|
518
523
|
if options[:dry_run]
|
519
|
-
print_dry_run @
|
524
|
+
print_dry_run @monitoring_checks_interface.dry.quarantine(check["id"], payload)
|
520
525
|
return 0
|
521
526
|
end
|
522
|
-
json_response = @
|
527
|
+
json_response = @monitoring_checks_interface.quarantine(check["id"], payload)
|
523
528
|
if options[:json]
|
524
529
|
puts as_json(json_response, options)
|
525
530
|
elsif !options[:quiet]
|
@@ -558,11 +563,12 @@ class Morpheus::Cli::MonitoringChecksCommand
|
|
558
563
|
else
|
559
564
|
payload = params
|
560
565
|
end
|
566
|
+
@monitoring_checks_interface.setopts(options)
|
561
567
|
if options[:dry_run]
|
562
|
-
print_dry_run @
|
568
|
+
print_dry_run @monitoring_checks_interface.dry.quarantine_all(payload)
|
563
569
|
return 0
|
564
570
|
end
|
565
|
-
json_response = @
|
571
|
+
json_response = @monitoring_checks_interface.quarantine_all(payload)
|
566
572
|
if options[:json]
|
567
573
|
puts as_json(json_response, options)
|
568
574
|
elsif !options[:quiet]
|
@@ -603,11 +609,12 @@ class Morpheus::Cli::MonitoringChecksCommand
|
|
603
609
|
else
|
604
610
|
payload = params
|
605
611
|
end
|
612
|
+
@monitoring_checks_interface.setopts(options)
|
606
613
|
if options[:dry_run]
|
607
|
-
print_dry_run @
|
614
|
+
print_dry_run @monitoring_checks_interface.dry.quarantine_all(payload)
|
608
615
|
return 0
|
609
616
|
end
|
610
|
-
json_response = @
|
617
|
+
json_response = @monitoring_checks_interface.quarantine_all(payload)
|
611
618
|
if options[:json]
|
612
619
|
puts as_json(json_response, options)
|
613
620
|
elsif !options[:quiet]
|
@@ -641,13 +648,13 @@ class Morpheus::Cli::MonitoringChecksCommand
|
|
641
648
|
unless options[:yes] || ::Morpheus::Cli::OptionTypes::confirm("Are you sure you would like to delete check '#{check['name']}'?", options)
|
642
649
|
return false
|
643
650
|
end
|
644
|
-
|
651
|
+
@monitoring_checks_interface.setopts(options)
|
645
652
|
if options[:dry_run]
|
646
|
-
print_dry_run @
|
653
|
+
print_dry_run @monitoring_checks_interface.dry.destroy(check["id"])
|
647
654
|
return
|
648
655
|
end
|
649
656
|
|
650
|
-
json_response = @
|
657
|
+
json_response = @monitoring_checks_interface.destroy(check["id"])
|
651
658
|
if options[:json]
|
652
659
|
puts as_json(json_response, options)
|
653
660
|
elsif !options[:quiet]
|
@@ -674,12 +681,13 @@ class Morpheus::Cli::MonitoringChecksCommand
|
|
674
681
|
[:phrase, :offset, :max, :sort, :direction].each do |k|
|
675
682
|
params[k] = options[k] unless options[k].nil?
|
676
683
|
end
|
684
|
+
@monitoring_checks_interface.setopts(options)
|
677
685
|
if options[:dry_run]
|
678
|
-
print_dry_run @
|
686
|
+
print_dry_run @monitoring_checks_interface.dry.list_check_types(params)
|
679
687
|
return
|
680
688
|
end
|
681
689
|
|
682
|
-
json_response = @
|
690
|
+
json_response = @monitoring_checks_interface.list_check_types(params)
|
683
691
|
if options[:json]
|
684
692
|
puts as_json(json_response, options, "checkTypes")
|
685
693
|
return 0
|