Documentation
¶
Index ¶
- Constants
- Variables
- func TransformCounterVariable(expression string, celAstTransform bool) (*string, error)
- func ValidateWasmAction(action wasm.Action, validator *Validator) error
- type Issue
- type IssueCollection
- type Validator
- type ValidatorBuilder
- func (b *ValidatorBuilder) AddBinding(name string, t *cel.Type) *ValidatorBuilder
- func (b *ValidatorBuilder) AddFunction(name string, funcOpt cel.FunctionOpt) *ValidatorBuilder
- func (b *ValidatorBuilder) AddPolicyBindingAfter(after *string, policy string, name string, t *cel.Type) (*ValidatorBuilder, error)
- func (b *ValidatorBuilder) Build() (*Validator, error)
- func (b *ValidatorBuilder) PushPolicyBinding(policy string, name string, t *cel.Type) *ValidatorBuilder
Constants ¶
const ( AuthPolicyKind = "AuthPolicy" RateLimitPolicyKind = "RateLimitPolicy" TokenRateLimitPolicyKind = "TokenRateLimitPolicy" AuthPolicyName = "auth" RateLimitName = "ratelimit" )
Variables ¶
var StateCELValidationErrors = "CELValidationErrors"
Functions ¶
func TransformCounterVariable ¶
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.
Types ¶
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
}
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