diff

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChangeOpAdd    ChangeOp = "add"
	ChangeOpDelete          = "delete"
	ChangeOpUpdate          = "update"
	ChangeOpKeep            = "keep" // unchanged
)

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

	Op() ChangeOp
	TextDiff() TextDiff
	OpsDiff() OpsDiff

	IsIgnored() bool
	IgnoredReason() string
}

type ChangeFactory

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

func NewChangeFactory

func NewChangeFactory(mods []ctlres.FieldCopyMod) 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 ctlres.Resource) *ChangeImpl

func (*ChangeImpl) AppliedResource

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

func (*ChangeImpl) ExistingResource

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

func (*ChangeImpl) IgnoredReason

func (d *ChangeImpl) IgnoredReason() string

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

func (*ChangeImpl) TextDiff

func (d *ChangeImpl) TextDiff() TextDiff

type ChangeOp

type ChangeOp string

type ChangePrecalculated

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

func NewChangePrecalculated

func NewChangePrecalculated(existingRes, newRes, appliedRes ctlres.Resource) *ChangePrecalculated

func (*ChangePrecalculated) AppliedResource

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

func (*ChangePrecalculated) ExistingResource

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

func (*ChangePrecalculated) IgnoredReason

func (d *ChangePrecalculated) IgnoredReason() string

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

func (*ChangePrecalculated) TextDiff

func (d *ChangePrecalculated) TextDiff() TextDiff

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 ChangeSetOpts

type ChangeSetOpts struct {
	AgainstLastApplied bool
}

type ChangeSetView

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

func NewChangeSetView

func NewChangeSetView(changes []Change, opts ChangeSetViewOpts) *ChangeSetView

func (*ChangeSetView) Print

func (v *ChangeSetView) Print(ui ui.UI)

func (*ChangeSetView) Summary

func (v *ChangeSetView) Summary() string

type ChangeSetViewOpts

type ChangeSetViewOpts struct {
	Summary     bool
	SummaryFull bool
	Changes     bool
	ChangesFull bool
	TextDiffViewOpts
}

type ChangeSetWithTemplates

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

func NewChangeSetWithTemplates

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

func (ChangeSetWithTemplates) Calculate

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

type ChangesCountsView

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

func NewChangesCountsView

func NewChangesCountsView() *ChangesCountsView

func (*ChangesCountsView) Add

func (v *ChangesCountsView) Add(op ChangeOp)

func (*ChangesCountsView) AddHidden

func (v *ChangesCountsView) AddHidden(op ChangeOp)

func (*ChangesCountsView) String

func (v *ChangesCountsView) String() string

type ChangesView

type ChangesView struct {
	Changes     []Change
	Sort        bool
	IncludeFunc func(ch Change) bool
	// contains filtered or unexported fields
}

func (*ChangesView) Print

func (v *ChangesView) Print(ui ui.UI)

func (*ChangesView) Summary

func (v *ChangesView) Summary() string

type GroupResources

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

func (GroupResources) Resources

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

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 RebasedResource

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

func NewRebasedResource

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

func (RebasedResource) Resource

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

type ResourceWithHistory

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

func NewResourceWithHistory

func NewResourceWithHistory(resource ctlres.Resource, changeFactory *ChangeFactory) ResourceWithHistory

func (ResourceWithHistory) HistorylessResource

func (r ResourceWithHistory) HistorylessResource() (ctlres.Resource, error)

func (ResourceWithHistory) LastAppliedResource

func (r ResourceWithHistory) LastAppliedResource() ctlres.Resource

func (ResourceWithHistory) RecordLastAppliedResource

func (r ResourceWithHistory) RecordLastAppliedResource(appliedRes ctlres.Resource) (ctlres.Resource, error)

type TemplateResource

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

func (TemplateResource) NonTemplatedName

func (d TemplateResource) NonTemplatedName() (string, string)

func (TemplateResource) SetTemplatedName

func (d TemplateResource) SetTemplatedName(ver int)

func (TemplateResource) UniqTemplateKey

func (d TemplateResource) UniqTemplateKey() ctlres.UniqueResourceKey

func (TemplateResource) UpdateAffected

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

func (TemplateResource) Version

func (d TemplateResource) Version() int

type TextDiff

type TextDiff []difflib.DiffRecord

func NewTextDiff

func NewTextDiff(existingLines, newLines []string) 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) String

func (l TextDiff) String(full bool) string

type TextDiffView

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

func NewTextDiffView

func NewTextDiffView(diff TextDiff, 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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