Documentation ¶
Index ¶
- func ExprError(expr Expr, summary, detail string) *syntax.Diagnostic
- type ArrayDecl
- type ArrayExpr
- type BooleanExpr
- type BuiltinExpr
- type EnvironmentDecl
- func Environment(description *StringExpr, imports ImportListDecl, values PropertyMapDecl) *EnvironmentDecl
- func EnvironmentSyntax(node *syntax.ObjectNode, description *StringExpr, imports ImportListDecl, ...) *EnvironmentDecl
- func ParseEnvironment(source []byte, node syntax.Node) (*EnvironmentDecl, syntax.Diagnostics)
- type Expr
- type FromBase64Expr
- type FromJSONExpr
- type ImportDecl
- type ImportListDecl
- type ImportMetaDecl
- type InterpolateExpr
- type Interpolation
- type JoinExpr
- type MapDecl
- type MapEntry
- type Node
- type NullExpr
- type NumberExpr
- type ObjectExpr
- type ObjectProperty
- type OpenExpr
- type PropertyAccess
- type PropertyAccessor
- type PropertyMapDecl
- type PropertyMapEntry
- type PropertyName
- type PropertySubscript
- type SecretExpr
- type StringExpr
- type SymbolExpr
- type ToBase64Expr
- type ToJSONExpr
- type ToStringExpr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ArrayDecl ¶ added in v0.5.5
type ArrayDecl[T Node] struct { Elements []T // contains filtered or unexported fields }
func (*ArrayDecl[T]) GetElements ¶ added in v0.5.5
func (d *ArrayDecl[T]) GetElements() []T
type ArrayExpr ¶ added in v0.5.5
type ArrayExpr struct { Elements []Expr // contains filtered or unexported fields }
A ArrayExpr represents a list of expressions.
func ArraySyntax ¶ added in v0.5.5
ArraySyntax creates a new list expression with the given elements and associated syntax.
type BooleanExpr ¶
type BooleanExpr struct { Value bool // contains filtered or unexported fields }
A BooleanExpr represents a boolean literal.
func Boolean ¶
func Boolean(value bool) *BooleanExpr
Boolean creates a new boolean literal expression with the given value.
func BooleanSyntax ¶
func BooleanSyntax(node *syntax.BooleanNode) *BooleanExpr
BooleanSyntax creates a new boolean literal expression with the given value and associated syntax.
type BuiltinExpr ¶
type BuiltinExpr interface { Expr Name() *StringExpr Args() Expr // contains filtered or unexported methods }
BuiltinExpr represents a call to a builtin function.
type EnvironmentDecl ¶
type EnvironmentDecl struct { Description *StringExpr Imports ImportListDecl Values PropertyMapDecl // contains filtered or unexported fields }
An EnvironmentDecl represents a Pulumi environment.
func Environment ¶
func Environment(description *StringExpr, imports ImportListDecl, values PropertyMapDecl) *EnvironmentDecl
func EnvironmentSyntax ¶
func EnvironmentSyntax(node *syntax.ObjectNode, description *StringExpr, imports ImportListDecl, values PropertyMapDecl) *EnvironmentDecl
func ParseEnvironment ¶
func ParseEnvironment(source []byte, node syntax.Node) (*EnvironmentDecl, syntax.Diagnostics)
ParseEnvironment parses a environment from the given syntax node. The source text is optional, and is only used to print diagnostics.
func (*EnvironmentDecl) NewDiagnosticWriter ¶
func (d *EnvironmentDecl) NewDiagnosticWriter(w io.Writer, width uint, color bool) hcl.DiagnosticWriter
NewDiagnosticWriter returns a new hcl.DiagnosticWriter that can be used to print diagnostics associated with the environment.
func (*EnvironmentDecl) Syntax ¶
func (d *EnvironmentDecl) Syntax() syntax.Node
type Expr ¶
Expr represents a Pulumi YAML expression. Expressions may be literals, interpolated strings, symbols, or builtin functions.
func ParseExpr ¶
func ParseExpr(node syntax.Node) (Expr, syntax.Diagnostics)
ParseExpr parses an expression from the given syntax tree.
The syntax tree is parsed using the following rules:
- *syntax.{Null,Boolean,Number}Node is parsed as a *{Null,Boolean,Number}Expr.
- *syntax.ArrayNode is parsed as a *ArrayExpr.
- *syntax.StringNode is parsed as an *InterpolateExpr, a *SymbolExpr, or a *StringExpr. The node's literal is first parsed as an interpolated string. If the result contains a single property access with no surrounding text, (i.e. the string is of the form "${resource.property}", it is treated as a symbol. If the result contains no property accesses, it is treated as a string literal. Otherwise, it it treated as an interpolated string.
- *syntax.ObjectNode is parses as either an *ObjectExpr or a BuiltinExpr. If the object contains a single key and that key names a builtin function ("fn::invoke", "fn::join", "fn::select", "fn::*Asset", "fn::*Archive", or "fn::stackReference"), then the object is parsed as the corresponding BuiltinExpr. Otherwise, the object is parsed as a *syntax.ObjectNode.
type FromBase64Expr ¶ added in v0.5.5
type FromBase64Expr struct { String Expr // contains filtered or unexported fields }
FromBase64 decodes a Base64 string.
func FromBase64 ¶ added in v0.5.5
func FromBase64(value Expr) *FromBase64Expr
func FromBase64Syntax ¶ added in v0.5.5
func FromBase64Syntax(node *syntax.ObjectNode, name *StringExpr, args Expr) *FromBase64Expr
func (*FromBase64Expr) Name ¶ added in v0.5.5
func (n *FromBase64Expr) Name() *StringExpr
type FromJSONExpr ¶ added in v0.5.5
type FromJSONExpr struct { String Expr // contains filtered or unexported fields }
FromJSON deserializes a JSON string into a value.
func FromJSON ¶ added in v0.5.5
func FromJSON(value Expr) *FromJSONExpr
func FromJSONSyntax ¶ added in v0.5.5
func FromJSONSyntax(node *syntax.ObjectNode, name *StringExpr, args Expr) *FromJSONExpr
func (*FromJSONExpr) Name ¶ added in v0.5.5
func (n *FromJSONExpr) Name() *StringExpr
type ImportDecl ¶
type ImportDecl struct { Environment *StringExpr Meta *ImportMetaDecl // contains filtered or unexported fields }
type ImportListDecl ¶
type ImportListDecl = *ArrayDecl[*ImportDecl]
type ImportMetaDecl ¶
type ImportMetaDecl struct { Merge *BooleanExpr // contains filtered or unexported fields }
type InterpolateExpr ¶
type InterpolateExpr struct { Parts []Interpolation // contains filtered or unexported fields }
An InterpolateExpr represents an interpolated string.
Interpolated strings are represented syntactically as strings of the form "some text with ${property.accesses}". During evaluation, each access replaced with its evaluated value coerced to a string.
In order to allow convenient access to object properties without string coercion, a string of the form "${property.access}" is parsed as a symbol rather than an interpolated string.
func Interpolate ¶
func Interpolate(value string) (*InterpolateExpr, syntax.Diagnostics)
Interpolate creates a new interpolated string expression by parsing the given input string.
func InterpolateSyntax ¶
func InterpolateSyntax(node *syntax.StringNode) (*InterpolateExpr, syntax.Diagnostics)
InterpolateSyntax creates a new interpolated string expression with associated syntax by parsing the given input string literal.
func MustInterpolate ¶
func MustInterpolate(value string) *InterpolateExpr
MustInterpolate creates a new interpolated string expression and panics if parsing fails.
func (*InterpolateExpr) String ¶
func (n *InterpolateExpr) String() string
type Interpolation ¶
type Interpolation struct { Text string Value *PropertyAccess }
type JoinExpr ¶
JoinExpr appends a set of values into a single value, separated by the specified delimiter. If a delimiter is the empty string, the set of values are concatenated with no delimiter.
func JoinSyntax ¶
func JoinSyntax(node *syntax.ObjectNode, name *StringExpr, args *ArrayExpr, delimiter Expr, values Expr) *JoinExpr
func (*JoinExpr) Name ¶
func (n *JoinExpr) Name() *StringExpr
type MapDecl ¶
func (*MapDecl[T]) GetEntries ¶
type MapEntry ¶
type MapEntry[T Node] struct { Key *StringExpr Value T // contains filtered or unexported fields }
type NullExpr ¶
type NullExpr struct {
// contains filtered or unexported fields
}
A NullExpr represents a null literal.
func NullSyntax ¶
NullSyntax creates a new null literal expression with associated syntax.
type NumberExpr ¶
A NumberExpr represents a number literal.
func Number ¶
func Number[T syntax.NumberValue](value T) *NumberExpr
Number creates a new number literal expression with the given value.
func NumberSyntax ¶
func NumberSyntax(node *syntax.NumberNode) *NumberExpr
NumberSyntax creates a new number literal expression with the given value and associated syntax.
type ObjectExpr ¶
type ObjectExpr struct { Entries []ObjectProperty // contains filtered or unexported fields }
An ObjectExpr represents an object.
func Object ¶
func Object(entries ...ObjectProperty) *ObjectExpr
Object creates a new object expression with the given properties.
func ObjectSyntax ¶
func ObjectSyntax(node *syntax.ObjectNode, entries ...ObjectProperty) *ObjectExpr
ObjectSyntax creates a new object expression with the given properties and associated syntax.
type ObjectProperty ¶
type ObjectProperty struct { Key *StringExpr Value Expr // contains filtered or unexported fields }
An ObjectProperty represents an object property. Key must be a string.
type OpenExpr ¶
type OpenExpr struct { Provider *StringExpr Inputs Expr // contains filtered or unexported fields }
OpenExpr is a function expression that invokes an environment provider by name.
func Open ¶
func Open(provider string, inputs *ObjectExpr) *OpenExpr
func OpenSyntax ¶
func OpenSyntax(node *syntax.ObjectNode, name *StringExpr, args Expr, provider *StringExpr, inputs Expr) *OpenExpr
func (*OpenExpr) Name ¶
func (n *OpenExpr) Name() *StringExpr
type PropertyAccess ¶
type PropertyAccess struct {
Accessors []PropertyAccessor
}
func (*PropertyAccess) RootName ¶
func (p *PropertyAccess) RootName() string
func (*PropertyAccess) String ¶
func (p *PropertyAccess) String() string
type PropertyAccessor ¶
type PropertyAccessor interface {
// contains filtered or unexported methods
}
type PropertyMapDecl ¶
type PropertyMapEntry ¶
type PropertyName ¶
type PropertyName struct {
Name string
}
type PropertySubscript ¶
type PropertySubscript struct {
Index interface{}
}
type SecretExpr ¶
type SecretExpr struct { Value Expr // contains filtered or unexported fields }
func Secret ¶
func Secret(value Expr) *SecretExpr
func SecretSyntax ¶
func SecretSyntax(node *syntax.ObjectNode, name *StringExpr, value Expr) *SecretExpr
func (*SecretExpr) Name ¶
func (n *SecretExpr) Name() *StringExpr
type StringExpr ¶
type StringExpr struct { Value string // contains filtered or unexported fields }
A StringExpr represents a string literal.
func String ¶
func String(value string) *StringExpr
String creates a new string literal expression with the given value.
func StringSyntax ¶
func StringSyntax(node *syntax.StringNode) *StringExpr
StringSyntax creates a new string literal expression with the given value and associated syntax.
func StringSyntaxValue ¶
func StringSyntaxValue(node *syntax.StringNode, value string) *StringExpr
StringSyntaxValue creates a new string literal expression with the given syntax and value.
func (*StringExpr) GetValue ¶
func (x *StringExpr) GetValue() string
GetValue returns the expression's value. If the receiver is null, GetValue returns the empty string.
type SymbolExpr ¶
type SymbolExpr struct { Property *PropertyAccess // contains filtered or unexported fields }
A SymbolExpr represents a symbol: a reference to a resource or config property.
Symbol expressions are represented as strings of the form "${resource.property}".
func (*SymbolExpr) String ¶
func (n *SymbolExpr) String() string
type ToBase64Expr ¶
type ToBase64Expr struct { Value Expr // contains filtered or unexported fields }
func ToBase64Syntax ¶
func ToBase64Syntax(node *syntax.ObjectNode, name *StringExpr, args Expr) *ToBase64Expr
func (*ToBase64Expr) Name ¶
func (n *ToBase64Expr) Name() *StringExpr
type ToJSONExpr ¶
type ToJSONExpr struct { Value Expr // contains filtered or unexported fields }
ToJSON returns the underlying structure as a json string.
func ToJSON ¶
func ToJSON(value Expr) *ToJSONExpr
func ToJSONSyntax ¶
func ToJSONSyntax(node *syntax.ObjectNode, name *StringExpr, args Expr) *ToJSONExpr
func (*ToJSONExpr) Name ¶
func (n *ToJSONExpr) Name() *StringExpr
type ToStringExpr ¶
type ToStringExpr struct { Value Expr // contains filtered or unexported fields }
ToString returns the underlying structure as a string.
func ToString ¶
func ToString(value Expr) *ToStringExpr
func ToStringSyntax ¶
func ToStringSyntax(node *syntax.ObjectNode, name *StringExpr, args Expr) *ToStringExpr
func (*ToStringExpr) Name ¶
func (n *ToStringExpr) Name() *StringExpr