preview

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteLine

func DeleteLine(change Change) string

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

func (c Change) Pending() bool

Pending reports whether the change would modify Dash0. An update with no diff would not.

func (Change) TextKindName

func (c Change) TextKindName() string

TextKindName is the kind name text output shows for the change.

type Group

type Group struct {
	File    string
	Changes []Change
}

Group is the changes of one file. File is empty for a single-file or stdin target.

type Plan

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

Plan groups changes by the file they come from.

func (*Plan) Add

func (p *Plan) Add(file string, change Change)

func (*Plan) AddDeletions

func (p *Plan) AddDeletions(sincePlan *gitutil.SincePlan, documents []asset.Document) int

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) Changes

func (p *Plan) Changes(file string) []Change

func (*Plan) Files

func (p *Plan) Files() []string

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

func (p *Plan) Groups(fromDirectory bool) []Group

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

func (p *Plan) PendingCount() int

PendingCount returns how many changes would modify Dash0.

func (*Plan) WriteJSON

func (p *Plan) WriteJSON(w io.Writer, fromDirectory bool, fileArg, since string) error

WriteJSON writes the agent-mode {path, changes} array. A single-file or stdin target is one entry keyed by fileArg. Changes that are not pending are left out, and so is a file that has no pending change.

Jump to

Keyboard shortcuts

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