core

package
v3.9.9 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNonKeyedSetter = errors.New("mutator does not understand keyed lists")

ErrNonKeyedSetter occurs when a setter that doesn't understand keyed lists is called against a keyed list.

Functions

func Mutate

func Mutate(
	path parser.Path,
	tester *path.Tester,
	setter Setter,
	obj *unstructured.Unstructured,
) (bool, error)

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

Jump to

Keyboard shortcuts

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