morpheus-cli 5.3.4 → 5.4.0
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 +14 -1
- data/lib/morpheus/api/health_interface.rb +37 -3
- 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_servers_interface.rb +68 -12
- data/lib/morpheus/api/roles_interface.rb +7 -0
- data/lib/morpheus/cli/cli_command.rb +7 -8
- data/lib/morpheus/cli/cli_registry.rb +1 -0
- 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} +0 -3
- 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} +0 -9
- data/lib/morpheus/cli/{archives_command.rb → commands/archives_command.rb} +0 -6
- 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} +0 -0
- 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} +0 -4
- data/lib/morpheus/cli/{clouds.rb → commands/clouds.rb} +0 -7
- data/lib/morpheus/cli/{clusters.rb → commands/clusters.rb} +0 -6
- 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} +0 -9
- 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} +0 -4
- data/lib/morpheus/cli/{integrations_command.rb → commands/integrations_command.rb} +0 -0
- data/lib/morpheus/cli/{invoices_command.rb → commands/invoices_command.rb} +1 -1
- data/lib/morpheus/cli/{jobs_command.rb → commands/jobs_command.rb} +0 -0
- data/lib/morpheus/cli/{key_pairs.rb → commands/key_pairs.rb} +0 -6
- data/lib/morpheus/cli/{library_cluster_layouts_command.rb → commands/library_cluster_layouts_command.rb} +0 -4
- data/lib/morpheus/cli/{library_container_scripts_command.rb → commands/library_container_scripts_command.rb} +0 -0
- data/lib/morpheus/cli/{library_container_templates_command.rb → commands/library_container_templates_command.rb} +0 -1
- data/lib/morpheus/cli/{library_container_types_command.rb → commands/library_container_types_command.rb} +0 -4
- data/lib/morpheus/cli/{library_instance_types_command.rb → commands/library_instance_types_command.rb} +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} +0 -4
- data/lib/morpheus/cli/{library_option_types_command.rb → commands/library_option_types_command.rb} +0 -4
- data/lib/morpheus/cli/{library_spec_templates_command.rb → commands/library_spec_templates_command.rb} +0 -1
- data/lib/morpheus/cli/{library_upgrades_command.rb → commands/library_upgrades_command.rb} +0 -4
- data/lib/morpheus/cli/{license.rb → commands/license.rb} +0 -3
- data/lib/morpheus/cli/{load_balancer_pools.rb → commands/load_balancer_pools.rb} +0 -0
- data/lib/morpheus/cli/{load_balancer_types.rb → commands/load_balancer_types.rb} +0 -4
- data/lib/morpheus/cli/{load_balancer_virtual_servers.rb → commands/load_balancer_virtual_servers.rb} +0 -0
- data/lib/morpheus/cli/{load_balancers.rb → commands/load_balancers.rb} +0 -1
- data/lib/morpheus/cli/commands/{standard/log_level_command.rb → log_level_command.rb} +0 -3
- data/lib/morpheus/cli/{log_settings_command.rb → commands/log_settings_command.rb} +0 -0
- data/lib/morpheus/cli/{login.rb → commands/login.rb} +0 -5
- data/lib/morpheus/cli/commands/logout.rb +63 -0
- data/lib/morpheus/cli/{logs_command.rb → commands/logs_command.rb} +0 -3
- data/lib/morpheus/cli/commands/{standard/man_command.rb → man_command.rb} +0 -2
- data/lib/morpheus/cli/{monitoring_alerts_command.rb → commands/monitoring_alerts_command.rb} +0 -7
- data/lib/morpheus/cli/{monitoring_apps_command.rb → commands/monitoring_apps_command.rb} +0 -1
- data/lib/morpheus/cli/{monitoring_checks_command.rb → commands/monitoring_checks_command.rb} +0 -1
- data/lib/morpheus/cli/{monitoring_contacts_command.rb → commands/monitoring_contacts_command.rb} +0 -7
- data/lib/morpheus/cli/{monitoring_groups_command.rb → commands/monitoring_groups_command.rb} +0 -1
- data/lib/morpheus/cli/{monitoring_incidents_command.rb → commands/monitoring_incidents_command.rb} +0 -1
- data/lib/morpheus/cli/commands/network_dhcp_relays_command.rb +416 -0
- data/lib/morpheus/cli/commands/network_dhcp_servers_command.rb +407 -0
- data/lib/morpheus/cli/{network_domains_command.rb → commands/network_domains_command.rb} +0 -4
- data/lib/morpheus/cli/commands/network_edge_clusters_command.rb +329 -0
- data/lib/morpheus/cli/commands/network_firewalls_command.rb +806 -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} +0 -5
- data/lib/morpheus/cli/{network_services_command.rb → commands/network_services_command.rb} +0 -4
- data/lib/morpheus/cli/{network_scopes_command.rb → commands/network_transport_zones_command.rb} +102 -92
- data/lib/morpheus/cli/{networks_command.rb → commands/networks_command.rb} +18 -18
- 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} +0 -7
- 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} +0 -0
- 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} +1 -7
- 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} +244 -39
- 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} +2 -103
- 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/{subnets_command.rb → commands/subnets_command.rb} +0 -4
- data/lib/morpheus/cli/{tasks.rb → commands/tasks.rb} +0 -4
- 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} +0 -7
- 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} +0 -1
- data/lib/morpheus/cli/{user_settings_command.rb → commands/user_settings_command.rb} +0 -0
- data/lib/morpheus/cli/{user_sources_command.rb → commands/user_sources_command.rb} +0 -1
- data/lib/morpheus/cli/{users.rb → commands/users.rb} +0 -7
- data/lib/morpheus/cli/{vdi_allocations_command.rb → commands/vdi_allocations_command.rb} +0 -0
- data/lib/morpheus/cli/{vdi_apps_command.rb → commands/vdi_apps_command.rb} +0 -0
- data/lib/morpheus/cli/{vdi_command.rb → commands/vdi_command.rb} +0 -0
- data/lib/morpheus/cli/{vdi_gateways_command.rb → commands/vdi_gateways_command.rb} +0 -0
- data/lib/morpheus/cli/{vdi_pools_command.rb → commands/vdi_pools_command.rb} +0 -0
- data/lib/morpheus/cli/commands/{standard/version_command.rb → version_command.rb} +0 -0
- data/lib/morpheus/cli/{virtual_images.rb → commands/virtual_images.rb} +0 -4
- 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/logs_helper.rb +1 -1
- data/lib/morpheus/cli/mixins/print_helper.rb +1 -0
- data/lib/morpheus/cli/mixins/rest_command.rb +103 -17
- data/lib/morpheus/cli/mixins/secondary_rest_command.rb +105 -18
- data/lib/morpheus/cli/option_types.rb +56 -19
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/cli.rb +4 -135
- data/lib/morpheus/terminal.rb +5 -6
- metadata +150 -144
- data/lib/morpheus/cli/change_password_command.rb +0 -147
- data/lib/morpheus/cli/library.rb +0 -1
- data/lib/morpheus/cli/logout.rb +0 -81
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09fb64a860681d1b04e678410b8f69cd981e950c476a52377c0d9630cdc9af92'
|
4
|
+
data.tar.gz: c9d15338a5e8e801608b0098345656d6bd9a19ade174005aba2948596ef289b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae7e456cf6c52ef57ee80d1ae77601a5297ae48612bd5088cffb8a74ec8f170da14850de931e7a34bc16a4aecedd69b0c2191ad4b981200c82cf53a24ed7b662
|
7
|
+
data.tar.gz: 25d57f2dbc6350fd59209a1422a1820203cb51060bd57ab538b12b8f47daf5fe0a781672eb733d3b5ebdc973fc82a3dc6d01d5724eb3ece09414b7fc6138704d
|
data/Dockerfile
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'json'
|
2
2
|
require 'uri'
|
3
3
|
require 'cgi'
|
4
|
-
require '
|
4
|
+
require 'morpheus/rest_client'
|
5
|
+
# require 'rest-client'
|
5
6
|
|
6
7
|
class Morpheus::APIClient
|
7
8
|
|
@@ -844,6 +845,18 @@ class Morpheus::APIClient
|
|
844
845
|
Morpheus::NetworkServersInterface.new(common_interface_options).setopts(@options)
|
845
846
|
end
|
846
847
|
|
848
|
+
def network_edge_clusters
|
849
|
+
Morpheus::NetworkEdgeClustersInterface.new(common_interface_options).setopts(@options)
|
850
|
+
end
|
851
|
+
|
852
|
+
def network_dhcp_servers
|
853
|
+
Morpheus::NetworkDhcpServersInterface.new(common_interface_options).setopts(@options)
|
854
|
+
end
|
855
|
+
|
856
|
+
def network_dhcp_relays
|
857
|
+
Morpheus::NetworkDhcpRelaysInterface.new(common_interface_options).setopts(@options)
|
858
|
+
end
|
859
|
+
|
847
860
|
def rest(endpoint)
|
848
861
|
Morpheus::RestInterface.new(common_interface_options).setopts(@options.merge({base_path: "#{@base_url}/api/#{endpoint}"}))
|
849
862
|
end
|
@@ -49,6 +49,13 @@ class Morpheus::HealthInterface < Morpheus::APIClient
|
|
49
49
|
execute(opts)
|
50
50
|
end
|
51
51
|
|
52
|
+
def notifications(params={})
|
53
|
+
url = "#{@base_url}/api/health/notifications"
|
54
|
+
headers = { params: params, authorization: "Bearer #{@access_token}" }
|
55
|
+
opts = {method: :get, url: url, headers: headers}
|
56
|
+
execute(opts)
|
57
|
+
end
|
58
|
+
|
52
59
|
def logs(params={})
|
53
60
|
url = "#{@base_url}/api/health/logs"
|
54
61
|
headers = { params: params, authorization: "Bearer #{@access_token}" }
|
@@ -56,11 +63,38 @@ class Morpheus::HealthInterface < Morpheus::APIClient
|
|
56
63
|
execute(opts)
|
57
64
|
end
|
58
65
|
|
59
|
-
def
|
60
|
-
url = "#{@base_url}/api/health/
|
66
|
+
def export_logs(outfile, params={})
|
67
|
+
url = "#{@base_url}/api/health/logs/export"
|
61
68
|
headers = { params: params, authorization: "Bearer #{@access_token}" }
|
62
69
|
opts = {method: :get, url: url, headers: headers}
|
63
|
-
execute(opts)
|
70
|
+
# execute(opts, {parse_json: false})
|
71
|
+
if Dir.exists?(outfile)
|
72
|
+
raise "outfile is invalid. It is the name of an existing directory: #{outfile}"
|
73
|
+
end
|
74
|
+
# if @verify_ssl == false
|
75
|
+
# opts[:verify_ssl] = OpenSSL::SSL::VERIFY_NONE
|
76
|
+
# end
|
77
|
+
if @dry_run
|
78
|
+
return opts
|
79
|
+
end
|
80
|
+
http_response = nil
|
81
|
+
bad_body = nil
|
82
|
+
File.open(outfile, 'w') {|f|
|
83
|
+
block = proc { |response|
|
84
|
+
if response.code.to_i == 200
|
85
|
+
response.read_body do |chunk|
|
86
|
+
#puts "writing to #{outfile} ..."
|
87
|
+
f.write chunk
|
88
|
+
end
|
89
|
+
else
|
90
|
+
# puts_error (#{response.inspect}) #{chunk} ..."
|
91
|
+
bad_body = response.body.to_s
|
92
|
+
end
|
93
|
+
}
|
94
|
+
opts[:block_response] = block
|
95
|
+
http_response = Morpheus::RestClient.execute(opts)
|
96
|
+
}
|
97
|
+
return http_response, bad_body
|
64
98
|
end
|
65
99
|
|
66
100
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'morpheus/api/api_client'
|
2
|
+
|
3
|
+
class Morpheus::NetworkDhcpRelaysInterface < Morpheus::RestInterface
|
4
|
+
|
5
|
+
def base_path
|
6
|
+
"/api/networks/servers"
|
7
|
+
end
|
8
|
+
|
9
|
+
def get_dhcp_relay(server_id, dhcp_relay_id, params={}, headers={})
|
10
|
+
validate_id!(server_id)
|
11
|
+
validate_id!(dhcp_relay_id)
|
12
|
+
execute(method: :get, url: "#{base_path}/#{server_id}/dhcp-relays/#{dhcp_relay_id}", params: params, headers: headers)
|
13
|
+
end
|
14
|
+
|
15
|
+
def list_dhcp_relays(server_id, params={}, headers={})
|
16
|
+
validate_id!(server_id)
|
17
|
+
execute(method: :get, url: "#{base_path}/#{server_id}/dhcp-relays", params: params, headers: headers)
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_dhcp_relay(server_id, payload, params={}, headers={})
|
21
|
+
validate_id!(server_id)
|
22
|
+
execute(method: :post, url: "#{base_path}/#{server_id}/dhcp-relays", params: params, payload: payload, headers: headers)
|
23
|
+
end
|
24
|
+
|
25
|
+
def update_dhcp_relay(server_id, dhcp_relay_id, payload, params={}, headers={})
|
26
|
+
validate_id!(server_id)
|
27
|
+
validate_id!(dhcp_relay_id)
|
28
|
+
execute(method: :put, url: "#{base_path}/#{server_id}/dhcp-relays/#{dhcp_relay_id}", params: params, payload: payload, headers: headers)
|
29
|
+
end
|
30
|
+
|
31
|
+
def delete_dhcp_relay(server_id, dhcp_relay_id, params={}, headers={})
|
32
|
+
validate_id!(server_id)
|
33
|
+
validate_id!(dhcp_relay_id)
|
34
|
+
execute(method: :delete, url: "#{base_path}/#{server_id}/dhcp-relays/#{dhcp_relay_id}", params: params, headers: headers)
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'morpheus/api/api_client'
|
2
|
+
|
3
|
+
class Morpheus::NetworkDhcpServersInterface < Morpheus::RestInterface
|
4
|
+
|
5
|
+
def base_path
|
6
|
+
"/api/networks/servers"
|
7
|
+
end
|
8
|
+
|
9
|
+
def get_dhcp_server(server_id, dhcp_server_id, params={}, headers={})
|
10
|
+
validate_id!(server_id)
|
11
|
+
validate_id!(dhcp_server_id)
|
12
|
+
execute(method: :get, url: "#{base_path}/#{server_id}/dhcp-servers/#{dhcp_server_id}", params: params, headers: headers)
|
13
|
+
end
|
14
|
+
|
15
|
+
def list_dhcp_servers(server_id, params={}, headers={})
|
16
|
+
validate_id!(server_id)
|
17
|
+
execute(method: :get, url: "#{base_path}/#{server_id}/dhcp-servers", params: params, headers: headers)
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_dhcp_server(server_id, payload, params={}, headers={})
|
21
|
+
validate_id!(server_id)
|
22
|
+
execute(method: :post, url: "#{base_path}/#{server_id}/dhcp-servers", params: params, payload: payload, headers: headers)
|
23
|
+
end
|
24
|
+
|
25
|
+
def update_dhcp_server(server_id, dhcp_server_id, payload, params={}, headers={})
|
26
|
+
validate_id!(server_id)
|
27
|
+
validate_id!(dhcp_server_id)
|
28
|
+
execute(method: :put, url: "#{base_path}/#{server_id}/dhcp-servers/#{dhcp_server_id}", params: params, payload: payload, headers: headers)
|
29
|
+
end
|
30
|
+
|
31
|
+
def delete_dhcp_server(server_id, dhcp_server_id, params={}, headers={})
|
32
|
+
validate_id!(server_id)
|
33
|
+
validate_id!(dhcp_server_id)
|
34
|
+
execute(method: :delete, url: "#{base_path}/#{server_id}/dhcp-servers/#{dhcp_server_id}", params: params, headers: headers)
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'morpheus/api/api_client'
|
2
|
+
|
3
|
+
class Morpheus::NetworkEdgeClustersInterface < Morpheus::RestInterface
|
4
|
+
|
5
|
+
def base_path
|
6
|
+
"/api/networks/servers"
|
7
|
+
end
|
8
|
+
|
9
|
+
def list_edge_clusters(server_id, params={}, headers={})
|
10
|
+
validate_id!(server_id)
|
11
|
+
execute(method: :get, url: "#{base_path}/#{server_id}/edge-clusters", params: params, headers: headers)
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_edge_cluster(server_id, edge_cluster_id, params={}, headers={})
|
15
|
+
validate_id!(server_id)
|
16
|
+
validate_id!(edge_cluster_id)
|
17
|
+
execute(method: :get, url: "#{base_path}/#{server_id}/edge-clusters/#{edge_cluster_id}", params: params, headers: headers)
|
18
|
+
end
|
19
|
+
|
20
|
+
def update_edge_cluster(server_id, edge_cluster_id, payload, params={}, headers={})
|
21
|
+
validate_id!(server_id)
|
22
|
+
validate_id!(edge_cluster_id)
|
23
|
+
execute(method: :put, url: "#{base_path}/#{server_id}/edge-clusters/#{edge_cluster_id}", params: params, payload: payload, headers: headers)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -11,10 +11,10 @@ class Morpheus::NetworkServersInterface < Morpheus::RestInterface
|
|
11
11
|
execute(method: :get, url: "#{base_path}/#{server_id}/scopes", params: params, headers: headers)
|
12
12
|
end
|
13
13
|
|
14
|
-
def get_scope(server_id,
|
14
|
+
def get_scope(server_id, id, params={}, headers={})
|
15
15
|
validate_id!(server_id)
|
16
|
-
validate_id!(
|
17
|
-
execute(method: :get, url: "#{base_path}/#{server_id}/scopes/#{
|
16
|
+
validate_id!(id)
|
17
|
+
execute(method: :get, url: "#{base_path}/#{server_id}/scopes/#{id}", params: params, headers: headers)
|
18
18
|
end
|
19
19
|
|
20
20
|
def create_scope(server_id, payload, params={}, headers={})
|
@@ -22,21 +22,77 @@ class Morpheus::NetworkServersInterface < Morpheus::RestInterface
|
|
22
22
|
execute(method: :post, url: "#{base_path}/#{server_id}/scopes", params: params, payload: payload, headers: headers)
|
23
23
|
end
|
24
24
|
|
25
|
-
def update_scope(server_id,
|
25
|
+
def update_scope(server_id, id, payload, params={}, headers={})
|
26
26
|
validate_id!(server_id)
|
27
|
-
validate_id!(
|
28
|
-
execute(method: :put, url: "#{base_path}/#{server_id}/scopes/#{
|
27
|
+
validate_id!(id)
|
28
|
+
execute(method: :put, url: "#{base_path}/#{server_id}/scopes/#{id}", params: params, payload: payload, headers: headers)
|
29
29
|
end
|
30
30
|
|
31
|
-
def destroy_scope(server_id,
|
31
|
+
def destroy_scope(server_id, id, params={}, headers={})
|
32
32
|
validate_id!(server_id)
|
33
|
-
validate_id!(
|
34
|
-
execute(method: :delete, url: "#{base_path}/#{server_id}/scopes/#{
|
33
|
+
validate_id!(id)
|
34
|
+
execute(method: :delete, url: "#{base_path}/#{server_id}/scopes/#{id}", params: params, headers: headers)
|
35
35
|
end
|
36
36
|
|
37
|
-
def update_scope_permissions(server_id,
|
37
|
+
def update_scope_permissions(server_id, id, payload, params={}, headers={})
|
38
38
|
validate_id!(server_id)
|
39
|
-
validate_id!(
|
40
|
-
execute(method: :put, url: "#{base_path}/#{server_id}/scopes/#{
|
39
|
+
validate_id!(id)
|
40
|
+
execute(method: :put, url: "#{base_path}/#{server_id}/scopes/#{id}", payload: payload.to_json, params: params, headers: headers)
|
41
|
+
end
|
42
|
+
|
43
|
+
def list_firewall_rules(server_id, params={}, headers={})
|
44
|
+
validate_id!(server_id)
|
45
|
+
execute(method: :get, url: "#{base_path}/#{server_id}/firewall-rules", params: params, headers: headers)
|
46
|
+
end
|
47
|
+
|
48
|
+
def get_firewall_rule(server_id, id, params={}, headers={})
|
49
|
+
validate_id!(server_id)
|
50
|
+
validate_id!(id)
|
51
|
+
execute(method: :get, url: "#{base_path}/#{server_id}/firewall-rules/#{id}", params: params, headers: headers)
|
52
|
+
end
|
53
|
+
|
54
|
+
def create_firewall_rule(server_id, payload, params={}, headers={})
|
55
|
+
validate_id!(server_id)
|
56
|
+
execute(method: :post, url: "#{base_path}/#{server_id}/firewall-rules", params: params, payload: payload, headers: headers)
|
57
|
+
end
|
58
|
+
|
59
|
+
def update_firewall_rule(server_id, id, payload, params={}, headers={})
|
60
|
+
validate_id!(server_id)
|
61
|
+
validate_id!(id)
|
62
|
+
execute(method: :put, url: "#{base_path}/#{server_id}/firewall-rules/#{id}", params: params, payload: payload, headers: headers)
|
63
|
+
end
|
64
|
+
|
65
|
+
def destroy_firewall_rule(server_id, id, params={}, headers={})
|
66
|
+
validate_id!(server_id)
|
67
|
+
validate_id!(id)
|
68
|
+
execute(method: :delete, url: "#{base_path}/#{server_id}/firewall-rules/#{id}", params: params, headers: headers)
|
69
|
+
end
|
70
|
+
|
71
|
+
def list_firewall_rule_groups(server_id, params={}, headers={})
|
72
|
+
validate_id!(server_id)
|
73
|
+
execute(method: :get, url: "#{base_path}/#{server_id}/firewall-rule-groups", params: params, headers: headers)
|
74
|
+
end
|
75
|
+
|
76
|
+
def get_firewall_rule_group(server_id, id, params={}, headers={})
|
77
|
+
validate_id!(server_id)
|
78
|
+
validate_id!(id)
|
79
|
+
execute(method: :get, url: "#{base_path}/#{server_id}/firewall-rule-groups/#{id}", params: params, headers: headers)
|
80
|
+
end
|
81
|
+
|
82
|
+
def create_firewall_rule_group(server_id, payload, params={}, headers={})
|
83
|
+
validate_id!(server_id)
|
84
|
+
execute(method: :post, url: "#{base_path}/#{server_id}/firewall-rule-groups", params: params, payload: payload, headers: headers)
|
85
|
+
end
|
86
|
+
|
87
|
+
def update_firewall_rule_group(server_id, id, payload, params={}, headers={})
|
88
|
+
validate_id!(server_id)
|
89
|
+
validate_id!(id)
|
90
|
+
execute(method: :put, url: "#{base_path}/#{server_id}/firewall-rule-groups/#{id}", params: params, payload: payload, headers: headers)
|
91
|
+
end
|
92
|
+
|
93
|
+
def destroy_firewall_rule_group(server_id, id, params={}, headers={})
|
94
|
+
validate_id!(server_id)
|
95
|
+
validate_id!(id)
|
96
|
+
execute(method: :delete, url: "#{base_path}/#{server_id}/firewall-rule-groups/#{id}", params: params, headers: headers)
|
41
97
|
end
|
42
98
|
end
|
@@ -92,6 +92,13 @@ class Morpheus::RolesInterface < Morpheus::APIClient
|
|
92
92
|
execute(method: :put, url: url, headers: headers, payload: payload.to_json)
|
93
93
|
end
|
94
94
|
|
95
|
+
def update_report_type(account_id, id, options)
|
96
|
+
url = build_url(account_id, id) + "/update-report-type"
|
97
|
+
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
98
|
+
payload = options
|
99
|
+
execute(method: :put, url: url, headers: headers, payload: payload.to_json)
|
100
|
+
end
|
101
|
+
|
95
102
|
private
|
96
103
|
|
97
104
|
def build_url(account_id=nil, role_id=nil)
|
@@ -1,15 +1,14 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
require 'json'
|
3
|
-
require 'fileutils'
|
4
1
|
require 'morpheus/logging'
|
5
2
|
require 'morpheus/benchmarking'
|
6
|
-
require 'morpheus/
|
3
|
+
require 'morpheus/terminal'
|
7
4
|
require 'morpheus/cli/cli_registry'
|
5
|
+
require 'morpheus/cli/option_parser'
|
6
|
+
require 'morpheus/cli/option_types'
|
8
7
|
require 'morpheus/cli/mixins/print_helper'
|
9
8
|
require 'morpheus/cli/credentials'
|
9
|
+
#require 'morpheus/cli/commands/shell'
|
10
|
+
#require 'morpheus/cli/commands/remote'
|
10
11
|
require 'morpheus/api/api_client'
|
11
|
-
require 'morpheus/cli/remote'
|
12
|
-
require 'morpheus/terminal'
|
13
12
|
|
14
13
|
module Morpheus
|
15
14
|
module Cli
|
@@ -1412,14 +1411,14 @@ module Morpheus
|
|
1412
1411
|
end
|
1413
1412
|
|
1414
1413
|
def set_command_name(cmd_name)
|
1415
|
-
@command_name = cmd_name
|
1414
|
+
@command_name = cmd_name.to_sym
|
1416
1415
|
Morpheus::Cli::CliRegistry.add(self, self.command_name)
|
1417
1416
|
end
|
1418
1417
|
|
1419
1418
|
def default_command_name
|
1420
1419
|
class_name = self.name.split('::')[-1]
|
1421
1420
|
#class_name.sub!(/Command$/, '')
|
1422
|
-
Morpheus::Cli::CliRegistry.cli_ize(class_name)
|
1421
|
+
Morpheus::Cli::CliRegistry.cli_ize(class_name).to_sym
|
1423
1422
|
end
|
1424
1423
|
|
1425
1424
|
def command_name
|
@@ -75,7 +75,7 @@ class Morpheus::Cli::AccessTokenCommand
|
|
75
75
|
"Refresh Token" => lambda {|wallet| wallet['refresh_token'] },
|
76
76
|
"Login Date" => lambda {|wallet| format_local_dt(wallet['login_date']) },
|
77
77
|
"Expire Date" => lambda {|wallet| wallet['expire_date'] ? format_local_dt(wallet['expire_date']) : "" },
|
78
|
-
|
78
|
+
"Remote" => lambda {|wallet| display_appliance(@appliance_name, @appliance_url) },
|
79
79
|
}
|
80
80
|
print cyan
|
81
81
|
puts as_description_list(@wallet, description_cols)
|
@@ -1,12 +1,4 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require 'yaml'
|
3
|
-
require 'io/console'
|
4
|
-
require 'rest_client'
|
5
|
-
require 'optparse'
|
6
1
|
require 'morpheus/cli/cli_command'
|
7
|
-
require 'morpheus/cli/mixins/accounts_helper'
|
8
|
-
require 'morpheus/cli/mixins/infrastructure_helper'
|
9
|
-
require 'morpheus/logging'
|
10
2
|
|
11
3
|
class Morpheus::Cli::AccountGroupsCommand
|
12
4
|
include Morpheus::Cli::CliCommand
|
File without changes
|
data/lib/morpheus/cli/{appliance_settings_command.rb → commands/appliance_settings_command.rb}
RENAMED
File without changes
|
File without changes
|
@@ -1,13 +1,4 @@
|
|
1
|
-
# require 'yaml'
|
2
|
-
require 'io/console'
|
3
|
-
require 'rest_client'
|
4
|
-
require 'optparse'
|
5
|
-
require 'filesize'
|
6
1
|
require 'morpheus/cli/cli_command'
|
7
|
-
require 'morpheus/cli/mixins/accounts_helper'
|
8
|
-
require 'morpheus/cli/mixins/provisioning_helper'
|
9
|
-
require 'morpheus/cli/mixins/processes_helper'
|
10
|
-
require 'morpheus/cli/mixins/logs_helper'
|
11
2
|
|
12
3
|
class Morpheus::Cli::Apps
|
13
4
|
include Morpheus::Cli::CliCommand
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/morpheus/cli/{catalog_item_types_command.rb → commands/catalog_item_types_command.rb}
RENAMED
File without changes
|
File without changes
|
@@ -0,0 +1,132 @@
|
|
1
|
+
require 'morpheus/cli/cli_command'
|
2
|
+
|
3
|
+
class Morpheus::Cli::ChangePasswordCommand
|
4
|
+
include Morpheus::Cli::CliCommand
|
5
|
+
include Morpheus::Cli::AccountsHelper
|
6
|
+
|
7
|
+
set_command_name :passwd
|
8
|
+
|
9
|
+
def connect(opts)
|
10
|
+
@api_client = establish_remote_appliance_connection(opts)
|
11
|
+
@whoami_interface = @api_client.whoami
|
12
|
+
@users_interface = @api_client.users
|
13
|
+
@accounts_interface = @api_client.accounts
|
14
|
+
@roles_interface = @api_client.roles
|
15
|
+
end
|
16
|
+
|
17
|
+
def handle(args)
|
18
|
+
change_password(args)
|
19
|
+
end
|
20
|
+
|
21
|
+
def change_password(args)
|
22
|
+
options = {}
|
23
|
+
username = nil
|
24
|
+
new_password = nil
|
25
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
26
|
+
opts.banner = subcommand_usage("[username] [options]")
|
27
|
+
opts.on('--username USERNAME', String, "Username. Default is your own.") do |val|
|
28
|
+
username = val
|
29
|
+
end
|
30
|
+
opts.on('--password VALUE', String, "New password") do |val|
|
31
|
+
new_password = val
|
32
|
+
end
|
33
|
+
build_common_options(opts, options, [:account, :options, :json, :dry_run, :remote, :quiet, :auto_confirm], [:username,:password])
|
34
|
+
opts.footer = "Change your password or the password of another user.\n" +
|
35
|
+
"[username] is optional. This is the username of the user to update. Default is your own.\n" +
|
36
|
+
"Be careful with this command, the default behavior is to update your own password."
|
37
|
+
end
|
38
|
+
optparse.parse!(args)
|
39
|
+
|
40
|
+
if args.count > 1
|
41
|
+
print_error Morpheus::Terminal.angry_prompt
|
42
|
+
puts_error "wrong number of arguments, expected 0-1 and got #{args.count} #{args}\n#{optparse}"
|
43
|
+
return 1
|
44
|
+
end
|
45
|
+
|
46
|
+
connect(options)
|
47
|
+
@current_remote = @appliance_name ? ::Morpheus::Cli::Remote.load_remote(@appliance_name) : ::Morpheus::Cli::Remote.load_active_remote()
|
48
|
+
|
49
|
+
if args[0]
|
50
|
+
username = args[0]
|
51
|
+
end
|
52
|
+
if username.nil?
|
53
|
+
if !@current_remote
|
54
|
+
raise_command_error "No current appliance, see `remote use`."
|
55
|
+
end
|
56
|
+
if !@current_remote[:username]
|
57
|
+
raise_command_error "You are not currently logged in to #{display_appliance(@current_remote[:name], @current_remote[:url])}"
|
58
|
+
end
|
59
|
+
username = @current_remote[:username]
|
60
|
+
end
|
61
|
+
|
62
|
+
account = find_account_from_options(options)
|
63
|
+
account_id = account ? account['id'] : nil
|
64
|
+
|
65
|
+
user = find_user_by_username_or_id(account_id, username)
|
66
|
+
return 1 if user.nil?
|
67
|
+
|
68
|
+
if @current_remote && @current_remote[:username] == username
|
69
|
+
if !options[:quiet]
|
70
|
+
if options[:dry_run]
|
71
|
+
print cyan,bold, "DRY RUN. This is just a dry run, the password is not being updated.",reset,"\n"
|
72
|
+
else
|
73
|
+
print cyan,bold, "WARNING! You are about to update your own password!",reset,"\n"
|
74
|
+
print yellow,bold,"WARNING! You are about to update your own password!",reset,"\n"
|
75
|
+
print reset,bold, "WARNING! You are about to update your own password!",reset,"\n"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
if !options[:quiet]
|
81
|
+
print cyan, "Changing password for #{user['username']}", reset, "\n"
|
82
|
+
end
|
83
|
+
|
84
|
+
if new_password.nil? && options[:options]['password']
|
85
|
+
new_password = options[:options]['password']
|
86
|
+
end
|
87
|
+
if new_password.nil?
|
88
|
+
password_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'password', 'fieldLabel' => 'New Password', 'type' => 'password', 'required' => true}], options[:options], @api_client)
|
89
|
+
new_password = password_prompt['password']
|
90
|
+
confirm_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'passwordConfirmation', 'fieldLabel' => 'Confirm Password', 'type' => 'password', 'required' => true}], options[:options], @api_client)
|
91
|
+
confirm_password = confirm_prompt['passwordConfirmation']
|
92
|
+
if confirm_password != new_password
|
93
|
+
print_red_alert "Confirm password did not match."
|
94
|
+
return 1
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
if new_password.nil? || new_password.empty?
|
99
|
+
print_red_alert "A new password is required"
|
100
|
+
return 1
|
101
|
+
end
|
102
|
+
|
103
|
+
payload = {
|
104
|
+
'user' => {
|
105
|
+
'password' => new_password
|
106
|
+
}
|
107
|
+
}
|
108
|
+
@users_interface.setopts(options)
|
109
|
+
if options[:dry_run]
|
110
|
+
print_dry_run @users_interface.dry.update(account_id, user['id'], payload)
|
111
|
+
return 0
|
112
|
+
end
|
113
|
+
|
114
|
+
unless options[:yes]
|
115
|
+
unless ::Morpheus::Cli::OptionTypes::confirm("Are you sure you would like to update the password for user #{user['username']}?", options)
|
116
|
+
return 9, "aborted command"
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
json_response = @users_interface.update(account_id, user['id'], payload)
|
121
|
+
if options[:json]
|
122
|
+
puts as_json(json_response)
|
123
|
+
elsif !options[:quiet]
|
124
|
+
print_green_success "Updated password for user #{user['username']}"
|
125
|
+
end
|
126
|
+
return 0
|
127
|
+
end
|
128
|
+
|
129
|
+
private
|
130
|
+
|
131
|
+
|
132
|
+
end
|
@@ -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/mixins/infrastructure_helper'
|
7
|
-
require 'morpheus/cli/mixins/provisioning_helper'
|
8
|
-
require 'morpheus/cli/option_types'
|
9
2
|
|
10
3
|
class Morpheus::Cli::Clouds
|
11
4
|
include Morpheus::Cli::CliCommand
|