ecr

package
v0.0.0-...-6d46272 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2023 License: Apache-2.0 Imports: 12 Imported by: 8

Documentation

Overview

Package ecr implements ECR utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(
	lg *zap.Logger,
	svc ecriface.ECRAPI,
	repoAccountID string,
	repoRegion string,
	repoName string,
	imgScanOnPush bool,
	imgTagMutability string,
	policyTxt string,
	setPolicyForce bool) (repoURI string, err error)

Create creates an ECR repo if it does not exist. If the set policy fails, ECR repo creation is reverted (delete).

func Delete

func Delete(
	lg *zap.Logger,
	svc ecriface.ECRAPI,
	repoAccountID string,
	repoRegion string,
	repoName string,
	force bool) (err error)

Delete deletes an ECR repo if it exists.

func SetPolicy

func SetPolicy(
	lg *zap.Logger,
	svc ecriface.ECRAPI,
	repoAccountID string,
	repoRegion string,
	repoName string,
	policyTxt string,
	setPolicyForce bool) (repoURI string, err error)

SetPolicy updates the policy for an ECR repo.

Types

type Repository

type Repository struct {
	// Partition is used for deciding between "amazonaws.com" and "amazonaws.com.cn".
	Partition string `json:"partition"`
	// AccountID is the account ID for tester ECR image.
	// e.g. "my-app" for "[ACCOUNT_ID].dkr.ecr.[REGION].amazonaws.com/my-app"
	AccountID string `json:"account_id"`
	// Region is the ECR repository region to pull from.
	Region string `json:"region"`
	// Name is the repositoryName for tester ECR image.
	// e.g. "my-app" for "[ACCOUNT_ID].dkr.ecr.[REGION].amazonaws.com/my-app"
	Name string `json:"name"`
	// ImageTag is the image tag for tester ECR image.
	// e.g. "latest" for image URI "[ACCOUNT_ID].dkr.ecr.[REGION].amazonaws.com/my-app:latest"
	ImageTag string `json:"image_tag"`
}

Repository represents an ECR image.

func (*Repository) Describe

func (repo *Repository) Describe(lg *zap.Logger, svc ecriface.ECRAPI) (img string, exists bool, err error)

Describe checks if the specified repository exists, and returns the repository URI + ":" + image tag. It returns "true" for "exists" if the repository exists. This method succeeds if and only if the ECR image exists and the caller is able to verify via "ecr:DescribeImages". The success of this operation does not guarantee the success of image pull. This will fail even when the image describe fails and the caller can still pull the images.

func (*Repository) IsEmpty

func (repo *Repository) IsEmpty() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL