utils

package
v0.0.0-...-ef8c4a0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToCtyObject

func ConvertToCtyObject(val interface{}) (cty.Value, error)

func ExpressionString

func ExpressionString(expression hcl.Expression, parser *hclparse.Parser) string

func ExtractContent

func ExtractContent(body hcl.Body, schema *hcl.BodySchema, ctx types.RattContext) *hcl.BodyContent

func ExtractStr

func ExtractStr(expr hcl.Expression, ctx types.RattContext) string

func GetOptionalAttr

func GetOptionalAttr(name string, body *hcl.BodyContent, ctx types.RattContext) (*cty.Value, bool)

func GetOptionalAttrAsString

func GetOptionalAttrAsString(name string, body *hcl.BodyContent, ctx types.RattContext) (string, bool)

func GetRequiredAttr

func GetRequiredAttr(name string, attributes hcl.Attributes, r *hcl.Range, ctx types.RattContext) *hcl.Attribute

func GetRequiredAttrAsStr

func GetRequiredAttrAsStr(name string, body *hcl.BodyContent, ctx types.RattContext, validate func(val string, body *hcl.BodyContent, attr *hcl.Attribute, ctx types.RattContext)) string

func GetStringAtRange

func GetStringAtRange(rnge hcl.Range, files map[string]*hcl.File) string

func HighlightExpressionString

func HighlightExpressionString(expression string) string

func JsonToCtyObject

func JsonToCtyObject(val []byte) (cty.Value, error)

func MapManyModels

func MapManyModels[R any](blocks []*hcl.Block, ctx types.RattContext, builder func(block *hcl.Block, ctx types.RattContext) []R) []R

func MapModels

func MapModels[R any](blocks []*hcl.Block, ctx types.RattContext, builder func(block *hcl.Block, ctx types.RattContext) R) []R

func NoopValidate

func NoopValidate(val string, body *hcl.BodyContent, attr *hcl.Attribute, ctx types.RattContext)

func OttoArgAsNumber

func OttoArgAsNumber(index int, defaultVal int64, call otto.FunctionCall) int64

func PrettyPrintCtyVal

func PrettyPrintCtyVal(val cty.Value) string

func ResponseToCtyVal

func ResponseToCtyVal(res *http.Response) (cty.Value, error)

func SetVar

func SetVar(evalCtx *hcl.EvalContext, name string, val cty.Value)

Types

type MappableModel

type MappableModel[V any] interface {
	*V // "type *T" in the current Go2 playground
}

Jump to

Keyboard shortcuts

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