ey-core 3.4.2 → 3.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +1 -0
- data/lib/ey-core/cli/deploy.rb +2 -2
- data/lib/ey-core/cli/ssh.rb +1 -1
- data/lib/ey-core/client.rb +8 -0
- data/lib/ey-core/client/mock.rb +1 -0
- data/lib/ey-core/collections/auto_scaling_groups.rb +8 -0
- data/lib/ey-core/collections/servers.rb +4 -0
- data/lib/ey-core/models/auto_scaling_group.rb +49 -0
- data/lib/ey-core/models/environment.rb +13 -7
- data/lib/ey-core/models/request.rb +2 -0
- data/lib/ey-core/models/server.rb +2 -0
- data/lib/ey-core/requests/create_auto_scaling_group.rb +62 -0
- data/lib/ey-core/requests/create_environment.rb +1 -0
- data/lib/ey-core/requests/destroy_auto_scaling_group.rb +44 -0
- data/lib/ey-core/requests/discover_server.rb +60 -0
- data/lib/ey-core/requests/get_auto_scaling_group.rb +21 -0
- data/lib/ey-core/requests/get_auto_scaling_groups.rb +29 -0
- data/lib/ey-core/requests/update_auto_scaling_group.rb +45 -0
- data/lib/ey-core/version.rb +1 -1
- data/spec/auto_scaling_groups_spec.rb +28 -0
- data/spec/environments_spec.rb +18 -0
- data/spec/servers_spec.rb +8 -0
- metadata +13 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60c37b8856b7cd6b06d2996a64d376bbb170f75f
|
4
|
+
data.tar.gz: 17060911ccff177a709c111a1916fc8d42b3dadb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3911ac7f2dab3d27fa225e563e9abb46f6ab2b4a95ee82153a70668480f56a751a2623c731a24cfbc17efc0615c6f7d56e210af24b01ceeb458833aee45a8ba3
|
7
|
+
data.tar.gz: fb4d4e6c23f50159d54c784e07fd62c63998b33d9930a67c57e1e364fc7a0fd917f9e4d11c58b31a3ae0108278dfe09504162f35b17ad8a6d47e17209f07138d
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.2.2
|
data/.travis.yml
CHANGED
data/lib/ey-core/cli/deploy.rb
CHANGED
@@ -91,8 +91,8 @@ EOF
|
|
91
91
|
raise "--ref is required (HEAD is the typical choice)"
|
92
92
|
end
|
93
93
|
end
|
94
|
-
if (
|
95
|
-
deploy_options.merge!(migrate_command: option(:migrate)) if
|
94
|
+
if (option(:migrate) || switch_active?(:no_migrate))
|
95
|
+
deploy_options.merge!(migrate_command: option(:migrate)) if option(:migrate)
|
96
96
|
deploy_options.merge!(migrate_command: '') if switch_active?(:no_migrate)
|
97
97
|
else
|
98
98
|
puts "missing migrate option (--migrate or --no-migrate), checking latest deploy...".yellow
|
data/lib/ey-core/cli/ssh.rb
CHANGED
@@ -107,7 +107,7 @@ module Ey
|
|
107
107
|
end
|
108
108
|
|
109
109
|
if option(:server)
|
110
|
-
servers += [core_server_for(server: option
|
110
|
+
servers += [core_server_for(server: option(:server), operator: environment)]
|
111
111
|
else
|
112
112
|
servers += Ey::Core::Cli::Helpers::ServerSieve.filter(
|
113
113
|
environment.servers,
|
data/lib/ey-core/client.rb
CHANGED
@@ -14,6 +14,7 @@ class Ey::Core::Client < Cistern::Service
|
|
14
14
|
collection :application_archives
|
15
15
|
collection :application_deployments
|
16
16
|
collection :applications
|
17
|
+
collection :auto_scaling_groups
|
17
18
|
collection :backup_files
|
18
19
|
collection :blueprints
|
19
20
|
collection :components
|
@@ -70,6 +71,7 @@ class Ey::Core::Client < Cistern::Service
|
|
70
71
|
model :application
|
71
72
|
model :application_archive
|
72
73
|
model :application_deployment
|
74
|
+
model :auto_scaling_group
|
73
75
|
model :backup_file
|
74
76
|
model :billing
|
75
77
|
model :blueprint
|
@@ -134,6 +136,7 @@ class Ey::Core::Client < Cistern::Service
|
|
134
136
|
request :create_alert
|
135
137
|
request :create_application
|
136
138
|
request :create_application_archive
|
139
|
+
request :create_auto_scaling_group
|
137
140
|
request :create_backup_file
|
138
141
|
request :create_database_server
|
139
142
|
request :create_database_service
|
@@ -162,6 +165,7 @@ class Ey::Core::Client < Cistern::Service
|
|
162
165
|
request :deploy_environment_application
|
163
166
|
request :deprovision_environment
|
164
167
|
request :destroy_addon
|
168
|
+
request :destroy_auto_scaling_group
|
165
169
|
request :destroy_blueprint
|
166
170
|
request :destroy_database_server
|
167
171
|
request :destroy_database_server_snapshot
|
@@ -182,6 +186,7 @@ class Ey::Core::Client < Cistern::Service
|
|
182
186
|
request :discover_database_server
|
183
187
|
request :discover_database_server_snapshots
|
184
188
|
request :discover_provider_location
|
189
|
+
request :discover_server
|
185
190
|
request :download_file
|
186
191
|
request :enable_feature
|
187
192
|
request :get_account
|
@@ -203,6 +208,8 @@ class Ey::Core::Client < Cistern::Service
|
|
203
208
|
request :get_application_deployment
|
204
209
|
request :get_application_deployments
|
205
210
|
request :get_applications
|
211
|
+
request :get_auto_scaling_group
|
212
|
+
request :get_auto_scaling_groups
|
206
213
|
request :get_backup_file
|
207
214
|
request :get_backup_files
|
208
215
|
request :get_billing
|
@@ -305,6 +312,7 @@ class Ey::Core::Client < Cistern::Service
|
|
305
312
|
request :update_address
|
306
313
|
request :update_alert
|
307
314
|
request :update_application_archive
|
315
|
+
request :update_auto_scaling_group
|
308
316
|
request :update_billing
|
309
317
|
request :update_blueprint
|
310
318
|
request :update_environment
|
data/lib/ey-core/client/mock.rb
CHANGED
@@ -0,0 +1,8 @@
|
|
1
|
+
class Ey::Core::Client::AutoScalingGroups < Ey::Core::Collection
|
2
|
+
model Ey::Core::Client::AutoScalingGroup
|
3
|
+
|
4
|
+
self.model_root = "auto_scaling_group"
|
5
|
+
self.model_request = :get_auto_scaling_group
|
6
|
+
self.collection_root = "auto_scaling_groups"
|
7
|
+
self.collection_request = :get_auto_scaling_groups
|
8
|
+
end
|
@@ -6,4 +6,8 @@ class Ey::Core::Client::Servers < Ey::Core::Collection
|
|
6
6
|
self.model_request = :get_server
|
7
7
|
self.collection_root = "servers"
|
8
8
|
self.collection_request = :get_servers
|
9
|
+
|
10
|
+
def discover(options={})
|
11
|
+
self.connection.requests.new(self.connection.discover_server(Cistern::Hash.stringify_keys(options)).body["request"])
|
12
|
+
end
|
9
13
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
class Ey::Core::Client::AutoScalingGroup < Ey::Core::Model
|
2
|
+
extend Ey::Core::Associations
|
3
|
+
|
4
|
+
identity :id
|
5
|
+
|
6
|
+
attribute :created_at, type: :time
|
7
|
+
attribute :deleted_at, type: :time
|
8
|
+
attribute :location_id
|
9
|
+
attribute :provisioned_id
|
10
|
+
attribute :minimum_size
|
11
|
+
attribute :maximum_size
|
12
|
+
attribute :desired_capacity
|
13
|
+
|
14
|
+
has_one :environment
|
15
|
+
|
16
|
+
def destroy
|
17
|
+
connection.requests.new(connection.destroy_auto_scaling_group("id" => self.identity).body["request"])
|
18
|
+
end
|
19
|
+
|
20
|
+
def save!
|
21
|
+
if new_record?
|
22
|
+
requires :maximum_size, :minimum_size, :environment
|
23
|
+
|
24
|
+
params = {
|
25
|
+
"url" => self.collection.url,
|
26
|
+
"environment" => self.environment_id,
|
27
|
+
"auto_scaling_group" => {
|
28
|
+
"maximum_size" => self.maximum_size,
|
29
|
+
"minimum_size" => self.minimum_size,
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
connection.requests.new(connection.create_auto_scaling_group(params).body["request"])
|
34
|
+
else
|
35
|
+
requires :identity
|
36
|
+
|
37
|
+
params = {
|
38
|
+
"id" => self.identity,
|
39
|
+
"auto_scaling_group" => {
|
40
|
+
"maximum_size" => self.maximum_size,
|
41
|
+
"minimum_size" => self.minimum_size,
|
42
|
+
"desired_capacity" => self.desired_capacity
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
connection.requests.new(connection.update_auto_scaling_group(params).body["request"])
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -17,10 +17,14 @@ class Ey::Core::Client::Environment < Ey::Core::Model
|
|
17
17
|
attribute :release_label
|
18
18
|
attribute :stack_name
|
19
19
|
attribute :username
|
20
|
+
attribute :service_level
|
21
|
+
attribute :database_backup_limit
|
22
|
+
attribute :encrypted_ebs_for_everything
|
20
23
|
|
21
24
|
has_one :account
|
22
25
|
has_one :database_service
|
23
26
|
has_one :firewall
|
27
|
+
has_one :auto_scaling_group
|
24
28
|
has_one :assignee, assoc_name: :user, resource: :user
|
25
29
|
|
26
30
|
has_many :costs
|
@@ -211,13 +215,15 @@ class Ey::Core::Client::Environment < Ey::Core::Model
|
|
211
215
|
"url" => self.collection.url,
|
212
216
|
"account" => self.account_id,
|
213
217
|
"environment" => {
|
214
|
-
"name"
|
215
|
-
"application_id"
|
216
|
-
"region"
|
217
|
-
"stack_name"
|
218
|
-
"database_stack"
|
219
|
-
"release_label"
|
220
|
-
"language"
|
218
|
+
"name" => self.name,
|
219
|
+
"application_id" => self.application_id,
|
220
|
+
"region" => self.region,
|
221
|
+
"stack_name" => self.stack_name,
|
222
|
+
"database_stack" => self.database_stack,
|
223
|
+
"release_label" => self.release_label,
|
224
|
+
"language" => self.language,
|
225
|
+
"database_backup_limit" => self.database_backup_limit,
|
226
|
+
"encrypted_ebs_for_everything" => self.encrypted_ebs_for_everything,
|
221
227
|
},
|
222
228
|
}
|
223
229
|
|
@@ -53,6 +53,8 @@ class Ey::Core::Client::Request < Ey::Core::Model
|
|
53
53
|
case type
|
54
54
|
when /address/
|
55
55
|
self.connection.addresses.get!(resource_id)
|
56
|
+
when /auto_scaling_group/
|
57
|
+
self.connection.auto_scaling_groups.get!(resource_id)
|
56
58
|
when /cluster_update/
|
57
59
|
self.connection.cluster_updates.get!(resource_id)
|
58
60
|
when /database_server_snapshot/
|
@@ -26,6 +26,7 @@ class Ey::Core::Client::Server < Ey::Core::Model
|
|
26
26
|
attribute :updated_at, type: :time
|
27
27
|
attribute :wait_for_chef, type: :boolean
|
28
28
|
attribute :release_label
|
29
|
+
attribute :ip_id
|
29
30
|
|
30
31
|
has_one :account
|
31
32
|
has_one :address, collection: "addresses"
|
@@ -117,6 +118,7 @@ class Ey::Core::Client::Server < Ey::Core::Model
|
|
117
118
|
"release_label" => self.release_label,
|
118
119
|
"role" => self.role,
|
119
120
|
"volume_size" => self.volume_size,
|
121
|
+
"ip_id" => self.ip_id
|
120
122
|
}
|
121
123
|
}
|
122
124
|
connection.requests.new(connection.create_server(server_attributes).body["request"])
|
@@ -0,0 +1,62 @@
|
|
1
|
+
class Ey::Core::Client
|
2
|
+
class Real
|
3
|
+
def create_auto_scaling_group(options={})
|
4
|
+
url = options.delete("url")
|
5
|
+
|
6
|
+
request(
|
7
|
+
:method => :post,
|
8
|
+
:url => url,
|
9
|
+
:path => "/auto_scaling_groups",
|
10
|
+
:body => options
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Mock
|
16
|
+
def create_auto_scaling_group(options={})
|
17
|
+
url = options.delete("url")
|
18
|
+
|
19
|
+
environment_id = options.delete("environment")
|
20
|
+
environment = find(:environments, environment_id)
|
21
|
+
resource_id = self.uuid
|
22
|
+
resource = options["auto_scaling_group"].dup
|
23
|
+
|
24
|
+
now = Time.now
|
25
|
+
|
26
|
+
resource.merge!(
|
27
|
+
"created_at" => now,
|
28
|
+
"environment" => url_for("/environments/#{environment_id}"),
|
29
|
+
"id" => resource_id,
|
30
|
+
"location_id" => environment["region"],
|
31
|
+
"provisioned_id" => "#{environment["name"]}#{SecureRandom.uuid}",
|
32
|
+
"desired_capacity" => 1,
|
33
|
+
"resource_url" => url_for("/auto_scaling_groups/#{resource_id}"),
|
34
|
+
)
|
35
|
+
|
36
|
+
self.data[:auto_scaling_groups][resource_id] = resource
|
37
|
+
|
38
|
+
environment.merge!("auto_scaling_group" => url_for("/auto_scaling_groups/#{resource_id}"))
|
39
|
+
|
40
|
+
request = {
|
41
|
+
"created_at" => now - 2,
|
42
|
+
"finished_at" => now,
|
43
|
+
"id" => self.uuid,
|
44
|
+
"message" => nil,
|
45
|
+
"read_channel" => nil,
|
46
|
+
"resource" => [:auto_scaling_groups, resource_id, resource],
|
47
|
+
"resource_url" => url_for("/auto_scaling_groups/#{resource_id}"),
|
48
|
+
"started_at" => now - 1,
|
49
|
+
"successful" => true,
|
50
|
+
"type" => "provision_auto_scaling_group",
|
51
|
+
"updated_at" => now,
|
52
|
+
}
|
53
|
+
|
54
|
+
self.data[:requests][request["id"]] = request
|
55
|
+
|
56
|
+
response(
|
57
|
+
:body => {"request" => request},
|
58
|
+
:status => 200
|
59
|
+
)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
class Ey::Core::Client
|
2
|
+
class Real
|
3
|
+
def destroy_auto_scaling_group(params={})
|
4
|
+
id = params["id"]
|
5
|
+
url = params["url"]
|
6
|
+
|
7
|
+
request(
|
8
|
+
:method => :delete,
|
9
|
+
:url => url,
|
10
|
+
:path => "/auto_scaling_groups/#{id}",
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end # Real
|
14
|
+
|
15
|
+
class Mock
|
16
|
+
def destroy_auto_scaling_group(params={})
|
17
|
+
request_id = self.uuid
|
18
|
+
url = params.delete("url")
|
19
|
+
|
20
|
+
auto_scaling_group_id = params["id"] || url && url.split('/').last
|
21
|
+
|
22
|
+
auto_scaling_group = self.data[:auto_scaling_groups][auto_scaling_group_id].dup
|
23
|
+
auto_scaling_group["deleted_at"] = Time.now
|
24
|
+
auto_scaling_group["resource_url"] = url_for("/auto_scaling_groups/#{auto_scaling_group_id}")
|
25
|
+
|
26
|
+
environment = find(:environments, resource_identity(auto_scaling_group["environment"]))
|
27
|
+
environment.delete("auto_scaling_group")
|
28
|
+
|
29
|
+
self.data[:requests][request_id] = {
|
30
|
+
"id" => request_id,
|
31
|
+
"finished_at" => nil,
|
32
|
+
"successful" => "true",
|
33
|
+
"started_at" => Time.now,
|
34
|
+
"resource" => [:auto_scaling_groups, auto_scaling_group_id, auto_scaling_group],
|
35
|
+
"type" => "deprovision_auto_scaling_group",
|
36
|
+
}
|
37
|
+
|
38
|
+
response(
|
39
|
+
:body => {"request" => {id: request_id}},
|
40
|
+
:status => 201,
|
41
|
+
)
|
42
|
+
end
|
43
|
+
end # Mock
|
44
|
+
end # Ey::Core::Client
|
@@ -0,0 +1,60 @@
|
|
1
|
+
class Ey::Core::Client
|
2
|
+
class Real
|
3
|
+
def discover_server(options={})
|
4
|
+
provider_id = options.delete("provider")
|
5
|
+
|
6
|
+
request(
|
7
|
+
:method => :post,
|
8
|
+
:path => "/providers/#{provider_id}/servers/discover",
|
9
|
+
:body => options
|
10
|
+
)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class Mock
|
15
|
+
def discover_server(options={})
|
16
|
+
options = Cistern::Hash.stringify_keys(options)
|
17
|
+
|
18
|
+
provider_id = options.delete("provider")
|
19
|
+
request_id = self.uuid
|
20
|
+
|
21
|
+
options["server"]["role"] ||= "app"
|
22
|
+
options["server"]["flavor"] ||= "m4.large"
|
23
|
+
|
24
|
+
server = self.data[:servers].values.detect do |s|
|
25
|
+
!s["deleted_at"] && s["provider"] == url_for("/providers/#{provider_id}") && s["provisioned_id"] == options["server"]["provisioned_id"]
|
26
|
+
end
|
27
|
+
|
28
|
+
resource = if server
|
29
|
+
server
|
30
|
+
else
|
31
|
+
if auto_scaling_group_id = options["auto_scaling_group"]
|
32
|
+
find(:auto_scaling_groups, auto_scaling_group_id)
|
33
|
+
end
|
34
|
+
|
35
|
+
s = self.requests.new(create_server(options).body["request"]).resource! # cheating
|
36
|
+
self.data[:servers][s.id]
|
37
|
+
end
|
38
|
+
|
39
|
+
request = {
|
40
|
+
"id" => request_id,
|
41
|
+
"type" => "discover_server",
|
42
|
+
"successful" => true,
|
43
|
+
"started_at" => Time.now,
|
44
|
+
"finished_at" => nil,
|
45
|
+
"resource_url" => url_for("/servers/#{resource["id"]}"),
|
46
|
+
"resource" => [:servers, resource["id"], resource],
|
47
|
+
}
|
48
|
+
|
49
|
+
self.data[:requests][request_id] = request
|
50
|
+
|
51
|
+
response_hash = request.dup
|
52
|
+
response_hash.delete("resource")
|
53
|
+
|
54
|
+
response(
|
55
|
+
:body => {"request" => response_hash},
|
56
|
+
:status => 201,
|
57
|
+
)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class Ey::Core::Client
|
2
|
+
class Real
|
3
|
+
def get_auto_scaling_group(params={})
|
4
|
+
id = params["id"]
|
5
|
+
url = params["url"]
|
6
|
+
|
7
|
+
request(
|
8
|
+
:path => "auto_scaling_groups/#{id}",
|
9
|
+
:url => url,
|
10
|
+
)
|
11
|
+
end
|
12
|
+
end # Real
|
13
|
+
|
14
|
+
class Mock
|
15
|
+
def get_auto_scaling_group(params={})
|
16
|
+
response(
|
17
|
+
:body => {"auto_scaling_group" => self.find(:auto_scaling_groups, resource_identity(params))},
|
18
|
+
)
|
19
|
+
end
|
20
|
+
end # Mock
|
21
|
+
end # Ey::Core::Client
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class Ey::Core::Client
|
2
|
+
class Real
|
3
|
+
def get_auto_scaling_groups(options={})
|
4
|
+
query = Ey::Core.paging_parameters(options)
|
5
|
+
url = options.delete("url")
|
6
|
+
|
7
|
+
request(
|
8
|
+
:params => options,
|
9
|
+
:query => query,
|
10
|
+
:path => "/auto_scaling_groups",
|
11
|
+
:url => url,
|
12
|
+
)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class Mock
|
17
|
+
def get_auto_scaling_groups(options={})
|
18
|
+
extract_url_params!(options)
|
19
|
+
|
20
|
+
headers, auto_scaling_groups_page = search_and_page(options, :auto_scaling_groups, search_keys: %w[environment environment_id account account_id provider provider_id provisioned_id])
|
21
|
+
|
22
|
+
response(
|
23
|
+
:body => {"auto_scaling_groups" => auto_scaling_groups_page},
|
24
|
+
:status => 200,
|
25
|
+
:headers => headers
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
class Ey::Core::Client
|
2
|
+
class Real
|
3
|
+
def update_auto_scaling_group(params = {})
|
4
|
+
id = params.delete("id")
|
5
|
+
|
6
|
+
request(
|
7
|
+
:method => :put,
|
8
|
+
:path => "/auto_scaling_groups/#{id}",
|
9
|
+
:body => { "auto_scaling_group" => params.fetch("auto_scaling_group") },
|
10
|
+
)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class Mock
|
15
|
+
def update_auto_scaling_group(params = {})
|
16
|
+
url = params.delete("url")
|
17
|
+
|
18
|
+
resource_id = params.delete("id")
|
19
|
+
resource = find(:auto_scaling_groups, resource_id).merge(params["auto_scaling_group"])
|
20
|
+
|
21
|
+
now = Time.now
|
22
|
+
|
23
|
+
request = {
|
24
|
+
"id" => self.uuid,
|
25
|
+
"type" => "update_auto_scaling_group",
|
26
|
+
"successful" => true,
|
27
|
+
"created_at" => now - 5,
|
28
|
+
"updated_at" => now,
|
29
|
+
"started_at" => now - 3,
|
30
|
+
"finished_at" => now,
|
31
|
+
"message" => nil,
|
32
|
+
"read_channel" => nil,
|
33
|
+
"resource" => [:auto_scaling_groups, resource_id, resource],
|
34
|
+
"resource_url" => url_for("/auto_scaling_groups/#{resource_id}")
|
35
|
+
}
|
36
|
+
|
37
|
+
self.data[:requests][request["id"]] = request
|
38
|
+
|
39
|
+
response(
|
40
|
+
:body => {"request" => request},
|
41
|
+
:status => 200
|
42
|
+
)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/ey-core/version.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'as a user' do
|
4
|
+
let!(:client) { create_client }
|
5
|
+
|
6
|
+
context "with an environment" do
|
7
|
+
let!(:account) { create_account(client: client) }
|
8
|
+
let!(:provider) { create_provider(account: account) }
|
9
|
+
let!(:app) { create_application(account: account, client: client) }
|
10
|
+
let!(:environment) { create_environment(client: client, account: account, application: app, configuration: { type: "production"}) }
|
11
|
+
|
12
|
+
it "adds an auto scaling group" do
|
13
|
+
expect {
|
14
|
+
client.auto_scaling_groups.create!(minimum_size: 2, maximum_size: 6, environment: environment).resource!
|
15
|
+
}.to change { environment.reload.auto_scaling_group }.from(nil).and change { client.auto_scaling_groups.count }.by(1)
|
16
|
+
end
|
17
|
+
|
18
|
+
context "with an auto scaling group" do
|
19
|
+
let!(:group) { client.auto_scaling_groups.create!(minimum_size: 2, maximum_size: 6, environment: environment).resource! }
|
20
|
+
|
21
|
+
it "destroys the auto scaling group" do
|
22
|
+
expect {
|
23
|
+
group.destroy.ready!
|
24
|
+
}.to change { group.reload.deleted_at }.from(nil).and change { client.environments.get(environment.id).auto_scaling_group }.to(nil)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/spec/environments_spec.rb
CHANGED
@@ -173,6 +173,24 @@ describe 'as a user' do
|
|
173
173
|
expect(account.environments.all.map(&:identity)).to contain_exactly(environment.identity)
|
174
174
|
end
|
175
175
|
|
176
|
+
it 'gets the environment attributes' do
|
177
|
+
expect(client.environments.get(environment.id)).to have_attributes(
|
178
|
+
"account" => account,
|
179
|
+
"classic" => true,
|
180
|
+
"custom_recipes" => nil,
|
181
|
+
"database_stack" => "postgres9_4",
|
182
|
+
"deployments_url" => client.url_for("/environments/#{environment.id}/deployments"),
|
183
|
+
"id" => environment.id,
|
184
|
+
"keypairs" => environment.keypairs,
|
185
|
+
"logical_databases_url" => client.url_for("/environments/#{environment.id}/logical-databases"),
|
186
|
+
"release_label" => "stable-v4-2.0.101",
|
187
|
+
"servers" => environment.servers,
|
188
|
+
"stack_name" => "nginx_passenger4",
|
189
|
+
"username" => "deploy",
|
190
|
+
"service_level" => "default"
|
191
|
+
)
|
192
|
+
end
|
193
|
+
|
176
194
|
it "adds a keypair" do
|
177
195
|
client.keypairs.create(name: SecureRandom.hex(6), public_key: SSHKey.generate.ssh_public_key)
|
178
196
|
end
|
data/spec/servers_spec.rb
CHANGED
@@ -10,6 +10,14 @@ describe 'servers' do
|
|
10
10
|
let!(:environment) { create_environment(account: account, application: application, name: Faker::Name.first_name) }
|
11
11
|
let!(:server) { environment.servers.first }
|
12
12
|
|
13
|
+
context "discovering" do
|
14
|
+
it "discovers a server that it knows nothing about" do
|
15
|
+
expect {
|
16
|
+
client.servers.discover(provider: account.providers.first.identity, environment: environment.identity, server: {location: "us-east-1b", provisioned_id: "i-newserver"}).resource!
|
17
|
+
}.to change { client.servers.count }.by(1)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
13
21
|
context "with a second account" do
|
14
22
|
let(:account2) { create_account(client: client) }
|
15
23
|
let(:app2) { create_application(account: account2) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ey-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Engine Yard Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -485,6 +485,7 @@ files:
|
|
485
485
|
- lib/ey-core/collections/application_archives.rb
|
486
486
|
- lib/ey-core/collections/application_deployments.rb
|
487
487
|
- lib/ey-core/collections/applications.rb
|
488
|
+
- lib/ey-core/collections/auto_scaling_groups.rb
|
488
489
|
- lib/ey-core/collections/backup_files.rb
|
489
490
|
- lib/ey-core/collections/blueprints.rb
|
490
491
|
- lib/ey-core/collections/components.rb
|
@@ -548,6 +549,7 @@ files:
|
|
548
549
|
- lib/ey-core/models/application.rb
|
549
550
|
- lib/ey-core/models/application_archive.rb
|
550
551
|
- lib/ey-core/models/application_deployment.rb
|
552
|
+
- lib/ey-core/models/auto_scaling_group.rb
|
551
553
|
- lib/ey-core/models/backup_file.rb
|
552
554
|
- lib/ey-core/models/billing.rb
|
553
555
|
- lib/ey-core/models/blueprint.rb
|
@@ -613,6 +615,7 @@ files:
|
|
613
615
|
- lib/ey-core/requests/create_alert.rb
|
614
616
|
- lib/ey-core/requests/create_application.rb
|
615
617
|
- lib/ey-core/requests/create_application_archive.rb
|
618
|
+
- lib/ey-core/requests/create_auto_scaling_group.rb
|
616
619
|
- lib/ey-core/requests/create_backup_file.rb
|
617
620
|
- lib/ey-core/requests/create_database_server.rb
|
618
621
|
- lib/ey-core/requests/create_database_service.rb
|
@@ -641,6 +644,7 @@ files:
|
|
641
644
|
- lib/ey-core/requests/deploy_environment_application.rb
|
642
645
|
- lib/ey-core/requests/deprovision_environment.rb
|
643
646
|
- lib/ey-core/requests/destroy_addon.rb
|
647
|
+
- lib/ey-core/requests/destroy_auto_scaling_group.rb
|
644
648
|
- lib/ey-core/requests/destroy_blueprint.rb
|
645
649
|
- lib/ey-core/requests/destroy_database_server.rb
|
646
650
|
- lib/ey-core/requests/destroy_database_server_snapshot.rb
|
@@ -661,6 +665,7 @@ files:
|
|
661
665
|
- lib/ey-core/requests/discover_database_server.rb
|
662
666
|
- lib/ey-core/requests/discover_database_server_snapshots.rb
|
663
667
|
- lib/ey-core/requests/discover_provider_location.rb
|
668
|
+
- lib/ey-core/requests/discover_server.rb
|
664
669
|
- lib/ey-core/requests/download_file.rb
|
665
670
|
- lib/ey-core/requests/enable_feature.rb
|
666
671
|
- lib/ey-core/requests/get_account.rb
|
@@ -682,6 +687,8 @@ files:
|
|
682
687
|
- lib/ey-core/requests/get_application_deployment.rb
|
683
688
|
- lib/ey-core/requests/get_application_deployments.rb
|
684
689
|
- lib/ey-core/requests/get_applications.rb
|
690
|
+
- lib/ey-core/requests/get_auto_scaling_group.rb
|
691
|
+
- lib/ey-core/requests/get_auto_scaling_groups.rb
|
685
692
|
- lib/ey-core/requests/get_backup_file.rb
|
686
693
|
- lib/ey-core/requests/get_backup_files.rb
|
687
694
|
- lib/ey-core/requests/get_billing.rb
|
@@ -787,6 +794,7 @@ files:
|
|
787
794
|
- lib/ey-core/requests/update_address.rb
|
788
795
|
- lib/ey-core/requests/update_alert.rb
|
789
796
|
- lib/ey-core/requests/update_application_archive.rb
|
797
|
+
- lib/ey-core/requests/update_auto_scaling_group.rb
|
790
798
|
- lib/ey-core/requests/update_billing.rb
|
791
799
|
- lib/ey-core/requests/update_blueprint.rb
|
792
800
|
- lib/ey-core/requests/update_connector.rb
|
@@ -819,6 +827,7 @@ files:
|
|
819
827
|
- spec/alerts_spec.rb
|
820
828
|
- spec/application_archives_spec.rb
|
821
829
|
- spec/applications_spec.rb
|
830
|
+
- spec/auto_scaling_groups_spec.rb
|
822
831
|
- spec/billing_spec.rb
|
823
832
|
- spec/blueprints_spec.rb
|
824
833
|
- spec/client_spec.rb
|
@@ -893,7 +902,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
893
902
|
version: '0'
|
894
903
|
requirements: []
|
895
904
|
rubyforge_project:
|
896
|
-
rubygems_version: 2.5.2
|
905
|
+
rubygems_version: 2.5.2.1
|
897
906
|
signing_key:
|
898
907
|
specification_version: 4
|
899
908
|
summary: Client library providing real and mock functionality for accessing Engine
|
@@ -939,6 +948,7 @@ test_files:
|
|
939
948
|
- spec/alerts_spec.rb
|
940
949
|
- spec/application_archives_spec.rb
|
941
950
|
- spec/applications_spec.rb
|
951
|
+
- spec/auto_scaling_groups_spec.rb
|
942
952
|
- spec/billing_spec.rb
|
943
953
|
- spec/blueprints_spec.rb
|
944
954
|
- spec/client_spec.rb
|