lang

package
v0.51.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 EncodeExpression

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

func EvaluateAttr

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 *BodyBuilder) (hcl.Expression, hcl.Diagnostics)

func LoadValidationErrors

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

func Mapd

func Mapd(ectx map[string]cty.Value, file string, name string) (map[string]cty.Value, error)

func MapdFile

func MapdFile(ectx map[string]cty.Value, file string) (map[string]cty.Value, error)

func NewContextFromFile

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

func NewContextFromFiles

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

func NewContextualizedFunctionMap

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

func NewDynamicContextualizedFunctionMap

func NewDynamicContextualizedFunctionMap(ectx *SudoContext) map[string]function.Function

func NewFunctionMap

func NewFunctionMap() map[string]function.Function

func NewGetMetaKeyFunc

func NewGetMetaKeyFunc(str 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 BodyBuilder

type BodyBuilder struct {
	// contains filtered or unexported fields
}

func (*BodyBuilder) GetAllBlocksOfType

func (me *BodyBuilder) GetAllBlocksOfType(name string) []*hclsyntax.Block

func (*BodyBuilder) NewRoot

func (me *BodyBuilder) NewRoot() *hclsyntax.Body

func (*BodyBuilder) NewRootForFile

func (me *BodyBuilder) NewRootForFile(file string) (*hclsyntax.Body, error)

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 *BodyBuilder) (res []*FileBlockEvaluation, diags hcl.Diagnostics, err error)

func ProccessBulk

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

func Process

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

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 SudoContext

type SudoContext struct {
	ParentKey string
	Parent    *SudoContext
	Map       map[string]*SudoContext
	Array     []*SudoContext
	Value     *cty.Value
	UserFuncs map[string]function.Function
}

func (*SudoContext) ApplyArray

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

func (*SudoContext) ApplyBody

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

func (*SudoContext) ApplyKeyVal

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

func (*SudoContext) ApplyValue

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

func (*SudoContext) ApplyValueMap

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

func (*SudoContext) BuildStaticEvalContext

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

func (*SudoContext) BuildStaticEvalContextWithFileData

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

func (*SudoContext) BuildStaticEvalVars

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

func (*SudoContext) BuildStaticVarsList

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

func (*SudoContext) Functions

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

func (*SudoContext) NewArrayChild

func (me *SudoContext) NewArrayChild() *SudoContext

func (*SudoContext) NewChild

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

func (*SudoContext) NewNestedChild

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

func (*SudoContext) Root

func (wc *SudoContext) Root() *SudoContext

func (*SudoContext) ToValue

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