diff

package
v0.62.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Change

type Change interface {
	NewOrExistingResource() ctlres.Resource
	NewResource() ctlres.Resource
	ExistingResource() ctlres.Resource
	AppliedResource() ctlres.Resource
	ClusterOriginalResource() ctlres.Resource

	Op() ChangeOp
	ConfigurableTextDiff() *ConfigurableTextDiff
	OpsDiff() OpsDiff

	IsIgnored() bool
}

type ChangeFactory

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

func NewChangeFactory

func NewChangeFactory(rebaseMods []ctlres.ResourceModWithMultiple,
	diffAgainstLastAppliedFieldExclusionMods []ctlres.FieldRemoveMod, diffAgainstExistingFieldExclusionRules []ctlres.FieldRemoveMod, opts ChangeOpts) ChangeFactory

func (ChangeFactory) NewChangeAgainstLastApplied

func (f ChangeFactory) NewChangeAgainstLastApplied(existingRes, newRes ctlres.Resource) (Change, error)

func (ChangeFactory) NewExactChange

func (f ChangeFactory) NewExactChange(existingRes, newRes ctlres.Resource) (Change, error)

func (ChangeFactory) NewResourceWithHistory

func (f ChangeFactory) NewResourceWithHistory(resource ctlres.Resource) ResourceWithHistory

type ChangeImpl

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

func NewChange

func NewChange(existingRes, newRes, appliedRes, clusterOriginalRes ctlres.Resource, opts ChangeOpts) *ChangeImpl

func (*ChangeImpl) AppliedResource

func (d *ChangeImpl) AppliedResource() ctlres.Resource

func (*ChangeImpl) ClusterOriginalResource added in v0.62.0

func (d *ChangeImpl) ClusterOriginalResource() ctlres.Resource

func (*ChangeImpl) ConfigurableTextDiff added in v0.62.0

func (d *ChangeImpl) ConfigurableTextDiff() *ConfigurableTextDiff

func (*ChangeImpl) ExistingResource

func (d *ChangeImpl) ExistingResource() ctlres.Resource

func (*ChangeImpl) IsIgnored

func (d *ChangeImpl) IsIgnored() bool

func (*ChangeImpl) NewOrExistingResource

func (d *ChangeImpl) NewOrExistingResource() ctlres.Resource

func (*ChangeImpl) NewResource

func (d *ChangeImpl) NewResource() ctlres.Resource

func (*ChangeImpl) Op

func (d *ChangeImpl) Op() ChangeOp

func (*ChangeImpl) OpsDiff

func (d *ChangeImpl) OpsDiff() OpsDiff

type ChangeOp

type ChangeOp string
const (
	ChangeOpAdd    ChangeOp = "add"
	ChangeOpDelete ChangeOp = "delete"
	ChangeOpUpdate ChangeOp = "update"
	ChangeOpKeep   ChangeOp = "keep" // unchanged
	ChangeOpExists ChangeOp = "exists"
	ChangeOpNoop   ChangeOp = "noop"
)

type ChangeOpts added in v0.62.0

type ChangeOpts struct {
	AllowAnchoredDiff bool
}

type ChangePrecalculated

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

func NewChangePrecalculated

func NewChangePrecalculated(existingRes, newRes, appliedRes ctlres.Resource,
	op ChangeOp, configurableTextDiff *ConfigurableTextDiff, opsDiff OpsDiff) *ChangePrecalculated

func (*ChangePrecalculated) AppliedResource

func (d *ChangePrecalculated) AppliedResource() ctlres.Resource

func (*ChangePrecalculated) ClusterOriginalResource added in v0.62.0

func (d *ChangePrecalculated) ClusterOriginalResource() ctlres.Resource

func (*ChangePrecalculated) ConfigurableTextDiff added in v0.62.0

func (d *ChangePrecalculated) ConfigurableTextDiff() *ConfigurableTextDiff

func (*ChangePrecalculated) ExistingResource

func (d *ChangePrecalculated) ExistingResource() ctlres.Resource

func (*ChangePrecalculated) IsIgnored

func (d *ChangePrecalculated) IsIgnored() bool

func (*ChangePrecalculated) NewOrExistingResource

func (d *ChangePrecalculated) NewOrExistingResource() ctlres.Resource

func (*ChangePrecalculated) NewResource

func (d *ChangePrecalculated) NewResource() ctlres.Resource

func (*ChangePrecalculated) Op

func (d *ChangePrecalculated) Op() ChangeOp

