resmgr

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	KeyPod       = "pod"
	KeyID        = "id"
	KeyUID       = "uid"
	KeyName      = "name"
	KeyNamespace = "namespace"
	KeyQOSClass  = "qosclass"
	KeyLabels    = "labels"
	KeyTags      = "tags"
)

Variables

This section is empty.

Functions

func ResolveRef

func ResolveRef(subject Evaluable, spec string) (string, bool, error)

ResolveRef walks an object trying to resolve a reference to a value.

Types

type Evaluable

type Evaluable interface {
	Eval(string) interface{}
}

Evaluable is the interface objects need to implement to be evaluable against Expressions.

type Expression

type Expression struct {
	Key    string   `json:"key"`              // key to check values of/against
	Op     Operator `json:"operator"`         // operator to apply to value of Key and Values
	Values []string `json:"values,omitempty"` // value(s) for domain key
}

Expression is used to describe a criteria to select objects within a domain.

func (*Expression) DeepCopy

func (e *Expression) DeepCopy() *Expression

DeepCopy creates a deep copy of the expression.

func (*Expression) DeepCopyInto

func (e *Expression) DeepCopyInto(out *Expression)

DeepCopyInto copies the expression into another one.

func (*Expression) Evaluate

func (e *Expression) Evaluate(subject Evaluable) bool

Evaluate evaluates an expression against a container.

func (*Expression) KeyValue

func (e *Expression) KeyValue(subject Evaluable) (string, bool)

KeyValue extracts the value of the expresssion key from a container.

func (*Expression) String

func (e *Expression) String() string

String returns the expression as a string.

func (*Expression) Validate

func (e *Expression) Validate() error

Validate checks the expression for (obvious) invalidity.

type Operator

type Operator string

Operator defines the possible operators for an Expression.

const (
	// Equals tests for equality with a single value.
	Equals Operator = "Equals"
	// NotEqual test for inequality with a single value.
	NotEqual Operator = "NotEqual"
	// In tests if the key's value is one of the specified set.
	In Operator = "In"
	// NotIn tests if the key's value is not one of the specified set.
	NotIn Operator = "NotIn"
	// Exists evalutes to true if the named key exists.
	Exists Operator = "Exists"
	// NotExist evalutes to true if the named key does not exist.
	NotExist Operator = "NotExist"
	// AlwaysTrue always evaluates to true.
	AlwaysTrue Operator = "AlwaysTrue"
	// Matches tests if the key value matches the only given globbing pattern.
	Matches Operator = "Matches"
	// MatchesNot is true if Matches would be false for the same key and pattern.
	MatchesNot Operator = "MatchesNot"
	// MatchesAny tests if the key value matches any of the given globbing patterns.
	MatchesAny Operator = "MatchesAny"
	// MatchesNone is true if MatchesAny would be false for the same key and patterns.
	MatchesNone Operator = "MatchesNone"
)

Jump to

Keyboard shortcuts

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