Class: Stax::Aws::Ecr

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

Class Method Summary collapse

Methods inherited from Sdk

paginate

Class Method Details

.authObject



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

def auth
  client.get_authorization_token.authorization_data
end

.clientObject



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

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

.exists?(repo, tag) ⇒ Boolean

Returns:

  • (Boolean)


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

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

.images(opt = {}) ⇒ Object



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

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

.login(*registry_ids) ⇒ Object



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

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

.repositories(opt = {}) ⇒ Object



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

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