Documentation
¶
Overview ¶
Package preview holds the change list that `apply --dry-run` and `diff` print, so both report the same rows and the same agent-mode JSON.
Index ¶
- func DeleteLine(change Change) string
- type Change
- type Group
- type Plan
- func (p *Plan) Add(file string, change Change)
- func (p *Plan) AddDeletions(sincePlan *gitutil.SincePlan, documents []asset.Document) int
- func (p *Plan) Changes(file string) []Change
- func (p *Plan) Files() []string
- func (p *Plan) Groups(fromDirectory bool) []Group
- func (p *Plan) PendingCount() int
- func (p *Plan) WriteJSON(w io.Writer, fromDirectory bool, fileArg, since string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteLine ¶
DeleteLine is the line apply --dry-run and diff print for a deletion.
Types ¶
type Change ¶
type Change struct {
Op string // "apply", "create", "update", or "delete"
Kind string
Name string
OriginOrID string
// Detail names the PrometheusRule CRD a removed alert came from. Text only.
Detail string
// Diff is the unified diff of an update, empty when nothing changed.
Diff string
// TextKind replaces Kind in text output when set. diff prints the kind
// apply prints, and its JSON carries the declared kind, as apply --dry-run
// does, so one PersesDashboard is "Dashboard" in text and
// "PersesDashboard" in JSON for both commands.
TextKind string
}
Change is one asset a run would apply, create, update, or delete.
func (Change) Pending ¶
Pending reports whether the change would modify Dash0. An update with no diff would not.
func (Change) TextKindName ¶
TextKindName is the kind name text output shows for the change.
type Plan ¶
type Plan struct {
// contains filtered or unexported fields
}
Plan groups changes by the file they come from.
func (*Plan) AddDeletions ¶
AddDeletions adds the assets sincePlan would delete and returns how many it added. A check rule that documents still declare is left out, because apply --since skips its deletion.
func (*Plan) Files ¶
Files returns the files in sorted order, each one's changes sorted by OriginOrID, so a surviving and a removed asset in one file show together.
func (*Plan) Groups ¶
Groups returns one group per file for a directory target. A single-file or stdin target has no file grouping to show, so it gets one group with every change sorted by OriginOrID.
func (*Plan) PendingCount ¶
PendingCount returns how many changes would modify Dash0.