registry

package
v0.0.0-...-cfe8db7 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrBasicAuth indicates that the repository requires basic rather than token authentication.
	ErrBasicAuth = errors.New("basic auth required")
)

Functions

This section is empty.

Types

type BasicTransport

type BasicTransport struct {
	Transport http.RoundTripper
	URL       string
	Username  string
	Password  string
}

BasicTransport defines the data structure for authentication via basic auth.

func (*BasicTransport) RoundTrip

func (t *BasicTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip defines the round tripper for basic auth transport.

type CustomTransport

type CustomTransport struct {
	Transport http.RoundTripper
	Headers   map[string]string
}

CustomTransport defines the data structure for custom http.Request options.

func (*CustomTransport) RoundTrip

func (t *CustomTransport) RoundTrip(request *http.Request) (*http.Response, error)

RoundTrip defines the round tripper for the error transport.

type ErrorTransport

type ErrorTransport struct {
	Transport http.RoundTripper
}

ErrorTransport defines the data structure for returning errors from the round tripper.

func (*ErrorTransport) RoundTrip

func (t *ErrorTransport) RoundTrip(request *http.Request) (*http.Response, error)

RoundTrip defines the round tripper for the error transport.

type Image

type Image struct {
	Domain string
	Path   string
	Tag    string
	Digest digest.Digest
	// contains filtered or unexported fields
}

Image holds information about an image.

func ParseImage

func ParseImage(image string) (Image, error)

ParseImage returns an Image struct with all the values filled in for a given image.

func (Image) Reference

func (i Image) Reference() string

Reference returns either the digest if it is non-empty or the tag for the image.

func (Image) String

func (i Image) String() string

String returns the string representation of an image.

func (*Image) WithDigest

func (i *Image) WithDigest(digest digest.Digest) (err error)

WithDigest sets the digest for an image.

type Info

type Info struct {
	Image     *oci.Image
	Platform  *oci.Platform
	Digest    string
	DigestAll string
	ID        string
	Repo      string
	Ref       string
	Size      int64
}

Info type for interesting information

type Opt

type Opt struct {
	Domain     string
	CAFile     string
	CertFile   string
	KeyFile    string
	Passphrase string
	Insecure   bool
	Debug      bool
	Digests    bool
	NonSSL     bool
	Timeout    time.Duration
	Headers    map[string]string
}

Opt holds the options for a new registry.

type Registry

type Registry struct {
	URL        string
	Domain     string
	Username   string
	Password   string
	Passphrase string
	Client     *http.Client
	Opt        Opt
	// contains filtered or unexported fields
}

Registry defines the client for retrieving information from the registry API.

func New

func New(ctx context.Context, auth types.AuthConfig, opt Opt) (*Registry, error)

New creates a new Registry struct with the given URL and credentials.

func (*Registry) Catalog

func (r *Registry) Catalog(ctx context.Context, u string) ([]string, error)

Catalog returns the repositories in a registry.

func (*Registry) Delete

func (r *Registry) Delete(ctx context.Context, repository string, ref string) (err error)

Delete removes a repository digest from the registry. https://docs.docker.com/registry/spec/api/#deleting-an-image https://github.com/opencontainers/distribution-spec/blob/main/spec.md#deleting-tags

func (*Registry) GetImage

func (r *Registry) GetImage(ctx context.Context, repo string, ref string) (*oci.Image, error)

GetImage gets the image config

func (*Registry) GetInfo

func (r *Registry) GetInfo(ctx context.Context, repo string, ref string) (*Info, error)

GetInfo from manifest

func (*Registry) GetInfoAll

func (r *Registry) GetInfoAll(ctx context.Context, repo string, ref string, arches []string, oses []string) ([]*Info, error)

GetInfoAll from fat manifests and then each manifest

func (*Registry) Headers

func (r *Registry) Headers(ctx context.Context, uri string) (map[string]string, error)

Headers returns the authorization headers for a specific uri.

func (*Registry) Tags

func (r *Registry) Tags(ctx context.Context, repository string) ([]string, error)

Tags returns the tags for a specific repository.

func (*Registry) Token

func (r *Registry) Token(ctx context.Context, url string) (string, error)

Token returns the required token for the specific resource url. If the registry requires basic authentication, this function returns ErrBasicAuth.

type TokenTransport

type TokenTransport struct {
	Transport http.RoundTripper
	Username  string
	Password  string
}

TokenTransport defines the data structure for authentication via tokens.

func (*TokenTransport) RoundTrip

func (t *TokenTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip defines the round tripper for token transport.

Jump to

Keyboard shortcuts

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