imagename

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FormatOption

type FormatOption byte

FormatOption is a the byte switch that sets the format for the image ToString func

const (
	// Registry output option includes the registry in the string.
	Registry FormatOption = 1 << iota
	// Tag includes the tag in the output string.
	Tag
	// ExplicitTag forces a tag in the string, will use latest if no tag is avail.
	ExplicitTag
	// ExplicitNamespace forces a namespace in the repo, will use "library" if no namespace
	ExplicitNamespace
)
var (
	// DefaultGetStringOptions is the default set of options
	DefaultGetStringOptions FormatOption = Registry | Tag

	// ErrNoImageRepository returns when there is there is no image repository
	ErrNoImageRepository = errors.New("No image repository specified")
)

func (FormatOption) Clear

func (b FormatOption) Clear(flag FormatOption) FormatOption

Clear clears the binary flag

func (FormatOption) Has

func (b FormatOption) Has(flag FormatOption) bool

Has checks if the flag is set.

func (FormatOption) Set

Set sets the binary flag

func (FormatOption) Toggle

func (b FormatOption) Toggle(flag FormatOption) FormatOption

Toggle toggles the flag

type ImageName

type ImageName struct {
	Registry  string
	Namespace string
	Repo      string
	Tag       string
}

ImageName represents the parts of an image reference.

func Parse

func Parse(imageName string) *ImageName

Parse parses the image from a string.

func (*ImageName) Enclose

func (imageName *ImageName) Enclose(organization string)

Enclose will set the organization on the image.

func (*ImageName) GetRepo

func (imageName *ImageName) GetRepo(option FormatOption) string

GetRepo returns the repository of the image.

func (*ImageName) HasDigest

func (imageName *ImageName) HasDigest() bool

HasDigest return true if the image uses a digest.

func (ImageName) MarshalText added in v0.2.0

func (name ImageName) MarshalText() ([]byte, error)

MarshalText marhsals the image name into a byte string so it can be used as a JSON map key

func (*ImageName) String

func (imageName *ImageName) String() string

String returns the string representation of the image using the registry and tag formatting.

func (*ImageName) ToString

func (imageName *ImageName) ToString(optionSet FormatOption) (string, error)

ToString will print the image using formatting options.

Jump to

Keyboard shortcuts

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