destroyui

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ItemTypeResource = shared.ItemTypeResource
	ItemTypeChild    = shared.ItemTypeChild
	ItemTypeLink     = shared.ItemTypeLink

	ActionCreate   = shared.ActionCreate
	ActionUpdate   = shared.ActionUpdate
	ActionDelete   = shared.ActionDelete
	ActionRecreate = shared.ActionRecreate
	ActionNoChange = shared.ActionNoChange
)

Re-export constants.

View Source
const MaxExpandDepth = 2

MaxExpandDepth is the maximum nesting depth for expanding child blueprints.

Variables

This section is empty.

Functions

func BuildDriftItems

func BuildDriftItems(result *container.ReconciliationCheckResult, instanceState *state.InstanceState) []splitpane.Item

BuildDriftItems builds split-pane items from drift reconciliation results.

func InstanceStatusToAction

func InstanceStatusToAction(status core.InstanceStatus) string

InstanceStatusToAction converts an instance status to a human-readable action string.

func IsFailedInstanceStatus

func IsFailedInstanceStatus(status core.InstanceStatus) bool

IsFailedInstanceStatus returns true if the child blueprint is in a failed state.

func IsFailedLinkStatus

func IsFailedLinkStatus(status core.LinkStatus) bool

IsFailedLinkStatus returns true if the link is in a failed state.

func IsFailedResourceStatus

func IsFailedResourceStatus(status core.ResourceStatus) bool

IsFailedResourceStatus returns true if the resource is in a failed state.

func IsFailedStatus

func IsFailedStatus(status core.InstanceStatus) bool

IsFailedStatus returns true if the instance status should result in a non-zero exit code.

func IsInProgressInstanceStatus

func IsInProgressInstanceStatus(status core.InstanceStatus) bool

IsInProgressInstanceStatus returns true if the instance status indicates the child blueprint is still being processed (not in a terminal state).

func IsInProgressLinkStatus

func IsInProgressLinkStatus(status core.LinkStatus) bool

IsInProgressLinkStatus returns true if the link status indicates the link is still being processed (not in a terminal state).

func IsInProgressResourceStatus

func IsInProgressResourceStatus(status core.ResourceStatus) bool

IsInProgressResourceStatus returns true if the resource status indicates the resource is still being processed (not in a terminal state).

func IsInterruptedInstanceStatus

func IsInterruptedInstanceStatus(status core.InstanceStatus) bool

IsInterruptedInstanceStatus returns true if the child blueprint was interrupted.

func IsInterruptedLinkStatus

func IsInterruptedLinkStatus(status core.LinkStatus) bool

IsInterruptedLinkStatus returns true if the link was interrupted.

func IsInterruptedResourceStatus

func IsInterruptedResourceStatus(status core.ResourceStatus) bool

IsInterruptedResourceStatus returns true if the resource was interrupted.

func IsRollingBackOrFailedStatus

func IsRollingBackOrFailedStatus(status core.InstanceStatus) bool

IsRollingBackOrFailedStatus returns true if the instance status indicates a rollback is in progress or has completed/failed.

func IsRollingBackStatus

func IsRollingBackStatus(status core.InstanceStatus) bool

IsRollingBackStatus returns true if the instance is actively rolling back.

func IsSuccessInstanceStatus

func IsSuccessInstanceStatus(status core.InstanceStatus) bool

IsSuccessInstanceStatus returns true if the child blueprint completed successfully.

func IsSuccessLinkStatus

func IsSuccessLinkStatus(status core.LinkStatus) bool

IsSuccessLinkStatus returns true if the link completed successfully.

func IsSuccessResourceStatus

func IsSuccessResourceStatus(status core.ResourceStatus) bool

IsSuccessResourceStatus returns true if the resource completed successfully.

func LinkStatusToAction

func LinkStatusToAction(status core.LinkStatus) string

LinkStatusToAction converts a link status to a human-readable action string.

func ResourceStatusToAction

func ResourceStatusToAction(status core.ResourceStatus) string

ResourceStatusToAction converts a resource status to a human-readable action string.

func ToSplitPaneItems

func ToSplitPaneItems(items []DestroyItem) []splitpane.Item

