Help us shape the future of Go! Take the 2026 Go Developer Survey

ecr

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package ecr mints an Amazon ECR registry password from an AWS access key.

ECR has no long-lived registry password: GetAuthorizationToken trades an access key for one that lasts twelve hours. Two places need that — an image app pulling with its own credential (core/oci, issue #41) and the install's image registry adapter pushing builds (adapter/imageregistry/ecr) — so it lives here, in a leaf package core and the adapters can both import, as internal/registrylimit does.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mint

func Mint(ctx context.Context, k Key, whose string) (string, secret.Value, error)

Mint asks ECR for a registry password. whose names the key's owner in the refusal — "the app's", "the image registry's" — so the message says which credential to replace.

func Region

func Region(registry string) (string, bool)

Region reads the region from an ECR registry host: 123456789012.dkr.ecr.us-east-1.amazonaws.com is us-east-1, and so is 123456789012.dkr-ecr.us-east-1.on.aws.

Types

type Host added in v0.10.0

type Host struct {
	Region string

	// DualStack is a host on ECR's dual-stack (IPv4 and IPv6) endpoint, so
	// the password is asked of the API's dual-stack endpoint too: an install
	// that reaches the registry only over IPv6 reaches nothing else.
	DualStack bool

	// FIPS is a host on a FIPS endpoint, so the API's FIPS endpoint is used.
	FIPS bool
}

Host is what an ECR registry host says about where to ask for a password.

func Parse added in v0.10.0

func Parse(registry string) (Host, bool)

Parse reads an ECR registry host.

type Key

type Key struct {
	AccessKeyID     string
	SecretAccessKey secret.Value
	Region          string

	// DualStack and FIPS choose the API endpoint, as the registry host does
	// (Parse).
	DualStack bool
	FIPS      bool

	// Endpoint overrides the ECR API endpoint, for tests.
	Endpoint string
}

Key is an AWS access key, and where to ask.

Jump to

Keyboard shortcuts

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