Sha256: 4d0908e64c48cc724c3ce463026af6088c80e833ef40f95db4987a12c419b470

Contents?: true

Size: 858 Bytes

Versions: 20

Compression:

Stored size: 858 Bytes

Contents

class ECR < Mapper
  #
  # Returns an array of resources.
  #
  def collect
    resources = []

    #
    # describe_repositories
    #
    @client.describe_repositories.each_with_index do |response, page|
      log(response.context.operation_name, page)

      response.repositories.each do |repo|
        struct = OpenStruct.new(repo.to_h)
        struct.type = 'repository'
        struct.arn = repo.repository_arn
        struct.policy = @client
                        .get_repository_policy({ repository_name: repo.repository_name }).to_h

      rescue Aws::ECR::Errors::ServiceError => e
        raise e unless suppressed_errors.include?(e.code)
      ensure
        resources.push(struct.to_h)
      end
    end

    resources
  end

  private

  # not an error
  def suppressed_errors
    %w[
      RepositoryPolicyNotFoundException
    ]
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
aws_recon-0.2.20 lib/aws_recon/collectors/ecr.rb
aws_recon-0.2.19 lib/aws_recon/collectors/ecr.rb
aws_recon-0.2.18 lib/aws_recon/collectors/ecr.rb
aws_recon-0.2.17 lib/aws_recon/collectors/ecr.rb
aws_recon-0.2.16 lib/aws_recon/collectors/ecr.rb
aws_recon-0.2.15 lib/aws_recon/collectors/ecr.rb
aws_recon-0.2.14 lib/aws_recon/collectors/ecr.rb
aws_recon-0.2.13 lib/aws_recon/collectors/ecr.rb
aws_recon-0.2.12 lib/aws_recon/collectors/ecr.rb
aws_recon-0.2.11 lib/aws_recon/collectors/ecr.rb
aws_recon-0.2.10 lib/aws_recon/collectors/ecr.rb
aws_recon-0.2.9 lib/aws_recon/collectors/ecr.rb
aws_recon-0.2.8 lib/aws_recon/collectors/ecr.rb
aws_recon-0.2.7 lib/aws_recon/collectors/ecr.rb
aws_recon-0.2.6 lib/aws_recon/collectors/ecr.rb
aws_recon-0.2.5 lib/aws_recon/collectors/ecr.rb
aws_recon-0.2.4 lib/aws_recon/collectors/ecr.rb
aws_recon-0.2.3 lib/aws_recon/collectors/ecr.rb
aws_recon-0.2.2 lib/aws_recon/collectors/ecr.rb
aws_recon-0.2.1 lib/aws_recon/collectors/ecr.rb