{"modulePath":"github.com/newstack-cloud/deploy-cli-sdk","version":"v0.10.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package stateutil\n\nPackage stateutil provides shared utilities for fetching and working with blueprint instance state across TUI components.\n\n## Functions\n\n```go\nfunc DescribeEngineState(engineConfig *stateio.EngineConfig) string\n```\nDescribeEngineState describes the state an import or export works on, such as \"memfile state in /path\", or \"state\" when there is no engine config to describe.\n\n```go\nfunc FetchInstanceState(ctx context.Context, eng engine.DeployEngine, instanceID, instanceName string) *state.InstanceState\n```\nFetchInstanceState attempts to fetch the instance state for an existing deployment. Returns nil if the instance doesn't exist or if there's an error (new deployment case).\n\n```go\nfunc FindChildInstanceState(instanceState *state.InstanceState, childName string) *state.InstanceState\n```\nFindChildInstanceState finds the instance state for a child blueprint by name.\n\n```go\nfunc FindLinkState(instanceState *state.InstanceState, name string) *state.LinkState\n```\nFindLinkState finds a link state by logical name.\n\n```go\nfunc FindResourceState(instanceState *state.InstanceState, name string) *state.ResourceState\n```\nFindResourceState finds a resource state by logical name. It uses the instance state's ResourceIDs map to look up the resource ID, then retrieves the state from Resources.\n\n```go\nfunc FormatFailureText(heading string, details []LabelledValue, err error) string\n```\nFormatFailureText formats an import or export failure as plain text for headless output: the heading and error summary on the first line, then the given details, the cause and the hint, each indented under it.\n\n```go\nfunc RenderFailure(\n\tstyles *stylespkg.Styles,\n\theading string,\n\tdetails []LabelledValue,\n\terr error,\n\twidth int,\n) string\n```\nRenderFailure renders an import or export failure for a TUI: the heading, the given details followed by the error and its cause as aligned labelled lines, and the hint on what to do. Every line is wrapped to fit within width.\n\n```go\nfunc RenderProgress(spinnerView string, status string, width int) string\n```\nRenderProgress renders the status line shown while an import or export runs: the spinner followed by the status, wrapped to fit within width.\n\n## Types\n\n```go\ntype LabelledValue struct {\n\tLabel string\n\tValue string\n}\n```\nLabelledValue is one line of a failure view, such as the state or file an import or export was working on.\n\n","path":"github.com/newstack-cloud/deploy-cli-sdk/tui/stateutil","name":"stateutil","synopsis":"Package stateutil provides shared utilities for fetching and working with blueprint instance state across TUI components.","isRedistributable":true}
