Documentation
¶
Overview ¶
Package shared provides common types and utilities for deployment TUI components.
This file defines the abstract resource grouping mechanism used to group concrete cloud resources under their abstract source types when a transformer plugin has expanded abstract resources.
Index ¶
- Constants
- func ActionIcon(action ActionType) string
- func BlueprintSourceFromPath(blueprintFile string) string
- func BuildDocumentInfo(source, blueprintFile string) (types.BlueprintDocumentInfo, error)
- func BuildElementPath(parentPath, elementType, elementName string) string
- func BuildHTTPSDocumentInfo(blueprintFile string) (types.BlueprintDocumentInfo, error)
- func BuildIntermediaryActions(changes map[string]*container.IntermediaryReconcileResult) map[string]*types.IntermediaryReconcileActionPayload
- func BuildLinkActions(links []container.LinkReconcileResult) []types.LinkReconcileActionPayload
- func BuildLocalFileDocumentInfo(blueprintFile string) (types.BlueprintDocumentInfo, error)
- func BuildMapKey(prefix, name string) string
- func BuildObjectStorageDocumentInfo(blueprintFile, scheme string) types.BlueprintDocumentInfo
- func BuildResourceActions(resources []container.ResourceReconcileResult) []types.ResourceReconcileActionPayload
- func DispatchBlueprintEvent(event *types.BlueprintInstanceEvent, handlers BlueprintEventHandlers) bool
- func ExtractResourceCategory(meta *state.ResourceMetadataState) string
- func FindChildInstanceIDByPath(instanceState *state.InstanceState, path string) string
- func FindLinkIDByPath(instanceState *state.InstanceState, path, linkName string) string
- func FindResourceIDByPath(instanceState *state.InstanceState, path, resourceName string) string
- func FindResourceStateByName(instanceState *state.InstanceState, name string) *state.ResourceState
- func FormatLinkStatus(status core.LinkStatus) string
- func FormatPreciseLinkStatus(status core.PreciseLinkStatus) string
- func FormatPreciseResourceStatus(status core.PreciseResourceStatus) string
- func GetEffectiveInstanceID(instanceID, instanceName string) string
- func GroupHeadlessResources(resources []HeadlessResourceInfo) ([]HeadlessResourceGroup, []HeadlessResourceInfo)
- func InstanceStatusHeadlessIcon(status core.InstanceStatus) string
- func InstanceStatusHeadlessText(status core.InstanceStatus) string
- func InstanceStatusIcon(status core.InstanceStatus) string
- func IsPendingChildStatus(status core.InstanceStatus) bool
- func IsPendingLinkStatus(status core.LinkStatus) bool
- func IsPendingResourceStatus(status core.ResourceStatus) bool
- func JoinPath(parts []string) string
- func LinkStatusHeadlessIcon(status core.LinkStatus) string
- func LinkStatusHeadlessText(status core.LinkStatus) string
- func LinkStatusIcon(status core.LinkStatus) string
- func LookupByKey[T any](m map[string]*T, pathKey, name string) *T
- func MarkPendingChildrenAsSkipped[T SkippableChild](children map[string]T)
- func MarkPendingLinksAsSkipped[T SkippableLink](links map[string]T)
- func MarkPendingResourcesAsSkipped[T SkippableResource](resources map[string]T)
- func NewAutoApproveGroup(valuePtr *bool, stageFirstPtr *bool, negativeLabel string) *huh.Group
- func NewChangesetIDGroup(valuePtr *string, stageFirstPtr *bool, description string) *huh.Group
- func NewInstanceIDNote(instanceID string) *huh.Note
- func NewInstanceNameInput(valuePtr *string, description string) *huh.Input
- func NewStageFirstConfirm(valuePtr *bool, title, description string) *huh.Confirm
- func NewThemedForm(styles *stylespkg.Styles, groups ...*huh.Group) *huh.Form
- func RenderActionBadge(action ActionType, s *styles.Styles) string
- func RenderBreadcrumb(sb *strings.Builder, navigationPath []string, s *styles.Styles)
- func RenderChangesetTypeMismatchError(params ChangesetTypeMismatchParams, s *styles.Styles) string
- func RenderConfirmationPrompt(sb *strings.Builder, promptText string, s *styles.Styles)
- func RenderDiagnostic(diag *core.Diagnostic, s *styles.Styles) string
- func RenderElementFailures(sb *strings.Builder, failures []ElementFailure, contentWidth int, ...)
- func RenderElementSummary(sb *strings.Builder, summary ElementSummary, s *styles.Styles)
- func RenderErrorFooter(s *styles.Styles) string
- func RenderExportsFooterNavigation(sb *strings.Builder, s *styles.Styles)
- func RenderFailureReasons(sb *strings.Builder, reasons []string, width int, s *styles.Styles)
- func RenderFooterNavigation(sb *strings.Builder, s *styles.Styles, extraKeys ...KeyHint)
- func RenderGenericError(err error, operationFailedHeader string, s *styles.Styles) string
- func RenderGroupDetails(group *ResourceGroupItem, width int, s *styles.Styles) string
- func RenderInstanceStatus(status core.InstanceStatus, s *styles.Styles) string
- func RenderLabelValue(sb *strings.Builder, label, value string, s *styles.Styles)
- func RenderLinkAction(sb *strings.Builder, action string, s *styles.Styles)
- func RenderLinkDetailsBase(sb *strings.Builder, link LinkDetailsBase, width int, s *styles.Styles)
- func RenderLinkStatus(status core.LinkStatus, s *styles.Styles) string
- func RenderOutboundLinksSection(resourceName string, links map[string]*state.LinkState, s *styles.Styles) string
- func RenderResourceMetadata(sb *strings.Builder, meta ResourceMetadata, resourceState *state.ResourceState, ...)
- func RenderResourceStatus(status core.ResourceStatus, s *styles.Styles) string
- func RenderSectionHeader(sb *strings.Builder, headerText string, width int, s *styles.Styles)
- func RenderStagingCompleteHeader(sb *strings.Builder, changesetID string, s *styles.Styles)
- func RenderStagingDrillDownFooter(sb *strings.Builder, model SplitPaneModel, s *styles.Styles) bool
- func RenderStreamError(streamErr *engineerrors.StreamError, ctx ErrorContext, s *styles.Styles) string
- func RenderStreamingFooter(sb *strings.Builder, params StreamingFooterParams, s *styles.Styles)
- func RenderValidationError(clientErr *engineerrors.ClientError, ctx ErrorContext, s *styles.Styles) string
- func RenderViewportOverlayFooter(sb *strings.Builder, toggleKey string, s *styles.Styles)
- func RenderViewportScrollHints(sb *strings.Builder, toggleKey string, s *styles.Styles)
- func RenderWrappedFailureReasons(sb *strings.Builder, reasons []string, width int, s *styles.Styles)
- func ResolveInstanceIdentifiers(resolver InstanceResolver) (instanceID, instanceName string)
- func ResourceStatusHeadlessIcon(status core.ResourceStatus) string
- func ResourceStatusHeadlessText(status core.ResourceStatus) string
- func ResourceStatusIcon(status core.ResourceStatus) string
- func SortItems(items []splitpane.Item)
- func StripObjectStorageScheme(blueprintFile, scheme string) string
- func StyleInstanceIcon(icon string, status core.InstanceStatus, s *styles.Styles) string
- func StyleLinkIcon(icon string, status core.LinkStatus, s *styles.Styles) string
- func StyleResourceIcon(icon string, status core.ResourceStatus, s *styles.Styles) string
- func StyledActionIcon(action ActionType, s *styles.Styles, applyStyle bool) string
- func ValidateChangesetID(value string) error
- func ValidateInstanceName(value string) error
- type ActionType
- type BlueprintEventHandlers
- type ChangesetTypeMismatchParams
- type CodeOnlyResult
- type DepthAdjustedItem
- type ElementFailure
- type ElementSummary
- type ErrorContext
- type ExportsKeyAction
- type GroupableItem
- type HeadlessResourceGroup
- type HeadlessResourceInfo
- type InstanceLookup
- type InstanceResolver
- type InterruptedElement
- type ItemType
- type KeyHint
- type LinkClassifiable
- type LinkDetailsBase
- type PathBuilder
- func (p *PathBuilder) BuildInstancePath(parentInstanceID, childName string) string
- func (p *PathBuilder) BuildItemPath(instanceID, itemName string) string
- func (p *PathBuilder) BuildParentChain(startInstanceID string) []string
- func (p *PathBuilder) TrackChildInstance(childInstanceID, childName, parentInstanceID string)
- type ResourceGroup
- type ResourceGroupItem
- func (g *ResourceGroupItem) CanDrillDown() bool
- func (g *ResourceGroupItem) GetAction() string
- func (g *ResourceGroupItem) GetChildren() []splitpane.Item
- func (g *ResourceGroupItem) GetDepth() int
- func (g *ResourceGroupItem) GetID() string
- func (g *ResourceGroupItem) GetIcon(selected bool) string
- func (g *ResourceGroupItem) GetItemType() string
- func (g *ResourceGroupItem) GetName() string
- func (g *ResourceGroupItem) GetParentID() string
- func (g *ResourceGroupItem) IsExpandable() bool
- type ResourceMetadata
- type RetainedElement
- type SectionGrouper
- type SkippableChild
- type SkippableLink
- type SkippableResource
- type SplitPaneModel
- type StreamingFooterParams
- type SuccessfulElement
- type ViewportKeyResult
Constants ¶
const ( // AnnotationSourceAbstractName is the annotation key set by transformer plugins // to record the original abstract resource name that a concrete resource was // expanded from. AnnotationSourceAbstractName = "bluelink.transform.source.abstractName" // AnnotationSourceAbstractType is the annotation key set by transformer plugins // to record the original abstract resource type that a concrete resource was // expanded from. AnnotationSourceAbstractType = "bluelink.transform.source.abstractType" // AnnotationResourceCategory is the annotation key set by transformer plugins // to classify a concrete resource as either "code-hosting" or "infrastructure". // Used by the code-only auto-approval mechanism. AnnotationResourceCategory = "bluelink.transform.resourceCategory" // ResourceCategoryCodeHosting indicates a resource that hosts application code // (e.g. Lambda function, ECS task, API Gateway). ResourceCategoryCodeHosting = "code-hosting" // ResourceCategoryInfrastructure indicates an infrastructure dependency // (e.g. DynamoDB table, S3 bucket, IAM role, VPC). ResourceCategoryInfrastructure = "infrastructure" )
const ( IconPending = "○" IconInProgress = "◐" IconSuccess = "✓" IconFailed = "✗" IconRollingBack = "↺" IconRollbackFailed = "⚠" IconRollbackComplete = "⟲" IconInterrupted = "⏹" IconSkipped = "⊘" IconNoChange = "─" IconRetained = "⊙" )
Icon characters used across deploy and destroy UIs.
Variables ¶
This section is empty.
Functions ¶
func ActionIcon ¶
func ActionIcon(action ActionType) string
ActionIcon returns the icon character for an action type.
func BlueprintSourceFromPath ¶
BlueprintSourceFromPath determines the blueprint source type from a file path. It checks for URL schemes (https://, s3://, gcs://, azureblob://) and returns the appropriate source constant, defaulting to file source for local paths.
func BuildDocumentInfo ¶
func BuildDocumentInfo(source, blueprintFile string) (types.BlueprintDocumentInfo, error)
BuildDocumentInfo creates BlueprintDocumentInfo based on the source type.
func BuildElementPath ¶
BuildElementPath constructs a full path like "children.notifications::resources.queue".
func BuildHTTPSDocumentInfo ¶
func BuildHTTPSDocumentInfo(blueprintFile string) (types.BlueprintDocumentInfo, error)
BuildHTTPSDocumentInfo creates document info for HTTPS sources.
func BuildIntermediaryActions ¶
func BuildIntermediaryActions( changes map[string]*container.IntermediaryReconcileResult, ) map[string]*types.IntermediaryReconcileActionPayload
BuildIntermediaryActions converts intermediary reconciliation results to action payloads.
func BuildLinkActions ¶
func BuildLinkActions(links []container.LinkReconcileResult) []types.LinkReconcileActionPayload
BuildLinkActions converts link reconciliation results to action payloads.
func BuildLocalFileDocumentInfo ¶
func BuildLocalFileDocumentInfo(blueprintFile string) (types.BlueprintDocumentInfo, error)
BuildLocalFileDocumentInfo creates document info for local file sources.
func BuildMapKey ¶
BuildMapKey builds a path-based key for map lookups.
func BuildObjectStorageDocumentInfo ¶
func BuildObjectStorageDocumentInfo(blueprintFile, scheme string) types.BlueprintDocumentInfo
BuildObjectStorageDocumentInfo creates a BlueprintDocumentInfo for object storage sources. It strips the scheme prefix before extracting directory and file components, since path.Dir doesn't handle scheme-prefixed paths correctly.
func BuildResourceActions ¶
func BuildResourceActions(resources []container.ResourceReconcileResult) []types.ResourceReconcileActionPayload
BuildResourceActions converts resource reconciliation results to action payloads.
func DispatchBlueprintEvent ¶
func DispatchBlueprintEvent(event *types.BlueprintInstanceEvent, handlers BlueprintEventHandlers) bool
DispatchBlueprintEvent dispatches a blueprint instance event to the appropriate handler. Returns true if the event was handled, false otherwise.
func ExtractResourceCategory ¶
func ExtractResourceCategory(meta *state.ResourceMetadataState) string
ExtractResourceCategory reads the resource category annotation from resource metadata. Returns an empty string if not set.
func FindChildInstanceIDByPath ¶
func FindChildInstanceIDByPath(instanceState *state.InstanceState, path string) string
FindChildInstanceIDByPath finds a child blueprint's instance ID by traversing the instance state hierarchy. The path format is "childA/childB" where each segment is a child blueprint name.
func FindLinkIDByPath ¶
func FindLinkIDByPath(instanceState *state.InstanceState, path, linkName string) string
FindLinkIDByPath finds a link's ID by traversing the instance state hierarchy. The path format is "childA/childB/linkName" where the preceding segments are child blueprint names.
func FindResourceIDByPath ¶
func FindResourceIDByPath(instanceState *state.InstanceState, path, resourceName string) string
FindResourceIDByPath finds a resource ID by traversing the instance state hierarchy. The path format is "childA/childB/resourceName" where the preceding segments are child blueprint names.
func FindResourceStateByName ¶
func FindResourceStateByName(instanceState *state.InstanceState, name string) *state.ResourceState
FindResourceStateByName finds a resource state by name using the instance state's ResourceIDs map to look up the resource ID, then retrieves the state from Resources.
func FormatLinkStatus ¶
func FormatLinkStatus(status core.LinkStatus) string
FormatLinkStatus returns a lowercase human-readable status string for a link.
func FormatPreciseLinkStatus ¶
func FormatPreciseLinkStatus(status core.PreciseLinkStatus) string
FormatPreciseLinkStatus returns a human-readable string for a precise link status.
func FormatPreciseResourceStatus ¶
func FormatPreciseResourceStatus(status core.PreciseResourceStatus) string
FormatPreciseResourceStatus returns a human-readable string for a precise resource status.
func GetEffectiveInstanceID ¶
GetEffectiveInstanceID returns the instance ID, falling back to instance name if ID is empty.
func GroupHeadlessResources ¶
func GroupHeadlessResources( resources []HeadlessResourceInfo, ) ([]HeadlessResourceGroup, []HeadlessResourceInfo)
GroupHeadlessResources partitions resources by abstract group. Resources whose metadata contains grouping annotations are placed in groups; others are returned as ungrouped. Group order is preserved (first seen).
func InstanceStatusHeadlessIcon ¶
func InstanceStatusHeadlessIcon(status core.InstanceStatus) string
InstanceStatusHeadlessIcon returns the icon for an instance status in headless mode.
func InstanceStatusHeadlessText ¶
func InstanceStatusHeadlessText(status core.InstanceStatus) string
InstanceStatusHeadlessText returns the text for an instance status in headless mode.
func InstanceStatusIcon ¶
func InstanceStatusIcon(status core.InstanceStatus) string
InstanceStatusIcon returns an icon character for the given instance status. This handles all instance statuses (deploy, update, destroy).
func IsPendingChildStatus ¶
func IsPendingChildStatus(status core.InstanceStatus) bool
IsPendingChildStatus returns true if the child status is a pending/initial state.
func IsPendingLinkStatus ¶
func IsPendingLinkStatus(status core.LinkStatus) bool
IsPendingLinkStatus returns true if the link status is a pending/initial state.
func IsPendingResourceStatus ¶
func IsPendingResourceStatus(status core.ResourceStatus) bool
IsPendingResourceStatus returns true if the resource status is a pending/initial state.
func LinkStatusHeadlessIcon ¶
func LinkStatusHeadlessIcon(status core.LinkStatus) string
LinkStatusHeadlessIcon returns the icon for a link status in headless mode.
func LinkStatusHeadlessText ¶
func LinkStatusHeadlessText(status core.LinkStatus) string
LinkStatusHeadlessText returns the text for a link status in headless mode.
func LinkStatusIcon ¶
func LinkStatusIcon(status core.LinkStatus) string
LinkStatusIcon returns an icon character for the given link status. This handles all link statuses (create, update, destroy).
func LookupByKey ¶
LookupByKey looks up an item by path-based key, falling back to simple name. This is a generic helper used by the result collectors.
func MarkPendingChildrenAsSkipped ¶
func MarkPendingChildrenAsSkipped[T SkippableChild](children map[string]T)
MarkPendingChildrenAsSkipped marks children that were never attempted as skipped.
func MarkPendingLinksAsSkipped ¶
func MarkPendingLinksAsSkipped[T SkippableLink](links map[string]T)
MarkPendingLinksAsSkipped marks links that were never attempted as skipped.
func MarkPendingResourcesAsSkipped ¶
func MarkPendingResourcesAsSkipped[T SkippableResource](resources map[string]T)
MarkPendingResourcesAsSkipped marks resources that were never attempted as skipped.
func NewAutoApproveGroup ¶
NewAutoApproveGroup creates an auto-approve confirm group that shows when stageFirst is true.
func NewChangesetIDGroup ¶
NewChangesetIDGroup creates a changeset ID input group that hides when stageFirst is true.
func NewInstanceIDNote ¶
NewInstanceIDNote creates a read-only note displaying an instance ID.
func NewInstanceNameInput ¶
NewInstanceNameInput creates a standard instance name input field.
func NewStageFirstConfirm ¶
NewStageFirstConfirm creates a stage-first confirm field.
func NewThemedForm ¶
NewThemedForm creates a new form with the standard theme applied.
func RenderActionBadge ¶
func RenderActionBadge(action ActionType, s *styles.Styles) string
RenderActionBadge renders an action badge with appropriate styling.
func RenderBreadcrumb ¶
RenderBreadcrumb renders navigation breadcrumb for drill-down views.
func RenderChangesetTypeMismatchError ¶
func RenderChangesetTypeMismatchError(params ChangesetTypeMismatchParams, s *styles.Styles) string
RenderChangesetTypeMismatchError renders an error when attempting to use a changeset with the wrong command (e.g., using a destroy changeset with deploy command).
func RenderConfirmationPrompt ¶
RenderConfirmationPrompt renders a y/n confirmation prompt.
func RenderDiagnostic ¶
func RenderDiagnostic(diag *core.Diagnostic, s *styles.Styles) string
RenderDiagnostic renders a single diagnostic with level styling and suggested actions.
func RenderElementFailures ¶
func RenderElementFailures(sb *strings.Builder, failures []ElementFailure, contentWidth int, showElementType bool, s *styles.Styles)
RenderElementFailures renders a list of element failures with text wrapping. Set showElementType to true to display the element type for resources (used by destroy).
func RenderElementSummary ¶
func RenderElementSummary(sb *strings.Builder, summary ElementSummary, s *styles.Styles)
RenderElementSummary renders a summary line of element counts (successful/destroyed, failures, interrupted, retained).
func RenderErrorFooter ¶
RenderErrorFooter renders a standard "Press q to quit" footer.
func RenderExportsFooterNavigation ¶
RenderExportsFooterNavigation renders navigation hints for exports overlay views.
func RenderFailureReasons ¶
RenderFailureReasons renders failure reasons with word wrapping.
func RenderFooterNavigation ¶
RenderFooterNavigation renders standard keyboard navigation hints.
func RenderGenericError ¶
RenderGenericError renders a generic error with the operation context.
func RenderGroupDetails ¶
func RenderGroupDetails(group *ResourceGroupItem, width int, s *styles.Styles) string
RenderGroupDetails renders the right-pane detail view for a ResourceGroupItem.
func RenderInstanceStatus ¶
func RenderInstanceStatus(status core.InstanceStatus, s *styles.Styles) string
RenderInstanceStatus renders a styled instance status string.
func RenderLabelValue ¶
RenderLabelValue renders a label-value pair with muted label styling.
func RenderLinkAction ¶
RenderLinkAction renders the action badge for a link if action is non-empty.
func RenderLinkDetailsBase ¶
RenderLinkDetailsBase renders the common link details header and metadata. Returns after writing the metadata section, allowing callers to add UI-specific content.
func RenderLinkStatus ¶
func RenderLinkStatus(status core.LinkStatus, s *styles.Styles) string
RenderLinkStatus renders a styled link status string.
func RenderOutboundLinksSection ¶
func RenderOutboundLinksSection(resourceName string, links map[string]*state.LinkState, s *styles.Styles) string
RenderOutboundLinksSection renders the outbound links from a resource. It searches the provided links map for links that originate from the given resourceName.
func RenderResourceMetadata ¶
func RenderResourceMetadata(sb *strings.Builder, meta ResourceMetadata, resourceState *state.ResourceState, s *styles.Styles)
RenderResourceMetadata renders the common resource metadata fields (ID, name, type).
func RenderResourceStatus ¶
func RenderResourceStatus(status core.ResourceStatus, s *styles.Styles) string
RenderResourceStatus renders a styled resource status string.
func RenderSectionHeader ¶
RenderSectionHeader renders a styled section header with a separator line.
func RenderStagingCompleteHeader ¶
RenderStagingCompleteHeader renders the "Staging complete. Changeset: X" header line.
func RenderStagingDrillDownFooter ¶
RenderStagingDrillDownFooter renders the common drill-down footer for staging views. Returns true if footer was rendered (i.e., model is in drill-down), false otherwise.
func RenderStreamError ¶
func RenderStreamError(streamErr *engineerrors.StreamError, ctx ErrorContext, s *styles.Styles) string
RenderStreamError renders a stream error with diagnostics.
func RenderStreamingFooter ¶
func RenderStreamingFooter(sb *strings.Builder, params StreamingFooterParams, s *styles.Styles)
RenderStreamingFooter renders a footer for an in-progress streaming operation.
func RenderValidationError ¶
func RenderValidationError(clientErr *engineerrors.ClientError, ctx ErrorContext, s *styles.Styles) string
RenderValidationError renders a validation error with diagnostics.
func RenderViewportOverlayFooter ¶
RenderViewportOverlayFooter renders a footer for viewport overlay views (overview, spec, etc.). The toggleKey is the key that toggles the overlay (e.g., "o" for overview, "s" for spec).
func RenderViewportScrollHints ¶
RenderViewportScrollHints renders just the scroll/return/quit key hints for viewport overlays. Use this when you don't want the separator line (e.g., for inspect model).
func RenderWrappedFailureReasons ¶
func RenderWrappedFailureReasons(sb *strings.Builder, reasons []string, width int, s *styles.Styles)
RenderWrappedFailureReasons renders failure reasons with bullet points and text wrapping.
func ResolveInstanceIdentifiers ¶
func ResolveInstanceIdentifiers(resolver InstanceResolver) (instanceID, instanceName string)
ResolveInstanceIdentifiers looks up instance identifiers, returning the resolved ID and name. If an instance ID is already provided, it's returned as-is. If only a name is provided, it looks up the instance to get its ID. If the instance doesn't exist, empty strings are returned (indicating new deployment).
func ResourceStatusHeadlessIcon ¶
func ResourceStatusHeadlessIcon(status core.ResourceStatus) string
ResourceStatusHeadlessIcon returns the icon for a resource status in headless mode.
func ResourceStatusHeadlessText ¶
func ResourceStatusHeadlessText(status core.ResourceStatus) string
ResourceStatusHeadlessText returns the text for a resource status in headless mode.
func ResourceStatusIcon ¶
func ResourceStatusIcon(status core.ResourceStatus) string
ResourceStatusIcon returns an icon character for the given resource status. This handles all resource statuses (create, update, destroy).
func StripObjectStorageScheme ¶
StripObjectStorageScheme removes the scheme prefix from an object storage path. For example, "s3://bucket/file.yaml" becomes "bucket/file.yaml". If the path doesn't have the expected scheme prefix, it's returned unchanged.
func StyleInstanceIcon ¶
StyleInstanceIcon returns a styled icon string for the given instance status.
func StyleLinkIcon ¶
StyleLinkIcon returns a styled icon string for the given link status.
func StyleResourceIcon ¶
StyleResourceIcon returns a styled icon string for the given resource status.
func StyledActionIcon ¶
func StyledActionIcon(action ActionType, s *styles.Styles, applyStyle bool) string
StyledActionIcon returns a styled icon for an action type.
func ValidateChangesetID ¶
ValidateChangesetID validates a changeset ID. Returns an error if the ID is empty.
func ValidateInstanceName ¶
ValidateInstanceName validates an instance name. Returns an error if the name is empty, too short (< 3), or too long (> 128).
Types ¶
type ActionType ¶
type ActionType string
ActionType represents the action to be taken on an item.
const ( ActionCreate ActionType = "CREATE" ActionUpdate ActionType = "UPDATE" ActionDelete ActionType = "DELETE" ActionRecreate ActionType = "RECREATE" ActionRetain ActionType = "RETAIN" ActionNoChange ActionType = "NO CHANGE" // ActionInspect indicates the item is being viewed in inspect mode. // The icon will be rendered based on the item's actual status rather than its action. ActionInspect ActionType = "" )
func DetermineResourceAction ¶
func DetermineResourceAction(isNew, isRemoved, mustRecreate bool, changes *provider.Changes) ActionType
DetermineResourceAction determines the appropriate action based on item state and changes.
type BlueprintEventHandlers ¶
type BlueprintEventHandlers struct {
OnResourceUpdate func(data *container.ResourceDeployUpdateMessage)
OnChildUpdate func(data *container.ChildDeployUpdateMessage)
OnLinkUpdate func(data *container.LinkDeployUpdateMessage)
OnInstanceUpdate func(data *container.DeploymentUpdateMessage)
// OnPreRollbackState is optional - only used by deploy model
OnPreRollbackState func(data *container.PreRollbackStateMessage)
}
BlueprintEventHandlers holds callback functions for handling blueprint instance events.
type ChangesetTypeMismatchParams ¶
type ChangesetTypeMismatchParams struct {
// IsDestroyChangeset indicates whether the changeset is a destroy changeset (true)
// or a deploy changeset (false). This determines the error message direction.
IsDestroyChangeset bool
InstanceName string
ChangesetID string
}
ChangesetTypeMismatchParams holds the parameters for rendering a changeset type mismatch error.
type CodeOnlyResult ¶
type CodeOnlyResult struct {
// Eligible is true when all changes are modifications to code-hosting resources only.
Eligible bool
// Reasons lists why auto-approval was denied (empty when eligible).
Reasons []string
}
CodeOnlyResult holds the outcome of a code-only eligibility check.
func CheckCodeOnlyEligibility ¶
func CheckCodeOnlyEligibility( bpChanges *changes.BlueprintChanges, instanceState *state.InstanceState, ) CodeOnlyResult
CheckCodeOnlyEligibility analyses a changeset to determine if it contains only modifications to code-hosting resources with no structural changes. A nil or empty changeset is considered eligible.
type DepthAdjustedItem ¶
DepthAdjustedItem wraps a splitpane.Item to report a different depth while preserving all other behavior.
func (*DepthAdjustedItem) GetDepth ¶
func (d *DepthAdjustedItem) GetDepth() int
func (*DepthAdjustedItem) Unwrap ¶
func (d *DepthAdjustedItem) Unwrap() splitpane.Item
Unwrap returns the underlying item for type assertions in detail renderers.
type ElementFailure ¶
type ElementFailure struct {
ElementName string
ElementPath string // Full path like "children.notifications::resources.notificationQueue"
ElementType string // "resource", "child", or "link"
FailureReasons []string
}
ElementFailure represents a failure for a specific element with its root cause reasons.
type ElementSummary ¶
type ElementSummary struct {
SuccessCount int
SuccessLabel string // e.g., "successful" or "destroyed"
FailureCount int
InterruptedCount int
RetainedCount int
}
ElementSummary holds counts of successful, failed, and interrupted elements for footer rendering.
type ErrorContext ¶
type ErrorContext struct {
OperationName string // e.g., "deployment", "change staging"
FailedHeader string // e.g., "Failed to start deployment"
ErrorDuringHeader string // e.g., "Error during deployment"
IssuesPreamble string // e.g., "The following issues must be resolved before deployment can proceed:"
}
ErrorContext provides context-specific strings for error rendering.
func DeployErrorContext ¶
func DeployErrorContext() ErrorContext
DeployErrorContext returns the error context for deployment operations.
func DestroyErrorContext ¶
func DestroyErrorContext() ErrorContext
DestroyErrorContext returns the error context for destroy operations.
func StageErrorContext ¶
func StageErrorContext() ErrorContext
StageErrorContext returns the error context for staging operations.
type ExportsKeyAction ¶
type ExportsKeyAction int
ExportsKeyAction indicates what action to take after handling an exports view key.
const ( // ExportsKeyActionDelegate means the key should be delegated to the exports model. ExportsKeyActionDelegate ExportsKeyAction = iota // ExportsKeyActionClose means the exports view should be closed. ExportsKeyActionClose // ExportsKeyActionQuit means the application should quit. ExportsKeyActionQuit )
func CheckExportsKeyMsg ¶
func CheckExportsKeyMsg(msg tea.KeyMsg) ExportsKeyAction
CheckExportsKeyMsg checks if a key message should close/quit the exports view. Returns the action to take. If ExportsKeyActionDelegate is returned, the caller should delegate the key to the exports model.
type GroupableItem ¶
type GroupableItem interface {
GetResourceGroup() *ResourceGroup
}
GroupableItem is an optional interface that splitpane.Item implementations can implement to indicate they belong to an abstract resource group. The SectionGrouper uses this to nest concrete resources under their abstract type parent in the navigation tree.
type HeadlessResourceGroup ¶
type HeadlessResourceGroup struct {
Group ResourceGroup
Resources []HeadlessResourceInfo
}
HeadlessResourceGroup holds resources that share the same abstract group.
type HeadlessResourceInfo ¶
type HeadlessResourceInfo struct {
// Path is the full path key (e.g. "childA/myFunc" or "myFunc" for top-level).
Path string
// Name is the resource name (last path segment).
Name string
// Metadata holds resource metadata with annotations for grouping.
Metadata *state.ResourceMetadataState
}
HeadlessResourceInfo carries the data needed to group and print a resource in headless (non-interactive) output.
func SplitResourcesByPathLevel ¶
func SplitResourcesByPathLevel( resources []HeadlessResourceInfo, pathPrefix string, ) (atLevel, nested []HeadlessResourceInfo)
SplitResourcesByPathLevel separates resources into those at the given path level (direct children of pathPrefix) and those nested deeper. For top-level resources, pass pathPrefix = "".
type InstanceLookup ¶
type InstanceLookup interface {
GetBlueprintInstance(ctx context.Context, instanceIDOrName string) (*state.InstanceState, error)
}
InstanceLookup is the interface for looking up blueprint instances.
type InstanceResolver ¶
type InstanceResolver interface {
GetInstanceID() string
GetInstanceName() string
GetEngine() InstanceLookup
}
InstanceResolver provides the fields needed to resolve instance identifiers.
type InterruptedElement ¶
type InterruptedElement struct {
ElementName string
ElementPath string // Full path like "children.notifications::resources.notificationQueue"
ElementType string // "resource", "child", or "link"
}
InterruptedElement represents an element that was interrupted during an operation.
type ItemType ¶
type ItemType string
ItemType represents the type of item in a stage or deploy list.
type LinkClassifiable ¶
type LinkClassifiable interface {
GetLinkResourceNames() (resourceA, resourceB string)
}
LinkClassifiable is an optional interface that splitpane.Item implementations for links can implement to enable link classification into internal (within one abstract group) and cross-group categories.
type LinkDetailsBase ¶
type LinkDetailsBase struct {
LinkName string
ResourceAName string
ResourceBName string
LinkID string
Action string
}
LinkDetailsBase holds the common fields for rendering link details across UIs.
type PathBuilder ¶
type PathBuilder struct {
RootInstanceID string
InstanceIDToChildName map[string]string
InstanceIDToParentID map[string]string
}
PathBuilder provides path building utilities for hierarchical item paths. It tracks the mapping between instance IDs and child names to construct full paths like "parentChild/childName/resourceName".
func NewPathBuilder ¶
func NewPathBuilder(rootInstanceID string) *PathBuilder
NewPathBuilder creates a new PathBuilder with the given root instance ID.
func (*PathBuilder) BuildInstancePath ¶
func (p *PathBuilder) BuildInstancePath(parentInstanceID, childName string) string
BuildInstancePath builds a path from instance ID to the child name. For root instance children, returns just the name. For nested children, returns a path like "parentChild/childName".
func (*PathBuilder) BuildItemPath ¶
func (p *PathBuilder) BuildItemPath(instanceID, itemName string) string
BuildItemPath builds a path for an item (resource or link) based on its instance ID. For root instance items, returns just the item name. For nested items, returns a path like "parentChild/childName/itemName".
func (*PathBuilder) BuildParentChain ¶
func (p *PathBuilder) BuildParentChain(startInstanceID string) []string
BuildParentChain constructs the path parts from the root to the given instance ID.
func (*PathBuilder) TrackChildInstance ¶
func (p *PathBuilder) TrackChildInstance(childInstanceID, childName, parentInstanceID string)
TrackChildInstance records the mapping from a child instance ID to its name and parent.
type ResourceGroup ¶
type ResourceGroup struct {
// GroupName is the original abstract resource name (e.g. "myFunction").
GroupName string
// GroupType is the original abstract resource type (e.g. "celerity/function").
GroupType string
}
ResourceGroup holds the abstract resource grouping information for a concrete resource that was produced by a transformer plugin.
func ExtractGrouping ¶
func ExtractGrouping(meta *state.ResourceMetadataState) *ResourceGroup
ExtractGrouping reads standard Bluelink transform annotations from resource metadata to determine if a concrete resource was expanded from an abstract type. Returns nil if the resource was not produced by a transformer or if the required annotations are missing.
type ResourceGroupItem ¶
type ResourceGroupItem struct {
Group ResourceGroup
Children []splitpane.Item
InternalLinks []splitpane.Item
}
ResourceGroupItem is a synthetic navigation tree item that groups concrete cloud resources under their abstract type parent.
func (*ResourceGroupItem) CanDrillDown ¶
func (g *ResourceGroupItem) CanDrillDown() bool
func (*ResourceGroupItem) GetAction ¶
func (g *ResourceGroupItem) GetAction() string
func (*ResourceGroupItem) GetChildren ¶
func (g *ResourceGroupItem) GetChildren() []splitpane.Item
func (*ResourceGroupItem) GetDepth ¶
func (g *ResourceGroupItem) GetDepth() int
func (*ResourceGroupItem) GetID ¶
func (g *ResourceGroupItem) GetID() string
func (*ResourceGroupItem) GetIcon ¶
func (g *ResourceGroupItem) GetIcon(selected bool) string
func (*ResourceGroupItem) GetItemType ¶
func (g *ResourceGroupItem) GetItemType() string
func (*ResourceGroupItem) GetName ¶
func (g *ResourceGroupItem) GetName() string
func (*ResourceGroupItem) GetParentID ¶
func (g *ResourceGroupItem) GetParentID() string
func (*ResourceGroupItem) IsExpandable ¶
func (g *ResourceGroupItem) IsExpandable() bool
type ResourceMetadata ¶
type ResourceMetadata struct {
ResourceID string
DisplayName string
Name string
ResourceType string
}
ResourceMetadata holds basic resource information for rendering.
type RetainedElement ¶ added in v0.3.0
type RetainedElement struct {
ElementName string
ElementPath string // Full path like "children.notifications::resources.ordersTable"
ElementType string // The resource type, e.g. "aws/dynamodb/table"
}
RetainedElement represents a resource whose state was removed but whose underlying infrastructure was preserved due to a "retain" removal policy.
type SectionGrouper ¶
type SectionGrouper struct {
MaxExpandDepth int
}
SectionGrouper provides a generic implementation for grouping items into Resources, Child Blueprints, and Links sections. It works with any type implementing splitpane.Item. When items implement GroupableItem, resources are grouped under abstract type headers and links are classified as internal or cross-group.
func (*SectionGrouper) GroupItems ¶
func (g *SectionGrouper) GroupItems(items []splitpane.Item, isExpanded func(id string) bool) []splitpane.Section
GroupItems organizes items into sections using the splitpane.Item interface.
type SkippableChild ¶
type SkippableChild interface {
GetAction() ActionType
GetChildStatus() core.InstanceStatus
SetSkipped(skipped bool)
}
SkippableChild is an interface for child items that can be marked as skipped.
type SkippableLink ¶
type SkippableLink interface {
GetAction() ActionType
GetLinkStatus() core.LinkStatus
SetSkipped(skipped bool)
}
SkippableLink is an interface for link items that can be marked as skipped.
type SkippableResource ¶
type SkippableResource interface {
GetAction() ActionType
GetResourceStatus() core.ResourceStatus
SetSkipped(skipped bool)
}
SkippableResource is an interface for resource items that can be marked as skipped.
type SplitPaneModel ¶
type SplitPaneModel interface {
IsInDrillDown() bool
}
SplitPaneModel is the interface for split pane model methods needed by footer rendering.
type StreamingFooterParams ¶
type StreamingFooterParams struct {
}
StreamingFooterParams holds parameters for rendering a streaming operation footer.
type SuccessfulElement ¶
type SuccessfulElement struct {
ElementName string
ElementPath string // Full path like "children.notifications::resources.notificationQueue"
ElementType string // "resource", "child", or "link"
Action string // "created", "updated", "destroyed", etc.
}
SuccessfulElement represents an element that completed successfully.
type ViewportKeyResult ¶
type ViewportKeyResult struct {
ShouldClose bool
ShouldQuit bool
Viewport viewport.Model
Cmd tea.Cmd
}
ViewportKeyResult contains the result of handling a viewport key event.
func HandleViewportKeyMsg ¶
func HandleViewportKeyMsg(msg tea.KeyMsg, vp viewport.Model, toggleKeys ...string) ViewportKeyResult
HandleViewportKeyMsg handles key messages for viewport overlay views. toggleKeys are the keys that close the overlay (e.g., "o", "O" for overview). Always handles "esc" for closing and "q"/"ctrl+c" for quitting.
Source Files
¶
- abstract_resource_grouping.go
- actions.go
- blueprint_helpers.go
- code_only_approval.go
- commands.go
- detail_renderers.go
- error_renderers.go
- event_dispatch.go
- form_validators.go
- headless_grouping.go
- headless_status.go
- item_icons.go
- item_status.go
- path_builders.go
- resource_group_item.go
- result_types.go
- section_grouper.go
- status_renderers.go
- viewport_handlers.go