reporting

package
v0.48.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

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

Collector receives events and routes them to renderers. Thread-safe for concurrent event emission.

func NewCollector

func NewCollector() *Collector

NewCollector creates a new Collector.

func (*Collector) AddRenderer

func (c *Collector) AddRenderer(r Renderer)

AddRenderer adds a renderer to receive events. Must be called during setup before any concurrent operations.

func (*Collector) Complete

func (c *Collector) Complete()

Complete marks collection as finished and signals renderers to flush output. Emits Complete event before closing, allowing renderers to output final state. Safe to call multiple times - subsequent calls are no-ops.

func (*Collector) Emit

func (c *Collector) Emit(event Event)

Emit sends an event to all renderers. Callers construct event structs directly and call this method.

type Complete

type Complete struct{}

Complete is emitted by collector.Complete(), signaling the end of the operation. JSON renderer outputs on this event (using nukeMode to decide format).

func (Complete) EventType

func (Complete) EventType() string

type Event

type Event interface {
	EventType() string
}

Event is the interface that all reporting events implement.

type GeneralError

type GeneralError struct {
	ResourceType string
	Description  string
	Error        string
}

GeneralError is emitted for non-resource-specific errors during execution. Examples: failed to list resources in a region, API errors, etc.

func (GeneralError) EventType

func (GeneralError) EventType() string

type NukeComplete

type NukeComplete struct{}

NukeComplete is emitted when all nuke operations are finished. Used by CLI renderer to stop progress bar and display deletion results.

func (NukeComplete) EventType

func (NukeComplete) EventType() string

type NukeProgress

type NukeProgress struct {
	ResourceType string
	Region       string
	BatchSize    int
}

NukeProgress is emitted when processing a batch of resources. Used by CLI renderer to update progress bar title.

func (NukeProgress) EventType

func (NukeProgress) EventType() string

type NukeStarted

type NukeStarted struct {
	Total int // Total resources to nuke
}

NukeStarted is emitted at the start of a nuke operation. Used by CLI renderer to initialize the progress bar.

func (NukeStarted) EventType

func (NukeStarted) EventType() string

type Renderer

type Renderer interface {
	// OnEvent is called for each event as it occurs.
	OnEvent(event Event)
}

Renderer processes events and produces output. CLI renderer outputs progressively on ScanComplete and NukeComplete. JSON renderer outputs once on Complete (emitted by collector.Complete()).

type ResourceDeleted

type ResourceDeleted struct {
	ResourceType string
	Region       string
	Identifier   string
	Success      bool
	Warning      bool   // True if failure is transient/expected (e.g., DependencyViolation)
	Error        string // Empty if success
}

ResourceDeleted is emitted after a deletion attempt. Used to build the final nuke results table.

func (ResourceDeleted) EventType

func (ResourceDeleted) EventType() string

type ResourceFound

type ResourceFound struct {
	ResourceType string
	Region       string
	Identifier   string
	Nukable      bool
	Reason       string // Why not nukable (e.g., "protected by config")
}

ResourceFound is emitted when a resource is discovered during scanning. Used to build the "found resources" table for inspect or pre-nuke display.

func (ResourceFound) EventType

func (ResourceFound) EventType() string

type ScanComplete

type ScanComplete struct{}

ScanComplete is emitted when all resource scanning is finished. Used by CLI renderer to stop spinner and display found resources table.

func (ScanComplete) EventType

func (ScanComplete) EventType() string

type ScanProgress

type ScanProgress struct {
	ResourceType string
	Region       string
}

ScanProgress is emitted during resource discovery to show scanning status. Used by CLI renderer to update spinner text.

func (ScanProgress) EventType

func (ScanProgress) EventType() string

type ScanStarted

type ScanStarted struct {
	Regions              []string
	ResourceTypes        []string
	ExcludeAfter         string // formatted time string, empty if not set
	IncludeAfter         string // formatted time string, empty if not set
	ListUnaliasedKMSKeys bool
}

ScanStarted is emitted at the beginning of AWS resource scanning. Used by CLI renderer to display query parameters. Note: GCP does not emit this event as it has no interesting query parameters to display.

func (ScanStarted) EventType

func (ScanStarted) EventType() string

Jump to

Keyboard shortcuts

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