v1

package
v0.0.0-...-77f32e8 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package v1 defines structured types for OCI v1 images

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hasher

func Hasher(name string) (hash.Hash, error)

Hasher returns a hash.Hash for the named algorithm (e.g. "sha256")

Types

type Config

type Config struct {
	AttachStderr    bool
	AttachStdin     bool
	AttachStdout    bool
	Cmd             []string
	Healthcheck     *HealthConfig
	Domainname      string
	Entrypoint      []string
	Env             []string
	Hostname        string
	Image           string
	Labels          map[string]string
	OnBuild         []string
	OpenStdin       bool
	StdinOnce       bool
	Tty             bool
	User            string
	Volumes         map[string]struct{}
	WorkingDir      string
	ExposedPorts    map[string]struct{}
	ArgsEscaped     bool
	NetworkDisabled bool
	MacAddress      string
	StopSignal      string
	Shell           []string
}

Config is a submessage of the config file described as:

The execution parameters which SHOULD be used as a base when running
a container using the image.

The names of the fields in this message are chosen to reflect the JSON payload of the Config as defined here: https://git.io/vrAET and https://github.com/opencontainers/image-spec/blob/master/config.md

func (*Config) DeepCopy

func (in *Config) DeepCopy() *Config

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Config.

func (*Config) DeepCopyInto

func (in *Config) DeepCopyInto(out *Config)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ConfigFile

type ConfigFile struct {
	Architecture    string    `json:"architecture"`
	Author          string    `json:"author,omitempty"`
	Container       string    `json:"container,omitempty"`
	Created         Time      `json:"created,omitempty"`
	DockerVersion   string    `json:"docker_version,omitempty"`
	History         []History `json:"history,omitempty"`
	OS              string    `json:"os"`
	RootFS          RootFS    `json:"rootfs"`
	Config          Config    `json:"config"`
	ContainerConfig Config    `json:"container_config,omitempty"`
	OSVersion       string    `json:"osversion,omitempty"`
}

ConfigFile is the configuration file that holds the metadata describing how to launch a container. See: https://github.com/opencontainers/image-spec/blob/master/config.md

func ParseConfigFile

func ParseConfigFile(r io.Reader) (*ConfigFile, error)

ParseConfigFile parses the io.Reader's contents into a ConfigFile.

func (*ConfigFile) DeepCopy

func (in *ConfigFile) DeepCopy() *ConfigFile

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigFile.

func (*ConfigFile) DeepCopyInto

func (in *ConfigFile) DeepCopyInto(out *ConfigFile)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Descriptor

type Descriptor struct {
	MediaType   types.MediaType   `json:"mediaType"`
	Size        int64             `json:"size"`
	Digest      Hash              `json:"digest"`
	URLs        []string          `json:"urls,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty"`
	Platform    *Platform         `json:"platform,omitempty"`
}

Descriptor holds a reference from the manifest to one of its constituent elements.

func (*Descriptor) DeepCopy

func (in *Descriptor) DeepCopy() *Descriptor

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Descriptor.

func (*Descriptor) DeepCopyInto

func (in *Descriptor) DeepCopyInto(out *Descriptor)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Hash

type Hash struct {
	// Algorithm holds the algorithm used to compute the hash.
	Algorithm string

	// Hex holds the hex portion of the content hash.
	Hex string
}

Hash is an unqualified digest of some content, e.g. sha256:deadbeef

func NewHash

func NewHash(s string) (Hash, error)

NewHash validates the input string is a hash and returns a strongly type Hash object.

func SHA256

func SHA256(r io.Reader) (Hash, int64, error)

SHA256 computes the Hash of the provided io.Reader's content.

func (*Hash) DeepCopy

func (in *Hash) DeepCopy() *Hash

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Hash.

func (*Hash) DeepCopyInto

func (in *Hash) DeepCopyInto(out *Hash)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (Hash) MarshalJSON

func (h Hash) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (Hash) String

func (h Hash) String() string

String reverses NewHash returning the string-form of the hash.

func (*Hash) UnmarshalJSON

func (h *Hash) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type HealthConfig

