morpheus-cli 2.10.0 → 2.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/morpheus +27 -32
- data/lib/morpheus/api/accounts_interface.rb +36 -47
- data/lib/morpheus/api/api_client.rb +141 -110
- data/lib/morpheus/api/app_templates_interface.rb +56 -72
- data/lib/morpheus/api/apps_interface.rb +111 -132
- data/lib/morpheus/api/auth_interface.rb +30 -0
- data/lib/morpheus/api/clouds_interface.rb +71 -76
- data/lib/morpheus/api/custom_instance_types_interface.rb +21 -46
- data/lib/morpheus/api/dashboard_interface.rb +10 -17
- data/lib/morpheus/api/deploy_interface.rb +60 -72
- data/lib/morpheus/api/deployments_interface.rb +53 -71
- data/lib/morpheus/api/groups_interface.rb +55 -45
- data/lib/morpheus/api/instance_types_interface.rb +19 -23
- data/lib/morpheus/api/instances_interface.rb +179 -177
- data/lib/morpheus/api/key_pairs_interface.rb +11 -17
- data/lib/morpheus/api/license_interface.rb +18 -23
- data/lib/morpheus/api/load_balancers_interface.rb +54 -69
- data/lib/morpheus/api/logs_interface.rb +25 -29
- data/lib/morpheus/api/options_interface.rb +13 -17
- data/lib/morpheus/api/provision_types_interface.rb +19 -22
- data/lib/morpheus/api/roles_interface.rb +75 -94
- data/lib/morpheus/api/security_group_rules_interface.rb +28 -37
- data/lib/morpheus/api/security_groups_interface.rb +39 -51
- data/lib/morpheus/api/servers_interface.rb +113 -115
- data/lib/morpheus/api/setup_interface.rb +31 -0
- data/lib/morpheus/api/task_sets_interface.rb +36 -38
- data/lib/morpheus/api/tasks_interface.rb +56 -69
- data/lib/morpheus/api/users_interface.rb +67 -76
- data/lib/morpheus/api/virtual_images_interface.rb +61 -61
- data/lib/morpheus/api/whoami_interface.rb +12 -15
- data/lib/morpheus/cli.rb +71 -60
- data/lib/morpheus/cli/accounts.rb +254 -315
- data/lib/morpheus/cli/alias_command.rb +219 -0
- data/lib/morpheus/cli/app_templates.rb +264 -272
- data/lib/morpheus/cli/apps.rb +608 -671
- data/lib/morpheus/cli/cli_command.rb +259 -21
- data/lib/morpheus/cli/cli_registry.rb +99 -14
- data/lib/morpheus/cli/clouds.rb +599 -372
- data/lib/morpheus/cli/config_file.rb +126 -0
- data/lib/morpheus/cli/credentials.rb +141 -117
- data/lib/morpheus/cli/dashboard_command.rb +48 -56
- data/lib/morpheus/cli/deployments.rb +254 -268
- data/lib/morpheus/cli/deploys.rb +150 -142
- data/lib/morpheus/cli/error_handler.rb +38 -0
- data/lib/morpheus/cli/groups.rb +551 -179
- data/lib/morpheus/cli/hosts.rb +862 -617
- data/lib/morpheus/cli/instance_types.rb +103 -95
- data/lib/morpheus/cli/instances.rb +1335 -1009
- data/lib/morpheus/cli/key_pairs.rb +82 -90
- data/lib/morpheus/cli/library.rb +498 -499
- data/lib/morpheus/cli/license.rb +83 -101
- data/lib/morpheus/cli/load_balancers.rb +314 -300
- data/lib/morpheus/cli/login.rb +66 -44
- data/lib/morpheus/cli/logout.rb +47 -46
- data/lib/morpheus/cli/mixins/accounts_helper.rb +69 -31
- data/lib/morpheus/cli/mixins/infrastructure_helper.rb +106 -0
- data/lib/morpheus/cli/mixins/print_helper.rb +181 -17
- data/lib/morpheus/cli/mixins/provisioning_helper.rb +535 -458
- data/lib/morpheus/cli/mixins/whoami_helper.rb +2 -2
- data/lib/morpheus/cli/option_parser.rb +35 -0
- data/lib/morpheus/cli/option_types.rb +232 -192
- data/lib/morpheus/cli/recent_activity_command.rb +61 -65
- data/lib/morpheus/cli/remote.rb +446 -199
- data/lib/morpheus/cli/roles.rb +884 -906
- data/lib/morpheus/cli/security_group_rules.rb +213 -203
- data/lib/morpheus/cli/security_groups.rb +237 -192
- data/lib/morpheus/cli/shell.rb +338 -231
- data/lib/morpheus/cli/tasks.rb +326 -308
- data/lib/morpheus/cli/users.rb +457 -462
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/cli/version_command.rb +16 -18
- data/lib/morpheus/cli/virtual_images.rb +526 -345
- data/lib/morpheus/cli/whoami.rb +125 -111
- data/lib/morpheus/cli/workflows.rb +338 -185
- data/lib/morpheus/formatters.rb +8 -1
- data/lib/morpheus/logging.rb +1 -1
- data/lib/morpheus/rest_client.rb +17 -8
- metadata +9 -3
- data/lib/morpheus/api/custom_instance_types.rb +0 -55
@@ -1,72 +1,59 @@
|
|
1
|
-
require '
|
2
|
-
require 'rest-client'
|
1
|
+
require 'morpheus/api/api_client'
|
3
2
|
|
4
3
|
class Morpheus::TasksInterface < Morpheus::APIClient
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
response = Morpheus::RestClient.execute(method: :post, url: url,
|
61
|
-
timeout: 30, headers: headers, verify_ssl:false, payload: payload.to_json)
|
62
|
-
JSON.parse(response.to_s)
|
63
|
-
end
|
64
|
-
|
65
|
-
def destroy(id)
|
66
|
-
url = "#{@base_url}/api/tasks/#{id}"
|
67
|
-
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
68
|
-
response = Morpheus::RestClient.execute(method: :delete, url: url,
|
69
|
-
timeout: 30, headers: headers, verify_ssl:false)
|
70
|
-
JSON.parse(response.to_s)
|
71
|
-
end
|
4
|
+
def initialize(access_token, refresh_token,expires_at = nil, base_url=nil)
|
5
|
+
@access_token = access_token
|
6
|
+
@refresh_token = refresh_token
|
7
|
+
@base_url = base_url
|
8
|
+
@expires_at = expires_at
|
9
|
+
end
|
10
|
+
|
11
|
+
def task_types(options={})
|
12
|
+
url = "#{@base_url}/api/task-types"
|
13
|
+
headers = { params: {}, authorization: "Bearer #{@access_token}" }
|
14
|
+
|
15
|
+
if options.is_a?(Hash)
|
16
|
+
headers[:params].merge!(options)
|
17
|
+
elsif options.is_a?(Numeric)
|
18
|
+
url = "#{@base_url}/api/task-types/#{options}"
|
19
|
+
elsif options.is_a?(String)
|
20
|
+
headers[:params]['name'] = options
|
21
|
+
end
|
22
|
+
execute(method: :get, url: url, headers: headers)
|
23
|
+
end
|
24
|
+
|
25
|
+
def get(options=nil)
|
26
|
+
url = "#{@base_url}/api/tasks"
|
27
|
+
headers = { params: {}, authorization: "Bearer #{@access_token}" }
|
28
|
+
|
29
|
+
if options.is_a?(Hash)
|
30
|
+
headers[:params].merge!(options)
|
31
|
+
elsif options.is_a?(Numeric)
|
32
|
+
url = "#{@base_url}/api/tasks/#{options}"
|
33
|
+
elsif options.is_a?(String)
|
34
|
+
headers[:params]['name'] = options
|
35
|
+
end
|
36
|
+
execute(method: :get, url: url, headers: headers)
|
37
|
+
end
|
38
|
+
|
39
|
+
def update(id, options)
|
40
|
+
url = "#{@base_url}/api/tasks/#{id}"
|
41
|
+
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
42
|
+
payload = options
|
43
|
+
execute(method: :put, url: url, headers: headers, payload: payload.to_json)
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
def create(options)
|
48
|
+
url = "#{@base_url}/api/tasks"
|
49
|
+
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
50
|
+
payload = options
|
51
|
+
execute(method: :post, url: url, headers: headers, payload: payload.to_json)
|
52
|
+
end
|
53
|
+
|
54
|
+
def destroy(id)
|
55
|
+
url = "#{@base_url}/api/tasks/#{id}"
|
56
|
+
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
57
|
+
execute(method: :delete, url: url, headers: headers)
|
58
|
+
end
|
72
59
|
end
|
@@ -1,89 +1,80 @@
|
|
1
|
-
require '
|
2
|
-
require 'rest-client'
|
1
|
+
require 'morpheus/api/api_client'
|
3
2
|
|
4
3
|
class Morpheus::UsersInterface < Morpheus::APIClient
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
end
|
4
|
+
def initialize(access_token, refresh_token, expires_at = nil, base_url=nil)
|
5
|
+
@access_token = access_token
|
6
|
+
@refresh_token = refresh_token
|
7
|
+
@base_url = base_url
|
8
|
+
@expires_at = expires_at
|
9
|
+
end
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
11
|
+
def get(account_id, id)
|
12
|
+
raise "#{self.class}.get() passed a blank id!" if id.to_s == ''
|
13
|
+
url = build_url(account_id, id)
|
14
|
+
headers = { params: {}, authorization: "Bearer #{@access_token}" }
|
15
|
+
opts = {method: :get, url: url, timeout: 10, headers: headers}
|
16
|
+
execute(opts)
|
17
|
+
end
|
21
18
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
19
|
+
def list(account_id, options={})
|
20
|
+
url = build_url(account_id)
|
21
|
+
headers = { params: {}, authorization: "Bearer #{@access_token}" }
|
22
|
+
headers[:params].merge!(options)
|
23
|
+
opts = {method: :get, url: url, timeout: 10, headers: headers}
|
24
|
+
execute(opts)
|
25
|
+
end
|
30
26
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
27
|
+
def feature_permissions(account_id, id)
|
28
|
+
url = build_url(account_id, id) + "/feature-permissions"
|
29
|
+
headers = { params: {}, authorization: "Bearer #{@access_token}" }
|
30
|
+
opts = {method: :get, url: url, timeout: 10, headers: headers}
|
31
|
+
execute(opts)
|
32
|
+
end
|
38
33
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
34
|
+
def available_roles(account_id, id=nil, options={})
|
35
|
+
url = build_url(account_id, id) + "/available-roles"
|
36
|
+
headers = { params: {}, authorization: "Bearer #{@access_token}" }
|
37
|
+
headers[:params].merge!(options)
|
38
|
+
opts = {method: :get, url: url, timeout: 10, headers: headers}
|
39
|
+
execute(opts)
|
40
|
+
end
|
47
41
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
end
|
42
|
+
def create(account_id, options)
|
43
|
+
url = build_url(account_id)
|
44
|
+
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
45
|
+
payload = options
|
46
|
+
opts = {method: :post, url: url, timeout: 10, headers: headers, payload: payload.to_json}
|
47
|
+
execute(opts)
|
48
|
+
end
|
56
49
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
end
|
50
|
+
def update(account_id, id, options)
|
51
|
+
url = build_url(account_id, id)
|
52
|
+
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
53
|
+
payload = options
|
54
|
+
opts = {method: :put, url: url, timeout: 10, headers: headers, payload: payload.to_json}
|
55
|
+
execute(opts)
|
56
|
+
end
|
65
57
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
end
|
58
|
+
def destroy(account_id, id)
|
59
|
+
url = build_url(account_id, id)
|
60
|
+
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
61
|
+
opts = {method: :delete, url: url, timeout: 10, headers: headers}
|
62
|
+
execute(opts)
|
63
|
+
end
|
73
64
|
|
74
|
-
private
|
65
|
+
private
|
75
66
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
67
|
+
def build_url(account_id=nil, user_id=nil)
|
68
|
+
url = "#{@base_url}/api"
|
69
|
+
if account_id
|
70
|
+
url += "/accounts/#{account_id}/users"
|
71
|
+
else
|
72
|
+
url += "/users"
|
73
|
+
end
|
74
|
+
if user_id
|
75
|
+
url += "/#{user_id}"
|
76
|
+
end
|
77
|
+
url
|
78
|
+
end
|
88
79
|
|
89
80
|
end
|
@@ -1,72 +1,72 @@
|
|
1
|
-
require '
|
2
|
-
require 'rest-client'
|
1
|
+
require 'morpheus/api/api_client'
|
3
2
|
|
4
3
|
class Morpheus::VirtualImagesInterface < Morpheus::APIClient
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
def initialize(access_token, refresh_token,expires_at = nil, base_url=nil)
|
5
|
+
@access_token = access_token
|
6
|
+
@refresh_token = refresh_token
|
7
|
+
@base_url = base_url
|
8
|
+
@expires_at = expires_at
|
9
|
+
end
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
def virtual_image_types(options={})
|
12
|
+
url = "#{@base_url}/api/virtual-image-types"
|
13
|
+
headers = { params: {}, authorization: "Bearer #{@access_token}" }
|
14
|
+
if options.is_a?(Hash)
|
15
|
+
headers[:params].merge!(options)
|
16
|
+
end
|
17
|
+
execute(method: :get, url: url, headers: headers)
|
18
|
+
end
|
15
19
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
url = "#{@base_url}/api/virtual-image-types/#{options}"
|
20
|
-
elsif options.is_a?(String)
|
21
|
-
headers[:params]['name'] = options
|
22
|
-
end
|
23
|
-
response = Morpheus::RestClient.execute(method: :get, url: url,
|
24
|
-
timeout: 30, headers: headers, verify_ssl:false)
|
25
|
-
JSON.parse(response.to_s)
|
26
|
-
end
|
20
|
+
def get(options=nil)
|
21
|
+
url = "#{@base_url}/api/virtual-images"
|
22
|
+
headers = { params: {}, authorization: "Bearer #{@access_token}" }
|
27
23
|
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
if options.is_a?(Hash)
|
25
|
+
headers[:params].merge!(options)
|
26
|
+
elsif options.is_a?(Numeric)
|
27
|
+
url = "#{@base_url}/api/virtual-images/#{options}"
|
28
|
+
elsif options.is_a?(String)
|
29
|
+
headers[:params]['name'] = options
|
30
|
+
end
|
31
|
+
execute(method: :get, url: url, headers: headers)
|
32
|
+
end
|
31
33
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
headers[:params]['name'] = options
|
38
|
-
end
|
39
|
-
response = Morpheus::RestClient.execute(method: :get, url: url,
|
40
|
-
timeout: 30, headers: headers, verify_ssl:false)
|
41
|
-
JSON.parse(response.to_s)
|
42
|
-
end
|
34
|
+
def update(id, options)
|
35
|
+
url = "#{@base_url}/api/virtual-images/#{id}"
|
36
|
+
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
37
|
+
execute(method: :put, url: url, headers: headers, payload: payload.to_json)
|
38
|
+
end
|
43
39
|
|
44
|
-
def update(id, options)
|
45
|
-
url = "#{@base_url}/api/virtual-images/#{id}"
|
46
|
-
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
47
|
-
|
48
|
-
payload = options
|
49
|
-
response = Morpheus::RestClient.execute(method: :put, url: url,
|
50
|
-
timeout: 10, headers: headers, payload: payload.to_json)
|
51
|
-
JSON.parse(response.to_s)
|
52
|
-
end
|
53
40
|
|
41
|
+
def create(options)
|
42
|
+
url = "#{@base_url}/api/virtual-images"
|
43
|
+
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
44
|
+
payload = options
|
45
|
+
execute(method: :post, url: url, headers: headers, payload: payload.to_json)
|
46
|
+
end
|
54
47
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
48
|
+
def destroy(id)
|
49
|
+
url = "#{@base_url}/api/virtual-images/#{id}"
|
50
|
+
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
51
|
+
execute(method: :delete, url: url, headers: headers)
|
52
|
+
end
|
53
|
+
|
54
|
+
# NOT json, multipart file upload
|
55
|
+
def upload(id, image_file)
|
56
|
+
url = "#{@base_url}/api/virtual-images/#{id}/upload"
|
57
|
+
headers = { :params => {}, :authorization => "Bearer #{@access_token}"}
|
58
|
+
payload = {}
|
59
|
+
payload[:file] = image_file
|
60
|
+
payload[:multipart] = true
|
61
|
+
execute(method: :post, url: url, headers: headers, payload: payload)
|
62
|
+
end
|
63
|
+
|
64
|
+
def destroy_file(id, filename)
|
65
|
+
url = "#{@base_url}/api/virtual-images/#{id}/files"
|
66
|
+
#url = "#{@base_url}/api/virtual-images/#{id}/files/#{filename}"
|
67
|
+
headers = { params: {}, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
68
|
+
headers[:params][:filename] = filename
|
69
|
+
execute(method: :delete, url: url, headers: headers)
|
70
|
+
end
|
64
71
|
|
65
|
-
def destroy(id)
|
66
|
-
url = "#{@base_url}/api/virtual-images/#{id}"
|
67
|
-
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
68
|
-
response = Morpheus::RestClient.execute(method: :delete, url: url,
|
69
|
-
timeout: 30, headers: headers, verify_ssl:false)
|
70
|
-
JSON.parse(response.to_s)
|
71
|
-
end
|
72
72
|
end
|
@@ -1,20 +1,17 @@
|
|
1
|
-
require '
|
2
|
-
require 'rest-client'
|
1
|
+
require 'morpheus/api/api_client'
|
3
2
|
|
4
3
|
class Morpheus::WhoamiInterface < Morpheus::APIClient
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
def initialize(access_token, refresh_token,expires_at = nil, base_url=nil)
|
5
|
+
@access_token = access_token
|
6
|
+
@refresh_token = refresh_token
|
7
|
+
@base_url = base_url
|
8
|
+
@expires_at = expires_at
|
9
|
+
end
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
JSON.parse(response.to_s)
|
18
|
-
end
|
11
|
+
def get()
|
12
|
+
url = "#{@base_url}/api/whoami"
|
13
|
+
headers = { params: {}, authorization: "Bearer #{@access_token}" }
|
14
|
+
execute(method: :get, url: url, headers: headers, timeout: 5)
|
15
|
+
end
|
19
16
|
|
20
17
|
end
|