{"modulePath":"github.com/cloudposse/atmos","version":"v1.235.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package parser\n\nPackage parser owns the grammars used by Atmos configuration functions.\n\nIt parses function arguments and encodes their tagged YAML forms for deferred evaluation. Stack document loading, template rendering, and expression evaluation remain the responsibility of their existing layers. Callers receive typed argument values and can apply execution-context defaults.\n\n## Functions\n\n```go\nfunc EncodeCILabels(node *yaml.Node) (string, error)\n```\nEncodeCILabels validates tagged YAML arguments and encodes a deferred function expression. Sequence arguments must be preserved explicitly because their node.Value is empty.\n\n```go\nfunc ParseCILabels(input string) ([]string, error)\n```\nParseCILabels accepts no arguments (list mode) or a nonempty YAML sequence of literal strings. A nil result distinguishes list mode from membership matching.\n\n## Types\n\n```go\ntype EnvArgs struct {\n\tName    string\n\tDefault string\n}\n```\nEnvArgs contains an environment variable name and its optional default value.\n\n```go\nfunc ParseEnv(input string) (EnvArgs, error)\n```\nParseEnv parses \\`name \\[default]\\`.\n\n```go\ntype Error struct {\n\tPosition Position\n\tMessage  string\n}\n```\nError describes an invalid function-argument grammar.\n\n```go\nfunc (e *Error) Error() string\n```\nError implements error.\n\n```go\ntype IncludeArgs struct {\n\tPath  string\n\tQuery string\n\t// Eval reports the trailing `| eval` option: YAML functions inside the\n\t// included file are evaluated instead of being included as data.\n\tEval bool\n}\n```\nIncludeArgs contains an include target and its optional YQ query.\n\n```go\nfunc ParseInclude(input string) (IncludeArgs, error)\n```\nParseInclude parses \\`path \\[query] \\[| eval]\\` and preserves whitespace in the query. The only option !include accepts is the valueless \\`eval\\`; a pipe that is not followed by it belongs to the yq query (\\`.items\\[] | select(.enabled)\\`).\n\n```go\ntype LabelsArgs struct {\n\tKey     *string\n\tDefault *string\n}\n```\nLabelsArgs selects the full label map (Key == nil), or a literal key with an optional fallback. A pointer distinguishes an empty fallback from none.\n\n```go\nfunc ParseLabels(input string) (LabelsArgs, error)\n```\nParseLabels parses \\`\\[key \\[default]]\\` using the shared argument quoting rules.\n\n```go\ntype Position struct {\n\tOffset int\n\tLine   int\n\tColumn int\n}\n```\nPosition identifies a byte position in function arguments.\n\n```go\ntype RandomArgs struct {\n\tValues []string\n}\n```\nRandomArgs contains the optional minimum and maximum random values as source text.\n\n```go\nfunc ParseRandom(input string) (RandomArgs, error)\n```\nParseRandom parses zero, one, or two integer source values.\n\n```go\ntype SecretArgs struct {\n\tName    string\n\tPath    string\n\tRaw     bool\n\tDefault *string\n}\n```\nSecretArgs contains a declared secret name and its optional modifiers.\n\n```go\nfunc ParseSecret(input string) (SecretArgs, error)\n```\nParseSecret parses \\`name \\[| path expression | raw] \\[| default value]\\`.\n\n```go\ntype StoreArgs struct {\n\tStore     string\n\tStack     string\n\tComponent string\n\tKey       string\n\tDefault   *string\n\tQuery     string\n}\n```\nStoreArgs contains the parsed !store arguments.\n\n```go\nfunc ParseStore(input string) (StoreArgs, error)\n```\nParseStore parses !store arguments and their optional default/query clauses.\n\n```go\ntype StoreGetArgs struct {\n\tStore   string\n\tKey     string\n\tDefault *string\n\tQuery   string\n}\n```\nStoreGetArgs contains the parsed !store.get arguments.\n\n```go\nfunc ParseStoreGet(input string) (StoreGetArgs, error)\n```\nParseStoreGet parses !store.get arguments and optional default/query clauses.\n\n```go\ntype TerraformArgs struct {\n\tComponent  string\n\tStack      string\n\tExpression string\n}\n```\nTerraformArgs is the parsed form of \\`component \\[stack] expression\\`. An empty Stack means the caller should use the execution-context stack.\n\n```go\nfunc ParseTerraform(input string) (TerraformArgs, error)\n```\nParseTerraform parses \\`component \\[stack] expression\\`.\n\n","path":"github.com/cloudposse/atmos/pkg/function/parser","name":"parser","synopsis":"Package parser owns the grammars used by Atmos configuration functions.","isRedistributable":true}
