apimachinery: k8s.io/apimachinery/pkg/util/mergepatch Index | Files

package mergepatch

import "k8s.io/apimachinery/pkg/util/mergepatch"

Index

Package Files

errors.go util.go

Variables

var (
    ErrBadJSONDoc                           = errors.New("invalid JSON document")
    ErrNoListOfLists                        = errors.New("lists of lists are not supported")
    ErrBadPatchFormatForPrimitiveList       = errors.New("invalid patch format of primitive list")
    ErrBadPatchFormatForRetainKeys          = errors.New("invalid patch format of retainKeys")
    ErrBadPatchFormatForSetElementOrderList = errors.New("invalid patch format of setElementOrder list")
    ErrPatchContentNotMatchRetainKeys       = errors.New("patch content doesn't match retainKeys list")
    ErrUnsupportedStrategicMergePatchFormat = errors.New("strategic merge patch format is not supported")
)

func ErrBadArgKind Uses

func ErrBadArgKind(expected, actual interface{}) error

func ErrBadArgType Uses

func ErrBadArgType(expected, actual interface{}) error

func ErrBadPatchType Uses

func ErrBadPatchType(t interface{}, m map[string]interface{}) error

func ErrNoMergeKey Uses

func ErrNoMergeKey(m map[string]interface{}, k string) error

func HasConflicts Uses

func HasConflicts(left, right interface{}) (bool, error)

HasConflicts returns true if the left and right JSON interface objects overlap with different values in any key. All keys are required to be strings. Since patches of the same Type have congruent keys, this is valid for multiple patch types. This method supports JSON merge patch semantics.

NOTE: Numbers with different types (e.g. int(0) vs int64(0)) will be detected as conflicts.

Make sure the unmarshaling of left and right are consistent (e.g. use the same library).

func IsConflict Uses

func IsConflict(err error) bool

IsConflict returns true if the provided error indicates a conflict between the patch and the current configuration.

func IsPreconditionFailed Uses

func IsPreconditionFailed(err error) bool

IsPreconditionFailed returns true if the provided error indicates a precondition failed.

func ToYAMLOrError Uses

func ToYAMLOrError(v interface{}) string

type ErrConflict Uses

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

func NewErrConflict Uses

func NewErrConflict(patch, current string) ErrConflict

func (ErrConflict) Error Uses

func (err ErrConflict) Error() string

type ErrPreconditionFailed Uses

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

func NewErrPreconditionFailed Uses

func NewErrPreconditionFailed(target map[string]interface{}) ErrPreconditionFailed

func (ErrPreconditionFailed) Error Uses

func (err ErrPreconditionFailed) Error() string

type PreconditionFunc Uses

type PreconditionFunc func(interface{}) bool

PreconditionFunc asserts that an incompatible change is not present within a patch.

func RequireKeyUnchanged Uses

func RequireKeyUnchanged(key string) PreconditionFunc

RequireKeyUnchanged returns a precondition function that fails if the provided key is present in the patch (indicating that its value has changed).

func RequireMetadataKeyUnchanged Uses

func RequireMetadataKeyUnchanged(key string) PreconditionFunc

RequireMetadataKeyUnchanged creates a precondition function that fails if the metadata.key is present in the patch (indicating its value has changed).

Package mergepatch imports 5 packages (graph) and is imported by 62 packages. Updated 2019-02-19. Refresh now. Tools for package owners.