deployui

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package deployui provides drift item types for the deploy command. All core drift types are defined in the driftui package and re-exported here for backwards compatibility.

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
	ActionInspect  = shared.ActionInspect
)

Re-export constants for backwards compatibility.

View Source
const (
	DriftItemTypeResource = driftui.DriftItemTypeResource
	DriftItemTypeLink     = driftui.DriftItemTypeLink
	DriftItemTypeChild    = driftui.DriftItemTypeChild
)

Constant aliases for backwards compatibility

View Source
const MaxExpandDepth = 2

MaxExpandDepth is the maximum nesting depth for expanding child blueprints.

Variables

View Source
var BuildDriftItems = driftui.BuildDriftItems

BuildDriftItems creates DriftItems from a ReconciliationCheckResult.

View Source
var HumanReadableAction = driftui.HumanReadableAction

HumanReadableAction converts a ReconciliationAction to a human-readable label.

View Source
var HumanReadableDriftType = driftui.HumanReadableDriftType

HumanReadableDriftType converts a ReconciliationType to a short uppercase label.

View Source
var HumanReadableDriftTypeLabel = driftui.HumanReadableDriftTypeLabel

HumanReadableDriftTypeLabel converts a ReconciliationType to a human-readable label.

View Source
var SortDriftItems = driftui.SortDriftItems

SortDriftItems sorts items alphabetically by name.

Functions

func BuildInstanceHierarchy

func BuildInstanceHierarchy(root *state.InstanceState, rootName string) []splitpane.Item

BuildInstanceHierarchy builds a flat list of ExportsInstanceItems from the instance state hierarchy, suitable for display in the exports view.

func BuildInstancePath

func BuildInstancePath(state *EventProcessorState, parentInstanceID, childName string) string

BuildInstancePath builds a path from instance ID to the child name. For root instance resources, returns just the name. For nested children, returns a path like "parentChild/childName".

func BuildParentChain

func BuildParentChain(state *EventProcessorState, startInstanceID string) []string

BuildParentChain constructs the path parts from the root to the given instance ID.

func BuildResourcePath

func BuildResourcePath(state *EventProcessorState, instanceID, resourceName string) string

BuildResourcePath builds a path for a resource based on its instance ID. For root instance resources, returns just the resource name. For nested resources, returns a path like "parentChild/childName/resourceName".

func ExtractResourceAFromLinkName

func ExtractResourceAFromLinkName(linkName string) string

ExtractResourceAFromLinkName extracts the first resource name from a link name (format: "resourceA::resourceB").

func ExtractResourceBFromLinkName

func ExtractResourceBFromLinkName(linkName string) string

ExtractResourceBFromLinkName extracts the second resource name from a link name (format: "resourceA::resourceB").

func GetChildChanges

func GetChildChanges(state *EventProcessorState, childName string) *changes.BlueprintChanges

GetChildChanges returns the blueprint changes for a child, if available.

func InstanceStateHasExports

func InstanceStateHasExports(instanceState *state.InstanceState) bool

InstanceStateHasExports checks if an instance state has any exports (either directly or in child blueprints).

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. This includes failed operations and rollback complete states (since a rollback means the original operation failed). Used to determine exit code for CI/CD pipelines.

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. This is used to mark pending items as skipped in real-time.

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 ProcessChildUpdate

func ProcessChildUpdate(state *EventProcessorState, data *container.ChildDeployUpdateMessage)

ProcessChildUpdate handles a child blueprint update event.

func ProcessInstanceUpdate

func ProcessInstanceUpdate(state *EventProcessorState, data *container.DeploymentUpdateMessage)

ProcessInstanceUpdate handles an instance status update event.

func ProcessLinkUpdate

func ProcessLinkUpdate(state *EventProcessorState, data *container.LinkDeployUpdateMessage)

ProcessLinkUpdate handles a link update event.

func ProcessResourceUpdate

func ProcessResourceUpdate(state *EventProcessorState, data *container.ResourceDeployUpdateMessage)

ProcessResourceUpdate handles a resource update event.

func ResourceStatusToAction

func ResourceStatusToAction(status core.ResourceStatus) string

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

