Documentation ¶
Index ¶
- Constants
- Variables
- func DockerRefFromReference(ref Reference) reference.Named
- type ID
- type IdOrLocalTag
- type IdOrRemoteTag
- type IdOrTag
- type IdOrTagConstraint
- type Local
- type LocalRef
- type LocalTag
- type Name
- type Reference
- type Relative
- type Remote
- type RemoteRef
- type RemoteTag
- type Tag
- type TagConstraint
Constants ¶
const ( // HEAD reserved tag Head = "HEAD" // REBASE_HEAD reserved tag RebaseHead = "REBASE_HEAD" Latest = "latest" IdPrefix = "@sha256:" TagPrefix = ":" )
Variables ¶
var ( ErrNotAName = errors.New("not a name") ErrNameContainsTagOrID = errors.New("name contains tag or id") )
var ( ErrIDInvalidFormat = errors.New("invalid id format") ErrTagIsReserved = errors.New("tag is reserved") HeadTag = LocalTagFromTag(tag{TagPrefix + Head}) RebaseHeadTag = LocalTagFromTag(tag{TagPrefix + RebaseHead}) LatestTag = RemoteTagFromTag(tag{TagPrefix + Latest}) )
var (
ErrInvalidOffsetFormat = errors.New("invalid offset format")
)
Functions ¶
func DockerRefFromReference ¶ added in v0.2.0
DockerRefFromReference returns a docker reference from the given repository reference.
Types ¶
type ID ¶ added in v0.2.0
type ID struct {
// contains filtered or unexported fields
}
ID defines the ID component of a repository reference.
func IDFromDigest ¶ added in v0.2.0
func IDFromDigest(d digest.Digest) ID
IDFromDigested returns an ID from the given digest.
func IDFromString ¶ added in v0.2.0
IDFromString returns a new ID if the given string is a valid ID.
type IdOrTagConstraint ¶ added in v0.2.0
type IdOrTagConstraint interface { ID | TagConstraint fmt.Stringer }
IdOrTagConstraint is either an ID or a Tag.
type Local ¶ added in v0.2.0
type Local[T IdOrLocalTag] struct { // contains filtered or unexported fields }
Local defines a concrete local reference with either an ID or a local tag.
func LocalFromName ¶ added in v0.2.0
LocalFromName returns a new Local reference with the given name and a Head tag.
func NewLocal ¶ added in v0.2.0
func NewLocal[T IdOrLocalTag](name Name, idOrTag T) Local[T]
NewLocal returns a new Local reference with the given name and ID or Tag.
func (Local) GetIdOrTag ¶ added in v0.2.0
func (r Local) GetIdOrTag() T
type LocalRef ¶ added in v0.2.0
type LocalRef interface { Reference // contains filtered or unexported methods }
LocalRef defines a local repository reference.
func LocalRefFromString ¶ added in v0.2.0
type LocalTag ¶ added in v0.2.0
type LocalTag struct {
// contains filtered or unexported fields
}
LocalTag defines a tag for local reference. Any docker tag is a valid local tag.
func LocalTagFromString ¶ added in v0.2.0
LocalTagFromString creates a new LocalTag after validating the given tag.
func LocalTagFromTag ¶ added in v0.2.0
LocalTagFromTagged creates a new LocalTag from the given Tagged reference.
type Name ¶
type Name struct {
// contains filtered or unexported fields
}
Name define the name component of a Reference.
func NameFromNamed ¶
NameFromNamed returns a Name object from the given named reference.
func NameFromString ¶
Name returns a Name object from the given string after ensuring it is a valid name. An error is returned if the string is invalid or it contains a tag, an ID.
type Reference ¶ added in v0.2.0
Reference defines a repository reference. A reference composed of a repository name and an ID or a Tag.
NAME[:TAG | @sha256:ID]
type Relative ¶ added in v0.2.0
type Relative struct {
// contains filtered or unexported fields
}
Relative defines a relative reference. It is made of a base and an offset. Base is the reference on which the offset must be applied to get an absolute reference.
func RelativeFromReferenceAndOffset ¶ added in v0.2.0
RelativeFromReferenceAndOffset returns a new Relative reference base on the given reference and offset.
func RelativeFromString ¶ added in v0.2.0
RelativeFromString parses the given string and returns relative reference after validating and normalizing it. An error is returned if the reference is invalid.
type Remote ¶ added in v0.2.0
type Remote[T IdOrRemoteTag] struct { // contains filtered or unexported fields }
Remote define a concrete remote reference with either an ID or a remote tag.
func NewRemote ¶ added in v0.2.0
func NewRemote[T IdOrRemoteTag](name Name, idOrTag T) Remote[T]
NewRemote returns a new Remote reference with the given name and tag.
func RemoteFromName ¶ added in v0.2.0
RemoteFromName returns a new Remote reference with the given name and a Latest tag.
func (Remote) GetIdOrTag ¶ added in v0.2.0
func (r Remote) GetIdOrTag() T
type RemoteRef ¶ added in v0.2.0
type RemoteRef interface { Reference // contains filtered or unexported methods }
func RemoteRefFromString ¶ added in v0.2.0
type RemoteTag ¶ added in v0.2.0
type RemoteTag struct {
// contains filtered or unexported fields
}
RemoteTag defines a tag for remote reference. Remote tag can't contains reserved tag such as HEAD, REBASE_HEAD, etc.
func RemoteTagFromString ¶ added in v0.2.0
RemoteTagFromString creates a new RemoteTag after validating the given tag.
func RemoteTagFromTag ¶ added in v0.2.0
RemoteTagFromTag creates a new RemoteTag from the given Tagged reference. This function panic if the given tag is a reserved tag.
type TagConstraint ¶ added in v0.2.0
TagConstraint defines either a LocalTag or a RemoteTag.