Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseRawResourceName ¶
ParseRawResourceName parses a resource name string in the format "namespace, name, kind (apiBase)"
Types ¶
type DiffEntry ¶
type DiffEntry struct {
Path string `json:"path,omitempty"`
Original interface{} `json:"original,omitempty"`
Applied interface{} `json:"applied,omitempty"`
Type DiffEntryType `json:"type"`
Changes map[string]interface{} `json:"changes,omitempty"` // For nested changes
Payload string `json:"payload,omitempty"` // For raw diff content or line content
}
DiffEntry represents a single change in a resource
type DiffEntryType ¶
type DiffEntryType int
DiffEntryType represents the type of difference in a resource or property
const ( // EntryUnchanged indicates no change EntryUnchanged DiffEntryType = iota // EntryRemoved indicates the resource or property was removed EntryRemoved // EntryAdded indicates the resource or property was added EntryAdded // EntryModified indicates the resource or property was modified EntryModified // EntryError indicates an error occurred during the diff EntryError )
func (DiffEntryType) String ¶
func (t DiffEntryType) String() string
String returns a human-readable string representation for DiffEntryType
func (DiffEntryType) Symbol ¶
func (t DiffEntryType) Symbol() string
Symbol returns a single character representation for DiffEntryType (for visual diff)
type PlanContents ¶
type PlanContents struct {
Plan string `json:"plan"`
Op string `json:"op"`
ContentDiff []ResourceDiff `json:"content_diff"`
}
PlanContents is a common structure for both Helm and Kubernetes manifest plan contents
type ResourceDiff ¶
type ResourceDiff struct {
// Version identifier for this diff format
Version string `json:"_version"`
// Resource identification
Name string `json:"name,omitempty"`
Namespace string `json:"namespace,omitempty"`
Kind string `json:"kind,omitempty"`
ApiPath string `json:"api,omitempty"`
Resource string `json:"resource,omitempty"`
// Operation details
Operation string `json:"op,omitempty"`
Type DiffEntryType `json:"type"`
ErrorMsg string `json:"error,omitempty"`
DryRun bool `json:"dry_run,omitempty"`
// Detailed changes
Entries []DiffEntry `json:"entries"`
}
ResourceDiff represents the diff for a Kubernetes resource Used by both Helm and Kubernetes manifest implementations
func FormatResourceDiffs ¶
func FormatResourceDiffs(diffs []ResourceDiff) []ResourceDiff
FormatResourceDiffs converts all ResourceDiff objects in a slice to use line-by-line entries
func FormatToLineByLine ¶
func FormatToLineByLine(resourceDiff ResourceDiff) ResourceDiff
FormatToLineByLine converts a ResourceDiff object to use line-by-line entries This provides a more readable diff for UI presentation