manifest

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: Apache-2.0 Imports: 22 Imported by: 11

Documentation

Overview

Package manifest abstracts the various types of supported manifests. Supported types include OCI index and image, and Docker manifest list and manifest.

Index

Constants

View Source
const (
	// MediaTypeDocker1Manifest deprecated media type for docker schema1 manifests.
	MediaTypeDocker1Manifest = "application/vnd.docker.distribution.manifest.v1+json"
	// MediaTypeDocker1ManifestSigned is a deprecated schema1 manifest with jws signing.
	MediaTypeDocker1ManifestSigned = "application/vnd.docker.distribution.manifest.v1+prettyjws"
)
View Source
const (
	// MediaTypeDocker2Manifest is the media type when pulling manifests from a v2 registry
	MediaTypeDocker2Manifest = mediatype.Docker2Manifest
	// MediaTypeDocker2ManifestList is the media type when pulling a manifest list from a v2 registry
	MediaTypeDocker2ManifestList = mediatype.Docker2ManifestList
)
View Source
const (
	// MediaTypeOCI1Manifest OCI v1 manifest media type
	MediaTypeOCI1Manifest = mediatype.OCI1Manifest
	// MediaTypeOCI1ManifestList OCI v1 manifest list media type
	MediaTypeOCI1ManifestList = mediatype.OCI1ManifestList
)

Variables

This section is empty.

Functions

func GetDigest

func GetDigest(m Manifest) digest.Digest

GetDigest returns the digest from the manifest descriptor.

func GetMediaType

func GetMediaType(m Manifest) string

GetMediaType returns the media type from the manifest descriptor.

func GetPlatformDesc

func GetPlatformDesc(m Manifest, p *platform.Platform) (*descriptor.Descriptor, error)

GetPlatformDesc returns the descriptor for a specific platform from an index.

func GetPlatformList

func GetPlatformList(m Manifest) ([]*platform.Platform, error)

GetPlatformList returns the list of platforms from an index.

func GetRateLimit

func GetRateLimit(m Manifest) types.RateLimit

GetRateLimit returns the current rate limit seen in headers.

func HasRateLimit

func HasRateLimit(m Manifest) bool

HasRateLimit indicates whether the rate limit is set and available.

func OCIIndexFromAny

func OCIIndexFromAny(orig interface{}) (v1.Index, error)

OCIIndexFromAny converts manifest lists to an OCI index.

func OCIIndexToAny

func OCIIndexToAny(ociI v1.Index, origP interface{}) error

OCIIndexToAny converts from an OCI index back to the manifest list.

func OCIManifestFromAny

func OCIManifestFromAny(orig interface{}) (v1.Manifest, error)

OCIManifestFromAny converts an image manifest to an OCI manifest.

func OCIManifestToAny

func OCIManifestToAny(ociM v1.Manifest, origP interface{}) error

OCIManifestToAny converts an OCI manifest back to the image manifest.

Types

type Annotator added in v0.4.3

type Annotator interface {
	GetAnnotations() (map[string]string, error)
	SetAnnotation(key, val string) error
}

Annotator is used by manifests that support annotations. Note this will work for Docker manifests despite the spec not officially supporting it.

type Imager added in v0.4.4

type Imager interface {
	GetConfig() (descriptor.Descriptor, error)
	GetLayers() ([]descriptor.Descriptor, error)
	SetConfig(d descriptor.Descriptor) error
	SetLayers(dl []descriptor.Descriptor) error
	GetSize() (int64, error)
}

Imager is used by manifests packaging an image.

type Indexer added in v0.4.4

type Indexer interface {
	GetManifestList() ([]descriptor.Descriptor, error)
	SetManifestList(dl []descriptor.Descriptor) error
}

Indexer is used by manifests that contain a manifest list.

type Manifest

type Manifest interface {
	GetDescriptor() descriptor.Descriptor
	GetOrig() interface{}
	GetRef() ref.Ref
	IsList() bool
	IsSet() bool
	MarshalJSON() ([]byte, error)
	RawBody() ([]byte, error)
	RawHeaders() (http.Header, error)
	SetOrig(interface{}) error

	// Deprecated: GetConfig should be accessed using [Imager] interface.
	GetConfig() (descriptor.Descriptor, error)
	// Deprecated: GetLayers should be accessed using [Imager] interface.
	GetLayers() ([]descriptor.Descriptor, error)

	// Deprecated: GetManifestList should be accessed using [Indexer] interface.
	GetManifestList() ([]descriptor.Descriptor, error)

	// Deprecated: GetConfigDigest should be replaced with [GetConfig].
	GetConfigDigest() (digest.Digest, error)
	// Deprecated: GetDigest should be replaced with GetDescriptor().Digest, see [GetDescriptor].
	GetDigest() digest.Digest
	// Deprecated: GetMediaType should be replaced with GetDescriptor().MediaType, see [GetDescriptor].
	GetMediaType() string
	// Deprecated: GetPlatformDesc method should be replaced with [manifest.GetPlatformDesc].
	GetPlatformDesc(p *platform.Platform) (*descriptor.Descriptor, error)
	// Deprecated: GetPlatformList method should be replaced with [manifest.GetPlatformList].
	GetPlatformList() ([]*platform.Platform, error)
	// Deprecated: GetRateLimit method should be replaced with [manifest.GetRateLimit].
	GetRateLimit() types.RateLimit
	// Deprecated: HasRateLimit method should be replaced with [manifest.HasRateLimit].
	HasRateLimit() bool
}

Manifest interface is implemented by all supported manifests but many calls are only supported by certain underlying media types.

func New

func New(opts ...Opts) (Manifest, error)

New creates a new manifest based on provided options.

type Opts

type Opts func(*manifestConfig)

func WithDesc

func WithDesc(desc descriptor.Descriptor) Opts

WithDesc specifies the descriptor for the manifest.

func WithHeader

func WithHeader(header http.Header) Opts

WithHeader provides the headers from the response when pulling the manifest.

func WithOrig

func WithOrig(orig interface{}) Opts

WithOrig provides the original manifest variable.

func WithRaw

func WithRaw(raw []byte) Opts

WithRaw provides the manifest bytes or HTTP response body.

func WithRef

func WithRef(r ref.Ref) Opts

WithRef provides the reference used to get the manifest.

type Subjecter added in v0.4.5

type Subjecter interface {
	GetSubject() (*descriptor.Descriptor, error)
	SetSubject(d *descriptor.Descriptor) error
}

Subjecter is used by manifests that may have a subject field.

Jump to

Keyboard shortcuts

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