policy

package
v1.25.4 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ignore     = Policy("ignore")
	Locked     = Policy("locked")
	LockedUser = Policy("locked_user")
	LockedMsg  = Policy("locked_msg")
	Automated  = Policy("automated")
	TagAll     = Policy("tag_all")
)
View Source
const IgnoreSyncOnly = "sync_only"

Variables

View Source
var (
	// PatternAll matches everything.
	PatternAll    = NewPattern(globPrefix + "*")
	PatternLatest = NewPattern(globPrefix + "latest")
)

Functions

func Boolean

func Boolean(policy Policy) bool

func Tag

func Tag(policy Policy) bool

Types

type GlobPattern

type GlobPattern string

func (GlobPattern) Matches

func (g GlobPattern) Matches(tag string) bool

func (GlobPattern) Newer

func (g GlobPattern) Newer(a, b *image.Info) bool

func (GlobPattern) RequiresTimestamp

func (g GlobPattern) RequiresTimestamp() bool

func (GlobPattern) String

func (g GlobPattern) String() string

func (GlobPattern) Valid

func (g GlobPattern) Valid() bool

type Pattern

type Pattern interface {
	// Matches returns true if the given image tag matches the pattern.
	Matches(tag string) bool
	// String returns the prefixed string representation.
	String() string
	// Newer returns true if image `a` is newer than image `b`.
	Newer(a, b *image.Info) bool
	// Valid returns true if the pattern is considered valid.
	Valid() bool
	// RequiresTimestamp returns true if the pattern orders based on timestamp data.
	RequiresTimestamp() bool
}

Pattern provides an interface to match image tags.

func GetTagPattern

func GetTagPattern(policies Set, container string) Pattern

func NewPattern

func NewPattern(pattern string) Pattern

NewPattern instantiates a Pattern according to the prefix it finds. The prefix can be either `glob:` (default if omitted), `semver:` or `regexp:`.

type Policy

type Policy string

Policy is an string, denoting the current deployment policy of a service, e.g. automated, or locked.

func TagPrefix

func TagPrefix(container string) Policy

type RegexpPattern

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

RegexpPattern matches by regular expression.

func (RegexpPattern) Matches

func (r RegexpPattern) Matches(tag string) bool

func (RegexpPattern) Newer

func (r RegexpPattern) Newer(a, b *image.Info) bool

func (RegexpPattern) RequiresTimestamp

func (r RegexpPattern) RequiresTimestamp() bool

func (RegexpPattern) String

func (r RegexpPattern) String() string

func (RegexpPattern) Valid

func (r RegexpPattern) Valid() bool

type SemverPattern

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

SemverPattern matches by semantic versioning. See https://semver.org/

func (SemverPattern) Matches

func (s SemverPattern) Matches(tag string) bool

func (SemverPattern) Newer

func (s SemverPattern) Newer(a, b *image.Info) bool

func (SemverPattern) RequiresTimestamp

func (s SemverPattern) RequiresTimestamp() bool

func (SemverPattern) String

func (s SemverPattern) String() string

func (SemverPattern) Valid

func (s SemverPattern) Valid() bool

type Set

type Set map[Policy]string

func (Set) Add

func (s Set) Add(ps ...Policy) Set

func (Set) Get

func (s Set) Get(p Policy) (string, bool)

func (Set) Has

func (s Set) Has(needle Policy) bool

Has returns true if a resource has a particular policy present, and for boolean policies, if it is set to true.

func (Set) Set

func (s Set) Set(p Policy, v string) Set

func (Set) String

func (s Set) String() string

func (Set) ToStringMap

func (s Set) ToStringMap() map[string]string

func (*Set) UnmarshalJSON

func (s *Set) UnmarshalJSON(in []byte) error

We used to specify a set of policies as []Policy, and in some places it may be so serialised.

func (Set) Without

func (s Set) Without(omit Policy) Set

Jump to

Keyboard shortcuts

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