Help us shape the future of Go! Take the 2026 Go Developer Survey

renderers

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SuccessEmoji = "✅"
	FailureEmoji = "❌"
	WarningEmoji = "⚠️"
)

Emoji constants for CLI output

View Source
const MaxResourcesForDetailedTable = 500

MaxResourcesForDetailedTable is the threshold above which the CLI renders a summary table (grouped by resource type and region) instead of listing every individual resource. This prevents O(n²) pterm column-width calculation from hanging the CLI with very large resource counts.

Variables

This section is empty.

Functions

func GetOutputWriter

func GetOutputWriter(outputFile string) (io.Writer, func() error, error)

GetOutputWriter returns a writer for the specified output file or stdout if empty.

Types

type CLIRenderer

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

CLIRenderer outputs results to terminal using pterm.

func NewCLIRenderer

func NewCLIRenderer(writer io.Writer) *CLIRenderer

NewCLIRenderer creates a CLI renderer with an active spinner.

func (*CLIRenderer) OnEvent

func (r *CLIRenderer) OnEvent(event reporting.Event)

OnEvent routes events to appropriate handlers. Terminal events (ScanComplete for inspect, NukeComplete for nuke) trigger final output.

type GeneralError

type GeneralError struct {
	ResourceType string `json:"resource_type"`
	Description  string `json:"description"`
	Error        string `json:"error"`
}

GeneralError represents a general error in JSON output.

type InspectOutput

type InspectOutput struct {
	Timestamp time.Time      `json:"timestamp"`
	Command   string         `json:"command"`
	Query     QueryParams    `json:"query"`
	Resources []ResourceInfo `json:"resources"`
	Errors    []GeneralError `json:"general_errors,omitempty"`
	Summary   InspectSummary `json:"summary"`
}

InspectOutput represents the JSON output structure for inspect commands.

type InspectSummary

type InspectSummary struct {
	TotalResources int            `json:"total_resources"`
	Nukable        int            `json:"nukable"`
	NonNukable     int            `json:"non_nukable"`
	GeneralErrors  int            `json:"general_errors"`
	ByType         map[string]int `json:"by_type"`
	ByRegion       map[string]int `json:"by_region"`
}

InspectSummary provides summary statistics for inspection results.

type JSONRenderer

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

JSONRenderer outputs results as JSON. Output is triggered by Complete event (emitted when collector.Complete() is called). Uses nukeMode to determine output format: NukeOutput if nuke occurred, InspectOutput otherwise.

func NewJSONRenderer

func NewJSONRenderer(writer io.Writer, cfg JSONRendererConfig) *JSONRenderer

NewJSONRenderer creates a JSON renderer.

func (*JSONRenderer) OnEvent

func (r *JSONRenderer) OnEvent(event reporting.Event)

OnEvent collects events and outputs JSON on Complete.

type JSONRendererConfig

type JSONRendererConfig struct {
	Command string
	Query   *QueryParams
	Regions []string
}

JSONRendererConfig holds configuration for the JSON renderer.

type NukeOutput

type NukeOutput struct {
	Timestamp time.Time          `json:"timestamp"`
	Command   string             `json:"command"`
	Regions   []string           `json:"regions,omitempty"`
	Found     []ResourceInfo     `json:"found"`
	Resources []NukeResourceInfo `json:"resources"`
	Errors    []GeneralError     `json:"general_errors,omitempty"`
	Summary   NukeSummary        `json:"summary"`
}

NukeOutput represents the JSON output structure for nuke commands.

type NukeResourceInfo

type NukeResourceInfo struct {
	ResourceType string `json:"resource_type"`
	Region       string `json:"region"`
	Identifier   string `json:"identifier"`
	Status       string `json:"status"` // "deleted", "failed", or "warned"
	Error        string `json:"error,omitempty"`
}

NukeResourceInfo represents information about a resource deletion attempt.

type NukeSummary

type NukeSummary struct {
	Found         int `json:"found"`
	Total         int `json:"total"`
	Deleted       int `json:"deleted"`
	Failed        int `json:"failed"`
	Warned        int `json:"warned"`
	GeneralErrors int `json:"general_errors"`
}

NukeSummary provides summary statistics for nuke operation results.

type QueryParams

type QueryParams struct {
	Regions              []string   `json:"regions"`
	ResourceTypes        []string   `json:"resource_types,omitempty"`
	ExcludeAfter         *time.Time `json:"exclude_after,omitempty"`
	IncludeAfter         *time.Time `json:"include_after,omitempty"`
	ListUnaliasedKMSKeys bool       `json:"list_unaliased_kms_keys"`
}

QueryParams represents the query parameters used for resource inspection.

type ResourceInfo

type ResourceInfo struct {
	ResourceType string `json:"resource_type"`
	Region       string `json:"region"`
	Identifier   string `json:"identifier"`
	Nukable      bool   `json:"nukable"`
	Reason       string `json:"reason,omitempty"`
}

ResourceInfo represents information about a single cloud resource.

Jump to

Keyboard shortcuts

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