Documentation
¶
Overview ¶
Bind performs static analysis on a YAML document. The entry point for the package is `NewDecl`.
bind.go contains logic for the initial non-schema binding of an `ast.TemplateDecl` into a `Decl`. query.go contains logic to get information out of a `Decl`. schema.go handles loading appropriate schemas and binding them to an existing `Decl`. diags.go contains the diagnostic error messages used.
Index ¶
- func NewDiagsFromLocation(f func(*hcl.Range) *hcl.Diagnostic) diagsFromLocation
- type ConfigMapEntry
- type Decl
- type Definition
- type FunctionSpec
- type Invoke
- type MapKey
- type PropertyAccessor
- type PropertyAccessorList
- type Reference
- type ResolvableType
- type Resource
- type ResourceSpec
- type Variable
- type VariableMapEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDiagsFromLocation ¶
func NewDiagsFromLocation(f func(*hcl.Range) *hcl.Diagnostic) diagsFromLocation
Types ¶
type ConfigMapEntry ¶
type ConfigMapEntry struct{ ast.ConfigMapEntry }
func (*ConfigMapEntry) DefinitionRange ¶
func (c *ConfigMapEntry) DefinitionRange() *hcl.Range
func (*ConfigMapEntry) ResolveType ¶
func (c *ConfigMapEntry) ResolveType(*Decl) schema.Type
type Decl ¶
type Decl struct {
// contains filtered or unexported fields
}
A bound template.
NOTE: the binding need not be complete, and the template need not be valid.
func (*Decl) Diags ¶
func (b *Decl) Diags() hcl.Diagnostics
Retrieve the diagnostic list for the Decl.
func (*Decl) GetResources ¶
Return a list of all resources whose token matches `tk`.
func (*Decl) LoadSchema ¶
func (d *Decl) LoadSchema(loader schema.ReferenceLoader)
Loads schemas as necessary from the loader to attach to resources and invokes. The schemas are cached internally to make searching faster. New diagnostics are appended to the internal diag list.
func (*Decl) References ¶
Return a list of all variable references bound in the Decl.
type Definition ¶
type Definition interface { ResolvableType DefinitionRange() *hcl.Range // contains filtered or unexported methods }
type FunctionSpec ¶
type Invoke ¶
type Invoke struct {
// contains filtered or unexported fields
}
func (*Invoke) Expr ¶
func (f *Invoke) Expr() *ast.InvokeExpr
type PropertyAccessor ¶
type PropertyAccessor struct { ast.PropertyAccessor // contains filtered or unexported fields }
type PropertyAccessorList ¶
type PropertyAccessorList []PropertyAccessor
func (PropertyAccessorList) TypeFromRoot ¶
func (l PropertyAccessorList) TypeFromRoot(root schema.Type) ([]schema.Type, *hcl.Diagnostic)
Compute out the type chain as long as possible. The completion chain always has 1 element since it includes the root.
type Reference ¶
type Reference struct {
// contains filtered or unexported fields
}
func (*Reference) Accessors ¶
func (r *Reference) Accessors() PropertyAccessorList
Returns the property accessors that hang on the variable referenced. Examples:
${foo.bar} => ["bar"] ${foo.bar.baz} => ["bar" "baz"] ${foo.} => [] ${foo} => []
type ResolvableType ¶
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
func (*Resource) DefinitionRange ¶
func (r *Resource) DefinitionRange() *hcl.Range
type ResourceSpec ¶
type Variable ¶
type Variable struct {
// contains filtered or unexported fields
}
A value that a reference can bind to. This includes the variables, config and resources section of the yaml template.
func (*Variable) Source ¶
func (v *Variable) Source() Definition
type VariableMapEntry ¶
type VariableMapEntry struct{ ast.VariablesMapEntry }
func (*VariableMapEntry) DefinitionRange ¶
func (v *VariableMapEntry) DefinitionRange() *hcl.Range
func (*VariableMapEntry) ResolveType ¶
func (v *VariableMapEntry) ResolveType(d *Decl) schema.Type