Documentation
¶
Overview ¶
Package naming shares runtime naming resolution and inspects naming migrations. Migration inspection never executes configuration; runtime resolution uses injected evaluators.
Index ¶
- func EnsureLiteralStackIdentity(stackFileName, name string, section map[string]any) error
- func Field(path []string) bool
- func SafeTemplate(value string) bool
- func Upgrade(value string) (string, []string, []string)
- func WorkspacesEnabled(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo) bool
- type Identity
- type Resolver
- func (r Resolver) BuildTerraformWorkspace(atmosConfig *schema.AtmosConfiguration, ...) (string, error)
- func (r Resolver) ProcessStackContextPrefix(atmosConfig *schema.AtmosConfiguration, ...) error
- func (r Resolver) ResolveStackName(atmosConfig *schema.AtmosConfiguration, ...) (string, schema.Context, error)
- type Result
- type TemplateEvaluator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureLiteralStackIdentity ¶
EnsureLiteralStackIdentity rejects a stack name that was derived from a !starlark value. A !starlark value only has a result after the stack is known, so it cannot decide the stack's own identity. Silently using the encoded source as the name would produce stacks, workspaces, and files named after the program text. The error names the manifest and, when it can be found, the field whose value the name came from.
func SafeTemplate ¶
SafeTemplate permits only static field reads and pure formatting functions. It is deliberately conservative: evaluation must never access files, environment, or providers.
func Upgrade ¶
Upgrade replaces legacy tokens in template text, preserving quoted literals and actions. Unknown or context-dependent tokens are returned for manual review, never guessed.
func WorkspacesEnabled ¶
func WorkspacesEnabled(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo) bool
WorkspacesEnabled reports whether the configuration and backend support workspaces.
Types ¶
type Identity ¶
type Identity struct{ Manifest, ComponentType, Component string }
Identity keys results by authored identity, never by the name being migrated.
type Resolver ¶
type Resolver struct {
Template TemplateEvaluator
StackTemplate TemplateEvaluator
}
Resolver shares runtime naming precedence, normalization, and context construction. StackTemplate must also reject computed stack identities while evaluating expressions. The evaluator is injected so this package does not depend on command execution.
func (Resolver) BuildTerraformWorkspace ¶
func (r Resolver) BuildTerraformWorkspace(atmosConfig *schema.AtmosConfiguration, configAndStacksInfo *schema.ConfigAndStacksInfo) (string, error)
BuildTerraformWorkspace resolves workspace overrides and normalizes slash separators.
func (Resolver) ProcessStackContextPrefix ¶
func (r Resolver) ProcessStackContextPrefix( atmosConfig *schema.AtmosConfiguration, configAndStacksInfo *schema.ConfigAndStacksInfo, stackName string, stackManifestName string, ) error
ProcessStackContextPrefix populates command context and rejects invalid stack identities.
func (Resolver) ResolveStackName ¶
func (r Resolver) ResolveStackName( atmosConfig *schema.AtmosConfiguration, stackFileName, stackManifestName string, info schema.ConfigAndStacksInfo, varsSection map[string]any, ) (string, schema.Context, error)
ResolveStackName returns the logical name and the context populated by a legacy pattern. Precedence is manifest name, template, pattern, then filename. Invalid patterns fall back to filename.
type Result ¶
type Result struct{ Stack, Workspace, Cluster, KubeconfigCluster string }
Result contains the runtime identities a naming migration must preserve.
type TemplateEvaluator ¶
TemplateEvaluator renders a naming expression using the caller's template engine.