type HealthConfig struct {
	// Test is the test to perform to check that the container is healthy.
	// An empty slice means to inherit the default.
	// The options are:
	// {} : inherit healthcheck
	// {"NONE"} : disable healthcheck
	// {"CMD", args...} : exec arguments directly
	// {"CMD-SHELL", command} : run command with system's default shell
	Test []string `json:",omitempty"`

	// Zero means to inherit. Durations are expressed as integer nanoseconds.
	Interval    time.Duration `json:",omitempty"` // Interval is the time to wait between checks.
	Timeout     time.Duration `json:",omitempty"` // Timeout is the time to wait before considering the check to have hung.
	StartPeriod time.Duration `json:",omitempty"` // The start period for the container to initialize before the retries starts to count down.

	// Retries is the number of consecutive failures needed to consider a container as unhealthy.
	// Zero means inherit.
	Retries int `json:",omitempty"`
}

HealthConfig holds configuration settings for the HEALTHCHECK feature.

func (*HealthConfig) DeepCopy

func (in *HealthConfig) DeepCopy() *HealthConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HealthConfig.

func (*HealthConfig) DeepCopyInto

func (in *HealthConfig) DeepCopyInto(out *HealthConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type History

type History struct {
	Author     string `json:"author,omitempty"`
	Created    Time   `json:"created,omitempty"`
	CreatedBy  string `json:"created_by,omitempty"`
	Comment    string `json:"comment,omitempty"`
	EmptyLayer bool   `json:"empty_layer,omitempty"`
}

History is one entry of a list recording how this container image was built.

func (*History) DeepCopy

func (in *History) DeepCopy() *History

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new History.

func (*History) DeepCopyInto

func (in *History) DeepCopyInto(out *History)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Image

type Image interface {
	// Layers returns the ordered collection of filesystem layers that comprise this image.
	// The order of the list is oldest/base layer first, and most-recent/top layer last.
	Layers() ([]Layer, error)

	// MediaType of this image's manifest.
	MediaType() (types.MediaType, error)

	// ConfigName returns the hash of the image's config file.
	ConfigName() (Hash, error)

	// ConfigFile returns this image's config file.
	ConfigFile() (*ConfigFile, error)

	// RawConfigFile returns the serialized bytes of ConfigFile()
	RawConfigFile() ([]byte, error)

	// Digest returns the sha256 of this image's manifest.
	Digest() (Hash, error)

	// Manifest returns this image's Manifest object.
	Manifest() (*Manifest, error)

	// RawManifest returns the serialized bytes of Manifest()
	RawManifest() ([]byte, error)

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

	// LayerByDiffID is an analog to LayerByDigest, looking up by "diff id"
	// (the uncompressed hash).
	LayerByDiffID(Hash) (Layer, error)
}

Image defines the interface for interacting with an OCI v1 image.

type ImageIndex

type ImageIndex interface {
	// MediaType of this image's manifest.
	MediaType() (types.MediaType, error)

	// Digest returns the sha256 of this index's manifest.
	Digest() (Hash, error)

	// IndexManifest returns this image index's manifest object.
	IndexManifest() (*IndexManifest, error)

	// RawManifest returns the serialized bytes of IndexManifest().
	RawManifest() ([]byte, error)

	// Image returns a v1.Image that this ImageIndex references.
	Image(Hash) (Image, error)

	// ImageIndex returns a v1.ImageIndex that this ImageIndex references.
	ImageIndex(Hash) (ImageIndex, error)
}

ImageIndex defines the interface for interacting with an OCI image index.

type IndexManifest

type IndexManifest struct {
	SchemaVersion int64             `json:"schemaVersion"`
	MediaType     types.MediaType   `json:"mediaType,omitempty"`
	Manifests     []Descriptor      `json:"manifests"`
	Annotations   map[string]string `json:"annotations,omitempty"`
}

IndexManifest represents an OCI image index in a structured way.

func ParseIndexManifest

func ParseIndexManifest(r io.Reader) (*IndexManifest, error)

ParseIndexManifest parses the io.Reader's contents into an IndexManifest.

func (*IndexManifest) DeepCopy

func (in *IndexManifest) DeepCopy() *IndexManifest

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IndexManifest.

func (*IndexManifest) DeepCopyInto

func (in *IndexManifest) DeepCopyInto(out *IndexManifest)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Layer

type Layer interface {
	// Digest returns the Hash of the compressed layer.
	Digest() (Hash, error)

	// DiffID returns the Hash of the uncompressed layer.
	DiffID() (Hash, error)

	// Compressed returns an io.ReadCloser for the compressed layer contents.
	Compressed() (io.ReadCloser, error)

	// Uncompressed returns an io.ReadCloser for the uncompressed layer contents.
	Uncompressed() (io.ReadCloser, error)

	// Size returns the compressed size of the Layer.
	Size() (int64, error)
}

Layer is an interface for accessing the properties of a particular layer of a v1.Image

type Manifest

type Manifest struct {
	SchemaVersion int64             `json:"schemaVersion"`
	MediaType     types.MediaType   `json:"mediaType"`
	Config        Descriptor        `json:"config"`
	Layers        []Descriptor      `json:"layers"`
	Annotations   map[string]string `json:"annotations,omitempty"`
}

Manifest represents the OCI image manifest in a structured way.

func ParseManifest

func ParseManifest(r io.Reader) (*Manifest, error)

ParseManifest parses the io.Reader's contents into a Manifest.

func (*Manifest) DeepCopy

func (in *Manifest) DeepCopy() *Manifest

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Manifest.

func (*Manifest) DeepCopyInto

func (in *Manifest) DeepCopyInto(out *Manifest)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Platform

type Platform struct {
	Architecture string   `json:"architecture"`
	OS           string   `json:"os"`
	OSVersion    string   `json:"os.version,omitempty"`
	OSFeatures   []string `json:"os.features,omitempty"`
	Variant      string   `json:"variant,omitempty"`
}

Platform represents the target os/arch for an image.

func (*Platform) DeepCopy

func (in *Platform) DeepCopy() *Platform

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Platform.

func (*Platform) DeepCopyInto

func (in *Platform) DeepCopyInto(out *Platform)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RootFS

type RootFS struct {
	Type    string `json:"type"`
	DiffIDs []Hash `json:"diff_ids"`
}

RootFS holds the ordered list of file system deltas that comprise the container image's root filesystem.

func (*RootFS) DeepCopy

func (in *RootFS) DeepCopy() *RootFS

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RootFS.

func (*RootFS) DeepCopyInto

func (in *RootFS) DeepCopyInto(out *RootFS)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Time

type Time struct {
	time.Time
}

Time is a wrapper around time.Time to help with deep copying

func (*Time) DeepCopy

func (in *Time) DeepCopy() *Time

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Time.

func (*Time) DeepCopyInto

func (t *Time) DeepCopyInto(out *Time)

DeepCopyInto creates a deep-copy of the Time value. The underlying time.Time type is effectively immutable in the time API, so it is safe to copy-by-assign, despite the presence of (unexported) Pointer fields.

Directories

Path Synopsis
Package daemon provides facilities for reading/writing v1.Image from/to a running daemon.
Package daemon provides facilities for reading/writing v1.Image from/to a running daemon.
Package empty provides an implementation of v1.Image equivalent to "FROM scratch".
Package empty provides an implementation of v1.Image equivalent to "FROM scratch".
Package google provides facilities for listing images in gcr.io.
Package google provides facilities for listing images in gcr.io.
Package mutate provides facilities for mutating v1.Images of any kind.
Package mutate provides facilities for mutating v1.Images of any kind.
Package partial defines methods for building up a v1.Image from minimal subsets that are sufficient for defining a v1.Image.
Package partial defines methods for building up a v1.Image from minimal subsets that are sufficient for defining a v1.Image.
Package random provides a facility for synthesizing pseudo-random images.
Package random provides a facility for synthesizing pseudo-random images.
Package remote provides facilities for reading/writing v1.Images from/to a remote image registry.
Package remote provides facilities for reading/writing v1.Images from/to a remote image registry.
transport
Package transport provides facilities for setting up an authenticated http.RoundTripper given an Authenticator and base RoundTripper.
Package transport provides facilities for setting up an authenticated http.RoundTripper given an Authenticator and base RoundTripper.
Package tarball provides facilities for reading/writing v1.Images from/to a tarball on-disk.
Package tarball provides facilities for reading/writing v1.Images from/to a tarball on-disk.
Package validate provides methods for validating image correctness.
Package validate provides methods for validating image correctness.

Jump to

Keyboard shortcuts

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