ocischema

package
v3.0.0-...-11ed768 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IndexSchemaVersion = manifest.Versioned{
	SchemaVersion: 2,
	MediaType:     v1.MediaTypeImageIndex,
}

IndexSchemaVersion provides a pre-initialized version structure for OCI Image Indices.

View Source
var SchemaVersion = manifest.Versioned{
	SchemaVersion: 2,
	MediaType:     v1.MediaTypeImageManifest,
}

SchemaVersion provides a pre-initialized version structure for OCI Image Manifests

Functions

func NewManifestBuilder

func NewManifestBuilder(bs distribution.BlobService, configJSON []byte, annotations map[string]string) distribution.ManifestBuilder

NewManifestBuilder is used to build new manifests for the current schema version. It takes a BlobService so it can publish the configuration blob as part of the Build process, and annotations.

Types

type Builder

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

Builder is a type for constructing manifests.

func (*Builder) AppendReference

func (mb *Builder) AppendReference(d distribution.Describable) error

AppendReference adds a reference to the current ManifestBuilder.

func (*Builder) Build

func (mb *Builder) Build(ctx context.Context) (distribution.Manifest, error)

Build produces a final manifest from the given references.

func (*Builder) References

func (mb *Builder) References() []distribution.Descriptor

References returns the current references added to this builder.

func (*Builder) SetMediaType

func (mb *Builder) SetMediaType(mediaType string) error

SetMediaType assigns the passed mediatype or error if the mediatype is not a valid media type for oci image manifests currently: "" or "application/vnd.oci.image.manifest.v1+json"

type DeserializedImageIndex

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

DeserializedImageIndex wraps ManifestList with a copy of the original JSON.

func FromDescriptors

func FromDescriptors(descriptors []distribution.Descriptor, annotations map[string]string) (*DeserializedImageIndex, error)

FromDescriptors takes a slice of descriptors and a map of annotations, and returns a DeserializedManifestList which contains the resulting manifest list and its JSON representation. If annotations is nil or empty then the annotations property will be omitted from the JSON representation.

func (*DeserializedImageIndex) MarshalJSON

func (m *DeserializedImageIndex) MarshalJSON() ([]byte, error)

MarshalJSON returns the contents of canonical. If canonical is empty, marshals the inner contents.

func (DeserializedImageIndex) Payload

func (m DeserializedImageIndex) Payload() (string, []byte, error)

Payload returns the raw content of the manifest list. The contents can be used to calculate the content identifier.

func (*DeserializedImageIndex) UnmarshalJSON

func (m *DeserializedImageIndex) UnmarshalJSON(b []byte) error

UnmarshalJSON populates a new ManifestList struct from JSON data.

type DeserializedManifest

type DeserializedManifest struct {
	Manifest
	// contains filtered or unexported fields
}

DeserializedManifest wraps Manifest with a copy of the original JSON. It satisfies the distribution.Manifest interface.

func FromStruct

func FromStruct(m Manifest) (*DeserializedManifest, error)

FromStruct takes a Manifest structure, marshals it to JSON, and returns a DeserializedManifest which contains the manifest and its JSON representation.

func (*DeserializedManifest) MarshalJSON

func (m *DeserializedManifest) MarshalJSON() ([]byte, error)

MarshalJSON returns the contents of canonical. If canonical is empty, marshals the inner contents.

func (DeserializedManifest) Payload

func (m DeserializedManifest) Payload() (string, []byte, error)

Payload returns the raw content of the manifest. The contents can be used to calculate the content identifier.

func (*DeserializedManifest) UnmarshalJSON

func (m *DeserializedManifest) UnmarshalJSON(b []byte) error

UnmarshalJSON populates a new Manifest struct from JSON data.

type ImageIndex

type ImageIndex struct {
	manifest.Versioned

	// Manifests references a list of manifests
	Manifests []distribution.Descriptor `json:"manifests"`

	// Annotations is an optional field that contains arbitrary metadata for the
	// image index
	Annotations map[string]string `json:"annotations,omitempty"`
}

ImageIndex references manifests for various platforms.

func (ImageIndex) References

func (ii ImageIndex) References() []distribution.Descriptor

References returns the distribution descriptors for the referenced image manifests.

type Manifest

type Manifest struct {
	manifest.Versioned

	// Config references the image configuration as a blob.
	Config distribution.Descriptor `json:"config"`

	// Layers lists descriptors for the layers referenced by the
	// configuration.
	Layers []distribution.Descriptor `json:"layers"`

	// Annotations contains arbitrary metadata for the image manifest.
	Annotations map[string]string `json:"annotations,omitempty"`
}

Manifest defines a ocischema manifest.

func (Manifest) References

func (m Manifest) References() []distribution.Descriptor

References returns the descriptors of this manifests references.

func (Manifest) Target

func (m Manifest) Target() distribution.Descriptor

Target returns the target of this manifest.

Jump to

Keyboard shortcuts

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