registry_api

package
v0.0.0-...-d1c94df Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	// contains filtered or unexported methods
}

Representation of credentials for registry level authentication.

func NewAnonymousAuthenticator

func NewAnonymousAuthenticator() Authenticator

Create an unauthenticated registry authenticator.

func NewBasicAuthenticator

func NewBasicAuthenticator(username string, password string) Authenticator

Create a basic auth authenticator.

func NewBearerAuthenticator

func NewBearerAuthenticator(token string) Authenticator

Create a bearer auth token.

type RegistryClient

type RegistryClient interface {
	// Transfer an image into another registry.
	//
	// The other registry client should be the same implementation type as this registry client.
	//
	// Returns the digest of the copied image, or an error if something goes wrong.
	CopyInto(
		ctx context.Context,
		sourceRepositoryName string,
		sourceDigest string,
		destinationClient RegistryClient,
		destinationRepositoryName string,
		destinationTagName string,
	) (string, error)

	// Fetch the digest for the given tag in the given repository.
	//
	// Returns the string digest, or an error if something goes wrong.
	//
	// Optionally, provide a platform to target a different platform to the default
	// (linux/amd64).
	GetDigestForTag(ctx context.Context, repositoryName string, tagName string, platformName *string) (string, error)

	// List tags for the given repository in the registry. The platform name can be nil
	// if the default should be used (linux/amd64).
	//
	// Returns a set of tags, or an error if something goes wrong.
	ListTags(ctx context.Context, repositoryName string, platformName *string) (set.Set[string], error)
}

Base interface for a registry client. The implementation is kept separate to allow easy mocking and stubbing without physical API calls being performed.

func NewRegistryClient

func NewRegistryClient(registryName string, registryConfig *RegistryConfig) (RegistryClient, error)

Initialize a new registry client.

If the registry name is unparsable, then an error is returned instead.

type RegistryConfig

type RegistryConfig struct {
	Authenticator         Authenticator
	ConcurrentJobs        int
	ConnectTimeout        time.Duration
	ForceAttemptHttp2     bool
	IdleConnectionTimeout time.Duration
	Insecure              bool
	KeepAlive             time.Duration
	MaxIdleConnections    int
	ResponseTimeout       time.Duration
	TlsHandshakeTimeout   time.Duration
}

Registry access configuration.

func NewRegistryConfig

func NewRegistryConfig() RegistryConfig

Create a new registry configuration containing default settings.

Jump to

Keyboard shortcuts

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