func ToSplitPaneItems

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

ToSplitPaneItems converts a slice of DeployItems to splitpane.Items.

func TrackChildInstanceMapping

func TrackChildInstanceMapping(state *EventProcessorState, data *container.ChildDeployUpdateMessage)

TrackChildInstanceMapping records the mapping from a child instance ID to its name and parent.

func UpdateChildItemFromEvent

func UpdateChildItemFromEvent(item *ChildDeployItem, data *container.ChildDeployUpdateMessage)

UpdateChildItemFromEvent updates a child item with data from an event.

func UpdateLinkItemFromEvent

func UpdateLinkItemFromEvent(item *LinkDeployItem, data *container.LinkDeployUpdateMessage)

UpdateLinkItemFromEvent updates a link item with data from an event.

func UpdateResourceItemFromEvent

func UpdateResourceItemFromEvent(item *ResourceDeployItem, data *container.ResourceDeployUpdateMessage)

UpdateResourceItemFromEvent updates a resource item with data from an event.

Types

type ActionType

type ActionType = shared.ActionType

Type aliases for backwards compatibility with shared types.

type ChangeSummary

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

ChangeSummary holds counts of different change types.

type ChildDeployItem

type ChildDeployItem 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 // Set to true when deployment failed before this child was attempted
	// Changes holds the blueprint changes for this child (from staging)
	// Used to provide hierarchy for GetChildren()
	Changes *changes.BlueprintChanges
}

ChildDeployItem represents a child blueprint being deployed.

func CreateChildItem

func CreateChildItem(state *EventProcessorState, data *container.ChildDeployUpdateMessage, childPath string) *ChildDeployItem

CreateChildItem creates a new child deploy item.

func LookupOrMigrateChild

func LookupOrMigrateChild(state *EventProcessorState, path, name string) *ChildDeployItem

LookupOrMigrateChild looks up a child by path, migrating from name-based key if needed.

func (*ChildDeployItem) GetAction

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

func (*ChildDeployItem) GetChildStatus

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

func (*ChildDeployItem) SetSkipped

func (c *ChildDeployItem) SetSkipped(skipped bool)

type ConfirmDeployMsg

type ConfirmDeployMsg struct {
	Confirmed bool
}

ConfirmDeployMsg is a message to confirm deployment after staging review.

type DeployAppConfig

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

DeployAppConfig holds the configuration for creating a new deploy application.

type DeployConfigFormInitialValues

type DeployConfigFormInitialValues struct {
	InstanceName string
	InstanceID   string
	ChangesetID  string
	StageFirst   bool
	AutoApprove  bool
	AutoRollback bool
}

DeployConfigFormInitialValues holds the initial values for the deploy config form.

type DeployConfigFormModel

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

DeployConfigFormModel provides a combined form for deploy configuration.

func NewDeployConfigFormModel

func NewDeployConfigFormModel(
	initialValues DeployConfigFormInitialValues,
	styles *stylespkg.Styles,
) *DeployConfigFormModel

NewDeployConfigFormModel creates a new deploy config form model.

func (DeployConfigFormModel) Init

func (m DeployConfigFormModel) Init() tea.Cmd

Init initializes the model.

func (DeployConfigFormModel) Update

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

Update handles messages.

func (DeployConfigFormModel) View

func (m DeployConfigFormModel) View() string

View renders the model.

type DeployConfigMsg

type DeployConfigMsg struct {
	InstanceName string
	InstanceID   string
	ChangesetID  string
	StageFirst   bool
	AutoApprove  bool
	AutoRollback bool
}

DeployConfigMsg is sent when the user completes the deploy configuration form.

type DeployDetailsRenderer

type DeployDetailsRenderer struct {
	MaxExpandDepth          int
	NavigationStackDepth    int
	PreDeployInstanceState  *state.InstanceState // Instance state fetched before deployment for unchanged items
	PostDeployInstanceState *state.InstanceState // Instance state fetched after deployment completes
	Finished                bool                 // True when deployment has finished (enables spec view shortcut)
}

DeployDetailsRenderer implements splitpane.DetailsRenderer for deploy UI.