func (*ChangePrecalculated) OpsDiff

func (d *ChangePrecalculated) OpsDiff() OpsDiff

type ChangeSet

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

func NewChangeSet

func NewChangeSet(existingRs, newRs []ctlres.Resource,
	opts ChangeSetOpts, changeFactory ChangeFactory) *ChangeSet

func (ChangeSet) Calculate

func (d ChangeSet) Calculate() ([]Change, error)

type ChangeSetFactory added in v0.15.0

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

func NewChangeSetFactory added in v0.15.0

func NewChangeSetFactory(opts ChangeSetOpts, changeFactory ChangeFactory) ChangeSetFactory

func (ChangeSetFactory) New added in v0.15.0

func (f ChangeSetFactory) New(existingRs, newRs []ctlres.Resource) *ChangeSet

type ChangeSetFilter added in v0.62.0

type ChangeSetFilter struct {
	Filter string
}

func (*ChangeSetFilter) DiffFilter added in v0.62.0

func (s *ChangeSetFilter) DiffFilter() (*ChangeSetFilterRoot, error)

type ChangeSetFilterRoot added in v0.62.0

type ChangeSetFilterRoot struct {
	And              []ChangeSetFilterRoot
	Or               []ChangeSetFilterRoot
	Not              *ChangeSetFilterRoot
	Ops              OpsFilter
	NewResource      *ctlres.ResourceFilter
	ExistingResource *ctlres.ResourceFilter
}

func NewChangeSetFilterRootFromString added in v0.62.0

func NewChangeSetFilterRootFromString(data string) (*ChangeSetFilterRoot, error)

func (ChangeSetFilterRoot) Apply added in v0.62.0

func (f ChangeSetFilterRoot) Apply(changes []Change) []Change

func (ChangeSetFilterRoot) Matches added in v0.62.0

func (f ChangeSetFilterRoot) Matches(change Change) bool

type ChangeSetOpts

type ChangeSetOpts struct {
	AgainstLastApplied bool
}

type ChangeSetWithVersionedRs added in v0.62.0

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

func NewChangeSetWithVersionedRs added in v0.62.0

func NewChangeSetWithVersionedRs(existingRs, newRs []ctlres.Resource,
	rules []ctlconf.TemplateRule, opts ChangeSetOpts, changeFactory ChangeFactory) *ChangeSetWithVersionedRs

func (ChangeSetWithVersionedRs) Calculate added in v0.62.0

func (d ChangeSetWithVersionedRs) Calculate() ([]Change, error)

type ConfigurableTextDiff added in v0.62.0

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

func NewConfigurableTextDiff added in v0.62.0

func NewConfigurableTextDiff(existingRes, newRes ctlres.Resource, ignored bool, opts ChangeOpts) *ConfigurableTextDiff

func (ConfigurableTextDiff) Full added in v0.62.0

func (d ConfigurableTextDiff) Full() TextDiff

func (ConfigurableTextDiff) Masked added in v0.62.0

type ExplicitVersionedRef added in v0.62.0

type ExplicitVersionedRef struct {
	AnnotationKey string
	Annotation    string
}

func NewExplicitVersionedRef added in v0.62.0

func NewExplicitVersionedRef(annotationKey string, annotation string) *ExplicitVersionedRef

func (*ExplicitVersionedRef) AnnotationMod added in v0.62.0

func (e *ExplicitVersionedRef) AnnotationMod(objectRef map[string]interface{}) (ctlres.StringMapAppendMod, error)

func (*ExplicitVersionedRef) AsObjectRef added in v0.62.0

func (e *ExplicitVersionedRef) AsObjectRef() (map[string]interface{}, error)

type GroupResources

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

func (GroupResources) Resources

func (r GroupResources) Resources() map[string][]ctlres.Resource

type MaskedResource added in v0.62.0

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

func NewMaskedResource added in v0.62.0

func NewMaskedResource(res ctlres.Resource, rules []ctlconf.DiffMaskRule) MaskedResource

func (MaskedResource) Resource added in v0.62.0

func (r MaskedResource) Resource() (ctlres.Resource, error)

type OpsDiff

type OpsDiff patch.Ops

func (OpsDiff) FullString

func (l OpsDiff) FullString() string

func (OpsDiff) HasChanges

func (l OpsDiff) HasChanges() bool

func (OpsDiff) MinimalMD5

func (l OpsDiff) MinimalMD5() string

