Class: Stax::Aws::Ecr

Inherits:
Sdk
  • Object
show all
Defined in:
lib/stax/aws/ecr.rb

Constant Summary

Constants inherited from Sdk

Sdk::RETRY_LIMIT

Class Method Summary collapse

Methods inherited from Sdk

paginate

Class Method Details

.authObject



14
15
16
# File 'lib/stax/aws/ecr.rb', line 14

def auth
  client.get_authorization_token.authorization_data
end

.clientObject



10
11
12
# File 'lib/stax/aws/ecr.rb', line 10

def client
  @_client ||= ::Aws::ECR::Client.new
end

.exists?(repo, tag) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/stax/aws/ecr.rb', line 24

def exists?(repo, tag)
  !client.batch_get_image(repository_name: repo, image_ids: [{image_tag: tag}]).images.empty?
end

.images(opt = {}) ⇒ Object



33
34
35
36
37
# File 'lib/stax/aws/ecr.rb', line 33

def images(opt = {})
  paginate(:image_details) do |next_token|
    client.describe_images(opt.merge(next_token: next_token))
  end
end

.login(*registry_ids) ⇒ Object



28
29
30
31
# File 'lib/stax/aws/ecr.rb', line 28

def (*registry_ids)
  ids = registry_ids.empty? ? nil : Array(registry_ids)
  client.get_authorization_token(registry_ids: ids).authorization_data
end

.repositories(opt = {}) ⇒ Object



18
19
20
21
22
# File 'lib/stax/aws/ecr.rb', line 18

def repositories(opt = {})
  paginate(:repositories) do |next_token|
    client.describe_repositories(opt.merge(next_token: next_token))
  end
end