func (*DeployDetailsRenderer) RenderDetails

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

RenderDetails renders the right pane content for a selected item.

type DeployErrorMsg

type DeployErrorMsg struct {
	Err error
}

DeployErrorMsg is a message containing an error from the deployment process.

type DeployEventMsg

type DeployEventMsg types.BlueprintInstanceEvent

DeployEventMsg is a message containing a deployment event.

type DeployFooterRenderer

type DeployFooterRenderer struct {
	InstanceID          string
	InstanceName        string
	ChangesetID         string
	CurrentStatus       core.InstanceStatus
	FinalStatus         core.InstanceStatus
	FailureReasons      []string             // Legacy: kept for backwards compatibility
	ElementFailures     []ElementFailure     // Structured failures with root cause details
	InterruptedElements []InterruptedElement // Elements that were interrupted
	SuccessfulElements  []SuccessfulElement  // Elements that completed successfully
	Finished            bool
	SpinnerView         string // Current spinner frame for animated "Deploying" state
	HasInstanceState    bool   // Whether instance state is available (enables exports view)
	HasPreRollbackState bool   // Whether pre-rollback state is available (enables pre-rollback view)
}

DeployFooterRenderer implements splitpane.FooterRenderer for deploy UI.

func (*DeployFooterRenderer) RenderFooter

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

RenderFooter renders the deploy-specific footer.

type DeployItem

type DeployItem struct {
	Type        ItemType
	Resource    *ResourceDeployItem
	Child       *ChildDeployItem
	Link        *LinkDeployItem
	ParentChild string // For nested items
	Depth       int
	// Path is the full path to this item (e.g., "childA/childB/resourceName")
	// Used for unique keying in the shared lookup maps.
	Path string
	// Changes holds the blueprint changes for this item (for children)
	// Used to provide hierarchy for GetChildren()
	Changes *changes.BlueprintChanges
	// InstanceState holds the instance state for this level of the hierarchy.
	// Used to provide resource state data for items with no changes and
	// to populate the navigation tree with all instance elements.
	InstanceState *state.InstanceState
	// contains filtered or unexported fields
}

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

func BuildItemsFromChangeset

func BuildItemsFromChangeset(
	changesetChanges *changes.BlueprintChanges,
	resourcesByName map[string]*ResourceDeployItem,
	childrenByName map[string]*ChildDeployItem,
	linksByName map[string]*LinkDeployItem,
	instanceState *state.InstanceState,
) []DeployItem

BuildItemsFromChangeset creates the initial item list from changeset data. This provides the proper hierarchy (resources, children, links) from the start. It also includes items with no changes from the instance state.

func MakeChildDeployItem

func MakeChildDeployItem(
	child *ChildDeployItem,
	childChanges *changes.BlueprintChanges,
	instanceState *state.InstanceState,
	childrenByName map[string]*ChildDeployItem,
	resourcesByName map[string]*ResourceDeployItem,
	linksByName map[string]*LinkDeployItem,
) DeployItem

MakeChildDeployItem creates a DeployItem for a child blueprint with lookup maps. This allows child blueprints to properly navigate and display their nested items.

func (*DeployItem) BuildChildPath

func (i *DeployItem) BuildChildPath(childName string) string

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

func (*DeployItem) CanDrillDown

func (i *DeployItem) CanDrillDown() bool

CanDrillDown returns true if the item can be drilled into. A child can be drilled into if it has either Changes (from changeset) or InstanceState (for unchanged items).

func (*DeployItem) ChildrenByName

func (i *DeployItem) ChildrenByName() map[string]*ChildDeployItem

ChildrenByName returns the internal children lookup map.

func (*DeployItem) GetAction

func (i *DeployItem) GetAction() string

GetAction returns the action badge text.

func (*DeployItem) GetChildren

func (i *DeployItem) GetChildren() []splitpane.Item

GetChildren returns child items when expanded. Uses the Changes data from the changeset to build the hierarchy, and also includes unchanged items from InstanceState.

func (*DeployItem) GetDefaultChildAction

func (i *DeployItem) GetDefaultChildAction() ActionType

