distribution

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Scheme represents the Distribution URI scheme
	Scheme = "cimd"
)

Variables

This section is empty.

Functions

func FullDockerRef

func FullDockerRef(p *d2acommon.ParsedDockerURL) string

FullDockerRef return the docker reference populated with all the default values. References like "busybox" or "registry-1.docker.io/library/busybox:latest" will become the same docker reference.

func NewCIMDString

func NewCIMDString(typ Type, version uint32, data string) string

NewCIMDString creates a new cimd URL string.

func Register

func Register(distType Type, f newDistribution)

Register registers a function that returns a new instance of the given distribution. This is intended to be called from the init function in packages that implement distribution functions.

func SimpleDockerRef

func SimpleDockerRef(p *d2acommon.ParsedDockerURL) string

SimpleDockerRef returns a simplyfied docker reference. This means removing the index url if it's the default docker registry (registry-1.docker.io), removing the default repo (library) when using the default docker registry

Types

type ACIArchive

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

ACIArchive defines a distribution using an ACI file The format is: cimd:aci-archive:v=0:ArchiveURL?query... The distribution type is "archive" ArchiveURL must be query escaped Examples: cimd:aci-archive:v=0:file%3A%2F%2Fabsolute%2Fpath%2Fto%2Ffile cimd:aci-archive:v=0:https%3A%2F%2Fexample.com%2Fapp.aci

func (*ACIArchive) CIMD

func (a *ACIArchive) CIMD() *url.URL

func (*ACIArchive) Equals

func (a *ACIArchive) Equals(d Distribution) bool

func (*ACIArchive) String

func (a *ACIArchive) String() string

func (*ACIArchive) TransportURL

func (a *ACIArchive) TransportURL() *url.URL

TransportURL returns a copy of the transport URL.

type Appc

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

Appc defines a distribution using appc image discovery Its format is cimd:appc:v=0:name?label01=....&label02=.... The distribution type is "appc" The labels values must be Query escaped Example cimd:appc:v=0:coreos.com/etcd?version=v3.0.3&os=linux&arch=amd64

func (*Appc) App

func (a *Appc) App() *discovery.App

App returns the discovery.App for an Appc distribution. It'll fail if the distribution is not of type Appc.

func (*Appc) CIMD

func (a *Appc) CIMD() *url.URL

func (*Appc) Equals

func (a *Appc) Equals(d Distribution) bool

func (*Appc) String

func (d *Appc) String() string

String returns the simplest appc image format string from the Appc distribution. To avoid random label position they are lexically ordered giving the precedence to version, os, arch (in this order)

type Distribution

type Distribution interface {
	// URI returns a copy of the Distribution CIMD URI.
	CIMD() *url.URL
	// String returns a user friendly representation of the distribution point.
	String() string
	// Equals returns true if this distribution equals the given distribution, else false.
	Equals(Distribution) bool
}

Distribution is the interface that represents a distribution point.

func Get

func Get(u *url.URL) (Distribution, error)

Get returns a Distribution from the input URI. It returns an error if the uri string is wrong or referencing an unknown distribution type.

func NewACIArchive

func NewACIArchive(u *url.URL) (Distribution, error)

NewACIArchive creates a new aci-archive distribution from the provided distribution uri.

func NewACIArchiveFromTransportURL

func NewACIArchiveFromTransportURL(u *url.URL) (Distribution, error)

NewACIArchiveFromTransportURL creates a new aci-archive distribution from the provided transport URL Example: file:///full/path/to/aci/file.aci -> cimd:aci-archive:v=0:file%3A%2F%2F%2Ffull%2Fpath%2Fto%2Faci%2Ffile.aci

func NewAppc

func NewAppc(u *url.URL) (Distribution, error)

NewAppc returns an Appc distribution from an Appc distribution URI

func NewAppcFromApp

func NewAppcFromApp(app *discovery.App) Distribution

NewAppcFromApp returns an Appc distribution from an appc App discovery string

func NewDocker

func NewDocker(u *url.URL) (Distribution, error)

NewDocker creates a new docker distribution from the provided distribution uri string

func NewDockerFromString

func NewDockerFromString(ds string) (Distribution, error)

NewDockerFromDockerString creates a new docker distribution from the provided docker string (like "busybox", "busybox:1.0", "myregistry.example.com:4000/busybox" etc...)

func Parse

func Parse(rawuri string) (Distribution, error)

Parse parses the provided distribution URI string and returns a Distribution.

type Docker

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

Docker defines a distribution using a docker registry. The format after the docker distribution type prefix (cimd:docker:v=0:) is the same as the docker image string format (man docker-pull): cimd:docker:v=0:[REGISTRY_HOST[:REGISTRY_PORT]/]NAME[:TAG|@DIGEST] Examples: cimd:docker:v=0:busybox cimd:docker:v=0:busybox:latest cimd:docker:v=0:registry-1.docker.io/library/busybox@sha256:a59906e33509d14c036c8678d687bd4eec81ed7c4b8ce907b888c607f6a1e0e6

func (*Docker) CIMD

func (d *Docker) CIMD() *url.URL

func (*Docker) Equals

func (d *Docker) Equals(dist Distribution) bool

func (*Docker) ReferenceURL

func (d *Docker) ReferenceURL() string

ReferenceURL returns the docker reference URL.

func (*Docker) String

func (d *Docker) String() string

type Type

type Type string

Type represents the Distribution type

const (

	// TypeACIArchive represents the ACIArchive distribution type
	TypeACIArchive Type = "aci-archive"
)
const (

	// TypeAppc represents the Appc distribution type
	TypeAppc Type = "appc"
)
const (

	// TypeDocker represents the Docker distribution type
	TypeDocker Type = "docker"
)

Jump to

Keyboard shortcuts

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