ey-core 3.5.0 → 3.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/CHANGELOG.md +17 -3
- data/Gemfile +0 -1
- data/README.md +65 -8
- data/bin/ey-core +0 -8
- data/ey-core.gemspec +6 -5
- data/features/docker_registry_credentials.feature +21 -0
- data/features/step_definitions/docker_registry_credentials_steps.rb +3 -0
- data/features/support/mock_api.rb +0 -1
- data/lib/ey-core/cli/deploy.rb +2 -2
- data/lib/ey-core/cli/docker_registry_login.rb +29 -0
- data/lib/ey-core/cli/main.rb +3 -4
- data/lib/ey-core/cli/servers.rb +2 -1
- data/lib/ey-core/client.rb +4 -0
- data/lib/ey-core/client/mock.rb +1 -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/models/account.rb +10 -0
- data/lib/ey-core/models/container_service_deployment.rb +17 -0
- data/lib/ey-core/requests/discover_container_service_deployments.rb +71 -0
- data/lib/ey-core/requests/get_deployments.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/version.rb +1 -1
- data/spec/docker_registry_credentials_spec.rb +16 -0
- data/spec/support/core.rb +0 -2
- metadata +43 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e7cd69781a4eb3275ce1a1326c7ea79279dcff1c6de8a663d95e0276d318e36e
|
4
|
+
data.tar.gz: e60e683abec4d85850bf11d7368c3ec501cd9c4d96af07ed5fc6613988fe4f69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8d9bf7f44d69e2de4a71d393aa29e6e88cc851ebd99177c091388975bbe006d2cf4f9ccde6ab7d291dc200cbac0c26aa57ec96ba7322a5386e83d49df76a567
|
7
|
+
data.tar.gz: bbf84bfa83d24a4f293c14b928614b68846d988a30835d2973251f2a5caf6c85ad49703c1dc12b3e2e1478fec01003d9a14d8057f6a1f03ecf43e7ed93dc947f
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.5.8
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,25 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [Unreleased](https://github.com/engineyard/core-client-rb/tree/
|
3
|
+
## [Unreleased](https://github.com/engineyard/core-client-rb/tree/develop)
|
4
4
|
|
5
|
-
[Full Changelog](https://github.com/engineyard/core-client-rb/compare/v3.
|
5
|
+
[Full Changelog](https://github.com/engineyard/core-client-rb/compare/v3.6.1...develop)
|
6
6
|
|
7
7
|
**Merged pull requests:**
|
8
8
|
|
9
|
+
## [v3.6.1](https://github.com/engineyard/core-client-rb/tree/v3.6.1) (2020-06-11)
|
10
|
+
|
11
|
+
[Full Changelog](https://github.com/engineyard/core-client-rb/compare/v3.5.0...v3.6.1)
|
12
|
+
|
13
|
+
**Merged pull requests:**
|
14
|
+
|
15
|
+
- Adds support for Docker credentials [\#106](https://github.com/engineyard/core-client-rb/pull/106) ([nodecarter](https://github.com/nodecarter))
|
16
|
+
- Adds support for container discovery [\#107](https://github.com/engineyard/core-client-rb/pull/107) ([thorn](https://github.com/thorn))
|
17
|
+
- Fixes `get_deployment` request parameters [\#108](https://github.com/engineyard/core-client-rb/pull/108) ([lucis-fluxum](https://github.com/lucis-fluxum))
|
18
|
+
- Adds server names to server list output [\#112](https://github.com/engineyard/core-client-rb/pull/112) ([glennr](https://github.com/glennr))
|
19
|
+
- Fixes the `--no-migrate` flag for `ey-core deploy` [\#114](https://github.com/engineyard/core-client-rb/pull/114) ([mushyy](https://github.com/mushyy))
|
20
|
+
- Upgrades dependencies and adds ruby-2.7 support for the gem [\#120](https://github.com/engineyard/core-client-rb/pull/120) ([ssuttner](https://github.com/ssuttner))
|
21
|
+
- Adds a bit of CLI documentation [\#121](https://github.com/engineyard/core-client-rb/pull/121) ([ess](https://github.com/ess))
|
22
|
+
|
9
23
|
## [v3.5.0](https://github.com/engineyard/core-client-rb/tree/v3.5.0) (2018-04-04)
|
10
24
|
[Full Changelog](https://github.com/engineyard/core-client-rb/compare/v3.4.4...v3.5.0)
|
11
25
|
|
@@ -172,4 +186,4 @@
|
|
172
186
|
|
173
187
|
|
174
188
|
|
175
|
-
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
189
|
+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
# Ey::Core
|
1
|
+
# Ey::Core #
|
2
2
|
|
3
|
-
Official
|
3
|
+
Official Engine Yard Core API Ruby client and CLI utility.
|
4
4
|
|
5
|
-
## Installation
|
5
|
+
## Installation ##
|
6
6
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
@@ -12,11 +12,68 @@ And then execute:
|
|
12
12
|
|
13
13
|
$ bundle
|
14
14
|
|
15
|
-
Or install it yourself
|
15
|
+
Or install it yourself for ad-hoc or CLI usage:
|
16
16
|
|
17
17
|
$ gem install ey-core
|
18
18
|
|
19
|
-
## Usage
|
19
|
+
## Usage ##
|
20
|
+
|
21
|
+
There are two ways to use this gem: you can install it to use as a client library for writing your own Engine Yard Cloud integrations, or you can use the `ey-core` CLi app to use our curated integrations.
|
22
|
+
|
23
|
+
### CLI Usage ###
|
24
|
+
|
25
|
+
The CLI app, `ey-core`, is the replacement for the `ey` command that was provided by the now mostly deprecated`engineyard` gem. The old gem is still updated as need be, but is effectively just a slightly different UI for the `ey-core` command.
|
26
|
+
Like the `git` command, `ey-core` is like a gateway to other commands.
|
27
|
+
|
28
|
+
Rather than attempting to provide an exhaustive writeup of all of the commands provided by `ey-core`, this document will instead describe what are likely the most common use cases and leave you to read up on the remainder via the `help` command.
|
29
|
+
|
30
|
+
#### Use Case: Getting Help ####
|
31
|
+
|
32
|
+
Arguably the most important command in the app is `ey-core help`. Given no arguments, it provides the list of second-level commands avaiable for use. From that point, each argument is expected to be a command from the next level of the hierarchy.
|
33
|
+
|
34
|
+
For example, if one wishes to learn about the `servers` second-level command, they would do `ey-core help servers`.
|
35
|
+
|
36
|
+
For commands in even deeper levels, one just adds each level of chain after the `help` command. Try this in your terminal: `ey-core help recipes apply`
|
37
|
+
|
38
|
+
#### Use Case: Deploying An App ####
|
39
|
+
|
40
|
+
The `ey-core deploy` command allows one to deploy a new revision of an existing application in an existing environment. The command itself has several options, some of which may or may not be required depending on several factors. To guarantee the best result and remove a good deal of uncertainty in the process, we've opted to describe a somewhat verbose invocation of the command in this document.
|
41
|
+
|
42
|
+
Let's start with some assumptions:
|
43
|
+
|
44
|
+
* The name of our Engine Yard account is `MyAwesomeCompany` (you can get a real account name with `ey-core accounts`)
|
45
|
+
* That account has an environment named `awesome_production` (you can get a real environment name with `ey-core environments`)
|
46
|
+
* That account has an application named `awesome_app` (you can get a real application name with `ey-core applications`)
|
47
|
+
* The aforementioned application is already associated with the environment
|
48
|
+
|
49
|
+
As mentioned, some of the options for the `deploy` command are optional, and all of the topics discussed in our assumptions are effectively optional. That said, we suggest specifying *all* of these options to ensure absolutely that the proper application is deployed to the proper environment in the proper account.
|
50
|
+
|
51
|
+
All that said, to deploy the application to its latest git ref and the same migration command as the last deployment, you would issue the following command:
|
52
|
+
|
53
|
+
`$ ey-core deploy --account MyAwesomeCompany --environment awesome_production --app awesome_app`
|
54
|
+
|
55
|
+
You can also specify a git ref to use if you'd like to deploy a specific version or branch of the app:
|
56
|
+
|
57
|
+
`$ ey-core deploy --account MyAwesomeCompany --environment awesome_production --app awesome_app --ref feature/new-ui`
|
58
|
+
|
59
|
+
Say that you want to change the way your migrations are run during the deploy. You can specify the migration command:
|
60
|
+
|
61
|
+
`$ ey-core deploy --account MyAwesomeCompany --environment awesome_production --app awesome_app --migrate 'bundle exec rake db:migrate:new_hotness'`
|
62
|
+
|
63
|
+
Additionally, if you wish to skip migrations for the deployment, you can do that, too:
|
64
|
+
|
65
|
+
`$ ey-core deploy --account MyAwesomeCompany --environment awesome_production --app awesome_app --no-migrate`
|
66
|
+
|
67
|
+
Any of the invocations that we've talked about so far will stream the deployment log as it runs. If you'd rather do a fire-and-forget style deployment and check in on it later, you can add the `--no-wait` flag. If, however, you'd like to see even more information spit out during the deploy, you can add the `--verbose` flag.
|
68
|
+
|
69
|
+
That's about all there is to deployment so long as you consider the application, environment, and account to be required options. You can read more about any of the commands that we've mentioned in this use case by running the following in your terminal:
|
70
|
+
|
71
|
+
* `ey-core help accounts`
|
72
|
+
* `ey-core help applications`
|
73
|
+
* `ey-core help deploy`
|
74
|
+
* `ey-core help environments`
|
75
|
+
|
76
|
+
### Client Library Usage ###
|
20
77
|
|
21
78
|
Uses [cistern](https://github.com/lanej/cistern) to wrap RESTful resources nicely.
|
22
79
|
|
@@ -30,7 +87,7 @@ client.users.current # =>
|
|
30
87
|
>
|
31
88
|
```
|
32
89
|
|
33
|
-
|
90
|
+
#### Authentication ####
|
34
91
|
|
35
92
|
* Via Token
|
36
93
|
|
@@ -48,7 +105,7 @@ Ey::Core::Client.new(
|
|
48
105
|
)
|
49
106
|
```
|
50
107
|
|
51
|
-
|
108
|
+
#### Mock ####
|
52
109
|
|
53
110
|
Mock is disabled by default.
|
54
111
|
|
@@ -64,7 +121,7 @@ Reset the mock
|
|
64
121
|
Ey::Core::Client.reset!
|
65
122
|
```
|
66
123
|
|
67
|
-
|
124
|
+
#### Testing ####
|
68
125
|
|
69
126
|
By default, specs are run against the core mock. In order to run them against awsm mocked mode instead, run `MOCK_CORE=false bundle exec rspec`
|
70
127
|
|
data/bin/ey-core
CHANGED
@@ -1,12 +1,4 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
git_path = File.expand_path("../../.git", __FILE__)
|
4
|
-
|
5
|
-
if File.exist? git_path
|
6
|
-
lib_dir = File.expand_path("../../lib", __FILE__)
|
7
|
-
$LOAD_PATH.unshift( lib_dir )
|
8
|
-
end
|
9
|
-
|
10
2
|
require File.expand_path('../../lib/ey-core/cli/main', __FILE__)
|
11
3
|
|
12
4
|
Ey::Core::Cli::Main.new(ARGV).execute!
|
data/ey-core.gemspec
CHANGED
@@ -18,22 +18,23 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
gem.licenses = ["MIT"]
|
20
20
|
|
21
|
-
gem.required_ruby_version = ">= 2.
|
21
|
+
gem.required_ruby_version = ">= 2.5"
|
22
22
|
|
23
23
|
gem.add_dependency "addressable"
|
24
24
|
|
25
|
-
gem.add_dependency "
|
25
|
+
gem.add_dependency "amazing_print", "~> 1.1.0"
|
26
26
|
gem.add_dependency "belafonte"
|
27
27
|
gem.add_dependency "cistern", "~> 0.12.3"
|
28
28
|
gem.add_dependency "colorize"
|
29
29
|
gem.add_dependency "ey-hmac", "~> 2.0"
|
30
30
|
gem.add_dependency "escape"
|
31
|
-
gem.add_dependency "
|
32
|
-
gem.add_dependency "
|
31
|
+
gem.add_dependency "hashie", "~> 4.1.0"
|
32
|
+
gem.add_dependency "faraday", "~> 1.0.1"
|
33
|
+
gem.add_dependency "faraday_middleware", "~> 1.0.0"
|
33
34
|
gem.add_dependency "rack"
|
34
35
|
gem.add_dependency "faye"
|
35
36
|
gem.add_dependency "highline"
|
36
|
-
gem.add_dependency "json", "
|
37
|
+
gem.add_dependency "json", "~> 2.3.0"
|
37
38
|
gem.add_dependency "mime-types"
|
38
39
|
gem.add_dependency "oj"
|
39
40
|
gem.add_dependency "oj_mimic_json"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Feature: Docker Registry Credentials
|
2
|
+
In order to authorize the Docker Engine with the AWS ECR registry
|
3
|
+
As a User
|
4
|
+
I want to be able to retrieve the Docker authorization credentials
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I'm an Engine Yard user
|
8
|
+
And ey-core is configured with my cloud token
|
9
|
+
And I have the following accounts:
|
10
|
+
| Account Name |
|
11
|
+
| one |
|
12
|
+
| two |
|
13
|
+
|
14
|
+
Scenario Outline: Retrieving Docker authorization credentials
|
15
|
+
When I run `ey-core get-docker-registry-login <Account Flag> one <Location Flag> us-east-1`
|
16
|
+
Then I see the docker login command
|
17
|
+
|
18
|
+
Examples:
|
19
|
+
| Account Flag | Location Flag |
|
20
|
+
| -c | -l |
|
21
|
+
| --account | --location |
|
data/lib/ey-core/cli/deploy.rb
CHANGED
@@ -93,12 +93,12 @@ EOF
|
|
93
93
|
end
|
94
94
|
if (option(:migrate) || switch_active?(:no_migrate))
|
95
95
|
deploy_options.merge!(migrate_command: option(:migrate)) if option(:migrate)
|
96
|
-
deploy_options.merge!(migrate_command:
|
96
|
+
deploy_options.merge!(migrate_command: nil) if switch_active?(:no_migrate)
|
97
97
|
else
|
98
98
|
puts "missing migrate option (--migrate or --no-migrate), checking latest deploy...".yellow
|
99
99
|
latest_deploy ||= environment.latest_deploy(app)
|
100
100
|
if latest_deploy
|
101
|
-
deploy_options.merge!(migrate_command: (latest_deploy.migrate && latest_deploy.migrate_command) ||
|
101
|
+
deploy_options.merge!(migrate_command: (latest_deploy.migrate && latest_deploy.migrate_command) || nil)
|
102
102
|
else
|
103
103
|
raise "either --migrate or --no-migrate needs to be specified"
|
104
104
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'ey-core/cli/subcommand'
|
2
|
+
|
3
|
+
module Ey
|
4
|
+
module Core
|
5
|
+
module Cli
|
6
|
+
class DockerRegistryLogin < Subcommand
|
7
|
+
title "get-docker-registry-login"
|
8
|
+
summary "Prints the docker login command to authorize the Docker Engine with the AWS ECR registry"
|
9
|
+
|
10
|
+
option :account,
|
11
|
+
short: 'c',
|
12
|
+
long: 'account',
|
13
|
+
description: 'Name or ID of the account that the environment resides in.',
|
14
|
+
argument: 'Account name or id'
|
15
|
+
|
16
|
+
option :location,
|
17
|
+
short: 'l',
|
18
|
+
long: 'location',
|
19
|
+
description: 'ECR availability regions',
|
20
|
+
argument: 'Location name'
|
21
|
+
|
22
|
+
def handle
|
23
|
+
credentials = core_account.retrieve_docker_registry_credentials(option(:location))
|
24
|
+
stdout.puts "docker login -u #{credentials.username} -p #{credentials.password} #{credentials.registry_endpoint}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
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,6 +13,7 @@ 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'
|
17
18
|
require 'ey-core/cli/environment_variables'
|
18
19
|
require 'ey-core/cli/help'
|
@@ -30,9 +31,6 @@ require 'ey-core/cli/version'
|
|
30
31
|
require 'ey-core/cli/web'
|
31
32
|
require 'ey-core/cli/whoami'
|
32
33
|
|
33
|
-
Cistern.formatter = Cistern::Formatter::AwesomePrint
|
34
|
-
|
35
|
-
|
36
34
|
module Ey
|
37
35
|
module Core
|
38
36
|
module Cli
|
@@ -45,6 +43,7 @@ module Ey
|
|
45
43
|
mount Console
|
46
44
|
mount CurrentUser
|
47
45
|
mount Deploy
|
46
|
+
mount DockerRegistryLogin
|
48
47
|
mount Environments
|
49
48
|
mount EnvironmentVariables
|
50
49
|
mount Help
|
data/lib/ey-core/cli/servers.rb
CHANGED
data/lib/ey-core/client.rb
CHANGED
@@ -21,6 +21,7 @@ class Ey::Core::Client < Cistern::Service
|
|
21
21
|
collection :blueprints
|
22
22
|
collection :components
|
23
23
|
collection :contacts
|
24
|
+
collection :container_service_deployments
|
24
25
|
collection :costs
|
25
26
|
collection :database_plan_usages
|
26
27
|
collection :database_server_revisions
|
@@ -82,6 +83,7 @@ class Ey::Core::Client < Cistern::Service
|
|
82
83
|
model :blueprint
|
83
84
|
model :component
|
84
85
|
model :contact
|
86
|
+
model :container_service_deployment
|
85
87
|
model :cost
|
86
88
|
model :database_plan_usage
|
87
89
|
model :database_server
|
@@ -197,6 +199,7 @@ class Ey::Core::Client < Cistern::Service
|
|
197
199
|
request :destroy_user
|
198
200
|
request :detach_address
|
199
201
|
request :disable_feature
|
202
|
+
request :discover_container_service_deployments
|
200
203
|
request :discover_database_server
|
201
204
|
request :discover_database_server_snapshots
|
202
205
|
request :discover_provider_location
|
@@ -321,6 +324,7 @@ class Ey::Core::Client < Cistern::Service
|
|
321
324
|
request :reset_password
|
322
325
|
request :reset_server_state
|
323
326
|
request :restart_environment_app_servers
|
327
|
+
request :retrieve_docker_registry_credentials
|
324
328
|
request :run_cluster_application_action
|
325
329
|
request :run_environment_application_action
|
326
330
|
request :signup
|
data/lib/ey-core/client/mock.rb
CHANGED
@@ -127,6 +127,7 @@ class Ey::Core::Client::Mock
|
|
127
127
|
:components => components,
|
128
128
|
:contact_assignments => [],
|
129
129
|
:contacts => {},
|
130
|
+
:container_service_deployments => {},
|
130
131
|
:costs => [],
|
131
132
|
:database_plan_usages => Hash.new { |h1,k1| h1[k1] = {} },
|
132
133
|
:database_server_firewalls => [],
|
@@ -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
|
@@ -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
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class Ey::Core::Client::ContainerServiceDeployment < Ey::Core::Model
|
2
|
+
extend Ey::Core::Associations
|
3
|
+
|
4
|
+
identity :id
|
5
|
+
|
6
|
+
attribute :container_service_id
|
7
|
+
attribute :public_ip_address
|
8
|
+
attribute :private_ip_address
|
9
|
+
attribute :port_mappings
|
10
|
+
attribute :health_status
|
11
|
+
attribute :container_health_status
|
12
|
+
attribute :container_instance_id
|
13
|
+
attribute :task_arn
|
14
|
+
attribute :created_at, type: :time
|
15
|
+
attribute :updated_at, type: :time
|
16
|
+
attribute :deleted_at, type: :time
|
17
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
class Ey::Core::Client
|
2
|
+
class Real
|
3
|
+
def discover_container_service_deployments(params={})
|
4
|
+
url = params.delete("url")
|
5
|
+
|
6
|
+
request(
|
7
|
+
:method => :get,
|
8
|
+
:url => url,
|
9
|
+
:params => params,
|
10
|
+
:path => "/container_service_deployments/discover",
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Mock
|
16
|
+
def discover_container_service_deployments(params={})
|
17
|
+
extract_url_params!(params)
|
18
|
+
|
19
|
+
callback_url = params.delete("callback_url")
|
20
|
+
deployment_id = self.uuid
|
21
|
+
resource_id = self.uuid
|
22
|
+
|
23
|
+
existing_deploymens = self.data[:container_service_deployments].values.select do |deployment|
|
24
|
+
deployment["container_service_id"] == container_service["id"]
|
25
|
+
end
|
26
|
+
existing_deploymens = nil if existing_deploymens.empty?
|
27
|
+
|
28
|
+
resources = existing_deploymens || [{
|
29
|
+
"id" => deployment_id,
|
30
|
+
"container_service_id" => params["container_service_id"],
|
31
|
+
"public_ip_address" => "123.456.789.123",
|
32
|
+
"private_ip_address" => "10.0.1.2",
|
33
|
+
"container_instance_id" => SecureRandom.uuid,
|
34
|
+
"port_mappings" => [{
|
35
|
+
"container_port" => "80",
|
36
|
+
"host_port" => "80",
|
37
|
+
"protocol" => "tcp"
|
38
|
+
}],
|
39
|
+
"provisioned_id" => resource_id,
|
40
|
+
"health_status" => "HEALTHY",
|
41
|
+
"task_arn" => SecureRandom.uuid,
|
42
|
+
"container_health_status" => [{
|
43
|
+
"container_arn" => SecureRandom.uuid,
|
44
|
+
"health_status" => SecureRandom.uuid
|
45
|
+
}]
|
46
|
+
}]
|
47
|
+
|
48
|
+
request = {
|
49
|
+
"id" => request_id,
|
50
|
+
"type" => "discover_container_service_deployments",
|
51
|
+
"successful" => true,
|
52
|
+
"started_at" => Time.now,
|
53
|
+
"finished_at" => nil,
|
54
|
+
"resource" => [:container_service_deployments, resource_id, resources, "/container_service_deployments"]
|
55
|
+
}
|
56
|
+
|
57
|
+
self.data[:container_service_deployments][deployment_id] = request
|
58
|
+
|
59
|
+
response_hash = request.dup
|
60
|
+
response_hash.delete("resource")
|
61
|
+
|
62
|
+
response(
|
63
|
+
:body => {"request" => response_hash},
|
64
|
+
:status => 200,
|
65
|
+
:headers => {
|
66
|
+
"Content-Type" => "application/json; charset=utf8"
|
67
|
+
}
|
68
|
+
)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class Ey::Core::Client
|
2
|
+
class Real
|
3
|
+
def retrieve_docker_registry_credentials(account_id, location_id)
|
4
|
+
request(
|
5
|
+
:path => "/accounts/#{account_id}/docker-registry/#{location_id}/credentials"
|
6
|
+
)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class Mock
|
11
|
+
def retrieve_docker_registry_credentials(account_id, location_id)
|
12
|
+
response(
|
13
|
+
:body => {
|
14
|
+
'docker_registry_credentials' => {
|
15
|
+
'username' => 'foo',
|
16
|
+
'password' => 'bar',
|
17
|
+
'registry_endpoint' => "https://012345678901.dkr.ecr.#{location_id}.amazonaws.com",
|
18
|
+
'expires_at' => (Time.now + 8 * 3600).to_i
|
19
|
+
}
|
20
|
+
}
|
21
|
+
)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/ey-core/version.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'as a user' do
|
4
|
+
let(:client) { create_client }
|
5
|
+
let(:location) { 'us-east-1' }
|
6
|
+
let!(:account) { create_account(client: client) }
|
7
|
+
|
8
|
+
it 'returns a valid docker registry credentials' do
|
9
|
+
credentials = account.retrieve_docker_registry_credentials(location)
|
10
|
+
|
11
|
+
expect(credentials.username).to be
|
12
|
+
expect(credentials.password).to be
|
13
|
+
expect(credentials.registry_endpoint).to match(/#{location}/)
|
14
|
+
expect(credentials.expires_at).to be > (Time.now + 6 * 3600).to_i
|
15
|
+
end
|
16
|
+
end
|
data/spec/support/core.rb
CHANGED
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
|
+
version: 3.6.1
|
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:
|
11
|
+
date: 2020-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -25,19 +25,19 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: amazing_print
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.1.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 1.1.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: belafonte
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,34 +108,48 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: hashie
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 4.1.0
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 4.1.0
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: faraday
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
129
|
- - "~>"
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
131
|
+
version: 1.0.1
|
118
132
|
type: :runtime
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
136
|
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
138
|
+
version: 1.0.1
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: faraday_middleware
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
128
142
|
requirements:
|
129
143
|
- - "~>"
|
130
144
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
145
|
+
version: 1.0.0
|
132
146
|
type: :runtime
|
133
147
|
prerelease: false
|
134
148
|
version_requirements: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
150
|
- - "~>"
|
137
151
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
152
|
+
version: 1.0.0
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: rack
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -182,16 +196,16 @@ dependencies:
|
|
182
196
|
name: json
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|
184
198
|
requirements:
|
185
|
-
- - "
|
199
|
+
- - "~>"
|
186
200
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
201
|
+
version: 2.3.0
|
188
202
|
type: :runtime
|
189
203
|
prerelease: false
|
190
204
|
version_requirements: !ruby/object:Gem::Requirement
|
191
205
|
requirements:
|
192
|
-
- - "
|
206
|
+
- - "~>"
|
193
207
|
- !ruby/object:Gem::Version
|
194
|
-
version:
|
208
|
+
version: 2.3.0
|
195
209
|
- !ruby/object:Gem::Dependency
|
196
210
|
name: mime-types
|
197
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -403,6 +417,7 @@ files:
|
|
403
417
|
- features/accounts.feature
|
404
418
|
- features/applications.feature
|
405
419
|
- features/current_user.feature
|
420
|
+
- features/docker_registry_credentials.feature
|
406
421
|
- features/environment_variables.feature
|
407
422
|
- features/environments.feature
|
408
423
|
- features/init.feature
|
@@ -412,6 +427,7 @@ files:
|
|
412
427
|
- features/step_definitions/applications_steps.rb
|
413
428
|
- features/step_definitions/current_user_steps.rb
|
414
429
|
- features/step_definitions/deprecated_command_steps.rb
|
430
|
+
- features/step_definitions/docker_registry_credentials_steps.rb
|
415
431
|
- features/step_definitions/environment_variables_steps.rb
|
416
432
|
- features/step_definitions/environments_steps.rb
|
417
433
|
- features/step_definitions/version_steps.rb
|
@@ -442,6 +458,7 @@ files:
|
|
442
458
|
- lib/ey-core/cli/console.rb
|
443
459
|
- lib/ey-core/cli/current_user.rb
|
444
460
|
- lib/ey-core/cli/deploy.rb
|
461
|
+
- lib/ey-core/cli/docker_registry_login.rb
|
445
462
|
- lib/ey-core/cli/environment_variables.rb
|
446
463
|
- lib/ey-core/cli/environments.rb
|
447
464
|
- lib/ey-core/cli/errors.rb
|
@@ -496,6 +513,8 @@ files:
|
|
496
513
|
- lib/ey-core/collections/blueprints.rb
|
497
514
|
- lib/ey-core/collections/components.rb
|
498
515
|
- lib/ey-core/collections/contacts.rb
|
516
|
+
- lib/ey-core/collections/container_clusters.rb
|
517
|
+
- lib/ey-core/collections/container_service_deployments.rb
|
499
518
|
- lib/ey-core/collections/costs.rb
|
500
519
|
- lib/ey-core/collections/database_plan_usages.rb
|
501
520
|
- lib/ey-core/collections/database_server_revisions.rb
|
@@ -564,6 +583,7 @@ files:
|
|
564
583
|
- lib/ey-core/models/blueprint.rb
|
565
584
|
- lib/ey-core/models/component.rb
|
566
585
|
- lib/ey-core/models/contact.rb
|
586
|
+
- lib/ey-core/models/container_service_deployment.rb
|
567
587
|
- lib/ey-core/models/cost.rb
|
568
588
|
- lib/ey-core/models/database_plan_usage.rb
|
569
589
|
- lib/ey-core/models/database_server.rb
|
@@ -680,6 +700,7 @@ files:
|
|
680
700
|
- lib/ey-core/requests/destroy_user.rb
|
681
701
|
- lib/ey-core/requests/detach_address.rb
|
682
702
|
- lib/ey-core/requests/disable_feature.rb
|
703
|
+
- lib/ey-core/requests/discover_container_service_deployments.rb
|
683
704
|
- lib/ey-core/requests/discover_database_server.rb
|
684
705
|
- lib/ey-core/requests/discover_database_server_snapshots.rb
|
685
706
|
- lib/ey-core/requests/discover_provider_location.rb
|
@@ -807,6 +828,7 @@ files:
|
|
807
828
|
- lib/ey-core/requests/reset_password.rb
|
808
829
|
- lib/ey-core/requests/reset_server_state.rb
|
809
830
|
- lib/ey-core/requests/restart_environment_app_servers.rb
|
831
|
+
- lib/ey-core/requests/retrieve_docker_registry_credentials.rb
|
810
832
|
- lib/ey-core/requests/run_cluster_application_action.rb
|
811
833
|
- lib/ey-core/requests/run_environment_application_action.rb
|
812
834
|
- lib/ey-core/requests/signup.rb
|
@@ -869,6 +891,7 @@ files:
|
|
869
891
|
- spec/database_servers_spec.rb
|
870
892
|
- spec/database_services_spec.rb
|
871
893
|
- spec/deployments_spec.rb
|
894
|
+
- spec/docker_registry_credentials_spec.rb
|
872
895
|
- spec/environment_plan_usage_spec.rb
|
873
896
|
- spec/environments_spec.rb
|
874
897
|
- spec/ey-core/cli/accounts_spec.rb
|
@@ -924,15 +947,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
924
947
|
requirements:
|
925
948
|
- - ">="
|
926
949
|
- !ruby/object:Gem::Version
|
927
|
-
version: 2.
|
950
|
+
version: '2.5'
|
928
951
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
929
952
|
requirements:
|
930
953
|
- - ">="
|
931
954
|
- !ruby/object:Gem::Version
|
932
955
|
version: '0'
|
933
956
|
requirements: []
|
934
|
-
|
935
|
-
rubygems_version: 2.5.2.1
|
957
|
+
rubygems_version: 3.0.8
|
936
958
|
signing_key:
|
937
959
|
specification_version: 4
|
938
960
|
summary: Client library providing real and mock functionality for accessing Engine
|
@@ -941,6 +963,7 @@ test_files:
|
|
941
963
|
- features/accounts.feature
|
942
964
|
- features/applications.feature
|
943
965
|
- features/current_user.feature
|
966
|
+
- features/docker_registry_credentials.feature
|
944
967
|
- features/environment_variables.feature
|
945
968
|
- features/environments.feature
|
946
969
|
- features/init.feature
|
@@ -950,6 +973,7 @@ test_files:
|
|
950
973
|
- features/step_definitions/applications_steps.rb
|
951
974
|
- features/step_definitions/current_user_steps.rb
|
952
975
|
- features/step_definitions/deprecated_command_steps.rb
|
976
|
+
- features/step_definitions/docker_registry_credentials_steps.rb
|
953
977
|
- features/step_definitions/environment_variables_steps.rb
|
954
978
|
- features/step_definitions/environments_steps.rb
|
955
979
|
- features/step_definitions/version_steps.rb
|
@@ -995,6 +1019,7 @@ test_files:
|
|
995
1019
|
- spec/database_servers_spec.rb
|
996
1020
|
- spec/database_services_spec.rb
|
997
1021
|
- spec/deployments_spec.rb
|
1022
|
+
- spec/docker_registry_credentials_spec.rb
|
998
1023
|
- spec/environment_plan_usage_spec.rb
|
999
1024
|
- spec/environments_spec.rb
|
1000
1025
|
- spec/ey-core/cli/accounts_spec.rb
|