manifest

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 19 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 = types.MediaTypeDocker2Manifest
	// MediaTypeDocker2ManifestList is the media type when pulling a manifest list from a v2 registry
	MediaTypeDocker2ManifestList = types.MediaTypeDocker2ManifestList
)
View Source
const (
	// MediaTypeOCI1Manifest OCI v1 manifest media type
	MediaTypeOCI1Manifest = types.MediaTypeOCI1Manifest
	// MediaTypeOCI1ManifestList OCI v1 manifest list media type
	MediaTypeOCI1ManifestList = types.MediaTypeOCI1ManifestList
)

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) (*types.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)

func OCIIndexToAny

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

func OCIManifestFromAny

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

func OCIManifestToAny

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

Types

type Annotator added in v0.4.3

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

type Imager added in v0.4.4

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

type Indexer added in v0.4.4

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

type Manifest

type Manifest interface {
	GetDescriptor() types.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() (types.Descriptor, error)
	// Deprecated: GetLayers should be accessed using Imager interface
	GetLayers() ([]types.Descriptor, error)

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

	// Deprecated: GetConfigDigest should be replaced with GetConfig
	GetConfigDigest() (digest.Digest, error)
	// Deprecated: GetDigest should be replaced with GetDescriptor().Digest
	GetDigest() digest.Digest
	// Deprecated: GetMediaType should be replaced with GetDescriptor().MediaType
	GetMediaType() string
	// Deprecated: GetPlatformDesc method should be replaced with manifest.GetPlatformDesc function
	GetPlatformDesc(p *platform.Platform) (*types.Descriptor, error)
	// Deprecated: GetPlatformList method should be replaced with manifest.GetPlatformList function
	GetPlatformList() ([]*platform.Platform, error)
	// Deprecated: GetRateLimit method should be replaced with manifest.GetRateLimit function
	GetRateLimit() types.RateLimit
	// Deprecated: HasRateLimit method should be replaced with manifest.HasRateLimit function
	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 types.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() (*types.Descriptor, error)
	SetSubject(d *types.Descriptor) error
}

Jump to

Keyboard shortcuts

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