eval

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 17 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TagDecoder = tagDecoder(0)

The TagDecoder is responsible for decoding YAML tags that represent calls to builtin functions.

No tags are presently supported, but the machinery to support tags is useful to preserve until we are confident that we won't re-introduce.

Functions

func CheckEnvironment

func CheckEnvironment(
	ctx context.Context,
	name string,
	env *ast.EnvironmentDecl,
	providers ProviderLoader,
	environments EnvironmentLoader,
) (*esc.Environment, syntax.Diagnostics)

CheckEnvironment symbolically evaluates the given environment. Calls to fn::open are not invoked, and instead evaluate to unknown values with appropriate schemata.

func EvalEnvironment

func EvalEnvironment(
	ctx context.Context,
	name string,
	env *ast.EnvironmentDecl,
	providers ProviderLoader,
	environments EnvironmentLoader,
) (*esc.Environment, syntax.Diagnostics)

EvalEnvironment evaluates the given environment.

func LoadYAML

func LoadYAML(filename string, r io.Reader) (*ast.EnvironmentDecl, syntax.Diagnostics, error)

LoadYAML decodes a YAML template from an io.Reader.

func LoadYAMLBytes

func LoadYAMLBytes(filename string, source []byte) (*ast.EnvironmentDecl, syntax.Diagnostics, error)

LoadYAMLBytes decodes a YAML template from a byte array.

Types

type EnvironmentLoader

type EnvironmentLoader interface {
	// LoadEnvironment loads the definition for the environment with the given name.
	LoadEnvironment(ctx context.Context, name string) ([]byte, error)
}

An EnvironmentLoader provides the environment evaluator the capability to load imported environment definitions.

type ProviderLoader

type ProviderLoader interface {
	// LoadProvider loads the provider with the given name.
	LoadProvider(ctx context.Context, name string) (esc.Provider, error)
}

A ProviderLoader provides the environment evaluator the capability to load providers.

Jump to

Keyboard shortcuts

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