GetDefaultChildAction returns the action to use for child items created from state. If the parent has ActionInspect, children inherit that; otherwise ActionNoChange.

func (*DeployItem) GetDepth

func (i *DeployItem) GetDepth() int

GetDepth returns the nesting depth for indentation.

func (*DeployItem) GetID

func (i *DeployItem) GetID() string

GetID returns a unique identifier for the item.

func (*DeployItem) GetIcon

func (i *DeployItem) GetIcon(selected bool) string

GetIcon returns a status icon for the item.

func (*DeployItem) GetIconStyled

func (i *DeployItem) GetIconStyled(s *styles.Styles, styled bool) string

GetIconStyled returns a styled icon for the item.

func (*DeployItem) GetItemType

func (i *DeployItem) GetItemType() string

GetItemType returns the type for section grouping.

func (*DeployItem) GetLinkResourceNames

func (i *DeployItem) GetLinkResourceNames() (string, string)

GetLinkResourceNames returns the resource names for a link item.

func (*DeployItem) GetName

func (i *DeployItem) GetName() string

GetName returns the display name for the item.

func (*DeployItem) GetParentID

func (i *DeployItem) GetParentID() string

GetParentID returns the parent item ID.

func (*DeployItem) GetResourceGroup

func (i *DeployItem) GetResourceGroup() *shared.ResourceGroup

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

func (*DeployItem) IsDirectChild

func (i *DeployItem) IsDirectChild(path, pathPrefix string) bool

IsDirectChild checks if the given path represents a direct child of the pathPrefix. A direct child has exactly one path component after the prefix. Example: pathPrefix="parent/", path="parent/child" -> true Example: pathPrefix="parent/", path="parent/child/grandchild" -> false

func (*DeployItem) IsExpandable

func (i *DeployItem) IsExpandable() bool

IsExpandable returns true if the item can be expanded in-place. A child can be expanded if it has either Changes (from changeset) or InstanceState (for unchanged items).

func (*DeployItem) LinksByName

func (i *DeployItem) LinksByName() map[string]*LinkDeployItem

LinksByName returns the internal links lookup map.

func (*DeployItem) ResourcesByName

func (i *DeployItem) ResourcesByName() map[string]*ResourceDeployItem

ResourcesByName returns the internal resources lookup map.

type DeployModel

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

DeployModel is the model for the deploy view with real-time split-pane.

func NewDeployModel

func NewDeployModel(cfg DeployModelConfig) DeployModel

NewDeployModel creates a new deploy model.

func (*DeployModel) Err

func (m *DeployModel) Err() error

Err returns the error stored in the model.

func (*DeployModel) FinalStatus

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

FinalStatus returns the final instance status after deployment.

func (DeployModel) Init

func (m DeployModel) Init() tea.Cmd

Init initializes the deploy model.

func (*DeployModel) Items

func (m *DeployModel) Items() []DeployItem

Items returns the deployment items.

func (*DeployModel) ResourcesByName

func (m *DeployModel) ResourcesByName() map[string]*ResourceDeployItem

ResourcesByName returns the resources lookup map.

func (*DeployModel) SetChangesetChanges

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

SetChangesetChanges sets the changeset changes and rebuilds items from them. This is called when staging completes with the full changeset data.

func (*DeployModel) SetPreDeployInstanceState

func (m *DeployModel) SetPreDeployInstanceState(instanceState *state.InstanceState)

SetPreDeployInstanceState sets the pre-deployment instance state. This is called when staging completes with the instance state for displaying unchanged items.

func (DeployModel) Update

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

Update handles messages for the deploy model.

func (DeployModel) View

func (m DeployModel) View() string

View renders the deploy model.

type DeployModelConfig

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

DeployModelConfig holds the configuration for creating a new DeployModel.

type DeploySectionGrouper

type DeploySectionGrouper struct {
	shared.SectionGrouper
}

DeploySectionGrouper implements splitpane.SectionGrouper for deploy UI.

type DeployStagingFooterRenderer

