oras

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoImageIndexToPush = errors.New("no image index to push")
	ErrNoImageToPush      = errors.New("no image to push")
)

Functions

func AuthConfig

func AuthConfig(username, password string) remote.Option

AuthConfig returns option for the authentication to a remote registry.

func CompatibleManifest

func CompatibleManifest(mt types.MediaType) bool

CompatibleManifest returns if the media type corresponds to a compatible ORAS manifest.

func GetLayer added in v0.0.6

func GetLayer(manifest *v1.Manifest, mediaType types.MediaType) (v1.Descriptor, error)

func GetLayerFilter added in v0.0.6

func GetLayerFilter(manifest *v1.Manifest, mediaTypeFilter MediaTypeFilter) (v1.Descriptor, error)

func GetManifest

func GetManifest(ref name.Reference, options ...remote.Option) (*v1.Manifest, error)

GetManifest returns the manifest corresponding to the reference.

func HeadManifest

func HeadManifest(ref name.Reference, options ...remote.Option) (types.MediaType, string, error)

HeadManifest returns the media type and digest of the manifest corresponding to the reference.

func Pull

func Pull(puller Puller, options ...remote.Option) error

Pull pulls an image from a remote OCI registry.

func PullIndex

func PullIndex(puller Puller, options ...remote.Option) error

PullIndex pulls an image index from a remote OCI registry.

func Push

func Push(pusher Pusher, options ...remote.Option) error

Push images to a remote OCI registry.

Types

type Image

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

Image defines an ORAS artifact manifest with the associated images layers.

func NewImage

func NewImage() *Image

NewImage returns a Image instance for uploading SIF images to OCI registries.

func (*Image) AddConfig

func (i *Image) AddConfig(mt types.MediaType, rawConfig []byte) error

func (*Image) AddLayer

func (i *Image) AddLayer(layer Layer) error

AddSIFLayer adds a blob layer to the image manifest.

func (*Image) ConfigFile

func (i *Image) ConfigFile() (*v1.ConfigFile, error)

ConfigFile returns this image's config file.

func (*Image) ConfigName

func (i *Image) ConfigName() (v1.Hash, error)

ConfigName returns the hash of the image's config file, also known as the Image ID.

func (*Image) Digest

func (i *Image) Digest() (v1.Hash, error)

Digest returns the sha256 of this image's manifest.

func (*Image) LayerByDiffID

func (i *Image) LayerByDiffID(v1.Hash) (v1.Layer, error)

LayerByDiffID is an analog to LayerByDigest, looking up by "diff id" (not supported by ORAS).

func (*Image) LayerByDigest

func (i *Image) LayerByDigest(hash v1.Hash) (v1.Layer, error)

LayerByDigest returns a Layer for interacting with a particular layer of the image, looking it up by "digest" (the compressed hash).

func (*Image) Layers

func (i *Image) Layers() ([]v1.Layer, error)

Layers returns a unordered collection of SIF file.

func (*Image) Manifest

func (i *Image) Manifest() (*v1.Manifest, error)

Manifest returns this image's Manifest object.

func (*Image) MediaType

func (i *Image) MediaType() (types.MediaType, error)

MediaType of this image's manifest.

func (*Image) RawConfigFile

func (i *Image) RawConfigFile() ([]byte, error)

RawConfigFile returns the serialized bytes of ConfigFile().

func (*Image) RawManifest

func (i *Image) RawManifest() ([]byte, error)

RawManifest returns the serialized bytes of Manifest().

func (*Image) Size

func (i *Image) Size() (int64, error)

Size returns the size of the manifest.

type ImageIndex

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

ImageIndex defines an image index.

func ImageIndexFromReference

func ImageIndexFromReference(ref name.Reference, options ...remote.Option) (*ImageIndex, error)

ImageIndexIndexFromReference returns an image index populated with the remote image reference to update an existing image index.

func NewImageIndex

func NewImageIndex() *ImageIndex

NewImageIndex returns an image index.

func (*ImageIndex) AddImage

func (i *ImageIndex) AddImage(image *Image) error

AddImage adds an image to the image index.

func (*ImageIndex) Digest

func (i *ImageIndex) Digest() (v1.Hash, error)

Digest returns the sha256 of this index's manifest.

func (*ImageIndex) Image

func (i *ImageIndex) Image(hash v1.Hash) (v1.Image, error)

Image returns a v1.Image that this ImageIndex references.

func (*ImageIndex) ImageIndex

func (i *ImageIndex) ImageIndex(v1.Hash) (v1.ImageIndex, error)

ImageIndex returns a v1.ImageIndex that this ImageIndex references. Not supported for ORAS.

func (*ImageIndex) IndexManifest

func (i *ImageIndex) IndexManifest() (*v1.IndexManifest, error)

IndexManifest returns this image index's manifest object.

func (*ImageIndex) MediaType

func (i *ImageIndex) MediaType() (types.MediaType, error)

MediaType of this image's manifest.

func (*ImageIndex) RawManifest

func (i *ImageIndex) RawManifest() ([]byte, error)

RawManifest returns the serialized bytes of IndexManifest().

func (*ImageIndex) RemoveImage

func (i *ImageIndex) RemoveImage(hash v1.Hash)

RemoveImage removes image manifest and layers if any from the current image index.

func (*ImageIndex) Size

func (i *ImageIndex) Size() (int64, error)

Size returns the size of the manifest.

type Layer

type Layer interface {
	v1.Layer
	Annotations() map[string]string
	Platform() *v1.Platform
}

Layer defines the image layer interface.

type MediaTypeFilter added in v0.0.6

type MediaTypeFilter func(types.MediaType) bool

type Puller

type Puller interface {
	// Reference returns the image reference to pull.
	Reference() name.Reference
	// IndexManifest returns the image hash manifest to pull from.
	IndexManifest(*v1.IndexManifest) *v1.Hash
	// Config inspects manifest config descriptor.
	Config(v1.Descriptor) error
	// RawConfig parses config blob descriptor content.
	RawConfig([]byte) error
	// Layers downloads image blobs.
	Layers([]v1.Layer) error
}

Puller defines the interface for pulling images.

type Pusher

type Pusher interface {
	// Reference returns the image reference to pull.
	Reference() name.Reference
	ImageIndex() (v1.ImageIndex, error)
	Image() (v1.Image, error)
}

Jump to

Keyboard shortcuts

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