ecr

package
v1.5.8 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ecr talks to Elastic Container Registry over signed JSON 1.1.

Index

Constants

View Source
const ServiceName = "ecr"

ServiceName is the key used in the guard ServicesEnabled map.

Variables

View Source
var ErrNotEmpty = errors.New("ecr: repository is not empty")

ErrNotEmpty is returned when DeleteRepository is asked to remove images.

View Source
var ErrRefused = errors.New("ecr: create refused")

ErrRefused wraps a guard refusal.

View Source
var Service = awsx.Service{Name: "ecr", Prefix: "api.ecr", SigningName: "ecr", TargetPrefix: "AmazonEC2ContainerRegistry_V20150921"}

Service is the ECR API (target prefix and endpoint checked against the botocore model).

Functions

This section is empty.

Types

type AuthToken

type AuthToken struct {
	Registry  string
	User      string
	Password  awsx.Secret
	ExpiresAt time.Time
}

AuthToken is the data for a docker login. Password is a Secret.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the lazy ECR module; it makes no call until a method runs.

func New

func New(c *awsx.Client, g Guard, o Options) *Client

New wraps a shared client and guard.

func (*Client) CreateRepository

func (c *Client) CreateRepository(ctx context.Context, in CreateInput) (Repository, error)

CreateRepository goes through the guard, turns scan on push on, and puts the default lifecycle policy. A failed policy call leaves the repository created and returns the error so the caller can retry PutLifecyclePolicy.

func (*Client) DeleteRepository

func (c *Client) DeleteRepository(ctx context.Context, region, name string) error

DeleteRepository removes a repository only when it holds no images.

func (*Client) DescribeRepositories

func (c *Client) DescribeRepositories(ctx context.Context, region string, names ...string) ([]Repository, error)

DescribeRepositories lists repositories, all of them or the named ones.

func (*Client) GetAuthorizationToken

func (c *Client) GetAuthorizationToken(ctx context.Context, region string) (AuthToken, error)

GetAuthorizationToken returns the registry login for the caller's account.

func (*Client) PutLifecyclePolicy

func (c *Client) PutLifecyclePolicy(ctx context.Context, region, name, text string) error

PutLifecyclePolicy sets the policy JSON text on a repository.

type CreateInput

type CreateInput struct {
	Account, Region, Name string
	Meta                  cloudguard.TagMeta
	EstimatedMonthlyUSD   float64
}

CreateInput describes one repository create.

type Guard

type Guard interface {
	Check(ctx context.Context, r cloudguard.CreateRequest) cloudguard.Decision
	Tags(m cloudguard.TagMeta) map[string]string
}

Guard is the create gate and tag source.

type Options

type Options struct {
	UntaggedExpireDays int
	KeepTaggedImages   int
}

Options sets the default lifecycle policy. Zero values skip that rule.

type Repository

type Repository struct {
	Name       string
	URI        string
	ARN        string
	ScanOnPush bool
	CreatedAt  time.Time
}

Repository is the read view of one repository.

Jump to

Keyboard shortcuts

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