type DeployStagingFooterRenderer struct {
	ChangesetID      string
	Summary          ChangeSummary
	HasExportChanges bool
	CodeOnlyDenied   bool
	CodeOnlyReasons  []string
}

DeployStagingFooterRenderer implements splitpane.FooterRenderer for the staging view when used in the deploy command flow. It shows a confirmation prompt instead of the standalone staging footer.

func (*DeployStagingFooterRenderer) RenderFooter

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

RenderFooter renders the footer with staging summary and confirmation prompt. The footer height matches the original StageFooterRenderer for consistent split pane layout.

type DeployStartedMsg

type DeployStartedMsg struct {
	InstanceID string
}

DeployStartedMsg is a message indicating that deployment has started.

type DeployStateRefreshTickMsg

type DeployStateRefreshTickMsg struct{}

DeployStateRefreshTickMsg triggers a periodic state refresh during deployment.

type DeployStateRefreshedMsg

type DeployStateRefreshedMsg struct {
	InstanceState *state.InstanceState
}

DeployStateRefreshedMsg is sent when the instance state has been refreshed during deployment.

type DeployStreamClosedMsg

type DeployStreamClosedMsg struct{}

DeployStreamClosedMsg is sent when the deploy event stream is closed. This typically happens due to a stream timeout or the connection being dropped.

type DestroyChangesetErrorMsg

type DestroyChangesetErrorMsg struct{}

DestroyChangesetErrorMsg is sent when deployment fails because the changeset was created for a destroy operation.

type DriftDetailsRenderer

type DriftDetailsRenderer = driftui.DriftDetailsRenderer

Type aliases for backwards compatibility

type DriftFooterRenderer

type DriftFooterRenderer = driftui.DriftFooterRenderer

Type aliases for backwards compatibility

type DriftItem

type DriftItem = driftui.DriftItem

Type aliases for backwards compatibility

type DriftItemType

type DriftItemType = driftui.DriftItemType

Type aliases for backwards compatibility

type DriftSectionGrouper

type DriftSectionGrouper = driftui.DriftSectionGrouper

Type aliases for backwards compatibility

type ElementFailure

type ElementFailure = shared.ElementFailure

Re-export shared result types for backwards compatibility.

type EventProcessorState

type EventProcessorState struct {
	InstanceID              string
	ResourcesByName         map[string]*ResourceDeployItem
	ChildrenByName          map[string]*ChildDeployItem
	LinksByName             map[string]*LinkDeployItem
	InstanceIDToChildName   map[string]string
	InstanceIDToParentID    map[string]string
	ChildNameToInstancePath map[string]string
	ChangesetChanges        *changes.BlueprintChanges
	FooterRenderer          *DeployFooterRenderer
	Items                   []DeployItem
}

EventProcessorState contains the state needed for event processing operations. This allows the event processing helper functions to be tested independently.

func NewEventProcessorState

func NewEventProcessorState(instanceID string) *EventProcessorState

NewEventProcessorState creates a new EventProcessorState with initialized maps.

type ExportsDetailsRenderer

type ExportsDetailsRenderer struct{}

ExportsDetailsRenderer renders export details for a selected instance.

func (*ExportsDetailsRenderer) RenderDetails

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

RenderDetails renders the export details for the selected instance.

type ExportsFooterRenderer

type ExportsFooterRenderer struct{}

ExportsFooterRenderer renders the footer for the exports view.

func (*ExportsFooterRenderer) RenderFooter

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

RenderFooter renders the exports view footer with navigation hints.

type ExportsHeaderRenderer

type ExportsHeaderRenderer struct {
	InstanceName string
}

ExportsHeaderRenderer renders the header for the exports view.

func (*ExportsHeaderRenderer) RenderHeader

func (r *ExportsHeaderRenderer) RenderHeader(model *splitpane.Model, s *styles.Styles) string

RenderHeader renders the exports view header.

type ExportsInstanceItem

type ExportsInstanceItem struct {
	// Name is the display name for the instance
	Name string
	// Path is the full path for lookup (e.g., "childA/childB")
	Path string
	// InstanceID is the blueprint instance ID
	InstanceID string
	// ExportCount is the number of exports for this instance
	ExportCount int
	// Depth is the nesting level for indentation
	Depth int
	// InstanceState holds the full instance state for export access
	InstanceState *state.InstanceState
}

