ey-core 3.4.2 → 3.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/.travis.yml +1 -0
- data/CHANGELOG.md +27 -5
- data/Gemfile +1 -2
- data/README.md +65 -8
- data/ey-core.gemspec +6 -5
- data/features/docker_registry_credentials.feature +21 -0
- data/features/environment_variables.feature +54 -0
- data/features/step_definitions/accounts_steps.rb +14 -0
- data/features/step_definitions/applications_steps.rb +7 -14
- data/features/step_definitions/docker_registry_credentials_steps.rb +3 -0
- data/features/step_definitions/environment_variables_steps.rb +51 -0
- data/features/step_definitions/environments_steps.rb +15 -0
- data/features/support/environment_variable_helpers.rb +20 -0
- data/features/support/mock_api.rb +0 -1
- data/features/support/resource_helpers.rb +12 -0
- data/lib/ey-core/cli/deploy.rb +14 -11
- data/lib/ey-core/cli/docker_registry_login.rb +29 -0
- data/lib/ey-core/cli/environment_variables.rb +71 -0
- data/lib/ey-core/cli/helpers/chef.rb +1 -1
- data/lib/ey-core/cli/helpers/core.rb +32 -3
- data/lib/ey-core/cli/helpers/server_sieve.rb +7 -0
- data/lib/ey-core/cli/main.rb +5 -4
- data/lib/ey-core/cli/servers.rb +35 -17
- data/lib/ey-core/cli/ssh.rb +7 -1
- data/lib/ey-core/client/mock.rb +5 -0
- data/lib/ey-core/client.rb +35 -0
- data/lib/ey-core/collections/auto_scaling_alarms.rb +8 -0
- data/lib/ey-core/collections/auto_scaling_groups.rb +8 -0
- data/lib/ey-core/collections/auto_scaling_policies.rb +33 -0
- data/lib/ey-core/collections/container_clusters.rb +9 -0
- data/lib/ey-core/collections/container_service_deployments.rb +17 -0
- data/lib/ey-core/collections/environment_variables.rb +8 -0
- data/lib/ey-core/collections/servers.rb +4 -0
- data/lib/ey-core/models/account.rb +10 -0
- data/lib/ey-core/models/address.rb +2 -0
- data/lib/ey-core/models/application.rb +1 -0
- data/lib/ey-core/models/auto_scaling_alarm.rb +54 -0
- data/lib/ey-core/models/auto_scaling_group.rb +75 -0
- data/lib/ey-core/models/base_auto_scaling_policy.rb +61 -0
- data/lib/ey-core/models/container_service_deployment.rb +17 -0
- data/lib/ey-core/models/deployment.rb +1 -0
- data/lib/ey-core/models/environment.rb +57 -45
- data/lib/ey-core/models/environment_variable.rb +29 -0
- data/lib/ey-core/models/request.rb +6 -0
- data/lib/ey-core/models/server.rb +2 -0
- data/lib/ey-core/models/simple_auto_scaling_policy.rb +24 -0
- data/lib/ey-core/models/step_auto_scaling_policy.rb +24 -0
- data/lib/ey-core/models/target_auto_scaling_policy.rb +24 -0
- data/lib/ey-core/requests/create_account.rb +5 -0
- data/lib/ey-core/requests/create_address.rb +1 -0
- data/lib/ey-core/requests/create_application.rb +8 -7
- data/lib/ey-core/requests/create_auto_scaling_alarm.rb +69 -0
- data/lib/ey-core/requests/create_auto_scaling_group.rb +62 -0
- data/lib/ey-core/requests/create_auto_scaling_policy.rb +68 -0
- data/lib/ey-core/requests/create_environment.rb +2 -0
- data/lib/ey-core/requests/create_environment_variable.rb +39 -0
- data/lib/ey-core/requests/create_user.rb +8 -6
- data/lib/ey-core/requests/deploy_environment_application.rb +1 -0
- data/lib/ey-core/requests/destroy_auto_scaling_alarm.rb +49 -0
- data/lib/ey-core/requests/destroy_auto_scaling_group.rb +44 -0
- data/lib/ey-core/requests/destroy_auto_scaling_policy.rb +49 -0
- data/lib/ey-core/requests/discover_container_service_deployments.rb +71 -0
- data/lib/ey-core/requests/discover_server.rb +60 -0
- data/lib/ey-core/requests/get_applications.rb +1 -1
- data/lib/ey-core/requests/get_auto_scaling_alarm.rb +27 -0
- data/lib/ey-core/requests/get_auto_scaling_alarms.rb +34 -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/get_auto_scaling_policies.rb +46 -0
- data/lib/ey-core/requests/get_auto_scaling_policy.rb +27 -0
- data/lib/ey-core/requests/get_deployments.rb +1 -1
- data/lib/ey-core/requests/get_environment_variable.rb +19 -0
- data/lib/ey-core/requests/get_environment_variables.rb +29 -0
- data/lib/ey-core/requests/get_environments.rb +1 -1
- data/lib/ey-core/requests/get_ssl_certificate.rb +1 -1
- data/lib/ey-core/requests/retrieve_docker_registry_credentials.rb +24 -0
- data/lib/ey-core/requests/update_auto_scaling_alarm.rb +45 -0
- data/lib/ey-core/requests/update_auto_scaling_group.rb +45 -0
- data/lib/ey-core/requests/update_auto_scaling_policy.rb +46 -0
- data/lib/ey-core/requests/update_environment_variable.rb +25 -0
- data/lib/ey-core/test_helpers/auto_scaling_helpers.rb +35 -0
- data/lib/ey-core/test_helpers.rb +2 -0
- data/lib/ey-core/version.rb +1 -1
- data/spec/addresses_spec.rb +2 -1
- data/spec/auto_scaling_alarms_spec.rb +40 -0
- data/spec/auto_scaling_groups_spec.rb +28 -0
- data/spec/auto_scaling_policies_spec.rb +94 -0
- data/spec/docker_registry_credentials_spec.rb +16 -0
- data/spec/environments_spec.rb +18 -0
- data/spec/servers_spec.rb +8 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/support/core.rb +0 -2
- metadata +88 -18
|
@@ -28,7 +28,7 @@ module Ey
|
|
|
28
28
|
puts "#{type.capitalize} chef run failed".red
|
|
29
29
|
ap request
|
|
30
30
|
if server = environment.servers.first
|
|
31
|
-
puts "For logs try `ey logs --server #{server.provisioned_id}` --environment #{environment.name}"
|
|
31
|
+
puts "For logs try `ey-core logs --server #{server.provisioned_id}` --environment #{environment.name}"
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
end
|
|
@@ -45,7 +45,7 @@ module Ey
|
|
|
45
45
|
|
|
46
46
|
def core_operator_and_environment_for(options={})
|
|
47
47
|
unless options[:environment]
|
|
48
|
-
raise "--environment is required (for a list of environments, try `ey environments`)"
|
|
48
|
+
raise "--environment is required (for a list of environments, try `ey-core environments`)"
|
|
49
49
|
end
|
|
50
50
|
operator = operator(options)
|
|
51
51
|
environment = nil
|
|
@@ -61,7 +61,7 @@ module Ey
|
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
unless environment
|
|
64
|
-
raise "environment '#{options[:environment]}' not found (for a list of environments, try `ey environments`)"
|
|
64
|
+
raise "environment '#{options[:environment]}' not found (for a list of environments, try `ey-core environments`)"
|
|
65
65
|
end
|
|
66
66
|
[operator, environment]
|
|
67
67
|
end
|
|
@@ -131,7 +131,7 @@ module Ey
|
|
|
131
131
|
write_core_yaml(legacy_token)
|
|
132
132
|
retry
|
|
133
133
|
elsif e.message.match(/missing token/i)
|
|
134
|
-
abort "Missing credentials: Run 'ey login' to retrieve your Engine Yard Cloud API token.".yellow
|
|
134
|
+
abort "Missing credentials: Run 'ey-core login' to retrieve your Engine Yard Cloud API token.".yellow
|
|
135
135
|
else
|
|
136
136
|
raise e
|
|
137
137
|
end
|
|
@@ -173,6 +173,35 @@ module Ey
|
|
|
173
173
|
end
|
|
174
174
|
end
|
|
175
175
|
|
|
176
|
+
# Fetches a list of environments by given name or ID.
|
|
177
|
+
#
|
|
178
|
+
# @param environment_name_or_id [String] name or ID of environment.
|
|
179
|
+
#
|
|
180
|
+
# @return [Array<Ey::Core::Client::Environment>] list of environments.
|
|
181
|
+
def core_environments(environment_name_or_id)
|
|
182
|
+
core_client.environments.all(name: environment_name_or_id).tap do |result|
|
|
183
|
+
result << core_client.environments.get(environment_name_or_id) if result.empty?
|
|
184
|
+
end.to_a.compact
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# Fetches a list of applications by given name or ID.
|
|
188
|
+
#
|
|
189
|
+
# @param application_name_or_id [String] name or ID of application.
|
|
190
|
+
#
|
|
191
|
+
# @return [Array<Ey::Core::Client::Environment>] list of environments.
|
|
192
|
+
def core_applications(application_name_or_id)
|
|
193
|
+
core_client.applications.all(name: application_name_or_id).tap do |result|
|
|
194
|
+
result << core_client.applications.get(application_name_or_id) if result.empty?
|
|
195
|
+
end.to_a.compact
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Fetches a list of environment variables available for current user.
|
|
199
|
+
#
|
|
200
|
+
# @return [Array<Ey::Core::Client::EnvironmentVariable>] list of environment variables.
|
|
201
|
+
def core_environment_variables
|
|
202
|
+
core_client.environment_variables
|
|
203
|
+
end
|
|
204
|
+
|
|
176
205
|
def write_core_yaml(token=nil)
|
|
177
206
|
core_yaml[core_url] = token if token
|
|
178
207
|
File.open(self.class.core_file, "w") {|file|
|
|
@@ -6,6 +6,7 @@ module Ey
|
|
|
6
6
|
ROLES = [
|
|
7
7
|
:app_servers,
|
|
8
8
|
:db_servers,
|
|
9
|
+
:app_master,
|
|
9
10
|
:db_master,
|
|
10
11
|
:utilities
|
|
11
12
|
]
|
|
@@ -56,6 +57,12 @@ module Ey
|
|
|
56
57
|
def db_servers
|
|
57
58
|
db_master + servers_api.all(role: 'db_slave').to_a
|
|
58
59
|
end
|
|
60
|
+
|
|
61
|
+
def app_master
|
|
62
|
+
['app_master', 'solo'].
|
|
63
|
+
map {|role| servers_api.all(role:role).to_a}.
|
|
64
|
+
flatten
|
|
65
|
+
end
|
|
59
66
|
|
|
60
67
|
def db_master
|
|
61
68
|
['db_master', 'solo'].
|
data/lib/ey-core/cli/main.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
#require 'ostruct'
|
|
3
3
|
#require 'ey-core'
|
|
4
4
|
require 'ey-core/cli'
|
|
5
|
-
require '
|
|
5
|
+
require 'amazing_print'
|
|
6
6
|
require 'belafonte'
|
|
7
7
|
require 'rubygems/package'
|
|
8
8
|
require 'escape'
|
|
@@ -13,7 +13,9 @@ require 'ey-core/cli/applications'
|
|
|
13
13
|
require 'ey-core/cli/console'
|
|
14
14
|
require 'ey-core/cli/current_user'
|
|
15
15
|
require 'ey-core/cli/deploy'
|
|
16
|
+
require 'ey-core/cli/docker_registry_login'
|
|
16
17
|
require 'ey-core/cli/environments'
|
|
18
|
+
require 'ey-core/cli/environment_variables'
|
|
17
19
|
require 'ey-core/cli/help'
|
|
18
20
|
require 'ey-core/cli/init'
|
|
19
21
|
require 'ey-core/cli/login'
|
|
@@ -29,9 +31,6 @@ require 'ey-core/cli/version'
|
|
|
29
31
|
require 'ey-core/cli/web'
|
|
30
32
|
require 'ey-core/cli/whoami'
|
|
31
33
|
|
|
32
|
-
Cistern.formatter = Cistern::Formatter::AwesomePrint
|
|
33
|
-
|
|
34
|
-
|
|
35
34
|
module Ey
|
|
36
35
|
module Core
|
|
37
36
|
module Cli
|
|
@@ -44,7 +43,9 @@ module Ey
|
|
|
44
43
|
mount Console
|
|
45
44
|
mount CurrentUser
|
|
46
45
|
mount Deploy
|
|
46
|
+
mount DockerRegistryLogin
|
|
47
47
|
mount Environments
|
|
48
|
+
mount EnvironmentVariables
|
|
48
49
|
mount Help
|
|
49
50
|
mount Init
|
|
50
51
|
mount Login
|
data/lib/ey-core/cli/servers.rb
CHANGED
|
@@ -4,36 +4,54 @@ module Ey
|
|
|
4
4
|
module Core
|
|
5
5
|
module Cli
|
|
6
6
|
class Servers < Subcommand
|
|
7
|
-
title
|
|
8
|
-
summary
|
|
7
|
+
title 'servers'
|
|
8
|
+
summary 'List servers you have access to'
|
|
9
9
|
|
|
10
10
|
option :account,
|
|
11
11
|
short: 'c',
|
|
12
12
|
long: 'account',
|
|
13
13
|
description: 'Filter by account name or id',
|
|
14
|
-
argument: '
|
|
14
|
+
argument: 'account'
|
|
15
15
|
|
|
16
16
|
option :environment,
|
|
17
|
-
short:
|
|
18
|
-
long:
|
|
19
|
-
description:
|
|
20
|
-
argument:
|
|
17
|
+
short: 'e',
|
|
18
|
+
long: 'environment',
|
|
19
|
+
description: 'Filter by environment.',
|
|
20
|
+
argument: 'environment'
|
|
21
|
+
|
|
22
|
+
option :role,
|
|
23
|
+
short: 'r',
|
|
24
|
+
long: 'role',
|
|
25
|
+
description: 'Filter by server role.',
|
|
26
|
+
argument: 'role'
|
|
21
27
|
|
|
22
28
|
def handle
|
|
23
|
-
puts TablePrint::Printer.
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
puts TablePrint::Printer.new(
|
|
30
|
+
servers,
|
|
31
|
+
[
|
|
32
|
+
{ id: { width: 10 } },
|
|
33
|
+
:role,
|
|
34
|
+
:provisioned_id,
|
|
35
|
+
{ public_hostname: { width: 50 } },
|
|
36
|
+
:name,
|
|
37
|
+
]
|
|
38
|
+
).table_print
|
|
26
39
|
end
|
|
27
40
|
|
|
28
41
|
private
|
|
29
42
|
def servers
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
43
|
+
filter_opts = {}
|
|
44
|
+
|
|
45
|
+
operator =
|
|
46
|
+
if option(:environment)
|
|
47
|
+
core_account.environments.first(name: option(:environment))
|
|
48
|
+
else
|
|
49
|
+
filter_opts[:account] = core_account.id if option(:account)
|
|
50
|
+
core_client
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
filter_opts[:role] = option(:role).split(',') if option(:role)
|
|
54
|
+
operator ? operator.servers.all(filter_opts) : nil
|
|
37
55
|
end
|
|
38
56
|
end
|
|
39
57
|
end
|
data/lib/ey-core/cli/ssh.rb
CHANGED
|
@@ -54,6 +54,10 @@ module Ey
|
|
|
54
54
|
long: "app_servers",
|
|
55
55
|
description: "Run command on all application servers"
|
|
56
56
|
|
|
57
|
+
switch :app_master,
|
|
58
|
+
long: "app_master",
|
|
59
|
+
description: "Run command on app master"
|
|
60
|
+
|
|
57
61
|
switch :db_servers,
|
|
58
62
|
long: "db_servers",
|
|
59
63
|
description: "Run command on all database servers"
|
|
@@ -97,6 +101,7 @@ module Ey
|
|
|
97
101
|
environment.servers,
|
|
98
102
|
all: switch_active?(:all),
|
|
99
103
|
app_servers: switch_active?(:app_servers),
|
|
104
|
+
app_master: switch_active?(:app_master),
|
|
100
105
|
db_servers: switch_active?(:db_servers),
|
|
101
106
|
db_master: switch_active?(:db_master),
|
|
102
107
|
utilities: option(:utilities)
|
|
@@ -107,12 +112,13 @@ module Ey
|
|
|
107
112
|
end
|
|
108
113
|
|
|
109
114
|
if option(:server)
|
|
110
|
-
servers += [core_server_for(server: option
|
|
115
|
+
servers += [core_server_for(server: option(:server), operator: environment)]
|
|
111
116
|
else
|
|
112
117
|
servers += Ey::Core::Cli::Helpers::ServerSieve.filter(
|
|
113
118
|
environment.servers,
|
|
114
119
|
all: switch_active?(:all),
|
|
115
120
|
app_servers: switch_active?(:app_servers),
|
|
121
|
+
app_master: switch_active?(:app_master),
|
|
116
122
|
db_servers: switch_active?(:db_servers),
|
|
117
123
|
db_master: switch_active?(:db_master),
|
|
118
124
|
utilities: option(:utilities)
|
data/lib/ey-core/client/mock.rb
CHANGED
|
@@ -116,6 +116,9 @@ class Ey::Core::Client::Mock
|
|
|
116
116
|
:application_archives => {},
|
|
117
117
|
:application_deployments => {},
|
|
118
118
|
:applications => {},
|
|
119
|
+
:auto_scaling_alarms => {},
|
|
120
|
+
:auto_scaling_groups => {},
|
|
121
|
+
:auto_scaling_policies => {},
|
|
119
122
|
:backup_files => {},
|
|
120
123
|
:backups => {},
|
|
121
124
|
:billing => {},
|
|
@@ -124,6 +127,7 @@ class Ey::Core::Client::Mock
|
|
|
124
127
|
:components => components,
|
|
125
128
|
:contact_assignments => [],
|
|
126
129
|
:contacts => {},
|
|
130
|
+
:container_service_deployments => {},
|
|
127
131
|
:costs => [],
|
|
128
132
|
:database_plan_usages => Hash.new { |h1,k1| h1[k1] = {} },
|
|
129
133
|
:database_server_firewalls => [],
|
|
@@ -136,6 +140,7 @@ class Ey::Core::Client::Mock
|
|
|
136
140
|
:deployments => {},
|
|
137
141
|
:environment_plan_usages => Hash.new { |h1,k1| h1[k1] = {} },
|
|
138
142
|
:environments => {},
|
|
143
|
+
:environment_variables => {},
|
|
139
144
|
:features => {},
|
|
140
145
|
:firewall_rules => {},
|
|
141
146
|
:firewalls => {},
|
data/lib/ey-core/client.rb
CHANGED
|
@@ -14,10 +14,14 @@ class Ey::Core::Client < Cistern::Service
|
|
|
14
14
|
collection :application_archives
|
|
15
15
|
collection :application_deployments
|
|
16
16
|
collection :applications
|
|
17
|
+
collection :auto_scaling_alarms
|
|
18
|
+
collection :auto_scaling_groups
|
|
19
|
+
collection :auto_scaling_policies
|
|
17
20
|
collection :backup_files
|
|
18
21
|
collection :blueprints
|
|
19
22
|
collection :components
|
|
20
23
|
collection :contacts
|
|
24
|
+
collection :container_service_deployments
|
|
21
25
|
collection :costs
|
|
22
26
|
collection :database_plan_usages
|
|
23
27
|
collection :database_server_revisions
|
|
@@ -28,6 +32,7 @@ class Ey::Core::Client < Cistern::Service
|
|
|
28
32
|
collection :deployments
|
|
29
33
|
collection :environment_plan_usages
|
|
30
34
|
collection :environments
|
|
35
|
+
collection :environment_variables
|
|
31
36
|
collection :features
|
|
32
37
|
collection :firewall_rules
|
|
33
38
|
collection :firewalls
|
|
@@ -70,11 +75,15 @@ class Ey::Core::Client < Cistern::Service
|
|
|
70
75
|
model :application
|
|
71
76
|
model :application_archive
|
|
72
77
|
model :application_deployment
|
|
78
|
+
model :auto_scaling_alarm
|
|
79
|
+
model :auto_scaling_group
|
|
73
80
|
model :backup_file
|
|
81
|
+
model :base_auto_scaling_policy
|
|
74
82
|
model :billing
|
|
75
83
|
model :blueprint
|
|
76
84
|
model :component
|
|
77
85
|
model :contact
|
|
86
|
+
model :container_service_deployment
|
|
78
87
|
model :cost
|
|
79
88
|
model :database_plan_usage
|
|
80
89
|
model :database_server
|
|
@@ -85,6 +94,7 @@ class Ey::Core::Client < Cistern::Service
|
|
|
85
94
|
model :deployment
|
|
86
95
|
model :environment
|
|
87
96
|
model :environment_plan_usage
|
|
97
|
+
model :environment_variable
|
|
88
98
|
model :feature
|
|
89
99
|
model :firewall
|
|
90
100
|
model :firewall_rule
|
|
@@ -107,10 +117,13 @@ class Ey::Core::Client < Cistern::Service
|
|
|
107
117
|
model :server_event
|
|
108
118
|
model :server_usage
|
|
109
119
|
model :service
|
|
120
|
+
model :simple_auto_scaling_policy
|
|
110
121
|
model :ssl_certificate
|
|
122
|
+
model :step_auto_scaling_policy
|
|
111
123
|
model :storage
|
|
112
124
|
model :storage_user
|
|
113
125
|
model :support_trial
|
|
126
|
+
model :target_auto_scaling_policy
|
|
114
127
|
model :task
|
|
115
128
|
model :token
|
|
116
129
|
model :untracked_address
|
|
@@ -134,11 +147,14 @@ class Ey::Core::Client < Cistern::Service
|
|
|
134
147
|
request :create_alert
|
|
135
148
|
request :create_application
|
|
136
149
|
request :create_application_archive
|
|
150
|
+
request :create_auto_scaling_alarm
|
|
151
|
+
request :create_auto_scaling_group
|
|
137
152
|
request :create_backup_file
|
|
138
153
|
request :create_database_server
|
|
139
154
|
request :create_database_service
|
|
140
155
|
request :create_database_service_snapshot
|
|
141
156
|
request :create_environment
|
|
157
|
+
request :create_environment_variable
|
|
142
158
|
request :create_firewall
|
|
143
159
|
request :create_firewall_rule
|
|
144
160
|
request :create_keypair
|
|
@@ -151,6 +167,7 @@ class Ey::Core::Client < Cistern::Service
|
|
|
151
167
|
request :create_password_reset
|
|
152
168
|
request :create_provider
|
|
153
169
|
request :create_server
|
|
170
|
+
request :create_auto_scaling_policy
|
|
154
171
|
request :create_ssl_certificate
|
|
155
172
|
request :create_storage
|
|
156
173
|
request :create_storage_user
|
|
@@ -162,6 +179,8 @@ class Ey::Core::Client < Cistern::Service
|
|
|
162
179
|
request :deploy_environment_application
|
|
163
180
|
request :deprovision_environment
|
|
164
181
|
request :destroy_addon
|
|
182
|
+
request :destroy_auto_scaling_alarm
|
|
183
|
+
request :destroy_auto_scaling_group
|
|
165
184
|
request :destroy_blueprint
|
|
166
185
|
request :destroy_database_server
|
|
167
186
|
request :destroy_database_server_snapshot
|
|
@@ -173,15 +192,18 @@ class Ey::Core::Client < Cistern::Service
|
|
|
173
192
|
request :destroy_logical_database
|
|
174
193
|
request :destroy_provider
|
|
175
194
|
request :destroy_server
|
|
195
|
+
request :destroy_auto_scaling_policy
|
|
176
196
|
request :destroy_ssl_certificate
|
|
177
197
|
request :destroy_storage
|
|
178
198
|
request :destroy_storage_user
|
|
179
199
|
request :destroy_user
|
|
180
200
|
request :detach_address
|
|
181
201
|
request :disable_feature
|
|
202
|
+
request :discover_container_service_deployments
|
|
182
203
|
request :discover_database_server
|
|
183
204
|
request :discover_database_server_snapshots
|
|
184
205
|
request :discover_provider_location
|
|
206
|
+
request :discover_server
|
|
185
207
|
request :download_file
|
|
186
208
|
request :enable_feature
|
|
187
209
|
request :get_account
|
|
@@ -203,6 +225,10 @@ class Ey::Core::Client < Cistern::Service
|
|
|
203
225
|
request :get_application_deployment
|
|
204
226
|
request :get_application_deployments
|
|
205
227
|
request :get_applications
|
|
228
|
+
request :get_auto_scaling_alarm
|
|
229
|
+
request :get_auto_scaling_alarms
|
|
230
|
+
request :get_auto_scaling_group
|
|
231
|
+
request :get_auto_scaling_groups
|
|
206
232
|
request :get_backup_file
|
|
207
233
|
request :get_backup_files
|
|
208
234
|
request :get_billing
|
|
@@ -229,6 +255,8 @@ class Ey::Core::Client < Cistern::Service
|
|
|
229
255
|
request :get_environment_database_services
|
|
230
256
|
request :get_environment_logical_databases
|
|
231
257
|
request :get_environment_plan_usages
|
|
258
|
+
request :get_environment_variable
|
|
259
|
+
request :get_environment_variables
|
|
232
260
|
request :get_environments
|
|
233
261
|
request :get_feature
|
|
234
262
|
request :get_features
|
|
@@ -271,6 +299,8 @@ class Ey::Core::Client < Cistern::Service
|
|
|
271
299
|
request :get_server_events
|
|
272
300
|
request :get_server_usages
|
|
273
301
|
request :get_servers
|
|
302
|
+
request :get_auto_scaling_policy
|
|
303
|
+
request :get_auto_scaling_policies
|
|
274
304
|
request :get_ssl_certificate
|
|
275
305
|
request :get_ssl_certificates
|
|
276
306
|
request :get_storage
|
|
@@ -294,6 +324,7 @@ class Ey::Core::Client < Cistern::Service
|
|
|
294
324
|
request :reset_password
|
|
295
325
|
request :reset_server_state
|
|
296
326
|
request :restart_environment_app_servers
|
|
327
|
+
request :retrieve_docker_registry_credentials
|
|
297
328
|
request :run_cluster_application_action
|
|
298
329
|
request :run_environment_application_action
|
|
299
330
|
request :signup
|
|
@@ -305,9 +336,13 @@ class Ey::Core::Client < Cistern::Service
|
|
|
305
336
|
request :update_address
|
|
306
337
|
request :update_alert
|
|
307
338
|
request :update_application_archive
|
|
339
|
+
request :update_auto_scaling_alarm
|
|
340
|
+
request :update_auto_scaling_group
|
|
341
|
+
request :update_auto_scaling_policy
|
|
308
342
|
request :update_billing
|
|
309
343
|
request :update_blueprint
|
|
310
344
|
request :update_environment
|
|
345
|
+
request :update_environment_variable
|
|
311
346
|
request :update_membership
|
|
312
347
|
request :update_provider_location
|
|
313
348
|
request :update_server
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
class Ey::Core::Client::AutoScalingAlarms < Ey::Core::Collection
|
|
2
|
+
model Ey::Core::Client::AutoScalingAlarm
|
|
3
|
+
|
|
4
|
+
self.model_root = "auto_scaling_alarm"
|
|
5
|
+
self.model_request = :get_auto_scaling_alarm
|
|
6
|
+
self.collection_root = "auto_scaling_alarms"
|
|
7
|
+
self.collection_request = :get_auto_scaling_alarms
|
|
8
|
+
end
|
|
@@ -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
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
class Ey::Core::Client::AutoScalingPolicies < Ey::Core::Collection
|
|
2
|
+
model Ey::Core::Client::BaseAutoScalingPolicy
|
|
3
|
+
|
|
4
|
+
MODELS_TO_TYPE = {
|
|
5
|
+
"simple" => Ey::Core::Client::SimpleAutoScalingPolicy,
|
|
6
|
+
"step" => Ey::Core::Client::StepAutoScalingPolicy,
|
|
7
|
+
"target" => Ey::Core::Client::TargetAutoScalingPolicy
|
|
8
|
+
}.freeze
|
|
9
|
+
|
|
10
|
+
self.model_root = "auto_scaling_policy"
|
|
11
|
+
self.model_request = :get_auto_scaling_policy
|
|
12
|
+
self.collection_root = "auto_scaling_policies"
|
|
13
|
+
self.collection_request = :get_auto_scaling_policies
|
|
14
|
+
|
|
15
|
+
def new(attributes = {})
|
|
16
|
+
unless attributes.is_a?(::Hash)
|
|
17
|
+
raise(ArgumentError.new("Initialization parameters must be an attributes hash, got #{attributes.class} #{attributes.inspect}"))
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
params = Cistern::Hash.stringify_keys(attributes)
|
|
21
|
+
type = params["type"] ||= "simple"
|
|
22
|
+
model = MODELS_TO_TYPE[type]
|
|
23
|
+
unless model
|
|
24
|
+
raise(ArgumentError.new("Unrecognized policy type #{type}. Allowed types are: #{MODELS_TO_TYPE.keys.join(', ')}"))
|
|
25
|
+
end
|
|
26
|
+
model.new(
|
|
27
|
+
{
|
|
28
|
+
:collection => self,
|
|
29
|
+
:connection => connection,
|
|
30
|
+
}.merge(params)
|
|
31
|
+
)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
class Ey::Core::Client::ContainerClusters < Ey::Core::Collection
|
|
2
|
+
|
|
3
|
+
model Ey::Core::Client::ContainerCluster
|
|
4
|
+
|
|
5
|
+
self.model_root = "container_cluster"
|
|
6
|
+
self.model_request = :get_container_cluster
|
|
7
|
+
self.collection_root = "container_clusters"
|
|
8
|
+
self.collection_request = :get_container_clusters
|
|
9
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class Ey::Core::Client::ContainerServiceDeployments < Ey::Core::Collection
|
|
2
|
+
|
|
3
|
+
model Ey::Core::Client::ContainerServiceDeployment
|
|
4
|
+
|
|
5
|
+
self.model_root = "container_service_deployment"
|
|
6
|
+
self.model_request = :get_container_service_deployment
|
|
7
|
+
self.collection_root = "container_service_deployments"
|
|
8
|
+
self.collection_request = :get_container_service_deployments
|
|
9
|
+
|
|
10
|
+
def discover(task_definition_arn)
|
|
11
|
+
params = {
|
|
12
|
+
"task_definition_arn" => task_definition_arn
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
connection.requests.new(connection.discover_container_service_deployments(params).body["request"])
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
class Ey::Core::Client::EnvironmentVariables < Ey::Core::Collection
|
|
2
|
+
model Ey::Core::Client::EnvironmentVariable
|
|
3
|
+
|
|
4
|
+
self.model_root = "environment_variable"
|
|
5
|
+
self.model_request = :get_environment_variable
|
|
6
|
+
self.collection_root = "environment_variables"
|
|
7
|
+
self.collection_request = :get_environment_variables
|
|
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
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'hashie'
|
|
2
|
+
|
|
1
3
|
class Ey::Core::Client::Account < Ey::Core::Model
|
|
2
4
|
extend Ey::Core::Associations
|
|
3
5
|
|
|
@@ -67,4 +69,12 @@ class Ey::Core::Client::Account < Ey::Core::Model
|
|
|
67
69
|
else raise NotImplementedError # update
|
|
68
70
|
end
|
|
69
71
|
end
|
|
72
|
+
|
|
73
|
+
# Get authorization data for an Amazon ECR registry.
|
|
74
|
+
# @param [String] location_id Aws region
|
|
75
|
+
# @return [Hashie::Mash]
|
|
76
|
+
def retrieve_docker_registry_credentials(location_id)
|
|
77
|
+
result = self.connection.retrieve_docker_registry_credentials(self.id, location_id).body
|
|
78
|
+
::Hashie::Mash.new(result['docker_registry_credentials'])
|
|
79
|
+
end
|
|
70
80
|
end
|
|
@@ -7,6 +7,7 @@ class Ey::Core::Client::Address < Ey::Core::Model
|
|
|
7
7
|
attribute :ip_address
|
|
8
8
|
attribute :provisioned_id
|
|
9
9
|
attribute :location
|
|
10
|
+
attribute :scope
|
|
10
11
|
attribute :disappeared_at, type: :time
|
|
11
12
|
|
|
12
13
|
has_one :provider
|
|
@@ -37,6 +38,7 @@ class Ey::Core::Client::Address < Ey::Core::Model
|
|
|
37
38
|
"provider" => self.provider_id,
|
|
38
39
|
"address" => {
|
|
39
40
|
"location" => self.location,
|
|
41
|
+
"scope" => self.scope,
|
|
40
42
|
},
|
|
41
43
|
}
|
|
42
44
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
class Ey::Core::Client::AutoScalingAlarm < Ey::Core::Model
|
|
2
|
+
extend Ey::Core::Associations
|
|
3
|
+
|
|
4
|
+
identity :id
|
|
5
|
+
|
|
6
|
+
attribute :deleted_at, type: :time
|
|
7
|
+
attribute :created_at, type: :time
|
|
8
|
+
attribute :updated_at, type: :time
|
|
9
|
+
attribute :auto_scaling_policy_id, aliases: "auto_scaling_policy", squash: ["id"]
|
|
10
|
+
attribute :name
|
|
11
|
+
attribute :aggregation_type
|
|
12
|
+
attribute :metric_type
|
|
13
|
+
attribute :operand
|
|
14
|
+
attribute :trigger_value, type: :float
|
|
15
|
+
attribute :number_of_periods, type: :integer
|
|
16
|
+
attribute :period_length, type: :integer
|
|
17
|
+
attribute :provisioned_id
|
|
18
|
+
|
|
19
|
+
has_one :auto_scaling_policy
|
|
20
|
+
|
|
21
|
+
def save!
|
|
22
|
+
requires :auto_scaling_policy_id, :trigger_value, :period_length
|
|
23
|
+
params = {
|
|
24
|
+
"auto_scaling_alarm" => {
|
|
25
|
+
"name" => name,
|
|
26
|
+
"trigger_value" => trigger_value,
|
|
27
|
+
"aggregation_type" => aggregation_type,
|
|
28
|
+
"metric_type" => metric_type,
|
|
29
|
+
"operand" => operand,
|
|
30
|
+
"period_length" => period_length,
|
|
31
|
+
"number_of_periods" => number_of_periods
|
|
32
|
+
},
|
|
33
|
+
"auto_scaling_policy_id" => auto_scaling_policy_id
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if new_record?
|
|
37
|
+
requires :name
|
|
38
|
+
request_attributes = connection.create_auto_scaling_alarm(params).body["request"]
|
|
39
|
+
connection.requests.new(request_attributes)
|
|
40
|
+
else
|
|
41
|
+
requires :identity
|
|
42
|
+
params.merge!("id" => identity)
|
|
43
|
+
connection.requests.new(connection.update_auto_scaling_alarm(params).body["request"])
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def destroy!
|
|
48
|
+
requires :identity
|
|
49
|
+
|
|
50
|
+
connection.requests.new(
|
|
51
|
+
connection.destroy_auto_scaling_alarm("id" => identity).body["request"]
|
|
52
|
+
)
|
|
53
|
+
end
|
|
54
|
+
end
|