ToSplitPaneItems converts DestroyItems to splitpane.Items.

Types

type ActionType

type ActionType = shared.ActionType

Type aliases for shared types.

type ChangeSummary

type ChangeSummary struct {
	Create   int
	Update   int
	Delete   int
	Recreate int
}

ChangeSummary holds counts of different change types.

type ChangesetFetchedMsg

type ChangesetFetchedMsg struct {
	Changes *changes.BlueprintChanges
}

ChangesetFetchedMsg is sent when changeset changes have been fetched.

type ChildDestroyItem

type ChildDestroyItem struct {
	Name             string
	ParentInstanceID string
	ChildInstanceID  string
	Action           ActionType
	Status           core.InstanceStatus
	FailureReasons   []string
	Group            int
	Durations        *state.InstanceCompletionDuration
	Timestamp        int64
	Depth            int
	Skipped          bool
	Changes          *changes.BlueprintChanges
}

ChildDestroyItem represents a child blueprint being destroyed.

func (*ChildDestroyItem) GetAction

func (c *ChildDestroyItem) GetAction() shared.ActionType

func (*ChildDestroyItem) GetChildStatus

func (c *ChildDestroyItem) GetChildStatus() core.InstanceStatus

func (*ChildDestroyItem) SetSkipped

func (c *ChildDestroyItem) SetSkipped(skipped bool)

type ConfirmDestroyMsg

type ConfirmDestroyMsg struct {
	Confirmed bool
}

ConfirmDestroyMsg is a message to confirm destroy after staging review.

type DeployChangesetErrorMsg

type DeployChangesetErrorMsg struct{}

DeployChangesetErrorMsg is sent when destroy fails because the changeset was created for a deploy operation, not a destroy operation.

type DestroyAppConfig

type DestroyAppConfig struct {
	DestroyEngine          engine.DeployEngine
	Logger                 *zap.Logger
	ChangesetID            string
	InstanceID             string
	InstanceName           string
	BlueprintFile          string
	IsDefaultBlueprintFile bool
	Force                  bool
	StageFirst             bool
	AutoApprove            bool
	SkipPrompts            bool
	Styles                 *stylespkg.Styles
	Headless               bool
	HeadlessWriter         io.Writer
	JSONMode               bool
	Preflight              tea.Model
}

DestroyAppConfig holds the configuration for creating a new destroy application.

type DestroyConfigFormInitialValues

type DestroyConfigFormInitialValues struct {
	InstanceName string
	InstanceID   string
	ChangesetID  string
	StageFirst   bool
	AutoApprove  bool
}

DestroyConfigFormInitialValues holds the initial values for the destroy config form.

type DestroyConfigFormModel

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

DestroyConfigFormModel provides a combined form for destroy configuration.

func NewDestroyConfigFormModel

func NewDestroyConfigFormModel(
	initialValues DestroyConfigFormInitialValues,
	styles *stylespkg.Styles,
) *DestroyConfigFormModel

NewDestroyConfigFormModel creates a new destroy config form model.

func (DestroyConfigFormModel) Init

func (m DestroyConfigFormModel) Init() tea.Cmd

Init initializes the model.

func (DestroyConfigFormModel) Update