ExportsInstanceItem represents a blueprint instance in the exports view. It can be the root instance or any nested child blueprint instance.

func (*ExportsInstanceItem) CanDrillDown

func (i *ExportsInstanceItem) CanDrillDown() bool

CanDrillDown indicates whether the item can be drilled into.

func (*ExportsInstanceItem) GetAction

func (i *ExportsInstanceItem) GetAction() string

GetAction returns action badge text.

func (*ExportsInstanceItem) GetChildren

func (i *ExportsInstanceItem) GetChildren() []splitpane.Item

GetChildren returns child items (none for exports view).

func (*ExportsInstanceItem) GetDepth

func (i *ExportsInstanceItem) GetDepth() int

GetDepth returns the nesting depth for indentation.

func (*ExportsInstanceItem) GetID

func (i *ExportsInstanceItem) GetID() string

GetID returns a unique identifier for the item.

func (*ExportsInstanceItem) GetIcon

func (i *ExportsInstanceItem) GetIcon(selected bool) string

GetIcon returns a status icon for the item.

func (*ExportsInstanceItem) GetItemType

func (i *ExportsInstanceItem) GetItemType() string

GetItemType returns the type for section grouping.

func (*ExportsInstanceItem) GetName

func (i *ExportsInstanceItem) GetName() string

GetName returns the display name for the item.

func (*ExportsInstanceItem) GetParentID

func (i *ExportsInstanceItem) GetParentID() string

GetParentID returns the parent item ID.

func (*ExportsInstanceItem) IsExpandable

func (i *ExportsInstanceItem) IsExpandable() bool

IsExpandable indicates whether the item can be expanded in-place.

type ExportsModel

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

ExportsModel is a Bubble Tea model for viewing blueprint instance exports. It uses a split pane with instance hierarchy on the left and export details on the right.

func NewExportsModel

func NewExportsModel(
	instanceState *state.InstanceState,
	instanceName string,
	width, height int,
	s *styles.Styles,
) ExportsModel

NewExportsModel creates a new exports view model.

func (ExportsModel) HasExports

func (m ExportsModel) HasExports() bool

HasExports returns true if any instance in the hierarchy has exports.

func (ExportsModel) Init

func (m ExportsModel) Init() tea.Cmd

Init implements tea.Model.

func (ExportsModel) Update

func (m ExportsModel) Update(msg tea.Msg) (ExportsModel, tea.Cmd)

Update implements tea.Model.

func (*ExportsModel) UpdateInstanceState

func (m *ExportsModel) UpdateInstanceState(instanceState *state.InstanceState)

UpdateInstanceState updates the exports view with new instance state. This allows the exports view to dynamically update during deployment.

func (ExportsModel) View

func (m ExportsModel) View() string

View implements tea.Model.

type InstanceResolvedMsg

type InstanceResolvedMsg struct {
	InstanceID   string
	InstanceName string
}

InstanceResolvedMsg is a message indicating instance identifiers have been resolved. This is used to handle the case where a user provides an instance name for a new deployment and we need to resolve it to an empty instance ID (since the instance doesn't exist yet).

type InterruptedElement

type InterruptedElement = shared.InterruptedElement

Re-export shared result types for backwards compatibility.

type ItemType

type ItemType = shared.ItemType

Type aliases for backwards compatibility with shared types.

type LinkDeployItem

type LinkDeployItem 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 // Set to true when deployment failed before this link was attempted
}

LinkDeployItem represents a link being deployed.

func LookupOrMigrateLink(state *EventProcessorState, path, name string) *LinkDeployItem

LookupOrMigrateLink looks up a link by path, migrating from name-based key if needed.

func (*LinkDeployItem) GetAction

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

func (*LinkDeployItem) GetLinkStatus

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

func (*LinkDeployItem) SetSkipped

func (l *LinkDeployItem) SetSkipped(skipped bool)

type MainModel

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

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

func NewDeployApp

func NewDeployApp(cfg DeployAppConfig) (*MainModel, error)

