evaluator

package
v0.1.3 Latest Latest
Warning

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

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

Documentation

Overview

Package evaluator implements the HCL processing need to create resource definitions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiscardItem

type DiscardItem struct {
	Type        DiscardType   `json:"type"`                  // the kind of thing that is discarded
	Reason      DiscardReason `json:"reason"`                // the reason for the discard
	Name        string        `json:"name,omitempty"`        // used only for things that are named
	SourceRange string        `json:"sourceRange,omitempty"` // source range where the discard happened
	Context     []string      `json:"context,omitempty"`     // relevant messages with more details
}

DiscardItem is an instance of a resource, resource list, group, connection detail or a composite status being discarded from the output either based on user conditions or an incomplete definition of the object in question.

func (DiscardItem) MessageString

func (di DiscardItem) MessageString() string

type DiscardReason

type DiscardReason string

DiscardReason describes the reason for the elision.

type DiscardType

type DiscardType string

DiscardType describes what was discarded by the function.

type DynamicObject

type DynamicObject = map[string]cty.Value

type Evaluator

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

Evaluator evaluates the HCL DSL created for the purposes of producing crossplane resources. Evaluators have mutable state and must not be re-used, nor are they safe for concurrent use.

func New

func New(opts Options) (*Evaluator, error)

New creates an evaluator.

func (*Evaluator) Analyze

func (e *Evaluator) Analyze(files ...File) hcl.Diagnostics

Analyze runs static checks on the supplied HCL files that implement a composition. It returns errors and warnings in the process.

func (*Evaluator) Eval

func (e *Evaluator) Eval(in *fnv1.RunFunctionRequest, files ...File) (*fnv1.RunFunctionResponse, error)

Eval evaluates the supplied HCL files. Ordering of these files are not important for evaluation. Internally they are just processed as though all the files were concatenated into a single file.

type File

type File struct {
	Name    string // the name is informational and only used in diagnostic messages
	Content string // the content is the HCL content as a byte-array
}

File is an HCL file to evaluate.

type Object

type Object = map[string]any

type Options

type Options struct {
	Logger logging.Logger
	Debug  bool
}

Options are evaluation options.

Directories

Path Synopsis
internal/funcs/ipaddr
Package ipaddr is a fork of a subset of the Go standard "net" package which retains parsing behaviors from Go 1.16 or earlier.
Package ipaddr is a fork of a subset of the Go standard "net" package which retains parsing behaviors from Go 1.16 or earlier.

Jump to

Keyboard shortcuts

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