func (OpsDiff) MinimalString

func (l OpsDiff) MinimalString() string

type OpsFilter added in v0.62.0

type OpsFilter []ChangeOp

func (OpsFilter) Matches added in v0.62.0

func (ops OpsFilter) Matches(change Change) bool

type RebasedResource

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

func NewRebasedResource

func NewRebasedResource(existingRes, newRes ctlres.Resource, mods []ctlres.ResourceModWithMultiple) RebasedResource

func (RebasedResource) Resource

func (r RebasedResource) Resource() (ctlres.Resource, error)

type RenewableResources added in v0.62.0

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

func NewRenewableResources added in v0.62.0

func NewRenewableResources(existingRs, newRs []ctlres.Resource) *RenewableResources

func (RenewableResources) Prepare added in v0.62.0

func (d RenewableResources) Prepare() error

type ResourceWithHistory

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

func NewResourceWithHistory

func NewResourceWithHistory(resource ctlres.Resource,
	changeFactory *ChangeFactory, diffAgainstLastAppliedFieldExclusionMods []ctlres.FieldRemoveMod) ResourceWithHistory

func (ResourceWithHistory) AllowsRecordingLastApplied added in v0.62.0

func (r ResourceWithHistory) AllowsRecordingLastApplied() bool

func (ResourceWithHistory) CalculateChange added in v0.16.0

func (r ResourceWithHistory) CalculateChange(appliedRes ctlres.Resource) (Change, error)

func (ResourceWithHistory) LastAppliedResource

func (r ResourceWithHistory) LastAppliedResource() ctlres.Resource

LastAppliedResource will return "last applied" resource that was saved iff it still matches actually saved resource on the cluster (noted at the time of saving).

func (ResourceWithHistory) RecordLastAppliedResource

func (r ResourceWithHistory) RecordLastAppliedResource(appliedChange Change) (ctlres.Resource, bool, error)

type ResourceWithRemovedFields added in v0.14.0

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

func NewResourceWithRemovedFields added in v0.14.0

func NewResourceWithRemovedFields(res ctlres.Resource, mods []ctlres.FieldRemoveMod) ResourceWithRemovedFields

func (ResourceWithRemovedFields) Resource added in v0.14.0

type ResourceWithoutHistory added in v0.62.0

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

func NewResourceWithoutHistory added in v0.62.0

func NewResourceWithoutHistory(resource ctlres.Resource, fieldExclusionMods []ctlres.FieldRemoveMod) ResourceWithoutHistory

func (ResourceWithoutHistory) Resource added in v0.62.0

func (r ResourceWithoutHistory) Resource() (ctlres.Resource, error)

type TextDiff

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

func NewTextDiff

func NewTextDiff(existingLines, newLines []string, allowAnchoredDiff bool) TextDiff

func (TextDiff) FullString

func (l TextDiff) FullString() string

func (TextDiff) HasChanges

func (l TextDiff) HasChanges() bool

func (TextDiff) MinimalMD5

func (l TextDiff) MinimalMD5() string

func (TextDiff) MinimalString

func (l TextDiff) MinimalString() string

func (TextDiff) Records added in v0.62.0

func (l TextDiff) Records() []difflib.DiffRecord

func (TextDiff) String

func (l TextDiff) String(full bool) string

type TextDiffView

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

func NewTextDiffView

func NewTextDiffView(diff *ConfigurableTextDiff,
	maskRules []ctlconf.DiffMaskRule, opts TextDiffViewOpts) TextDiffView

func (TextDiffView) String

func (v TextDiffView) String() string

type TextDiffViewOpts

type TextDiffViewOpts struct {
	Context     int // number of lines to show around changed lines; <0 for all
	LineNumbers bool
	Mask        bool
}

type VersionedResource added in v0.62.0

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

func (VersionedResource) BaseNameAndVersion added in v0.62.0

func (d VersionedResource) BaseNameAndVersion() (string, string)

func (VersionedResource) SetBaseName added in v0.62.0

func (d VersionedResource) SetBaseName(ver int)

func (VersionedResource) UniqVersionedKey added in v0.62.0

func (d VersionedResource) UniqVersionedKey() ctlres.UniqueResourceKey

func (VersionedResource) UpdateAffected added in v0.62.0

func (d VersionedResource) UpdateAffected(rs []ctlres.Resource) error

func (VersionedResource) Version added in v0.62.0

func (d VersionedResource) Version() int

Jump to

Keyboard shortcuts

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