morpheus-cli 0.1.1 → 0.9.0
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/accounts_interface.rb +55 -0
- data/lib/morpheus/api/api_client.rb +48 -3
- data/lib/morpheus/api/apps_interface.rb +13 -13
- data/lib/morpheus/api/{zones_interface.rb → clouds_interface.rb} +10 -10
- data/lib/morpheus/api/deploy_interface.rb +4 -4
- data/lib/morpheus/api/groups_interface.rb +3 -3
- data/lib/morpheus/api/instance_types_interface.rb +2 -2
- data/lib/morpheus/api/instances_interface.rb +35 -19
- data/lib/morpheus/api/key_pairs_interface.rb +60 -0
- data/lib/morpheus/api/license_interface.rb +29 -0
- data/lib/morpheus/api/load_balancers_interface.rb +72 -0
- data/lib/morpheus/api/logs_interface.rb +37 -0
- data/lib/morpheus/api/options_interface.rb +20 -0
- data/lib/morpheus/api/provision_types_interface.rb +27 -0
- data/lib/morpheus/api/roles_interface.rb +73 -0
- data/lib/morpheus/api/security_group_rules_interface.rb +3 -3
- data/lib/morpheus/api/security_groups_interface.rb +5 -5
- data/lib/morpheus/api/servers_interface.rb +67 -3
- data/lib/morpheus/api/task_sets_interface.rb +46 -0
- data/lib/morpheus/api/tasks_interface.rb +72 -0
- data/lib/morpheus/api/users_interface.rb +72 -0
- data/lib/morpheus/cli.rb +27 -4
- data/lib/morpheus/cli/accounts.rb +306 -0
- data/lib/morpheus/cli/apps.rb +58 -1
- data/lib/morpheus/cli/cli_command.rb +87 -0
- data/lib/morpheus/cli/cli_registry.rb +6 -1
- data/lib/morpheus/cli/{zones.rb → clouds.rb} +99 -70
- data/lib/morpheus/cli/credentials.rb +23 -11
- data/lib/morpheus/cli/error_handler.rb +31 -11
- data/lib/morpheus/cli/groups.rb +1 -0
- data/lib/morpheus/cli/hosts.rb +567 -0
- data/lib/morpheus/cli/instances.rb +588 -292
- data/lib/morpheus/cli/key_pairs.rb +393 -0
- data/lib/morpheus/cli/license.rb +118 -0
- data/lib/morpheus/cli/load_balancers.rb +366 -0
- data/lib/morpheus/cli/mixins/accounts_helper.rb +193 -0
- data/lib/morpheus/cli/option_types.rb +260 -0
- data/lib/morpheus/cli/roles.rb +164 -0
- data/lib/morpheus/cli/security_group_rules.rb +4 -9
- data/lib/morpheus/cli/shell.rb +108 -0
- data/lib/morpheus/cli/tasks.rb +370 -0
- data/lib/morpheus/cli/users.rb +325 -0
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/cli/workflows.rb +100 -0
- data/lib/morpheus/formatters.rb +43 -0
- data/morpheus-cli.gemspec +1 -1
- metadata +33 -10
- data/lib/morpheus/cli/servers.rb +0 -265
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6834b78a674df15c02d4ef4c43428cd142411588
|
4
|
+
data.tar.gz: b66fe527feee6d80a5e3893709f8e679d0efa6e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09f7c2370738170a161ba9d78d364a87467d1bad084f2beb18c281f9db52e2fbc420361804170b5d3290962114ee4e48ac48913e4edd77a5991da28f6292e2e2
|
7
|
+
data.tar.gz: b734c26c11b19684b861a13a0e45be27dacdbdbcfde6d0a82496330de8297c2848f4b4720034f0a2ea09efadb53162296d2fa6591bbff1dc919c93a057a6cc09
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'rest-client'
|
3
|
+
|
4
|
+
class Morpheus::AccountsInterface < Morpheus::APIClient
|
5
|
+
def initialize(access_token, refresh_token,expires_at = nil, base_url=nil)
|
6
|
+
@access_token = access_token
|
7
|
+
@refresh_token = refresh_token
|
8
|
+
@base_url = base_url
|
9
|
+
@expires_at = expires_at
|
10
|
+
end
|
11
|
+
|
12
|
+
def get(id)
|
13
|
+
raise "#{self.class}.get() passed a blank id!" if id.to_s == ''
|
14
|
+
url = "#{@base_url}/api/accounts/#{id}"
|
15
|
+
headers = { params: {}, authorization: "Bearer #{@access_token}" }
|
16
|
+
response = Morpheus::RestClient.execute(method: :get, url: url,
|
17
|
+
timeout: 10, headers: headers)
|
18
|
+
JSON.parse(response.to_s)
|
19
|
+
end
|
20
|
+
|
21
|
+
def list(options={})
|
22
|
+
url = "#{@base_url}/api/accounts"
|
23
|
+
headers = { params: {}, authorization: "Bearer #{@access_token}" }
|
24
|
+
headers[:params].merge!(options)
|
25
|
+
response = Morpheus::RestClient.execute(method: :get, url: url,
|
26
|
+
timeout: 10, headers: headers)
|
27
|
+
JSON.parse(response.to_s)
|
28
|
+
end
|
29
|
+
|
30
|
+
def create(options)
|
31
|
+
url = "#{@base_url}/api/accounts"
|
32
|
+
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
33
|
+
payload = options
|
34
|
+
response = Morpheus::RestClient.execute(method: :post, url: url,
|
35
|
+
timeout: 10, headers: headers, payload: payload.to_json)
|
36
|
+
JSON.parse(response.to_s)
|
37
|
+
end
|
38
|
+
|
39
|
+
def update(id, options)
|
40
|
+
url = "#{@base_url}/api/accounts/#{id}"
|
41
|
+
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
42
|
+
payload = options
|
43
|
+
response = Morpheus::RestClient.execute(method: :put, url: url,
|
44
|
+
timeout: 10, headers: headers, payload: payload.to_json)
|
45
|
+
JSON.parse(response.to_s)
|
46
|
+
end
|
47
|
+
|
48
|
+
def destroy(id)
|
49
|
+
url = "#{@base_url}/api/accounts/#{id}"
|
50
|
+
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
51
|
+
response = Morpheus::RestClient.execute(method: :delete, url: url,
|
52
|
+
timeout: 10, headers: headers)
|
53
|
+
JSON.parse(response.to_s)
|
54
|
+
end
|
55
|
+
end
|
@@ -11,12 +11,16 @@ class Morpheus::APIClient
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
def options
|
15
|
+
Morpheus::OptionsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
|
16
|
+
end
|
17
|
+
|
14
18
|
def groups
|
15
19
|
Morpheus::GroupsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
|
16
20
|
end
|
17
21
|
|
18
|
-
def
|
19
|
-
Morpheus::
|
22
|
+
def clouds
|
23
|
+
Morpheus::CloudsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
|
20
24
|
end
|
21
25
|
|
22
26
|
def servers
|
@@ -31,6 +35,22 @@ class Morpheus::APIClient
|
|
31
35
|
Morpheus::InstanceTypesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
|
32
36
|
end
|
33
37
|
|
38
|
+
def provision_types
|
39
|
+
Morpheus::ProvisionTypesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
|
40
|
+
end
|
41
|
+
|
42
|
+
def load_balancers
|
43
|
+
Morpheus::LoadBalancersInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
|
44
|
+
end
|
45
|
+
|
46
|
+
def tasks
|
47
|
+
Morpheus::TasksInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
|
48
|
+
end
|
49
|
+
|
50
|
+
def task_sets
|
51
|
+
Morpheus::TaskSetsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
|
52
|
+
end
|
53
|
+
|
34
54
|
def apps
|
35
55
|
Morpheus::AppsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
|
36
56
|
end
|
@@ -46,4 +66,29 @@ class Morpheus::APIClient
|
|
46
66
|
def security_group_rules
|
47
67
|
Morpheus::SecurityGroupRulesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
|
48
68
|
end
|
49
|
-
|
69
|
+
|
70
|
+
def accounts
|
71
|
+
Morpheus::AccountsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
|
72
|
+
end
|
73
|
+
|
74
|
+
def users
|
75
|
+
Morpheus::UsersInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
|
76
|
+
end
|
77
|
+
|
78
|
+
def logs
|
79
|
+
Morpheus::LogsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
|
80
|
+
end
|
81
|
+
|
82
|
+
def roles
|
83
|
+
Morpheus::RolesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
|
84
|
+
end
|
85
|
+
|
86
|
+
def key_pairs
|
87
|
+
Morpheus::KeyPairsInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
|
88
|
+
end
|
89
|
+
|
90
|
+
def license
|
91
|
+
Morpheus::LicenseInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
@@ -22,7 +22,7 @@ class Morpheus::AppsInterface < Morpheus::APIClient
|
|
22
22
|
headers[:params]['name'] = options
|
23
23
|
end
|
24
24
|
response = Morpheus::RestClient.execute(method: :get, url: url,
|
25
|
-
timeout:
|
25
|
+
timeout: 30, headers: headers)
|
26
26
|
JSON.parse(response.to_s)
|
27
27
|
end
|
28
28
|
|
@@ -30,7 +30,7 @@ class Morpheus::AppsInterface < Morpheus::APIClient
|
|
30
30
|
url = "#{@base_url}/api/apps/#{id}/envs"
|
31
31
|
headers = { params: {}, authorization: "Bearer #{@access_token}" }
|
32
32
|
response = Morpheus::RestClient.execute(method: :get, url: url,
|
33
|
-
timeout:
|
33
|
+
timeout: 30, headers: headers)
|
34
34
|
JSON.parse(response.to_s)
|
35
35
|
end
|
36
36
|
|
@@ -40,7 +40,7 @@ class Morpheus::AppsInterface < Morpheus::APIClient
|
|
40
40
|
|
41
41
|
payload = {envs: options}
|
42
42
|
response = Morpheus::RestClient.execute(method: :post, url: url,
|
43
|
-
timeout:
|
43
|
+
timeout: 30, headers: headers, payload: payload.to_json)
|
44
44
|
JSON.parse(response.to_s)
|
45
45
|
end
|
46
46
|
|
@@ -49,7 +49,7 @@ class Morpheus::AppsInterface < Morpheus::APIClient
|
|
49
49
|
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
50
50
|
|
51
51
|
response = Morpheus::RestClient.execute(method: :delete, url: url,
|
52
|
-
timeout:
|
52
|
+
timeout: 30, headers: headers)
|
53
53
|
JSON.parse(response.to_s)
|
54
54
|
end
|
55
55
|
|
@@ -60,7 +60,7 @@ class Morpheus::AppsInterface < Morpheus::APIClient
|
|
60
60
|
|
61
61
|
payload = options
|
62
62
|
response = Morpheus::RestClient.execute(method: :post, url: url,
|
63
|
-
timeout:
|
63
|
+
timeout: 30, headers: headers, payload: payload.to_json)
|
64
64
|
JSON.parse(response.to_s)
|
65
65
|
end
|
66
66
|
|
@@ -68,7 +68,7 @@ class Morpheus::AppsInterface < Morpheus::APIClient
|
|
68
68
|
url = "#{@base_url}/api/apps/#{id}"
|
69
69
|
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
70
70
|
response = Morpheus::RestClient.execute(method: :delete, url: url,
|
71
|
-
timeout:
|
71
|
+
timeout: 30, headers: headers)
|
72
72
|
JSON.parse(response.to_s)
|
73
73
|
end
|
74
74
|
|
@@ -76,7 +76,7 @@ class Morpheus::AppsInterface < Morpheus::APIClient
|
|
76
76
|
url = "#{@base_url}/api/apps/#{id}/stop"
|
77
77
|
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
78
78
|
response = Morpheus::RestClient.execute(method: :put, url: url,
|
79
|
-
timeout:
|
79
|
+
timeout: 30, headers: headers)
|
80
80
|
JSON.parse(response.to_s)
|
81
81
|
end
|
82
82
|
|
@@ -84,7 +84,7 @@ class Morpheus::AppsInterface < Morpheus::APIClient
|
|
84
84
|
url = "#{@base_url}/api/apps/#{id}/start"
|
85
85
|
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
86
86
|
response = Morpheus::RestClient.execute(method: :put, url: url,
|
87
|
-
timeout:
|
87
|
+
timeout: 30, headers: headers)
|
88
88
|
JSON.parse(response.to_s)
|
89
89
|
end
|
90
90
|
|
@@ -92,7 +92,7 @@ class Morpheus::AppsInterface < Morpheus::APIClient
|
|
92
92
|
url = "#{@base_url}/api/apps/#{id}/restart"
|
93
93
|
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
94
94
|
response = Morpheus::RestClient.execute(method: :put, url: url,
|
95
|
-
timeout:
|
95
|
+
timeout: 30, headers: headers)
|
96
96
|
JSON.parse(response.to_s)
|
97
97
|
end
|
98
98
|
|
@@ -100,7 +100,7 @@ class Morpheus::AppsInterface < Morpheus::APIClient
|
|
100
100
|
url = "#{@base_url}/api/apps/#{id}/security-groups/disable"
|
101
101
|
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
102
102
|
response = Morpheus::RestClient.execute(method: :put, url: url,
|
103
|
-
timeout:
|
103
|
+
timeout: 30, headers: headers)
|
104
104
|
JSON.parse(response.to_s)
|
105
105
|
end
|
106
106
|
|
@@ -108,7 +108,7 @@ class Morpheus::AppsInterface < Morpheus::APIClient
|
|
108
108
|
url = "#{@base_url}/api/apps/#{id}/security-groups/enable"
|
109
109
|
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
110
110
|
response = Morpheus::RestClient.execute(method: :put, url: url,
|
111
|
-
timeout:
|
111
|
+
timeout: 30, headers: headers)
|
112
112
|
JSON.parse(response.to_s)
|
113
113
|
end
|
114
114
|
|
@@ -116,7 +116,7 @@ class Morpheus::AppsInterface < Morpheus::APIClient
|
|
116
116
|
url = "#{@base_url}/api/apps/#{id}/security-groups"
|
117
117
|
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
118
118
|
response = Morpheus::RestClient.execute(method: :get, url: url,
|
119
|
-
timeout:
|
119
|
+
timeout: 30, headers: headers)
|
120
120
|
JSON.parse(response.to_s)
|
121
121
|
end
|
122
122
|
|
@@ -125,7 +125,7 @@ class Morpheus::AppsInterface < Morpheus::APIClient
|
|
125
125
|
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
126
126
|
payload = options
|
127
127
|
response = Morpheus::RestClient.execute(method: :post, url: url,
|
128
|
-
timeout:
|
128
|
+
timeout: 30, headers: headers, payload: payload.to_json)
|
129
129
|
JSON.parse(response.to_s)
|
130
130
|
end
|
131
131
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'json'
|
2
2
|
require 'rest-client'
|
3
3
|
|
4
|
-
class Morpheus::
|
4
|
+
class Morpheus::CloudsInterface < Morpheus::APIClient
|
5
5
|
def initialize(access_token, refresh_token,expires_at = nil, base_url=nil)
|
6
6
|
@access_token = access_token
|
7
7
|
@refresh_token = refresh_token
|
@@ -9,12 +9,12 @@ class Morpheus::ZonesInterface < Morpheus::APIClient
|
|
9
9
|
@expires_at = expires_at
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
12
|
+
def cloud_types()
|
13
13
|
url = "#{@base_url}/api/zone-types"
|
14
14
|
headers = { params: {}, authorization: "Bearer #{@access_token}" }
|
15
15
|
|
16
16
|
response = Morpheus::RestClient.execute(method: :get, url: url,
|
17
|
-
timeout:
|
17
|
+
timeout: 30, headers: headers,verify_ssl: false)
|
18
18
|
JSON.parse(response.to_s)
|
19
19
|
end
|
20
20
|
|
@@ -31,7 +31,7 @@ class Morpheus::ZonesInterface < Morpheus::APIClient
|
|
31
31
|
headers[:params]['name'] = options
|
32
32
|
end
|
33
33
|
response = Morpheus::RestClient.execute(method: :get, url: url,
|
34
|
-
timeout:
|
34
|
+
timeout: 30, headers: headers,verify_ssl: false)
|
35
35
|
JSON.parse(response.to_s)
|
36
36
|
end
|
37
37
|
|
@@ -42,7 +42,7 @@ class Morpheus::ZonesInterface < Morpheus::APIClient
|
|
42
42
|
|
43
43
|
payload = {zone: options}
|
44
44
|
response = Morpheus::RestClient.execute(method: :post, url: url,
|
45
|
-
timeout:
|
45
|
+
timeout: 30, headers: headers, payload: payload.to_json,verify_ssl: false)
|
46
46
|
JSON.parse(response.to_s)
|
47
47
|
end
|
48
48
|
|
@@ -50,7 +50,7 @@ class Morpheus::ZonesInterface < Morpheus::APIClient
|
|
50
50
|
url = "#{@base_url}/api/zones/#{id}"
|
51
51
|
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
52
52
|
response = Morpheus::RestClient.execute(method: :delete, url: url,
|
53
|
-
timeout:
|
53
|
+
timeout: 30, headers: headers,verify_ssl: false)
|
54
54
|
JSON.parse(response.to_s)
|
55
55
|
end
|
56
56
|
|
@@ -58,7 +58,7 @@ class Morpheus::ZonesInterface < Morpheus::APIClient
|
|
58
58
|
url = "#{@base_url}/api/zones/#{id}/security-groups/disable"
|
59
59
|
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
60
60
|
response = Morpheus::RestClient.execute(method: :put, url: url,
|
61
|
-
timeout:
|
61
|
+
timeout: 30, headers: headers,verify_ssl: false)
|
62
62
|
JSON.parse(response.to_s)
|
63
63
|
end
|
64
64
|
|
@@ -66,7 +66,7 @@ class Morpheus::ZonesInterface < Morpheus::APIClient
|
|
66
66
|
url = "#{@base_url}/api/zones/#{id}/security-groups/enable"
|
67
67
|
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
68
68
|
response = Morpheus::RestClient.execute(method: :put, url: url,
|
69
|
-
timeout:
|
69
|
+
timeout: 30, headers: headers,verify_ssl: false)
|
70
70
|
JSON.parse(response.to_s)
|
71
71
|
end
|
72
72
|
|
@@ -74,7 +74,7 @@ class Morpheus::ZonesInterface < Morpheus::APIClient
|
|
74
74
|
url = "#{@base_url}/api/zones/#{id}/security-groups"
|
75
75
|
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
76
76
|
response = Morpheus::RestClient.execute(method: :get, url: url,
|
77
|
-
timeout:
|
77
|
+
timeout: 30, headers: headers,verify_ssl: false)
|
78
78
|
JSON.parse(response.to_s)
|
79
79
|
end
|
80
80
|
|
@@ -83,7 +83,7 @@ class Morpheus::ZonesInterface < Morpheus::APIClient
|
|
83
83
|
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
84
84
|
payload = options
|
85
85
|
response = Morpheus::RestClient.execute(method: :post, url: url,
|
86
|
-
timeout:
|
86
|
+
timeout: 30, headers: headers, payload: payload.to_json,verify_ssl: false)
|
87
87
|
JSON.parse(response.to_s)
|
88
88
|
end
|
89
89
|
end
|
@@ -22,7 +22,7 @@ class Morpheus::DeployInterface < Morpheus::APIClient
|
|
22
22
|
headers[:params]['name'] = options
|
23
23
|
end
|
24
24
|
response = Morpheus::RestClient.execute(method: :get, url: url,
|
25
|
-
timeout:
|
25
|
+
timeout: 30, headers: headers)
|
26
26
|
JSON.parse(response.to_s)
|
27
27
|
end
|
28
28
|
|
@@ -33,7 +33,7 @@ class Morpheus::DeployInterface < Morpheus::APIClient
|
|
33
33
|
|
34
34
|
payload = options || {}
|
35
35
|
response = Morpheus::RestClient.execute(method: :post, url: url,
|
36
|
-
timeout:
|
36
|
+
timeout: 30, headers: headers, payload: payload.to_json)
|
37
37
|
JSON.parse(response.to_s)
|
38
38
|
end
|
39
39
|
|
@@ -43,7 +43,7 @@ class Morpheus::DeployInterface < Morpheus::APIClient
|
|
43
43
|
|
44
44
|
payload = options
|
45
45
|
response = Morpheus::RestClient.execute(method: :get, url: url,
|
46
|
-
timeout:
|
46
|
+
timeout: 30, headers: headers)
|
47
47
|
JSON.parse(response.to_s)
|
48
48
|
end
|
49
49
|
|
@@ -69,7 +69,7 @@ class Morpheus::DeployInterface < Morpheus::APIClient
|
|
69
69
|
url = "#{@base_url}/api/deploy/#{id}"
|
70
70
|
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
71
71
|
response = Morpheus::RestClient.execute(method: :delete, url: url,
|
72
|
-
timeout:
|
72
|
+
timeout: 30, headers: headers)
|
73
73
|
JSON.parse(response.to_s)
|
74
74
|
end
|
75
75
|
|
@@ -22,7 +22,7 @@ class Morpheus::GroupsInterface < Morpheus::APIClient
|
|
22
22
|
headers[:params]['name'] = options
|
23
23
|
end
|
24
24
|
response = Morpheus::RestClient.execute(method: :get, url: url,
|
25
|
-
timeout:
|
25
|
+
timeout: 30, headers: headers, verify_ssl:false)
|
26
26
|
JSON.parse(response.to_s)
|
27
27
|
end
|
28
28
|
|
@@ -33,7 +33,7 @@ class Morpheus::GroupsInterface < Morpheus::APIClient
|
|
33
33
|
|
34
34
|
payload = {group: options}
|
35
35
|
response = Morpheus::RestClient.execute(method: :post, url: url,
|
36
|
-
timeout:
|
36
|
+
timeout: 30, headers: headers, verify_ssl:false, payload: payload.to_json)
|
37
37
|
JSON.parse(response.to_s)
|
38
38
|
end
|
39
39
|
|
@@ -41,7 +41,7 @@ class Morpheus::GroupsInterface < Morpheus::APIClient
|
|
41
41
|
url = "#{@base_url}/api/groups/#{id}"
|
42
42
|
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
43
43
|
response = Morpheus::RestClient.execute(method: :delete, url: url,
|
44
|
-
timeout:
|
44
|
+
timeout: 30, headers: headers, verify_ssl:false)
|
45
45
|
JSON.parse(response.to_s)
|
46
46
|
end
|
47
47
|
end
|
@@ -22,7 +22,7 @@ class Morpheus::InstanceTypesInterface < Morpheus::APIClient
|
|
22
22
|
headers[:params]['name'] = options
|
23
23
|
end
|
24
24
|
response = Morpheus::RestClient.execute(method: :get, url: url,
|
25
|
-
timeout:
|
25
|
+
timeout: 30, headers: headers, verify_ssl:false)
|
26
26
|
JSON.parse(response.to_s)
|
27
27
|
end
|
28
28
|
|
@@ -34,7 +34,7 @@ class Morpheus::InstanceTypesInterface < Morpheus::APIClient
|
|
34
34
|
headers[:params][:name] = name
|
35
35
|
end
|
36
36
|
response = Morpheus::RestClient.execute(method: :get, url: url,
|
37
|
-
timeout:
|
37
|
+
timeout: 30, headers: headers, verify_ssl: false)
|
38
38
|
JSON.parse(response.to_s)
|
39
39
|
end
|
40
40
|
|
@@ -21,7 +21,7 @@ class Morpheus::InstancesInterface < Morpheus::APIClient
|
|
21
21
|
headers[:params]['name'] = options
|
22
22
|
end
|
23
23
|
response = Morpheus::RestClient.execute(method: :get, url: url,
|
24
|
-
timeout:
|
24
|
+
timeout: 30, headers: headers,verify_ssl: false)
|
25
25
|
JSON.parse(response.to_s)
|
26
26
|
end
|
27
27
|
|
@@ -29,7 +29,7 @@ class Morpheus::InstancesInterface < Morpheus::APIClient
|
|
29
29
|
url = "#{@base_url}/api/instances/#{id}/envs"
|
30
30
|
headers = { params: {}, authorization: "Bearer #{@access_token}" }
|
31
31
|
response = Morpheus::RestClient.execute(method: :get, url: url,
|
32
|
-
timeout:
|
32
|
+
timeout: 30, headers: headers,verify_ssl: false)
|
33
33
|
JSON.parse(response.to_s)
|
34
34
|
end
|
35
35
|
|
@@ -39,7 +39,7 @@ class Morpheus::InstancesInterface < Morpheus::APIClient
|
|
39
39
|
|
40
40
|
payload = {envs: options}
|
41
41
|
response = Morpheus::RestClient.execute(method: :post, url: url,
|
42
|
-
timeout:
|
42
|
+
timeout: 30, headers: headers,verify_ssl: false, payload: payload.to_json)
|
43
43
|
JSON.parse(response.to_s)
|
44
44
|
end
|
45
45
|
|
@@ -48,7 +48,7 @@ class Morpheus::InstancesInterface < Morpheus::APIClient
|
|
48
48
|
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
49
49
|
|
50
50
|
response = Morpheus::RestClient.execute(method: :delete, url: url,
|
51
|
-
timeout:
|
51
|
+
timeout: 30, headers: headers,verify_ssl: false)
|
52
52
|
JSON.parse(response.to_s)
|
53
53
|
end
|
54
54
|
|
@@ -59,7 +59,7 @@ class Morpheus::InstancesInterface < Morpheus::APIClient
|
|
59
59
|
|
60
60
|
payload = options
|
61
61
|
response = Morpheus::RestClient.execute(method: :post, url: url,
|
62
|
-
timeout:
|
62
|
+
timeout: 30, headers: headers,verify_ssl: false, payload: payload.to_json)
|
63
63
|
JSON.parse(response.to_s)
|
64
64
|
end
|
65
65
|
|
@@ -67,31 +67,47 @@ class Morpheus::InstancesInterface < Morpheus::APIClient
|
|
67
67
|
url = "#{@base_url}/api/instances/#{id}"
|
68
68
|
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
69
69
|
response = Morpheus::RestClient.execute(method: :delete, url: url,
|
70
|
-
timeout:
|
70
|
+
timeout: 30, headers: headers,verify_ssl: false)
|
71
71
|
JSON.parse(response.to_s)
|
72
72
|
end
|
73
73
|
|
74
|
-
def stop(id)
|
74
|
+
def stop(id,server=true)
|
75
75
|
url = "#{@base_url}/api/instances/#{id}/stop"
|
76
|
-
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
76
|
+
headers = { :params => {:server => server}, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
77
77
|
response = Morpheus::RestClient.execute(method: :put, url: url,
|
78
|
-
timeout:
|
78
|
+
timeout: 30, headers: headers,verify_ssl: false)
|
79
79
|
JSON.parse(response.to_s)
|
80
80
|
end
|
81
81
|
|
82
|
-
def start(id)
|
82
|
+
def start(id,server=true)
|
83
83
|
url = "#{@base_url}/api/instances/#{id}/start"
|
84
|
-
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
84
|
+
headers = { :params => {:server => server}, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
85
85
|
response = Morpheus::RestClient.execute(method: :put, url: url,
|
86
|
-
timeout:
|
86
|
+
timeout: 30, headers: headers,verify_ssl: false)
|
87
87
|
JSON.parse(response.to_s)
|
88
88
|
end
|
89
89
|
|
90
|
-
def restart(id)
|
90
|
+
def restart(id,server=true)
|
91
91
|
url = "#{@base_url}/api/instances/#{id}/restart"
|
92
|
-
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
92
|
+
headers = { :params => {:server => server},:authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
93
|
+
response = Morpheus::RestClient.execute(method: :put, url: url,
|
94
|
+
timeout: 30, headers: headers,verify_ssl: false)
|
95
|
+
JSON.parse(response.to_s)
|
96
|
+
end
|
97
|
+
|
98
|
+
def workflow(id,task_set_id,payload)
|
99
|
+
url = "#{@base_url}/api/instances/#{id}/workflow"
|
100
|
+
headers = { :params => {:taskSetId => task_set_id},:authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
101
|
+
response = Morpheus::RestClient.execute(method: :put, url: url,
|
102
|
+
timeout: 30, headers: headers,verify_ssl: false,payload: payload.to_json)
|
103
|
+
JSON.parse(response.to_s)
|
104
|
+
end
|
105
|
+
|
106
|
+
def backup(id,server=true)
|
107
|
+
url = "#{@base_url}/api/instances/#{id}/backup"
|
108
|
+
headers = {:authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
93
109
|
response = Morpheus::RestClient.execute(method: :put, url: url,
|
94
|
-
timeout:
|
110
|
+
timeout: 30, headers: headers,verify_ssl: false)
|
95
111
|
JSON.parse(response.to_s)
|
96
112
|
end
|
97
113
|
|
@@ -99,7 +115,7 @@ class Morpheus::InstancesInterface < Morpheus::APIClient
|
|
99
115
|
url = "#{@base_url}/api/instances/#{id}/security-groups/disable"
|
100
116
|
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
101
117
|
response = Morpheus::RestClient.execute(method: :put, url: url,
|
102
|
-
timeout:
|
118
|
+
timeout: 30, headers: headers,verify_ssl: false)
|
103
119
|
JSON.parse(response.to_s)
|
104
120
|
end
|
105
121
|
|
@@ -107,7 +123,7 @@ class Morpheus::InstancesInterface < Morpheus::APIClient
|
|
107
123
|
url = "#{@base_url}/api/instances/#{id}/security-groups/enable"
|
108
124
|
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
109
125
|
response = Morpheus::RestClient.execute(method: :put, url: url,
|
110
|
-
timeout:
|
126
|
+
timeout: 30, headers: headers,verify_ssl: false)
|
111
127
|
JSON.parse(response.to_s)
|
112
128
|
end
|
113
129
|
|
@@ -115,7 +131,7 @@ class Morpheus::InstancesInterface < Morpheus::APIClient
|
|
115
131
|
url = "#{@base_url}/api/instances/#{id}/security-groups"
|
116
132
|
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
117
133
|
response = Morpheus::RestClient.execute(method: :get, url: url,
|
118
|
-
timeout:
|
134
|
+
timeout: 30, headers: headers,verify_ssl: false)
|
119
135
|
JSON.parse(response.to_s)
|
120
136
|
end
|
121
137
|
|
@@ -125,7 +141,7 @@ class Morpheus::InstancesInterface < Morpheus::APIClient
|
|
125
141
|
payload = options
|
126
142
|
puts "payload #{payload}"
|
127
143
|
response = Morpheus::RestClient.execute(method: :post, url: url,
|
128
|
-
timeout:
|
144
|
+
timeout: 30, headers: headers,verify_ssl: false, payload: payload.to_json)
|
129
145
|
JSON.parse(response.to_s)
|
130
146
|
end
|
131
147
|
|