Documentation ¶
Index ¶
- Variables
- func ExprError(expr Expr, summary, detail string) *syntax.Diagnostic
- type AssetArchiveExpr
- type AssetOrArchiveExpr
- type BooleanExpr
- type BuiltinExpr
- type ConfigMapDecl
- type ConfigMapEntry
- type ConfigParamDecl
- type CustomTimeoutsDecl
- type Expr
- type FileArchiveExpr
- type FileAssetExpr
- type FromBase64Expr
- type GetResourceDecl
- type InterpolateExpr
- type Interpolation
- type InvokeExpr
- type InvokeOptionsDecl
- type JoinExpr
- type ListExpr
- type NullExpr
- type NumberExpr
- type ObjectExpr
- type ObjectProperty
- type PropertyAccess
- type PropertyAccessor
- type PropertyMapDecl
- type PropertyMapEntry
- type PropertyName
- type PropertySubscript
- type ReadFileExpr
- type RemoteArchiveExpr
- type RemoteAssetExpr
- type ResourceDecl
- type ResourceOptionsDecl
- type ResourcesMapDecl
- type ResourcesMapEntry
- type SecretExpr
- type SelectExpr
- type SplitExpr
- type StackReferenceExpr
- type StringAssetExpr
- type StringExpr
- type StringListDecl
- type SymbolExpr
- type TemplateDecl
- type ToBase64Expr
- type ToJSONExpr
- type VariablesMapDecl
- type VariablesMapEntry
Constants ¶
This section is empty.
Variables ¶
var PropertyNameRegexp = regexp.MustCompile("^[a-zA-Z_$][a-zA-Z0-9_$]*$")
RootTraversalValidation validates a root property access in global scope to avoid recompiling.
Functions ¶
Types ¶
type AssetArchiveExpr ¶
type AssetArchiveExpr struct { AssetOrArchives map[string]Expr // contains filtered or unexported fields }
func AssetArchiveSyntax ¶
func AssetArchiveSyntax(node *syntax.ObjectNode, name *StringExpr, args *ObjectExpr, assetsOrArchives map[string]Expr) *AssetArchiveExpr
func (*AssetArchiveExpr) Name ¶
func (n *AssetArchiveExpr) Name() *StringExpr
type AssetOrArchiveExpr ¶
type AssetOrArchiveExpr interface { Expr // contains filtered or unexported methods }
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 ConfigMapDecl ¶
type ConfigMapDecl struct { Entries []ConfigMapEntry // contains filtered or unexported fields }
type ConfigMapEntry ¶
type ConfigMapEntry struct { Key *StringExpr Value *ConfigParamDecl // contains filtered or unexported fields }
type ConfigParamDecl ¶
type ConfigParamDecl struct { Type *StringExpr Name *StringExpr Secret *BooleanExpr Default Expr Value Expr // contains filtered or unexported fields }
func ConfigParam ¶
func ConfigParam(typ *StringExpr, name *StringExpr, defaultValue Expr, secret *BooleanExpr) *ConfigParamDecl
func ConfigParamSyntax ¶
func ConfigParamSyntax(node *syntax.ObjectNode, typ *StringExpr, name *StringExpr, secret *BooleanExpr, defaultValue Expr) *ConfigParamDecl
type CustomTimeoutsDecl ¶
type CustomTimeoutsDecl struct { Create *StringExpr Update *StringExpr Delete *StringExpr // contains filtered or unexported fields }
func CustomTimeouts ¶
func CustomTimeouts(create, update, delete *StringExpr) *CustomTimeoutsDecl
func CustomTimeoutsSyntax ¶
func CustomTimeoutsSyntax(node *syntax.ObjectNode, create, update, delete *StringExpr) *CustomTimeoutsDecl
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.ListNode is parsed as a *ListExpr.
- *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 FileArchiveExpr ¶
type FileArchiveExpr struct { Source Expr // contains filtered or unexported fields }
func FileArchiveSyntax ¶
func FileArchiveSyntax(node syntax.Node, name *StringExpr, source Expr) *FileArchiveExpr
func (*FileArchiveExpr) Name ¶
func (n *FileArchiveExpr) Name() *StringExpr
type FileAssetExpr ¶
type FileAssetExpr struct { Source Expr // contains filtered or unexported fields }
func FileAssetSyntax ¶
func FileAssetSyntax(node syntax.Node, name *StringExpr, source Expr) *FileAssetExpr
func (*FileAssetExpr) Name ¶
func (n *FileAssetExpr) Name() *StringExpr
type FromBase64Expr ¶
type FromBase64Expr struct { Value Expr // contains filtered or unexported fields }
func FromBase64Syntax ¶
func FromBase64Syntax(node *syntax.ObjectNode, name *StringExpr, args Expr) *FromBase64Expr
func (*FromBase64Expr) Name ¶
func (n *FromBase64Expr) Name() *StringExpr
type GetResourceDecl ¶ added in v0.5.4
type GetResourceDecl struct { // We need to call the field Id instead of ID because we want the derived user field to be id instead of iD Id Expr //nolint:revive State PropertyMapDecl // contains filtered or unexported fields }
func GetResource ¶ added in v0.5.4
func GetResource(id *StringExpr, state PropertyMapDecl) GetResourceDecl
func GetResourceSyntax ¶ added in v0.5.4
func GetResourceSyntax(node *syntax.ObjectNode, id *StringExpr, state PropertyMapDecl) GetResourceDecl
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 InvokeExpr ¶
type InvokeExpr struct { Token *StringExpr CallArgs *ObjectExpr CallOpts InvokeOptionsDecl Return *StringExpr // contains filtered or unexported fields }
InvokeExpr is a function expression that invokes a Pulumi function by type token.
func Invoke ¶
func Invoke(token string, callArgs *ObjectExpr, callOpts InvokeOptionsDecl, ret string) *InvokeExpr
func InvokeSyntax ¶
func InvokeSyntax(node *syntax.ObjectNode, name *StringExpr, args *ObjectExpr, token *StringExpr, callArgs *ObjectExpr, callOpts InvokeOptionsDecl, ret *StringExpr) *InvokeExpr
func (*InvokeExpr) Name ¶
func (n *InvokeExpr) Name() *StringExpr
type InvokeOptionsDecl ¶ added in v0.5.4
type InvokeOptionsDecl struct { Parent Expr Provider Expr Version *StringExpr PluginDownloadURL *StringExpr // contains filtered or unexported fields }
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 *ListExpr, delimiter Expr, values Expr) *JoinExpr
func (*JoinExpr) Name ¶
func (n *JoinExpr) Name() *StringExpr
type ListExpr ¶
type ListExpr struct { Elements []Expr // contains filtered or unexported fields }
A ListExpr represents a list of expressions.
func ListSyntax ¶
ListSyntax creates a new list expression with the given elements and associated syntax.
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 ¶
type NumberExpr struct { Value float64 // contains filtered or unexported fields }
A NumberExpr represents a number literal.
func Number ¶
func Number(value float64) *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 ¶
An ObjectProperty represents an object property. Key must be a string, interpolated string, or symbol.
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 PropertyMapDecl struct { Entries []PropertyMapEntry // contains filtered or unexported fields }
type PropertyMapEntry ¶
type PropertyMapEntry struct { Key *StringExpr Value Expr // contains filtered or unexported fields }
func (PropertyMapEntry) Object ¶ added in v0.5.8
func (p PropertyMapEntry) Object() ObjectProperty
type PropertyName ¶
type PropertyName struct {
Name string
}
type PropertySubscript ¶
type PropertySubscript struct {
Index interface{}
}
type ReadFileExpr ¶
type ReadFileExpr struct { Path Expr // contains filtered or unexported fields }
func ReadFileSyntax ¶
func ReadFileSyntax(node syntax.Node, name *StringExpr, path Expr) *ReadFileExpr
func (*ReadFileExpr) Name ¶
func (n *ReadFileExpr) Name() *StringExpr
type RemoteArchiveExpr ¶
type RemoteArchiveExpr struct { Source Expr // contains filtered or unexported fields }
func RemoteArchiveSyntax ¶
func RemoteArchiveSyntax(node syntax.Node, name *StringExpr, source Expr) *RemoteArchiveExpr
func (*RemoteArchiveExpr) Name ¶
func (n *RemoteArchiveExpr) Name() *StringExpr
type RemoteAssetExpr ¶
type RemoteAssetExpr struct { Source Expr // contains filtered or unexported fields }
func RemoteAssetSyntax ¶
func RemoteAssetSyntax(node syntax.Node, name *StringExpr, source Expr) *RemoteAssetExpr
func (*RemoteAssetExpr) Name ¶
func (n *RemoteAssetExpr) Name() *StringExpr
type ResourceDecl ¶
type ResourceDecl struct { Type *StringExpr Name *StringExpr DefaultProvider *BooleanExpr Properties PropertyMapDecl Options ResourceOptionsDecl Get GetResourceDecl // contains filtered or unexported fields }
func Resource ¶
func Resource( typ *StringExpr, name *StringExpr, defaultProvider *BooleanExpr, properties PropertyMapDecl, options ResourceOptionsDecl, get GetResourceDecl) *ResourceDecl
func ResourceSyntax ¶
func ResourceSyntax(node *syntax.ObjectNode, typ *StringExpr, name *StringExpr, defaultProvider *BooleanExpr, properties PropertyMapDecl, options ResourceOptionsDecl, get GetResourceDecl) *ResourceDecl
func (*ResourceDecl) Fields ¶ added in v0.5.4
func (*ResourceDecl) Fields() []string
The names of exported fields.
type ResourceOptionsDecl ¶
type ResourceOptionsDecl struct { AdditionalSecretOutputs *StringListDecl Aliases *StringListDecl CustomTimeouts *CustomTimeoutsDecl DeleteBeforeReplace *BooleanExpr DependsOn Expr IgnoreChanges *StringListDecl Import *StringExpr Parent Expr Protect Expr Provider Expr Providers Expr Version *StringExpr PluginDownloadURL *StringExpr ReplaceOnChanges *StringListDecl RetainOnDelete *BooleanExpr DeletedWith Expr // contains filtered or unexported fields }
func ResourceOptions ¶
func ResourceOptions(additionalSecretOutputs, aliases *StringListDecl, customTimeouts *CustomTimeoutsDecl, deleteBeforeReplace *BooleanExpr, dependsOn Expr, ignoreChanges *StringListDecl, importID *StringExpr, parent Expr, protect Expr, provider, providers Expr, version *StringExpr, pluginDownloadURL *StringExpr, replaceOnChanges *StringListDecl, retainOnDelete *BooleanExpr, deletedWith Expr) ResourceOptionsDecl
func ResourceOptionsSyntax ¶
func ResourceOptionsSyntax(node *syntax.ObjectNode, additionalSecretOutputs, aliases *StringListDecl, customTimeouts *CustomTimeoutsDecl, deleteBeforeReplace *BooleanExpr, dependsOn Expr, ignoreChanges *StringListDecl, importID *StringExpr, parent Expr, protect Expr, provider, providers Expr, version *StringExpr, pluginDownloadURL *StringExpr, replaceOnChanges *StringListDecl, retainOnDelete *BooleanExpr, deletedWith Expr) ResourceOptionsDecl
type ResourcesMapDecl ¶
type ResourcesMapDecl struct { Entries []ResourcesMapEntry // contains filtered or unexported fields }
type ResourcesMapEntry ¶
type ResourcesMapEntry struct { Key *StringExpr Value *ResourceDecl // contains filtered or unexported fields }
type SecretExpr ¶
type SecretExpr struct { Value Expr // contains filtered or unexported fields }
func SecretSyntax ¶
func SecretSyntax(node *syntax.ObjectNode, name *StringExpr, args Expr) *SecretExpr
func (*SecretExpr) Name ¶
func (n *SecretExpr) Name() *StringExpr
type SelectExpr ¶
SelectExpr returns a single object from a list of objects by index.
func Select ¶
func Select(index Expr, values Expr) *SelectExpr
func SelectSyntax ¶
func SelectSyntax(node *syntax.ObjectNode, name *StringExpr, args *ListExpr, index Expr, values Expr) *SelectExpr
func (*SelectExpr) Name ¶
func (n *SelectExpr) Name() *StringExpr
type SplitExpr ¶
Splits a string into a list by a delimiter
func SplitSyntax ¶
func SplitSyntax(node *syntax.ObjectNode, name *StringExpr, args *ListExpr) *SplitExpr
func (*SplitExpr) Name ¶
func (n *SplitExpr) Name() *StringExpr
type StackReferenceExpr ¶
type StackReferenceExpr struct { StackName *StringExpr PropertyName Expr // contains filtered or unexported fields }
StackReferenceExpr gets an output of another stack for use in this deployment.
func StackReference ¶
func StackReference(stackName string, propertyName Expr) *StackReferenceExpr
func StackReferenceSyntax ¶
func StackReferenceSyntax(node *syntax.ObjectNode, name *StringExpr, args *ListExpr, stackName *StringExpr, propertyName Expr) *StackReferenceExpr
func (*StackReferenceExpr) Name ¶
func (n *StackReferenceExpr) Name() *StringExpr
type StringAssetExpr ¶
type StringAssetExpr struct { Source Expr // contains filtered or unexported fields }
func StringAssetSyntax ¶
func StringAssetSyntax(node syntax.Node, name *StringExpr, source Expr) *StringAssetExpr
func (*StringAssetExpr) Name ¶
func (n *StringAssetExpr) 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 ¶ added in v1.0.0
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 StringListDecl ¶
type StringListDecl struct { Elements []*StringExpr // contains filtered or unexported fields }
func (*StringListDecl) GetElements ¶
func (d *StringListDecl) GetElements() []*StringExpr
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 VariableSubstitution ¶ added in v0.5.4
func VariableSubstitution(value string) (*SymbolExpr, syntax.Diagnostics)
func (*SymbolExpr) String ¶
func (n *SymbolExpr) String() string
type TemplateDecl ¶
type TemplateDecl struct { Name *StringExpr Description *StringExpr Configuration ConfigMapDecl Config ConfigMapDecl Variables VariablesMapDecl Resources ResourcesMapDecl Outputs PropertyMapDecl // contains filtered or unexported fields }
A TemplateDecl represents a Pulumi YAML template.
func ParseTemplate ¶
func ParseTemplate(source []byte, node syntax.Node) (*TemplateDecl, syntax.Diagnostics)
ParseTemplate parses a template from the given syntax node. The source text is optional, and is only used to print diagnostics.
func Template ¶
func Template(description *StringExpr, configuration ConfigMapDecl, variables VariablesMapDecl, resources ResourcesMapDecl, outputs PropertyMapDecl) *TemplateDecl
func TemplateSyntax ¶
func TemplateSyntax(node *syntax.ObjectNode, description *StringExpr, configuration ConfigMapDecl, variables VariablesMapDecl, resources ResourcesMapDecl, outputs PropertyMapDecl) *TemplateDecl
func (*TemplateDecl) NewDiagnosticWriter ¶
func (d *TemplateDecl) 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 template.
func (*TemplateDecl) Syntax ¶
func (d *TemplateDecl) Syntax() syntax.Node
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 VariablesMapDecl ¶
type VariablesMapDecl struct { Entries []VariablesMapEntry // contains filtered or unexported fields }
type VariablesMapEntry ¶
type VariablesMapEntry struct { Key *StringExpr Value Expr // contains filtered or unexported fields }