pkg

package
v0.0.0-...-abf203a Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JsonPatchFinalizerIn

func JsonPatchFinalizerIn(ctx context.Context, clt client.Client, obj client.Object, finalizer string) (JsonPatch, PatchFunc, error)

JsonPatchFinalizerIn uses JSON-type patches to add a finalizer to obj. It will return the JsonPatch for you to log, the PatchFunc for you to execute, and an error if it fails to generate the patch. This function isn't currently returning an error, but this might change in the future

func JsonPatchFinalizerInP

func JsonPatchFinalizerInP(ctx context.Context, clt client.Client, obj client.Object, finalizer string) (JsonPatch, PatchFunc)

JsonPatchFinalizerInP executes JsonPatchFinalizerIn, panicking for errors. Use this function if you have no use of the returning error. The PatchFunc will still occur at runtime and might return an error; this function is only panicking for the errors that occurred while generating the patch

func JsonPatchFinalizerOut

func JsonPatchFinalizerOut(ctx context.Context, clt client.Client, obj client.Object, finalizer string) (JsonPatch, PatchFunc, error)

JsonPatchFinalizerOut uses JSON-type patches to remove a finalizer from the obj. It will return the JsonPatch for you to log, the PatchFunc for you to execute, and an error if it fails to generate the patch

func JsonPatchFinalizerOutP

func JsonPatchFinalizerOutP(ctx context.Context, clt client.Client, obj client.Object, finalizer string) (JsonPatch, PatchFunc)

JsonPatchFinalizerOutP executes JsonPatchFinalizerOut, panicking for errors. Use this function if you have no use of the returning error. The PatchFunc will still occur at runtime and might return an error; this function is only panicking for the errors that occurred while generating the patch

func JsonPatchMap

func JsonPatchMap(ctx context.Context, clt client.Client, obj client.Object, path string, origMap, newMap map[string]string) ([]JsonPatch, PatchFunc, error)

JsonPatchMap uses JSON-type patches to add or replace all members in the given path for the given obj with the member in newMap; we use origMap to determine whether we need to add or replace. It will return JsonPatches for you to log, the PatchFunc for you to execute, and an error if it fails to generate the patch

func JsonPatchMapP

func JsonPatchMapP(ctx context.Context, clt client.Client, obj client.Object, path string, origMap, newMap map[string]string) ([]JsonPatch, PatchFunc)

JsonPatchMapP executes JsonPatchMap, panicking for errors. Use this function if you have no use of the returning error. The PatchFunc will still occur at runtime and might return an error; this function is only panicking for the errors that occurred while generating the patch

func JsonPatchSpec

func JsonPatchSpec[T interface{}](ctx context.Context, clt client.Client, obj client.Object, spec *T) (JsonPatch, PatchFunc, error)

JsonPatchSpec uses JSON-type patches to replace a Spec in obj. It will return a JsonPatch for you to log, the PatchFunc for you to execute, and an error if it fails to generate the patch

func JsonPatchSpecP

func JsonPatchSpecP[T interface{}](ctx context.Context, clt client.Client, obj client.Object, spec *T) (JsonPatch, PatchFunc)

JsonPatchSpecP executes JsonPatchSpec, panicking for errors. Use this function if you have no use of the returning error. The PatchFunc will still occur at runtime and might return an error; this function is only panicking for the errors that occurred while generating the patch

func SanitizeKeyForJsonPatch

func SanitizeKeyForJsonPatch(key string) string

SanitizeKeyForJsonPatch is used for preparing an annotation or a label key for patching using JSON patches. Further information can be found at https://jsonpatch.com/#json-pointer

func UnSanitizeKeyForJsonPatch

func UnSanitizeKeyForJsonPatch(key string) string

UnSanitizeKeyForJsonPatch does the opposite of SanitizeKeyForJsonPatch

Types

type JsonPatch

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

JsonPatch encapsulates a JSON patch string

func (*JsonPatch) Get

func (p *JsonPatch) Get() string

Get will return the encapsulated patch string

type NoPatchRequired

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

NoPatchRequired is the error used to indicate your tool instructions have resulted in no patches being created

func (*NoPatchRequired) Error

func (e *NoPatchRequired) Error() string

Error returns the encapsulated error message

type PatchFunc

type PatchFunc func() error

PatchFunc is the function for you to execute to perform the patch

func JsonPatchFinalizerInQ

func JsonPatchFinalizerInQ(ctx context.Context, clt client.Client, obj client.Object, finalizer string) PatchFunc

JsonPatchFinalizerInQ executes JsonPatchFinalizerInP, ignoring the patches. Use this function if you only need the PatchFunc

func JsonPatchFinalizerOutQ

func JsonPatchFinalizerOutQ(ctx context.Context, clt client.Client, obj client.Object, finalizer string) PatchFunc

JsonPatchFinalizerOutQ executes JsonPatchFinalizerOutP, ignoring the patches. Use this function if you only need the PatchFunc

func JsonPatchMapQ

func JsonPatchMapQ(ctx context.Context, clt client.Client, obj client.Object, path string, origMap, newMap map[string]string) PatchFunc

JsonPatchMapQ executes JsonPatchMapP, ignoring the patches. Use this function if you only need the PatchFunc

func JsonPatchSpecQ

func JsonPatchSpecQ[T interface{}](ctx context.Context, clt client.Client, obj client.Object, spec *T) PatchFunc

JsonPatchSpecQ executes JsonPatchSpecP, ignoring the patches. Use this function if you only need the PatchFunc

Jump to

Keyboard shortcuts

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