Version: v0.27.1 Latest Latest

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 10 Imported by: 118




This section is empty.


This section is empty.


func CompareSecretKeyReferences added in v0.19.3

func CompareSecretKeyReferences(
	a, b []*ackv1alpha1.SecretKeyReference,
) (equal bool, added, removed []*ackv1alpha1.SecretKeyReference)

CompareSecretKeyReference returns true if the supplied slices of secret key reference pointers contain the exact same elements. It will also return 2 slices containing elements contained in a that aren't in b, and elements contained in b that aren't in a, respectively. The comparison doesn't take into consideration the order of elements. Duplicated elements will not impact the behaviour of this function, meaning that the function will always return only unique instances of the added/removed elements.

func GetTagsDifference added in v0.24.0

func GetTagsDifference(from, to acktags.Tags) (added, unchanged, removed acktags.Tags)

GetTagsDifference determines which tags have been added, unchanged or have been removed between the `from` and the `to` inputs. Tags that are in `from` but not in `to` are added to `removed`, whereas tags that are in `to` but not in `from` are added to `added`.

func HasNilDifference

func HasNilDifference(a, b interface{}) bool

HasNilDifference returns true if the supplied subjects' nilness is different

func IsNil added in v0.2.1

func IsNil(i interface{}) bool

IsNil checks the passed interface argument for Nil value. For interfaces, only 'i==nil' check is not sufficient. More details:

func IsNotNil added in v0.2.1

func IsNotNil(i interface{}) bool

func MapStringStringEqual added in v0.7.0

func MapStringStringEqual(a, b map[string]string) bool

MapStringStringEqual returns true if the supplied maps are equal

func MapStringStringPEqual

func MapStringStringPEqual(a, b map[string]*string) bool

MapStringStringPEqual returns true if the supplied maps are equal

func MetaV1ObjectEqual added in v0.7.0

func MetaV1ObjectEqual(a, b k8smetav1.Object) (bool, error)

MetaV1ObjectEqual returns true if the supplied have equal values.

func SecretKeyReferenceEqual added in v0.19.3

func SecretKeyReferenceEqual(a, b *ackv1alpha1.SecretKeyReference) bool

SecretKeyReferenceEqual returns true if the supplied secret key references are equal.

func SliceSecretKeyReferenceEqual added in v0.19.3

func SliceSecretKeyReferenceEqual(
	a, b []*ackv1alpha1.SecretKeyReference,
) bool

SliceSecretKeyReferenceEqual returns true if the supplied slices of secret key reference pointers contain the exact same elements.

func SliceStringEqual added in v0.7.0

func SliceStringEqual(a, b []string) bool

SliceStringEqual returns true if the supplied slices of string have equal values regardless of order.

func SliceStringPEqual

func SliceStringPEqual(a, b []*string) bool

SliceStringPEqual returns true if the supplied slices of string pointers have equal values regardless of order.


type Delta

type Delta struct {
	// Differences is a slice of *ackcompare.Difference structs representing
	// differences in values of two resources under comparison
	Differences []*Difference

Delta represents differences between two AWSResources. The underlying types of the two supplied AWSResources should be the same. In other words, the Delta() method should be called with the same concrete implementing AWSResource type

func NewDelta

func NewDelta() *Delta

NewDelta returns a new Delta struct used to compare two resources.

func (*Delta) Add

func (d *Delta) Add(
	path string,
	a interface{},
	b interface{},

Add adds a new Difference to the Delta

func (*Delta) DifferentAt

func (d *Delta) DifferentAt(subject string) bool

DifferentAt returns whether there is a difference at the supplied JSONPath expression in the resources under comparison

func (*Delta) DifferentExcept added in v0.18.5

func (d *Delta) DifferentExcept(
	exceptPaths ...string,
) bool

DifferentExcept returns true if the delta contains any differences *other* than any of the supplied path strings.

This method is useful if you have a scenario where you don't want to proceed with a modification action if certain fields in a resource have not been changed.

For example, consider this code:

if delta.DifferentAt("Spec.Tags") {
    if err = rm.SyncTags(ctx, desired, latest); err != nil {
        return nil, err

if !delta.DifferentExcept("Spec.Tags") {
    // We don't want to proceed to call the ModifyDBInstance API since
    // no other resource fields have changed.
    return desired, nil

might be placed in an sdk_update_pre_build_request custom code hook to prevent the ModifyDBInstance call from being executed if the DBInstance's Tags field is the only field with changes.

type DiffItem

type DiffItem struct {
	Path string

func (*DiffItem) String

func (diff *DiffItem) String() string

type Difference

type Difference struct {
	// Path is the field path to the detected difference between resources
	// under comparison
	Path Path
	// A is the value of the first resource under comparison at the Path
	A interface{}
	// B is the value of the first resource under comparison at the Path
	B interface{}

Difference contains the difference in values for a specified field path into two compared resources.

type Path

type Path struct {
	// contains filtered or unexported fields

Path provides a JSONPath-like struct and field-member "route" to a particular field within a compared struct. Path implements json.Marshaler interface.

func NewPath

func NewPath(dotted string) Path

NewPath returns a new Path struct pointer from a dotted-notation string, e.g. "Author.Name"

func (Path) Contains

func (p Path) Contains(subject string) bool

Contains returns true if the supplied string, delimited on ".", matches up to the length of the supplied string.

e.g. if the Path p represents "A.B":
	subject "A" -> true
	subject "A.B" -> true
	subject "A.B.C" -> false
	subject "B" -> false
	subject "A.C" -> false

func (Path) MarshalJSON added in v0.2.1

func (p Path) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of a Path object.

func (Path) Pop

func (p Path) Pop()

Pop removes the last part from the Path

func (Path) Push

func (p Path) Push(part string)

Push adds a new part to the Path.

type Reporter

type Reporter struct {
	Differences []DiffItem
	// contains filtered or unexported fields

func (*Reporter) PopStep

func (reporter *Reporter) PopStep()

func (*Reporter) PushStep

func (reporter *Reporter) PushStep(ps cmp.PathStep)

func (*Reporter) Report

func (reporter *Reporter) Report(result cmp.Result)

func (*Reporter) String

func (reporter *Reporter) String() string

Jump to

Keyboard shortcuts

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