client

package
v0.0.0-...-3e667ac Latest Latest
Warning

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

Go to latest
Published: May 23, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package client provides a just-enough-features client for an OCI registry (https://github.com/opencontainers/distribution-spec/blob/master/spec.md).

It uses https://github.com/google/go-containerregistry/ under the hood.

Index

Constants

View Source
const ContentType = "content-type"
View Source
const MetaRepository = "repository"

MetaRepository is the name of the meta property this blob was retrieved from.

Variables

View Source
var (
	ErrUnexpectedStatusCode    = errors.New("unexpected status code")
	ErrInvalidDigestFromServer = errors.New("server sent invalid digest")

	// ErrNotRegistryV2 is returned when the endpoint indicated by the image name
	// does not respond to a ping to /v2/ as expected.
	ErrNotRegistryV2 = errors.New("endpoint is not a registry with version v2")
)
View Source
var (
	ErrImageNameInvalid = errors.New("image name is of the wrong format")
)
View Source
var ErrRegistryUnwilling = errors.New("registry did not accept blob upload request")
View Source
var ErrUnexpectedDigest = errors.New("unexpected digest")

Functions

func Metadata

func Metadata(key string, val []byte) requestOption

Types

type BlobService

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

func (*BlobService) Get

func (bs *BlobService) Get(ctx context.Context, n ImageName, dgst digest.Digest, opts ...requestOption) error

func (*BlobService) Head

func (bs *BlobService) Head(ctx context.Context, n ImageName, dgst digest.Digest) error

func (*BlobService) Put

func (bs *BlobService) Put(ctx context.Context, n ImageName, dgst digest.Digest) error

type Client

type Client struct {
	Manifest *ManifestService
	Blob     *BlobService
	Tags     *TagService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(c cache.Cache, insecureRegistries []string, transport http.RoundTripper) *Client

NewClient builds a new client.

type ImageName

type ImageName struct {
	Host string
	Name string
}

func ParseImageName

func ParseImageName(n string) (ImageName, error)

func (ImageName) AsURLPrefix

func (in ImageName) AsURLPrefix() string

func (ImageName) RegistryPrefix

func (in ImageName) RegistryPrefix() string

func (ImageName) RegistryStr

func (in ImageName) RegistryStr() string

func (ImageName) String

func (in ImageName) String() string

type ManifestRef

type ManifestRef struct {
	ImageName
	Tag    string
	Digest digest.Digest
}

func ParseManifestRef

func ParseManifestRef(r string) (ManifestRef, error)

func (ManifestRef) HasDigest

func (mr ManifestRef) HasDigest() bool

func (ManifestRef) ManifestURL

func (mr ManifestRef) ManifestURL() string

func (ManifestRef) String

func (mr ManifestRef) String() string

type ManifestService

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

func (*ManifestService) Get

func (ms *ManifestService) Get(ctx context.Context, mr ManifestRef, opts ...requestOption) (*digest.Digest, error)

func (*ManifestService) Head

func (ms *ManifestService) Head(ctx context.Context, mr ManifestRef) error

func (*ManifestService) Put

type TagService

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

func (*TagService) List

func (ts *TagService) List(ctx context.Context, n ImageName) ([]string, error)

Jump to

Keyboard shortcuts

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