cel

package
v0.3.10 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCompositeCostEstimator

func NewCompositeCostEstimator(estimators ...checker.CostEstimator) checker.CostEstimator

Types

type CEL

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

func NewCEL

func NewCEL(objectCache objectcache.ObjectCache, cfg config.Config) (*CEL, error)

func (*CEL) EvaluateExpression

func (c *CEL) EvaluateExpression(event *events.EnrichedEvent, expression string) (string, error)

func (*CEL) EvaluateExpressionByMap

func (c *CEL) EvaluateExpressionByMap(event map[string]any, expression string, eventType utils.EventType) (string, error)

func (*CEL) EvaluateRule

func (c *CEL) EvaluateRule(event *events.EnrichedEvent, expressions []typesv1.RuleExpression) (bool, error)

func (*CEL) EvaluateRuleByMap

func (c *CEL) EvaluateRuleByMap(event map[string]any, eventType utils.EventType, expressions []typesv1.RuleExpression) (bool, error)

func (*CEL) RegisterCustomType

func (c *CEL) RegisterCustomType(eventType utils.EventType, obj interface{}) error

func (*CEL) RegisterHelper

func (c *CEL) RegisterHelper(function cel.EnvOption) error

type CELRuleEvaluator

type CELRuleEvaluator interface {
	EvaluateRule(event *events.EnrichedEvent, expressions []typesv1.RuleExpression) (bool, error)
	EvaluateExpressionByMap(event map[string]any, expression string, eventType utils.EventType) (string, error)
	EvaluateRuleByMap(event map[string]any, eventType utils.EventType, expressions []typesv1.RuleExpression) (bool, error)
	EvaluateExpression(event *events.EnrichedEvent, expression string) (string, error)
	RegisterHelper(function cel.EnvOption) error
	RegisterCustomType(eventType utils.EventType, obj interface{}) error
}

type CelEventSerializer

type CelEventSerializer struct{}

CelEventSerializer is a default implementation of CelSerializer.

func (*CelEventSerializer) Serialize

func (ces *CelEventSerializer) Serialize(event any) map[string]any

type CelSerializer

type CelSerializer interface {
	Serialize(event any) map[string]any
}

CelSerializer is an interface that serializes events for CEL evaluation.

type CompositeCostEstimator

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

CompositeCostEstimator holds multiple estimators and queries them in order.

func (*CompositeCostEstimator) EstimateCallCost

func (c *CompositeCostEstimator) EstimateCallCost(function, overloadID string, target *checker.AstNode, args []checker.AstNode) *checker.CallEstimate

EstimateCallCost iterates through its estimators and returns the first non-nil estimate.

func (*CompositeCostEstimator) EstimateSize

func (c *CompositeCostEstimator) EstimateSize(element checker.AstNode) *checker.SizeEstimate

EstimateSize iterates through its estimators for a size estimate.

Directories

Path Synopsis
k8s
net

Jump to

Keyboard shortcuts

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