commons

package
Version: v0.0.0-...-45f56e5 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: Apache-2.0 Imports: 8 Imported by: 14

Documentation

Index

Constants

View Source
const (
	AUTO    string = "auto"
	MANUAL  string = "manual"
	TCP     string = "tcp"
	UDP     string = "udp"
	STATIC  string = "static"
	VIRTUAL string = "virtual"
)

Variables

This section is empty.

Functions

func JoinRepoTag

func JoinRepoTag(repo, tag string) string

JoinRepoTag joins an image repo with the tag

Types

type ImageID

type ImageID struct {
	Host string
	Port int
	User string
	Repo string
	Tag  string
}

ImageID represents a Docker Image identifier.

func ParseImageID

func ParseImageID(iid string) (*ImageID, error)

ParseImageID parses the string representation of a Docker image ID into an ImageID structure. The grammar used by the parser is: image id = [host(':'port|'/')]reponame[':'tag] host = {alpha|digit|'.'|'-'}+ port = {digit}+ reponame = [user'/']repo user = {alpha|digit|'-'|'_'}+ repo = {alpha|digit|'-'|'_'|'.'}+ tag = {alpha|digit|'-'|'_'|'.'}+ The grammar is ambiguous so the parser is a little messy in places.

func RenameImageID

func RenameImageID(dockerRegistry, tenantId string, imgID string, tag string) (*ImageID, error)

Return an ImageID object from several different parts

dockerRegistry - The registry to use in the image name, eg. "localhost:5000"
tenantID       - The ID of the tenant that the image will pertain to
imgID          - The 'uncustomized' image name, eg. "zenoss/core-unstable:5.0.0".
                 Only the part after the last slash, but before the last colon will
                 actually be used from this
tag            - The new tag you'd like to create

An input of ("localhost:5000", "myLittleTenant", "zenoss/core-unstable:5.0.0", "latest")
would return an ImageID whose parts would be:
  Host: localhost
  Port: 5000
  User: myLittleTenant
  Repo: core-unstable
  Tag:  latest

func (ImageID) BaseName

func (iid ImageID) BaseName() string

BaseName returns a string representation of the ImageID structure sans tag

func (*ImageID) Copy

func (iid *ImageID) Copy() *ImageID

func (ImageID) Equals

func (iid ImageID) Equals(iid2 ImageID) bool

Equals compares to ImageID objects to verify they are the same

func (ImageID) IsLatest

func (iid ImageID) IsLatest() bool

IsLatest returns a boolean that indicates that the image ID is the latest

func (*ImageID) Merge

func (iid *ImageID) Merge(new *ImageID) error

Merge will merge the non-empty struct members of 'new' into the image iid

func (ImageID) Registry

func (iid ImageID) Registry() string

Registry returns registry component of the ImageID as a string with the form: hostname:port

func (ImageID) String

func (iid ImageID) String() string

String returns a string representation of the ImageID structure

func (*ImageID) Validate

func (iid *ImageID) Validate() bool

Validate returns true if the ImageID structure is valid.

Directories

Path Synopsis
Package diet provides an implementation of a Discrete Interval Encoding Tree.
Package diet provides an implementation of a Discrete Interval Encoding Tree.
Simple iptables controller based on Docker's
Simple iptables controller based on Docker's

Jump to

Keyboard shortcuts

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