Class: UffizziCore::AmazonRegistryClient

Inherits:
Object
  • Object
show all
Defined in:
app/clients/uffizzi_core/amazon_registry_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(region:, access_key_id:, secret_access_key:) ⇒ AmazonRegistryClient

Returns a new instance of AmazonRegistryClient.



6
7
8
9
# File 'app/clients/uffizzi_core/amazon_registry_client.rb', line 6

def initialize(region:, access_key_id:, secret_access_key:)
  credentials = Aws::Credentials.new(access_key_id, secret_access_key)
  @client = Aws::ECR::Client.new(region: region, credentials: credentials)
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



4
5
6
# File 'app/clients/uffizzi_core/amazon_registry_client.rb', line 4

def client
  @client
end

#registry_urlObject

Returns the value of attribute registry_url.



4
5
6
# File 'app/clients/uffizzi_core/amazon_registry_client.rb', line 4

def registry_url
  @registry_url
end

#tokenObject

Returns the value of attribute token.



4
5
6
# File 'app/clients/uffizzi_core/amazon_registry_client.rb', line 4

def token
  @token
end

Instance Method Details

#authorization_tokenObject



11
12
13
# File 'app/clients/uffizzi_core/amazon_registry_client.rb', line 11

def authorization_token
  client.get_authorization_token({})
end

#batch_get_image(image:, tag:) ⇒ Object



15
16
17
# File 'app/clients/uffizzi_core/amazon_registry_client.rb', line 15

def batch_get_image(image:, tag:)
  client.batch_get_image({ image_ids: [{ image_tag: tag }], repository_name: image })
end