policy

package
v0.0.0-...-c5ab296 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoMajorMinorPatchElementsFound = errors.New("No Major.Minor.Patch elements found")
)

Functions

This section is empty.

Types

type ForcePolicy

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

func NewForcePolicy

func NewForcePolicy(matchTag bool) *ForcePolicy

func (*ForcePolicy) Name

func (fp *ForcePolicy) Name() string

func (*ForcePolicy) ShouldUpdate

func (fp *ForcePolicy) ShouldUpdate(current, new string) (bool, error)

func (*ForcePolicy) Type

func (fp *ForcePolicy) Type() PolicyType

type GlobPolicy

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

func NewGlobPolicy

func NewGlobPolicy(policy string) (*GlobPolicy, error)

func (*GlobPolicy) Name

func (p *GlobPolicy) Name() string

func (*GlobPolicy) ShouldUpdate

func (p *GlobPolicy) ShouldUpdate(current, new string) (bool, error)

func (*GlobPolicy) Type

func (p *GlobPolicy) Type() PolicyType

type NilPolicy

type NilPolicy struct{}

func (*NilPolicy) Name

func (np *NilPolicy) Name() string

func (*NilPolicy) ShouldUpdate

func (np *NilPolicy) ShouldUpdate(c, n string) (bool, error)

func (*NilPolicy) Type

func (np *NilPolicy) Type() PolicyType

type Options

type Options struct {
	MatchTag bool
}

Options - additional options when parsing policy

type Policy

type Policy interface {
	ShouldUpdate(current, new string) (bool, error)
	Name() string
	Type() PolicyType
}

func GetPolicy

func GetPolicy(policyName string, options *Options) Policy

GetPolicy - policy getter used by Helm config

func GetPolicyFromLabelsOrAnnotations

func GetPolicyFromLabelsOrAnnotations(labels map[string]string, annotations map[string]string) Policy

GetPolicyFromLabelsOrAnnotations - gets policy from k8s labels or annotations

func ParseSemverPolicy

func ParseSemverPolicy(policy string) Policy

ParseSemverPolicy - parse policy type

type PolicyType

type PolicyType int
const (
	PolicyTypeNone PolicyType = iota
	PolicyTypeSemver
	PolicyTypeForce
	PolicyTypeGlob
	PolicyTypeRegexp
)

func (PolicyType) MarshalJSON

func (r PolicyType) MarshalJSON() ([]byte, error)

MarshalJSON is generated so PolicyType satisfies json.Marshaler.

func (*PolicyType) UnmarshalJSON

func (r *PolicyType) UnmarshalJSON(data []byte) error

UnmarshalJSON is generated so PolicyType satisfies json.Unmarshaler.

type RegexpPolicy

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

RegexpPolicy - regular expression based pattern

func NewRegexpPolicy

func NewRegexpPolicy(policy string) (*RegexpPolicy, error)

func (*RegexpPolicy) Name

func (p *RegexpPolicy) Name() string

func (*RegexpPolicy) ShouldUpdate

func (p *RegexpPolicy) ShouldUpdate(current, new string) (bool, error)

func (*RegexpPolicy) Type

func (p *RegexpPolicy) Type() PolicyType

type SemverPolicy

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

func NewSemverPolicy

func NewSemverPolicy(spt SemverPolicyType) *SemverPolicy

func (*SemverPolicy) Name

func (sp *SemverPolicy) Name() string

func (*SemverPolicy) ShouldUpdate

func (sp *SemverPolicy) ShouldUpdate(current, new string) (bool, error)

func (*SemverPolicy) Type

func (sp *SemverPolicy) Type() PolicyType

type SemverPolicyType

type SemverPolicyType int

SemverPolicyType - policy type

const (
	SemverPolicyTypeNone SemverPolicyType = iota
	SemverPolicyTypeAll
	SemverPolicyTypeMajor
	SemverPolicyTypeMinor
	SemverPolicyTypePatch
)

available policies

func (SemverPolicyType) MarshalJSON

func (r SemverPolicyType) MarshalJSON() ([]byte, error)

MarshalJSON is generated so SemverPolicyType satisfies json.Marshaler.

func (SemverPolicyType) String

func (t SemverPolicyType) String() string

func (*SemverPolicyType) UnmarshalJSON

func (r *SemverPolicyType) UnmarshalJSON(data []byte) error

UnmarshalJSON is generated so SemverPolicyType satisfies json.Unmarshaler.

Jump to

Keyboard shortcuts

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