parser

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNestedExpression = errors.New("nested expressions are not allowed")

Functions

func ParseConditionExpressions

func ParseConditionExpressions(conditions []string) ([]string, error)

This function parses resource condition expressions. These expressions need to be standalone expressions so, this function also does some validation. At the end we return the expressions with '${}' removed

To be honest I wouldn't necessarily call it parse, since we are mostly just validating, without caring what's in the expression. Maybe we can rename it in the future 🤔

func ParseResource

func ParseResource(resource map[string]interface{}, resourceSchema *spec.Schema) ([]variable.FieldDescriptor, error)

ParseResource extracts CEL expressions from a resource based on the schema. The resource is expected to be a map[string]interface{}.

Note that this function will also validate the resource against the schema and return an error if the resource does not match the schema. When CEL expressions are found, they are extracted and returned with the expected type of the field (inferred from the schema).

func ParseSchemalessResource

func ParseSchemalessResource(resource map[string]interface{}) ([]variable.FieldDescriptor, error)

ParseSchemalessResource extracts CEL expressions without a schema, this is useful when the schema is not available. e.g RGI statuses

Types

This section is empty.

Jump to

Keyboard shortcuts

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