Class: RakeDocker::Authentication::ECR
- Inherits:
-
Object
- Object
- RakeDocker::Authentication::ECR
- Defined in:
- lib/rake_docker/authentication/ecr.rb
Instance Method Summary collapse
- #arity ⇒ Object
- #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 |
# 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) end |
Instance Method Details
#arity ⇒ Object
16 17 18 |
# File 'lib/rake_docker/authentication/ecr.rb', line 16 def arity 0 end |
#call ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rake_docker/authentication/ecr.rb', line 20 def call registry_id = @config.registry_id.respond_to?(:call) ? @config.registry_id.call : @config.registry_id 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 |