hclread

package
v0.50.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const ArrKey = "____arr"
View Source
const FilesKey = "____files"
View Source
const MetaKey = "____meta"

Variables

This section is empty.

Functions

func ApplyFileSpecificToContext added in v0.49.0

func ApplyFileSpecificToContext(ctx context.Context, tange hcl.Range, child *hcl.EvalContext)

func EncodeExpression added in v0.49.0

func EncodeExpression(e hclsyntax.Expression, ectx *hcl.EvalContext) (any, hcl.Diagnostics, error)

func EvaluateAttr added in v0.49.0

func EvaluateAttr(ctx context.Context, name string, attr hclsyntax.Expression, parentctx *SudoContext) hcl.Diagnostics

func ExtractUserFuncs

func ExtractUserFuncs(ctx context.Context, ibdy hcl.Body, parent *hcl.EvalContext) (map[string]function.Function, hcl.Diagnostics)

func ExtractVariables

func ExtractVariables(ctx context.Context, bdy *hclsyntax.Body, parentctx *SudoContext) hcl.Diagnostics

func InstanceLocationStringToHCLRange

func InstanceLocationStringToHCLRange(instLoc string, msg string, cnt hclsyntax.Expression, ectx *hcl.EvalContext, file hcl.Body) (hcl.Expression, hcl.Diagnostics)

func LoadValidationErrors

func LoadValidationErrors(ctx context.Context, cnt hclsyntax.Expression, ectx *hcl.EvalContext, errv error, bdy hcl.Body) (hcl.Diagnostics, error)

func NewContextFromBody added in v0.48.0

func NewContextFromBody(ctx context.Context, body *hclsyntax.Body, parent *SudoContext) (*hcl.EvalContext, hcl.Diagnostics, error)

func NewContextualizedFunctionMap added in v0.46.0

func NewContextualizedFunctionMap(ectx map[string]cty.Value, file string) map[string]function.Function

func NewFunctionMap

func NewFunctionMap() map[string]function.Function

func NewGetMetaKeyFunc added in v0.48.0

func NewGetMetaKeyFunc(str string) function.Function

func NewGlobalContextualizedFunctionMap added in v0.47.0

func NewGlobalContextualizedFunctionMap(ectx map[string]cty.Value) map[string]function.Function

func NewRefFunctionFromPath

func NewRefFunctionFromPath(ctx context.Context, start string) function.Function

func NewUnknownBlockEvaluation

func NewUnknownBlockEvaluation(ctx context.Context, parentctx *SudoContext, block *hclsyntax.Block) (diags hcl.Diagnostics)

Types

type AnyBlockEvaluation

type AnyBlockEvaluation struct {
	Name    string
	Content map[string]cty.Value
}

type FileBlockEvaluation

type FileBlockEvaluation struct {
	Name          string
	Schema        string
	Path          string
	OrderedOutput yaml.MapSlice
	RawOutput     any
	Source        string
}

func NewGenBlockEvaluation

func NewGenBlockEvaluation(ctx context.Context, sctx *SudoContext, file *hclsyntax.Body) (res *FileBlockEvaluation, diags hcl.Diagnostics, err error)

func ProccessBulk added in v0.47.0

func ProccessBulk(ctx context.Context, fs afero.Fs, files []string) ([]*FileBlockEvaluation, hcl.Diagnostics, error)

func Process

func (*FileBlockEvaluation) Encode

func (me *FileBlockEvaluation) Encode() ([]byte, error)

func (*FileBlockEvaluation) WriteToFile

func (me *FileBlockEvaluation) WriteToFile(ctx context.Context, fs afero.Fs) error

func (*FileBlockEvaluation) WriteToReader

func (me *FileBlockEvaluation) WriteToReader(ctx context.Context) (io.Reader, error)

type PreCtyValue added in v0.49.0

type PreCtyValue struct {
	Val      cty.Value
	Range    hcl.Range
	Name     string
	Children []*PreCtyValue
}

type SudoContext added in v0.49.0

type SudoContext struct {
	ParentKey string
	Parent    *SudoContext
	Map       map[string]*SudoContext
	Array     []*SudoContext
	Value     *cty.Value
	UserFuncs map[string]function.Function
	// contains filtered or unexported fields
}

func NewContextFromFile

func NewContextFromFile(ctx context.Context, fle []byte, name string) (*hcl.File, *SudoContext, *hclsyntax.Body, hcl.Diagnostics, error)

func NewContextFromFiles added in v0.48.0

func NewContextFromFiles(ctx context.Context, fle map[string][]byte, parent *hcl.EvalContext) (*hcl.File, *SudoContext, *hclsyntax.Body, map[string]*hclsyntax.Body, hcl.Diagnostics, error)

func (*SudoContext) ApplyArray added in v0.49.0

func (me *SudoContext) ApplyArray(arr []cty.Value)

func (*SudoContext) ApplyKeyVal added in v0.49.0

func (me *SudoContext) ApplyKeyVal(key string, val cty.Value)

func (*SudoContext) ApplyValue added in v0.49.0

func (me *SudoContext) ApplyValue(val cty.Value)

func (*SudoContext) ApplyValueMap added in v0.49.0

func (me *SudoContext) ApplyValueMap(val map[string]cty.Value)

func (*SudoContext) BuildStaticEvalContext added in v0.49.0

func (wc *SudoContext) BuildStaticEvalContext() *hcl.EvalContext

func (*SudoContext) BuildStaticEvalContextWithFileData added in v0.49.0

func (wc *SudoContext) BuildStaticEvalContextWithFileData(file string) *hcl.EvalContext

func (*SudoContext) BuildStaticEvalVars added in v0.49.0

func (me *SudoContext) BuildStaticEvalVars() map[string]cty.Value

func (*SudoContext) BuildStaticVarsList added in v0.49.0

func (me *SudoContext) BuildStaticVarsList() []cty.Value

func (*SudoContext) Functions added in v0.49.0

func (me *SudoContext) Functions() map[string]function.Function

func (*SudoContext) NewArrayChild added in v0.49.0

func (me *SudoContext) NewArrayChild() *SudoContext

func (*SudoContext) NewChild added in v0.49.0

func (me *SudoContext) NewChild(key string) *SudoContext

func (*SudoContext) NewNestedChild added in v0.49.0

func (me *SudoContext) NewNestedChild(key ...string) *SudoContext

func (*SudoContext) Root added in v0.49.0

func (wc *SudoContext) Root() *SudoContext

func (*SudoContext) ToValue added in v0.49.0

func (me *SudoContext) ToValue() cty.Value

type ValidationBlock

type ValidationBlock interface {
	HasValidationErrors() bool
	Encode() ([]byte, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL