package jsonmerge
import "k8s.io/kubernetes/pkg/kubectl/cmd/util/jsonmerge"
Index ¶
- Variables
- func IsConflicting(err error) bool
- func IsPreconditionFailed(err error) bool
- func TestPreconditionsHold(edit []byte, preconditions []PreconditionFunc) (bool, string)
- type Delta
- func NewDelta(from, to []byte) (*Delta, error)
- func (d *Delta) AddPreconditions(fns ...PreconditionFunc)
- func (d *Delta) Apply(latest []byte) ([]byte, error)
- func (d *Delta) Edit() []byte
- type PreconditionFunc
Variables ¶
Functions ¶
func IsConflicting ¶
IsConflicting returns true if the provided error indicates a conflict exists between the original changes and the applied changes.
func IsPreconditionFailed ¶
IsPreconditionFailed returns true if the provided error indicates a Delta precondition did not succeed.
func TestPreconditionsHold ¶
func TestPreconditionsHold(edit []byte, preconditions []PreconditionFunc) (bool, string)
TestPreconditions test if preconditions hold given the edit
Types ¶
type Delta ¶
type Delta struct {
// contains filtered or unexported fields
}
Delta represents a change between two JSON documents.
func NewDelta ¶
NewDelta accepts two JSON or YAML documents and calculates the difference between them. It returns a Delta object which can be used to resolve conflicts against a third version with a common parent, or an error if either document is in error.
func (*Delta) AddPreconditions ¶
func (d *Delta) AddPreconditions(fns ...PreconditionFunc)
AddPreconditions adds precondition checks to a change which must be satisfied before an Apply is considered successful. If a precondition returns false, the Apply is failed with ErrPreconditionFailed.
func (*Delta) Apply ¶
Apply attempts to apply the changes described by Delta onto latest, returning an error if the changes cannot be applied cleanly. IsConflicting will be true if the changes overlap, otherwise a generic error will be returned.
func (*Delta) Edit ¶
type PreconditionFunc ¶
PreconditionFunc is a test to verify that an incompatible change has occurred before an Apply can be successful.
func RequireKeyUnchanged ¶
func RequireKeyUnchanged(key string) PreconditionFunc
RequireKeyUnchanged creates a precondition function that fails if the provided key is present in the diff (indicating its value has changed).
func RequireMetadataKeyUnchanged ¶
func RequireMetadataKeyUnchanged(key string) PreconditionFunc
RequireMetadataKeyUnchanged creates a precondition function that fails if the metadata.key is present in the diff (indicating its value has changed).
Source Files ¶
jsonmerge.go
- Version
- v1.6.0-rc.1
- Published
- Mar 24, 2017
- Platform
- js/wasm
- Imports
- 6 packages
- Last checked
- 6 seconds ago –
Tools for package owners.