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 FormatLinkName(resourceA, resourceB string) string
- func FormatLinkStatus(status core.LinkStatus) string
- func FormatLogicalLinkName(linkName string) 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 KnownStatusKeywords() []string
- func LinkFromName(resourceA string) string
- func LinkStatusHeadlessIcon(status core.LinkStatus) string
- func LinkStatusHeadlessText(status core.LinkStatus) string
- func LinkStatusIcon(status core.LinkStatus) string
- func LinkToName(resourceB string) 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 OverviewEntryIndent(base string, group *ResourceGroup) string
- func ParentElementPath(path, elementType, elementName string) string
- 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 RenderInstanceDurations(durations *state.InstanceCompletionDuration, 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 RenderLinkDurations(durations *state.LinkCompletionDurations, s *styles.Styles) string
- func RenderLinkStatus(status core.LinkStatus, s *styles.Styles) string
- func RenderOutboundLinksSection(resourceName string, links map[string]*state.LinkState, s *styles.Styles) string
- func RenderOverviewGroupHeader(sb *strings.Builder, group *ResourceGroup, indent string, s *styles.Styles)
- func RenderResourceDurations(durations *state.ResourceCompletionDurations, 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 RenderTimingSection(sb *strings.Builder, content string, 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(ctx context.Context, resolver InstanceResolver) (instanceID, instanceName string)
- func ResourceDegraded(status core.ResourceStatus, failureReasons []string) bool
- func ResourceGroupLabel(group *ResourceGroup) 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 StatusKeywordsForIcon(icon string) []string
- func StatusKeywordsForItem(item splitpane.Item) []string
- 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 UnwrapItem(item splitpane.Item) splitpane.Item
- 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 OverviewGroup
- 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) GetCollapsedSummary() string
- 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" // AnnotationResourceRole is the annotation key set by transformer plugins to // describe the part an abstract resource plays in a deployment, as opposed // to what it is made of, which is what AnnotationResourceCategory records. // Absent means "component". AnnotationResourceRole = "bluelink.transform.resourceRole" // ResourceRoleComponent indicates an abstract resource that is part of the // application, such as an API, a handler or a datastore. ResourceRoleComponent = "component" // ResourceRoleAmbient indicates an abstract resource that most of a // deployment sits inside or depends on, such as a VPC. Links out of it // describe the environment rather than the application, so the tree shows // them against the resource at the other end. ResourceRoleAmbient = "ambient" )
const ( IconPending = "○" IconInProgress = "◐" IconSuccess = "✓" IconFailed = "✗" IconRollingBack = "↺" IconRollbackFailed = "⚠" IconRollbackComplete = "⟲" IconInterrupted = "⏹" IconSkipped = "⊘" IconNoChange = "─" IconRetained = "⊙" IconDegraded = "!" )
Icon characters used across deploy and destroy UIs.
const LinkNameSeparator = "::"
LinkNameSeparator joins the two resources of a link in its logical name, which is the identifier the engine uses: "{resourceA}::{resourceB}".
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 FormatLinkName ¶ added in v0.9.0
FormatLinkName renders a link for display. The logical name stays the identifier used for lookups and expansion; this is only what a person reads.
func FormatLinkStatus ¶
func FormatLinkStatus(status core.LinkStatus) string
FormatLinkStatus returns a lowercase human-readable status string for a link.
func FormatLogicalLinkName ¶ added in v0.9.0
FormatLogicalLinkName renders a link given its logical "a::b" name, leaving anything that is not in that form untouched.
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 KnownStatusKeywords ¶ added in v0.9.0
func KnownStatusKeywords() []string
KnownStatusKeywords lists every word a status filter accepts, sorted for a stable hint line.
func LinkFromName ¶ added in v0.9.0
LinkFromName renders a link as seen from its destination: "← source".
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 LinkToName ¶ added in v0.9.0
LinkToName renders a link as seen from its source: "→ destination".
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 OverviewEntryIndent ¶ added in v0.9.0
func OverviewEntryIndent(base string, group *ResourceGroup) string
OverviewEntryIndent returns the indent for an entry in an overview list, adding a level of nesting for entries that sit under a group header.
func ParentElementPath ¶ added in v0.9.0
ParentElementPath returns the path of an element's parent, derived from a path previously built by BuildElementPath. It returns an empty string for top-level elements.
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 RenderInstanceDurations ¶ added in v0.9.0
func RenderInstanceDurations(durations *state.InstanceCompletionDuration, s *styles.Styles) string
RenderInstanceDurations renders how long a blueprint instance took to deploy.
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 RenderLinkDurations ¶ added in v0.9.0
func RenderLinkDurations(durations *state.LinkCompletionDurations, s *styles.Styles) string
RenderLinkDurations renders how long a link took to deploy, broken down by the components the engine reports separately.
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 RenderOverviewGroupHeader ¶ added in v0.9.0
func RenderOverviewGroupHeader(sb *strings.Builder, group *ResourceGroup, indent string, s *styles.Styles)
RenderOverviewGroupHeader writes the header line for an abstract resource group in an overview list. Nothing is written for the ungrouped bucket.
func RenderResourceDurations ¶ added in v0.9.0
func RenderResourceDurations(durations *state.ResourceCompletionDurations, s *styles.Styles) string
RenderResourceDurations renders how long a resource took to deploy.
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 RenderTimingSection ¶ added in v0.9.0
RenderTimingSection renders a labelled timing block, or nothing when there are no durations to show.
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(ctx context.Context, 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 ResourceDegraded ¶ added in v0.9.0
func ResourceDegraded(status core.ResourceStatus, failureReasons []string) bool
ResourceDegraded reports whether a resource reached a successful status but still carries failure reasons.
A resource whose links could not apply what they contribute is recorded with its own status, which is the deployment the blueprint asked for and did succeed, and the reason is attached alongside. Reading the status alone therefore shows it as healthy, and the only account of what went wrong sits in a detail view nobody has been given a reason to open.
func ResourceGroupLabel ¶ added in v0.9.0
func ResourceGroupLabel(group *ResourceGroup) string
ResourceGroupLabel returns the display label for an abstract resource group, matching the "[type] name" format used by group headers in the tree.
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 StatusKeywordsForIcon ¶ added in v0.9.0
StatusKeywordsForIcon returns the filter words matching a status icon.
func StatusKeywordsForItem ¶ added in v0.9.0
StatusKeywordsForItem returns the filter words for an item, taken from the status icon it renders. Wire it into a split pane through splitpane.Config.StatusKeywords.
A group header reports the most severe status among its contents rather than one of its own, so it is deliberately given no keywords, filtering by "failed" should show the failures inside a group, not every resource that happens to sit alongside them. The header is still shown, kept as the parent of what matched, with its aggregate icon marking the group as the one to look at.
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 UnwrapItem ¶ added in v0.9.0
UnwrapItem returns the item underneath any display wrappers the navigation tree has put around it. Items nested under an abstract resource group are wrapped to adjust their depth and name, so a type assertion against the concrete item type fails unless it goes through here.
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 ¶
type DepthAdjustedItem struct {
splitpane.Item
AdjustedDepth int
// DisplayName overrides the name for this position in the tree. A link
// shown inside the group that owns it names only its far end, since the
// near end is the group you are already looking at.
DisplayName string
}
DepthAdjustedItem wraps a splitpane.Item to report a different depth, and optionally a different name, while preserving all other behavior.
func (*DepthAdjustedItem) GetDepth ¶
func (d *DepthAdjustedItem) GetDepth() int
func (*DepthAdjustedItem) GetName ¶ added in v0.9.0
func (d *DepthAdjustedItem) GetName() string
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
// AbstractGroup holds the abstract resource this element was expanded from,
// used to group the element under its source type in overview listings.
AbstractGroup *ResourceGroup
}
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"
// AbstractGroup holds the abstract resource this element was expanded from,
// used to group the element under its source type in overview listings.
AbstractGroup *ResourceGroup
}
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 OverviewGroup ¶ added in v0.9.0
type OverviewGroup[T any] struct { // Group is the abstract resource the entries were expanded from, // or nil for the bucket of entries that belong to no group. Group *ResourceGroup // Entries holds the bucket's entries in their original order. Entries []T }
OverviewGroup buckets overview entries that share one abstract resource group.
func GroupOverviewEntries ¶ added in v0.9.0
func GroupOverviewEntries[T any](entries []T, groupOf func(T) *ResourceGroup) []OverviewGroup[T]
GroupOverviewEntries buckets entries by abstract resource group for the overview screens, mirroring the nesting used in the navigation tree. Buckets are ordered by group label with the ungrouped bucket last, and entry order is preserved within each bucket.
When no entry belongs to a group, a single ungrouped bucket is returned so callers can render a flat list without special-casing.
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
// Role is the part the abstract resource plays in the deployment, as the
// transformer declared it. Empty means ResourceRoleComponent.
Role 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.
func ExtractGroupingFromResolved ¶ added in v0.9.0
func ExtractGroupingFromResolved(resolved *provider.ResolvedResource) *ResourceGroup
ExtractGroupingFromResolved reads the same transform annotations from the resolved resource in a change set rather than from persisted state. This is the only source available for resources that are being created, which have no current resource state to read annotations from. Returns nil if the annotations are absent.
func (*ResourceGroup) IsAmbient ¶ added in v0.9.0
func (g *ResourceGroup) IsAmbient() bool
IsAmbient reports whether nearly everything in the deployment links out of this abstract resource, which decides where those links are shown.
type ResourceGroupItem ¶
type ResourceGroupItem struct {
Group ResourceGroup
// Children holds the concrete resources expanded from the abstract resource.
Children []splitpane.Item
// Links holds the links that belong under this group, including those between two of
// its own resources, and those running out of one of them to a resource
// elsewhere.
Links []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
GetAction reports the most significant action among everything the group holds, links included, for the same reason as GetIcon.
func (*ResourceGroupItem) GetChildren ¶
func (g *ResourceGroupItem) GetChildren() []splitpane.Item
func (*ResourceGroupItem) GetCollapsedSummary ¶ added in v0.9.0
func (g *ResourceGroupItem) GetCollapsedSummary() string
GetCollapsedSummary reports what the group holds while it is collapsed, so that resources and links folded into a group are still discoverable without expanding every group in the tree. The R and L markers match the type indicators the tree already uses for nested items, and it is kept terse because it shares the line with the group name.
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
GetIcon reports the most severe status among everything the group holds. Links count as a link that failed on the way out of this abstract resource is a failure of it, and reporting only the resources would show the group as healthy while it is not.
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 each link is nested under the group it belongs to, leaving only links between two ungrouped resources in a section of their own.
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.
// AbstractGroup holds the abstract resource this element was expanded from,
// used to group the element under its source type in overview listings.
AbstractGroup *ResourceGroup
}
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
- duration_renderers.go
- error_renderers.go
- event_dispatch.go
- form_validators.go
- headless_grouping.go
- headless_status.go
- item_icons.go
- item_status.go
- link_naming.go
- overview_grouping.go
- path_builders.go
- resource_group_item.go
- result_types.go
- section_grouper.go
- status_keywords.go
- status_renderers.go
- viewport_handlers.go