mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 16:06:56 +00:00
* JMESPath: Support regex expressions Signed-off-by: Max Goncharenko <kacejot@fex.net> * JMESPath: Add string functions Signed-off-by: Max Goncharenko <kacejot@fex.net> * Removed {{$}} variable handling logic Signed-off-by: Max Goncharenko <kacejot@fex.net> * Name all functions in snake case; Update error message; Fix {{@}} behavior Signed-off-by: Max Goncharenko <kacejot@fex.net>
18 lines
297 B
Go
18 lines
297 B
Go
package jmespath
|
|
|
|
import (
|
|
gojmespath "github.com/jmespath/go-jmespath"
|
|
)
|
|
|
|
func New(query string) (*gojmespath.JMESPath, error) {
|
|
jp, err := gojmespath.Compile(query)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
for _, function := range getFunctions() {
|
|
jp.Register(function)
|
|
}
|
|
|
|
return jp, nil
|
|
}
|