naming

package
v1.234.0 Latest Latest
Warning

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

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

Documentation

Overview

Package naming shares runtime naming resolution and inspects naming migrations. Migration inspection never executes configuration; runtime resolution uses injected evaluators.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureLiteralStackIdentity

func EnsureLiteralStackIdentity(stackFileName, name string, section map[string]any) error

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 Field

func Field(path []string) bool

Field recognizes only Atmos-owned naming fields, not similarly named user data.

func SafeTemplate

func SafeTemplate(value string) bool

SafeTemplate permits only static field reads and pure formatting functions. It is deliberately conservative: evaluation must never access files, environment, or providers.

func Upgrade

func Upgrade(value string) (string, []string, []string)

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

type TemplateEvaluator func(*schema.AtmosConfiguration, string, string, any, bool) (string, error)

TemplateEvaluator renders a naming expression using the caller's template engine.

Jump to

Keyboard shortcuts

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