NewDeployApp creates a new deploy application with the given configuration.

func (*MainModel) ChangesetID

func (m *MainModel) ChangesetID() string

ChangesetID returns the changeset ID.

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

func (m *MainModel) InstanceName() string

InstanceName returns the instance name.

func (*MainModel) StageFirst

func (m *MainModel) StageFirst() bool

StageFirst returns whether staging should happen before deployment.

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 PostDeployInstanceStateFetchedMsg

type PostDeployInstanceStateFetchedMsg struct {
	InstanceState *state.InstanceState
}

PostDeployInstanceStateFetchedMsg is sent when instance state has been fetched after deployment.

type PreDeployInstanceStateFetchedMsg

type PreDeployInstanceStateFetchedMsg struct {
	InstanceState *state.InstanceState
}

PreDeployInstanceStateFetchedMsg is sent when instance state has been fetched before deployment. This is used for direct deployments (without staging) to populate unchanged items.

type ResourceDeployItem

type ResourceDeployItem 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 // Set to true when deployment failed before this resource was attempted
	// Changes holds the provider.Changes data from the changeset, providing access to
	// AppliedResourceInfo.CurrentResourceState for pre-deployment outputs and spec data.
	Changes *provider.Changes
	// ResourceState holds the pre-deployment resource state from the instance.
	// Used for displaying outputs and spec data for items with no changes or before deployment completes.
	ResourceState *state.ResourceState
}

ResourceDeployItem represents a resource being deployed with real-time status.

func LookupOrMigrateResource

func LookupOrMigrateResource(state *EventProcessorState, path, name string) *ResourceDeployItem

LookupOrMigrateResource looks up a resource by path, migrating from name-based key if needed.

func (*ResourceDeployItem) GetAction

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

func (*ResourceDeployItem) GetResourceStatus

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

func (*ResourceDeployItem) SetSkipped

func (r *ResourceDeployItem) SetSkipped(skipped bool)

type ResultCollector

type ResultCollector struct {
	ResourcesByName map[string]*ResourceDeployItem
	ChildrenByName  map[string]*ChildDeployItem
	LinksByName     map[string]*LinkDeployItem
	Successful      []SuccessfulElement
	Failures        []ElementFailure
	Interrupted     []InterruptedElement
}

ResultCollector encapsulates the state needed for collecting deployment results. This pattern reduces parameter counts by grouping related data together. Exported for testing purposes.

func (*ResultCollector) CollectChildResult

func (c *ResultCollector) CollectChildResult(item *ChildDeployItem, path string)

func (*ResultCollector) CollectFromChanges

func (c *ResultCollector) CollectFromChanges(blueprintChanges *changes.BlueprintChanges, parentPath, pathPrefix string)

collectFromChanges recursively collects results from nested blueprint changes. The pathPrefix is used for map key lookups (e.g., "parentChild/childName"), while parentPath is used for display (e.g., "children.parentChild::children.childName").

func (*ResultCollector) CollectFromItems

func (c *ResultCollector) CollectFromItems(items []DeployItem, parentPath string)

collectFromItems recursively collects successful operations, failures, and interruptions from items, building full paths as it traverses the hierarchy.

func (*ResultCollector) CollectLinkResult

func (c *ResultCollector) CollectLinkResult(item *LinkDeployItem, path string)

func (*ResultCollector) CollectResourceResult

func (c *ResultCollector) CollectResourceResult(item *ResourceDeployItem, path string)

type StagingFooterOption

type StagingFooterOption func(*DeployStagingFooterRenderer)

StagingFooterOption configures optional fields on DeployStagingFooterRenderer.

func WithCodeOnlyDenial

func WithCodeOnlyDenial(reasons []string) StagingFooterOption

WithCodeOnlyDenial marks the footer as showing a code-only approval denial with the given reasons.

type StartDeployMsg

type StartDeployMsg struct{}

StartDeployMsg is a message to initiate deployment.

type SuccessfulElement

type SuccessfulElement = shared.SuccessfulElement

Re-export shared result types for backwards compatibility.

Jump to

Keyboard shortcuts

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