Class: RakeDocker::Authentication::ECR

Inherits:
Object
  • Object
show all
Defined in:
lib/rake_docker/authentication/ecr.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ ECR

Returns a new instance of ECR.



8
9
10
11
12
13
14
15
# File 'lib/rake_docker/authentication/ecr.rb', line 8

def initialize(&block)
  @config =
    Struct.new(:region, :registry_id)
          .new(nil, nil)
  block.call(@config)

  @ecr_client = Aws::ECR::Client.new(region: @config.region)
end

Instance Method Details

#arityObject



17
18
19
# File 'lib/rake_docker/authentication/ecr.rb', line 17

def arity
  0
end

#callObject



21
22
23
24
25
26
27
28
29
# File 'lib/rake_docker/authentication/ecr.rb', line 21

def call
  email = 'none'
  registry_id = resolve_registry_id
  token = get_authorization_token(registry_id)
  proxy_endpoint = extract_proxy_endpoint(token)
  username, password = extract_credentials(token)

  make_credentials_hash(email, password, username, proxy_endpoint)
end