Documentation
¶
Index ¶
- Constants
- func CheckSafety(plan *Plan, liveCount int, desiredCount int, pruneThreshold float64) error
- func EntityName(c Change) string
- func FormatPlan(w io.Writer, plan *Plan)
- func PlanToJSON(plan *Plan) ([]byte, error)
- func SavePlan(plan *Plan, path string) error
- type Applier
- type Change
- type Counts
- type JSONChange
- type JSONOutput
- type Plan
- type StaleChange
Constants ¶
View Source
const ( OpCreate = "create" OpUpdate = "update" OpDelete = "delete" OpNoop = "noop" )
View Source
const DefaultPruneThreshold = 0.2
Variables ¶
This section is empty.
Functions ¶
func CheckSafety ¶
func EntityName ¶
func FormatPlan ¶
func PlanToJSON ¶
PlanToJSON serializes a Plan as indented JSON bytes.
Types ¶
type Applier ¶
type Change ¶
type Change struct {
Op string
ExternalID string
Before *catalog.LiveEntity
After *catalog.DesiredEntity
FieldDiffs map[string][2]string
}
type JSONChange ¶
type JSONChange struct {
Op string `json:"op"`
ExternalID string `json:"external_id"`
Name string `json:"name"`
FieldDiffs map[string][2]string `json:"field_diffs,omitempty"`
}
JSONChange is a single change entry in JSON output.
type JSONOutput ¶
type JSONOutput struct {
Catalog string `json:"catalog"`
CatalogID string `json:"catalog_id"`
Counts Counts `json:"counts"`
Changes []JSONChange `json:"changes"`
}
JSONOutput is the structured output for --output=json mode.
type Plan ¶
func Diff ¶
func Diff(catalogName string, catalogID string, live []catalog.LiveEntity, desired []catalog.DesiredEntity, allowPrune bool) *Plan
type StaleChange ¶
StaleChange describes a single plan change that no longer matches live state.
func ValidatePlanFreshness ¶
func ValidatePlanFreshness(plan *Plan, live []catalog.LiveEntity) []StaleChange
ValidatePlanFreshness checks whether a saved plan still matches live state. It returns a list of stale changes; an empty slice means the plan is fresh.
Click to show internal directories.
Click to hide internal directories.