cel

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthPolicyKind           = "AuthPolicy"
	RateLimitPolicyKind      = "RateLimitPolicy"
	TokenRateLimitPolicyKind = "TokenRateLimitPolicy"

	AuthPolicyName = "auth"
	RateLimitName  = "ratelimit"
)

Variables

View Source
var StateCELValidationErrors = "CELValidationErrors"

Functions

func TransformCounterVariable

func TransformCounterVariable(expression string, celAstTransform bool) (*string, error)

TransformCounterVariable Limitador, as of v2, does expose `descriptors` explicitly. As such `Limit`'s variables need to be accessed through that root binding's `Ident`: `descriptors[0]`. This function parses the CEL `expression` and traverses its AST to "rename" all bindings that are from "well-known attributes" and prefixes them, e.g. `request.method` will become `descriptors[0].request.method`, so that the value can be successfully looked up at request time by `Limitador`. Note: This will _only_ replace `knownAttributes` and will leave others as is... tho these _should_ be meaningless anyway. This function does *NOT* try to validate or make any assumption about the expression being otherwise valid. Rather than transforming the AST directly, it only uses the AST to find the `Ident` that need renaming directly in the `expression` passed in. This keeps the resulting expression as close to the input as possible.

func ValidateWasmAction added in v1.3.0

func ValidateWasmAction(action wasm.Action, validator *Validator) error

Types

type Issue added in v1.3.0

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

func NewIssue added in v1.3.0

func NewIssue(action wasm.Action, pathID string, err error) *Issue

func (*Issue) GetError added in v1.3.0

func (i *Issue) GetError() error

type IssueCollection added in v1.3.0

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

func NewIssueCollection added in v1.3.0

func NewIssueCollection() *IssueCollection

func (*IssueCollection) Add added in v1.3.0

func (c *IssueCollection) Add(issue *Issue)

func (*IssueCollection) GetByPolicyKind added in v1.3.0

func (c *IssueCollection) GetByPolicyKind(policyKind string) (map[string][]*Issue, bool)

func (*IssueCollection) IsEmpty added in v1.3.0

func (c *IssueCollection) IsEmpty() bool

type Validator added in v1.3.0

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

func (*Validator) Validate added in v1.3.0

func (v *Validator) Validate(policy string, expr string) (*cel.Ast, error)

type ValidatorBuilder added in v1.3.0

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

func NewRootValidatorBuilder added in v1.3.0

func NewRootValidatorBuilder() *ValidatorBuilder

func NewValidatorBuilder added in v1.3.0

func NewValidatorBuilder() *ValidatorBuilder

func (*ValidatorBuilder) AddBinding added in v1.3.0

func (b *ValidatorBuilder) AddBinding(name string, t *cel.Type) *ValidatorBuilder

func (*ValidatorBuilder) AddFunction added in v1.3.0

func (b *ValidatorBuilder) AddFunction(name string, funcOpt cel.FunctionOpt) *ValidatorBuilder

func (*ValidatorBuilder) AddPolicyBindingAfter added in v1.3.0

func (b *ValidatorBuilder) AddPolicyBindingAfter(after *string, policy string, name string, t *cel.Type) (*ValidatorBuilder, error)

func (*ValidatorBuilder) Build added in v1.3.0

func (b *ValidatorBuilder) Build() (*Validator, error)

func (*ValidatorBuilder) PushPolicyBinding added in v1.3.0

func (b *ValidatorBuilder) PushPolicyBinding(policy string, name string, t *cel.Type) *ValidatorBuilder

Jump to

Keyboard shortcuts

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