Documentation ¶
Index ¶
- Variables
- func CheckKeyNotChanged(p parser.Path) error
- func HasMetadataRoot(path parser.Path) bool
- func MatchWithApplyTo(mut *types.Mutable, applies []match.ApplyTo, mat *match.Match) (bool, error)
- func Mutate(path parser.Path, tester *path.Tester, setter Setter, ...) (bool, error)
- func NewTester(name string, kind string, path parser.Path, ptests []unversioned.PathTest) (*patht.Tester, error)
- func NewValidatedBindings(name string, kind string, applies []match.ApplyTo) ([]schema.GroupVersionKind, error)
- func ValidateName(name string) error
- type Setter
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNonKeyedSetter = errors.New("mutator does not understand keyed lists") ErrNameLength = errors.New("maximum name length is 63 characters") )
ErrNonKeyedSetter occurs when a setter that doesn't understand keyed lists is called against a keyed list.
Functions ¶
func CheckKeyNotChanged ¶
CheckKeyNotChanged does not allow to change the key field of a list element. A path like foo[name: bar].name is rejected.
func HasMetadataRoot ¶
HasMetadataRoot returns true if the root node at given path references the metadata field.
func MatchWithApplyTo ¶
func Mutate ¶
func Mutate( path parser.Path, tester *path.Tester, setter Setter, obj *unstructured.Unstructured, ) (bool, error)
func NewTester ¶
func NewTester(name string, kind string, path parser.Path, ptests []unversioned.PathTest) (*patht.Tester, error)
NewTester returns a path.Tester for the given object name, kind path and pathtests.
func NewValidatedBindings ¶
func NewValidatedBindings(name string, kind string, applies []match.ApplyTo) ([]schema.GroupVersionKind, error)
NewValidatedBindings returns a slice of gvks from the given applies, or an error if the applies are invalid.
func ValidateName ¶ added in v3.15.0
Types ¶
type Setter ¶
type Setter interface { // SetValue takes the object that needs mutating and the key of the // field on that object that should be mutated. It is up to the // implementor to actually mutate the object. SetValue(obj map[string]interface{}, key string) error // KeyedListOkay returns whether this setter can handle keyed lists. // If it can't, an attempt to mutate a keyed-list-type field will // result in an error. KeyedListOkay() bool // KeyedListValue is the value that will be assigned to the // targeted keyed list entry. Unlike SetValue(), this does // not do mutation directly. KeyedListValue() (map[string]interface{}, error) }
Setter tells the mutate function what to do once we have found the node that needs mutating.
func NewDefaultSetter ¶
func NewDefaultSetter(value interface{}) Setter
Click to show internal directories.
Click to hide internal directories.