Documentation ¶
Index ¶
- Variables
- func ContextFunctions(workspaceDir string) map[string]function.Function
- func GetMetadataForParsedResource(resourceName string, block *hcl.Block, fileData map[string][]byte, ...) *modconfig.ResourceMetadata
- func IsMissingVariableError(diag *hcl.Diagnostic) bool
- func IsQualifiedTraversal(traversal hcl.Traversal) bool
- func LoadFileData(paths []string) (map[string][]byte, hcl.Diagnostics)
- func ParseConnection(block *hcl.Block, fileData map[string][]byte) (*modconfig.Connection, hcl.Diagnostics)
- func ParseHclFiles(fileData map[string][]byte) (hcl.Body, hcl.Diagnostics)
- func ParseMod(modPath string, fileData map[string][]byte, ...) (*modconfig.Mod, error)
- func ParseOptions(block *hcl.Block) (options.Options, hcl.Diagnostics)
- func TraversalAsString(traversal hcl.Traversal) string
- type ParseModFlag
- type ParseModOptions
- type RunContext
- func (c *RunContext) AddDependencies(block *hcl.Block, name string, dependencies []hcl.Traversal) hcl.Diagnostics
- func (c *RunContext) AddResource(resource modconfig.HclResource, block *hcl.Block) hcl.Diagnostics
- func (c *RunContext) BlocksToDecode() (hcl.Blocks, error)
- func (c *RunContext) EvalComplete() bool
Constants ¶
This section is empty.
Variables ¶
var ConfigSchema = &hcl.BodySchema{ Attributes: []hcl.AttributeSchema{}, Blocks: []hcl.BlockHeaderSchema{ { Type: "connection", LabelNames: []string{"name"}, }, { Type: "options", LabelNames: []string{"type"}, }, }, }
var ConnectionSchema = &hcl.BodySchema{ Attributes: []hcl.AttributeSchema{ { Name: "plugin", Required: true, }, }, Blocks: []hcl.BlockHeaderSchema{ { Type: "options", LabelNames: []string{"type"}, }, }, }
var ModFileSchema = &hcl.BodySchema{ Attributes: []hcl.AttributeSchema{}, Blocks: []hcl.BlockHeaderSchema{ { Type: string(modconfig.BlockTypeMod), LabelNames: []string{"name"}, }, { Type: string(modconfig.BlockTypeQuery), LabelNames: []string{"name"}, }, { Type: string(modconfig.BlockTypeControl), LabelNames: []string{"name"}, }, { Type: string(modconfig.BlockTypeControlGroup), LabelNames: []string{"name"}, }, { Type: string(modconfig.BlockTypeLocals), }, }, }
ModFileSchema :: top level schema for all mod resources
Functions ¶
func ContextFunctions ¶
ContextFunctions :: returns the set of functions that should be used to when evaluating expressions
func IsMissingVariableError ¶
func IsMissingVariableError(diag *hcl.Diagnostic) bool
func IsQualifiedTraversal ¶
func IsQualifiedTraversal(traversal hcl.Traversal) bool
IsQualifiedTraversal :: a 'qualified traversal' is of form <mod>.<query|action|policy>.<name>.xxx.xxx
func LoadFileData ¶
LoadFileData :: built a map of filepath to file data
func ParseConnection ¶
func ParseConnection(block *hcl.Block, fileData map[string][]byte) (*modconfig.Connection, hcl.Diagnostics)
func ParseHclFiles ¶
func ParseMod ¶
func ParseMod(modPath string, fileData map[string][]byte, pseudoResources []modconfig.MappableResource, opts *ParseModOptions) (*modconfig.Mod, error)
ParseMod :: parse all source hcl files for the mod and associated resources
func ParseOptions ¶
func TraversalAsString ¶
func TraversalAsString(traversal hcl.Traversal) string
TraversalAsString :: convert a traversal to a path string
Types ¶
type ParseModFlag ¶
type ParseModFlag uint32
const ( CreateDefaultMod ParseModFlag = 1 << iota CreatePseudoResources )
type ParseModOptions ¶
type ParseModOptions struct { Flags ParseModFlag ListOptions *filehelpers.ListOptions }
func (*ParseModOptions) CreateDefaultMod ¶
func (o *ParseModOptions) CreateDefaultMod() bool
func (*ParseModOptions) CreatePseudoResources ¶
func (o *ParseModOptions) CreatePseudoResources() bool
type RunContext ¶
type RunContext struct { Mod *modconfig.Mod UnresolvedBlocks map[string]*hcl.Block FileData map[string][]byte EvalCtx *hcl.EvalContext // contains filtered or unexported fields }
func NewRunContext ¶
func NewRunContext(mod *modconfig.Mod, content *hcl.BodyContent, fileData map[string][]byte) (*RunContext, hcl.Diagnostics)
func (*RunContext) AddDependencies ¶
func (c *RunContext) AddDependencies(block *hcl.Block, name string, dependencies []hcl.Traversal) hcl.Diagnostics
AddDependencies :: the block could not be resolved as it has dependencies 1) store block as unresolved 2) add dependencies to our tree of depdnecie
func (*RunContext) AddResource ¶
func (c *RunContext) AddResource(resource modconfig.HclResource, block *hcl.Block) hcl.Diagnostics
AddResource :: store this resource as a variable to be added to the eval ccontext
func (*RunContext) BlocksToDecode ¶
func (c *RunContext) BlocksToDecode() (hcl.Blocks, error)
func (*RunContext) EvalComplete ¶
func (c *RunContext) EvalComplete() bool
EvalComplete :: Are all elements in the dependency tree fully evaluated