mutation

package
v0.0.0-...-492d73e Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: Apache-2.0 Imports: 12 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

This section is empty.

Variables

This section is empty.

Functions

func ApplyResourceMutation

func ApplyResourceMutation(value any, mut syncagentv1alpha1.ResourceMutation, ctx *TemplateMutationContext) (any, error)

func ApplyResourceMutations

func ApplyResourceMutations(value any, mutations []syncagentv1alpha1.ResourceMutation, ctx *TemplateMutationContext) (any, error)

Types

type Mutator

type Mutator interface {
	// MutateSpec transform a remote object into a local one. On the first
	// mutation, otherObj will be nil. MutateSpec can modify all fields
	// except the status (i.e. "mutate spec" here means to mutate expected state,
	// which can be more than just the spec).
	MutateSpec(toMutate *unstructured.Unstructured, otherObj *unstructured.Unstructured) (*unstructured.Unstructured, error)
	// MutateStatus transform a local object into a remote one. MutateStatus
	// must only modify the status field.
	MutateStatus(toMutate *unstructured.Unstructured, otherObj *unstructured.Unstructured) (*unstructured.Unstructured, error)
}

func NewMutator

NewMutator creates a new mutator, which will apply the mutation rules to a synced object, in both directions. A nil spec is supported and will simply make the mutator not do anything.

type TemplateMutationContext

type TemplateMutationContext struct {
	// Value is always set by this package to the value found in the document.
	Value gjson.Result

	LocalObject  map[string]any
	RemoteObject map[string]any
}

Jump to

Keyboard shortcuts

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