func (m DestroyConfigFormModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages.

func (DestroyConfigFormModel) View

func (m DestroyConfigFormModel) View() string

View renders the model.

type DestroyConfigMsg

type DestroyConfigMsg struct {
	InstanceName string
	InstanceID   string
	ChangesetID  string
	StageFirst   bool
	AutoApprove  bool
}

DestroyConfigMsg is sent when the user completes the destroy configuration form.

type DestroyDetailsRenderer

type DestroyDetailsRenderer struct {
	MaxExpandDepth           int
	NavigationStackDepth     int
	PreDestroyInstanceState  *state.InstanceState
	PostDestroyInstanceState *state.InstanceState
	Finished                 bool
}

DestroyDetailsRenderer implements splitpane.DetailsRenderer for destroy UI.

func (*DestroyDetailsRenderer) RenderDetails

func (r *DestroyDetailsRenderer) RenderDetails(item splitpane.Item, width int, s *styles.Styles) string

RenderDetails renders the right pane content for a selected item.

type DestroyErrorMsg

type DestroyErrorMsg struct {
	Err error
}

DestroyErrorMsg is a message containing an error from the destroy process.

type DestroyEventMsg

type DestroyEventMsg types.BlueprintInstanceEvent

DestroyEventMsg is a message containing a destroy event.

type DestroyFooterRenderer

type DestroyFooterRenderer struct {
	InstanceID          string
	InstanceName        string
	ChangesetID         string
	CurrentStatus       core.InstanceStatus
	FinalStatus         core.InstanceStatus
	Finished            bool
	SpinnerView         string
	HasInstanceState    bool
	DestroyedElements   []DestroyedElement
	ElementFailures     []ElementFailure
	InterruptedElements []InterruptedElement
}

DestroyFooterRenderer renders the footer for the destroy split-pane.

func (*DestroyFooterRenderer) RenderFooter

func (r *DestroyFooterRenderer) RenderFooter(model *splitpane.Model, s *styles.Styles) string

RenderFooter renders the footer content.

type DestroyItem

type DestroyItem struct {
	Type          ItemType
	Resource      *ResourceDestroyItem
	Child         *ChildDestroyItem
	Link          *LinkDestroyItem
	ParentChild   string
	Depth         int
	Path          string
	Changes       *changes.BlueprintChanges
	InstanceState *state.InstanceState
	// contains filtered or unexported fields
}

DestroyItem is the unified item type for the split-pane.

func (*DestroyItem) AppendChildItems

func (d *DestroyItem) AppendChildItems(items []splitpane.Item, parentSkipped bool) []splitpane.Item

AppendChildItems adds child blueprint items from this child's changes to the list.

func (*DestroyItem) AppendResourceItems

func (d *DestroyItem) AppendResourceItems(items []splitpane.Item, parentSkipped bool) []splitpane.Item

AppendResourceItems adds resource items from this child's changes to the list.

func (*DestroyItem) BuildChildPath

func (d *DestroyItem) BuildChildPath(childName string) string

BuildChildPath builds a path for a child element based on this item's path.

func (*DestroyItem) CanDrillDown

func (d *DestroyItem) CanDrillDown() bool

CanDrillDown returns true if the item can be drilled into.

func (*DestroyItem) GetAction

func (d *DestroyItem) GetAction() string

GetAction returns the action badge text.

func (*DestroyItem) GetChildren

func (d *DestroyItem) GetChildren() []splitpane.Item

GetChildren returns child items when expanded.

func (*DestroyItem) GetDepth

func (d *DestroyItem) GetDepth() int

GetDepth returns the nesting depth for indentation.

func (*DestroyItem) GetID

func (d *DestroyItem) GetID() string

GetID returns a unique identifier for the item.

func (*DestroyItem) GetIcon

func (d *DestroyItem) GetIcon(selected bool) string

GetIcon returns a status icon for the item.

func (*DestroyItem) GetIconStyled

func (d *DestroyItem) GetIconStyled(s *styles.Styles, styled bool) string

GetIconStyled returns a styled icon for the item.

func (*DestroyItem) GetItemType

func (d *DestroyItem) GetItemType() string

GetItemType returns the type for section grouping.

func (*DestroyItem) GetLinkResourceNames

func (d *DestroyItem) GetLinkResourceNames() (string, string)

GetLinkResourceNames returns the resource names for a link item.

func (*DestroyItem) GetName

func (d *DestroyItem) GetName() string

GetName returns the display name for the item.

func (*DestroyItem) GetOrCreateChildItem

func (d *DestroyItem) GetOrCreateChildItem(name string, action ActionType, changes *changes.BlueprintChanges, skipped bool) *ChildDestroyItem

GetOrCreateChildItem looks up a child item from the shared map, or creates one if it doesn't exist.

func (*DestroyItem) GetOrCreateResourceItem

func (d *DestroyItem) GetOrCreateResourceItem(name string, action ActionType, skipped bool) *ResourceDestroyItem

GetOrCreateResourceItem looks up a resource item from the shared map, or creates one if it doesn't exist.

func (*DestroyItem) GetParentID

func (d *DestroyItem) GetParentID() string

GetParentID returns the parent item ID.

func (*DestroyItem) GetResourceGroup

func (d *DestroyItem) GetResourceGroup() *shared.ResourceGroup

GetResourceGroup returns the abstract resource group for this item, if any.

func (*DestroyItem) IsExpandable

func (d *DestroyItem) IsExpandable() bool

IsExpandable returns true if the item can be expanded in-place.

type DestroyModel

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

DestroyModel is the model for the destroy view with real-time split-pane.

func NewDestroyModel

func NewDestroyModel(cfg DestroyModelConfig) DestroyModel

NewDestroyModel creates a new destroy model.

func (*DestroyModel) Err

func (m *DestroyModel) Err() error

Err returns the error stored in the model.

func (*DestroyModel) FinalStatus

func (m *DestroyModel) FinalStatus() core.InstanceStatus

FinalStatus returns the final instance status after destroy.

func (*DestroyModel) Force

func (m *DestroyModel) Force() bool

Force returns whether force mode is enabled.

func (DestroyModel) Init

func (m DestroyModel) Init() tea.Cmd

Init initializes the destroy model.

func (*DestroyModel) Items

func (m *DestroyModel) Items() []DestroyItem

Items returns the destroy items.

func (*DestroyModel) ResourcesByName

func (m *DestroyModel) ResourcesByName() map[string]*ResourceDestroyItem

ResourcesByName returns the resources lookup map.

func (*DestroyModel) SetChangesetChanges

func (m *DestroyModel) SetChangesetChanges(changesetChanges *changes.BlueprintChanges)

SetChangesetChanges sets the changeset changes and rebuilds items from them.

func (*DestroyModel) SetPreDestroyInstanceState

func (m *DestroyModel) SetPreDestroyInstanceState(instanceState *state.InstanceState)

SetPreDestroyInstanceState sets the pre-destroy instance state.

func (DestroyModel) Update

func (m DestroyModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages for the destroy model.

func (DestroyModel) View

func (m DestroyModel) View() string

View renders the destroy model.

type DestroyModelConfig

type DestroyModelConfig struct {
	DestroyEngine    engine.DeployEngine
	Logger           *zap.Logger
	ChangesetID      string
	InstanceID       string
	InstanceName     string
	Force            bool
	Styles           *stylespkg.Styles
	IsHeadless       bool
	HeadlessWriter   io.Writer
	ChangesetChanges *changes.BlueprintChanges
	JSONMode         bool
}

DestroyModelConfig holds the configuration for creating a new DestroyModel.

type DestroySectionGrouper

type DestroySectionGrouper struct {
	shared.SectionGrouper
}

DestroySectionGrouper groups items into sections for the destroy UI.

type DestroyStagingFooterRenderer

type DestroyStagingFooterRenderer struct {
	ChangesetID      string
	Summary          ChangeSummary
	HasExportChanges bool
}

DestroyStagingFooterRenderer renders the footer during staging in destroy flow.

func (*DestroyStagingFooterRenderer) RenderFooter

func (r *DestroyStagingFooterRenderer) RenderFooter(model *splitpane.Model, s *styles.Styles) string

RenderFooter renders the staging confirmation footer.

type DestroyStartedMsg

type DestroyStartedMsg struct {
	InstanceID string
}

DestroyStartedMsg is a message indicating that destroy has started.

type DestroyStreamClosedMsg

type DestroyStreamClosedMsg struct{}

DestroyStreamClosedMsg is sent when the destroy event stream is closed.

type DestroyedElement

type DestroyedElement struct {
	ElementName string
	ElementPath string
	ElementType string
}

DestroyedElement represents an element that was destroyed successfully.

type DriftDetailsRenderer

type DriftDetailsRenderer = driftui.DriftDetailsRenderer

Type aliases for drift UI components from driftui package

type DriftFooterRenderer

type DriftFooterRenderer = driftui.DriftFooterRenderer

Type aliases for drift UI components from driftui package

type DriftSectionGrouper

type DriftSectionGrouper = driftui.DriftSectionGrouper

Type aliases for drift UI components from driftui package

type ElementFailure

type ElementFailure = shared.ElementFailure

Re-export shared result types for backwards compatibility.

type InstanceResolvedMsg

type InstanceResolvedMsg struct {
	InstanceID   string
	InstanceName string
}

InstanceResolvedMsg is a message indicating instance identifiers have been resolved.

type InterruptedElement

type InterruptedElement = shared.InterruptedElement

Re-export shared result types for backwards compatibility.

type ItemType

type ItemType = shared.ItemType

Type aliases for shared types.

type LinkDestroyItem

type LinkDestroyItem struct {
	LinkID               string
	LinkName             string
	ResourceAName        string
	ResourceBName        string
	Action               ActionType
	Status               core.LinkStatus
	PreciseStatus        core.PreciseLinkStatus
	FailureReasons       []string
	CurrentStageAttempt  int
	CanRetryCurrentStage bool
	Durations            *state.LinkCompletionDurations
	Timestamp            int64
	Skipped              bool
}

LinkDestroyItem represents a link being destroyed.

func (*LinkDestroyItem) GetAction

func (l *LinkDestroyItem) GetAction() shared.ActionType

func (*LinkDestroyItem) GetLinkStatus

func (l *LinkDestroyItem) GetLinkStatus() core.LinkStatus

func (*LinkDestroyItem) SetSkipped

func (l *LinkDestroyItem) SetSkipped(skipped bool)

type MainModel

type MainModel struct {
	Error error
	// contains filtered or unexported fields
}

MainModel is the top-level model for the destroy command TUI. It manages the session state and delegates to sub-models.

func NewDestroyApp

func NewDestroyApp(cfg DestroyAppConfig) (*MainModel, error)

NewDestroyApp creates a new destroy application with the given configuration.

func (MainModel) GetEngine

func (m MainModel) GetEngine() shared.InstanceLookup

GetEngine returns the engine for the InstanceResolver interface.

func (MainModel) GetInstanceID

func (m MainModel) GetInstanceID() string

GetInstanceID returns the instance ID for the InstanceResolver interface.

func (MainModel) GetInstanceName

func (m MainModel) GetInstanceName() string

GetInstanceName returns the instance name for the InstanceResolver interface.

func (MainModel) Init

func (m MainModel) Init() tea.Cmd

Init initializes the main model.

func (MainModel) Update

func (m MainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages for the main model.

func (MainModel) View

func (m MainModel) View() string

View renders the main model.

type PostDestroyInstanceStateFetchedMsg

type PostDestroyInstanceStateFetchedMsg struct {
	InstanceState *state.InstanceState
}

PostDestroyInstanceStateFetchedMsg is sent when instance state has been fetched after destroy.

type PreDestroyInstanceStateFetchedMsg

type PreDestroyInstanceStateFetchedMsg struct {
	InstanceState *state.InstanceState
}

PreDestroyInstanceStateFetchedMsg is sent when instance state has been fetched before destroy.

type ResourceDestroyItem

type ResourceDestroyItem struct {
	Name           string
	ResourceID     string
	ResourceType   string
	DisplayName    string
	Action         ActionType
	Status         core.ResourceStatus
	PreciseStatus  core.PreciseResourceStatus
	FailureReasons []string
	Attempt        int
	CanRetry       bool
	Group          int
	Durations      *state.ResourceCompletionDurations
	Timestamp      int64
	Skipped        bool
	Changes        *provider.Changes
	ResourceState  *state.ResourceState
}

ResourceDestroyItem represents a resource being destroyed with real-time status.

func (*ResourceDestroyItem) GetAction

func (r *ResourceDestroyItem) GetAction() shared.ActionType

func (*ResourceDestroyItem) GetResourceStatus

func (r *ResourceDestroyItem) GetResourceStatus() core.ResourceStatus

func (*ResourceDestroyItem) SetSkipped

func (r *ResourceDestroyItem) SetSkipped(skipped bool)

type StartDestroyMsg

type StartDestroyMsg struct{}

StartDestroyMsg is a message to initiate destroy.

Jump to

Keyboard shortcuts

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