Class: RakeDocker::Authentication::ECR
- Inherits:
-
Object
- Object
- RakeDocker::Authentication::ECR
- Defined in:
- lib/rake_docker/authentication/ecr.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(&block) ⇒ ECR
constructor
A new instance of ECR.
Constructor Details
#initialize(&block) ⇒ ECR
Returns a new instance of ECR.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rake_docker/authentication/ecr.rb', line 7 def initialize &block config = OpenStruct.new( region: nil, registry_id: nil) block.call(config) @ecr_client = Aws::ECR::Client.new(region: config.region) @registry_id = config.registry_id.respond_to?(:call) ? config.registry_id.call : config.registry_id end |
Instance Method Details
#call ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rake_docker/authentication/ecr.rb', line 20 def call token_response = @ecr_client.( registry_ids: [@registry_id]) token_data = token_response.[0] proxy_endpoint = token_data.proxy_endpoint email = 'none' username, password = Base64.decode64(token_data.).split(':') { username: username, password: password, email: email, serveraddress: proxy_endpoint } end |