Documentation
¶
Index ¶
- func JsonPatchFinalizerIn(ctx context.Context, clt client.Client, obj client.Object, finalizer string) (JsonPatch, PatchFunc, error)
- func JsonPatchFinalizerInP(ctx context.Context, clt client.Client, obj client.Object, finalizer string) (JsonPatch, PatchFunc)
- func JsonPatchFinalizerOut(ctx context.Context, clt client.Client, obj client.Object, finalizer string) (JsonPatch, PatchFunc, error)
- func JsonPatchFinalizerOutP(ctx context.Context, clt client.Client, obj client.Object, finalizer string) (JsonPatch, PatchFunc)
- func JsonPatchMap(ctx context.Context, clt client.Client, obj client.Object, path string, ...) ([]JsonPatch, PatchFunc, error)
- func JsonPatchMapP(ctx context.Context, clt client.Client, obj client.Object, path string, ...) ([]JsonPatch, PatchFunc)
- func JsonPatchSpec[T interface{}](ctx context.Context, clt client.Client, obj client.Object, spec *T) (JsonPatch, PatchFunc, error)
- func JsonPatchSpecP[T interface{}](ctx context.Context, clt client.Client, obj client.Object, spec *T) (JsonPatch, PatchFunc)
- func SanitizeKeyForJsonPatch(key string) string
- func UnSanitizeKeyForJsonPatch(key string) string
- type JsonPatch
- type NoPatchRequired
- type PatchFunc
- func JsonPatchFinalizerInQ(ctx context.Context, clt client.Client, obj client.Object, finalizer string) PatchFunc
- func JsonPatchFinalizerOutQ(ctx context.Context, clt client.Client, obj client.Object, finalizer string) PatchFunc
- func JsonPatchMapQ(ctx context.Context, clt client.Client, obj client.Object, path string, ...) PatchFunc
- func JsonPatchSpecQ[T interface{}](ctx context.Context, clt client.Client, obj client.Object, spec *T) PatchFunc
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 ¶
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 ¶
UnSanitizeKeyForJsonPatch does the opposite of SanitizeKeyForJsonPatch
Types ¶
type JsonPatch ¶
type JsonPatch struct {
// contains filtered or unexported fields
}
JsonPatch encapsulates a JSON 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