mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 16:06:56 +00:00
* feat: add image_normalize filter Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * tests Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
34 lines
733 B
Go
34 lines
733 B
Go
package jmespath
|
|
|
|
import "github.com/kyverno/kyverno/pkg/config"
|
|
|
|
type Query interface {
|
|
Search(interface{}) (interface{}, error)
|
|
}
|
|
|
|
type Interface interface {
|
|
Query(string) (Query, error)
|
|
Search(string, interface{}) (interface{}, error)
|
|
}
|
|
|
|
type implementation struct {
|
|
configuration config.Configuration
|
|
}
|
|
|
|
func New(configuration config.Configuration) Interface {
|
|
return implementation{
|
|
configuration: configuration,
|
|
}
|
|
}
|
|
|
|
func (i implementation) Query(query string) (Query, error) {
|
|
return newJMESPath(i.configuration, query)
|
|
}
|
|
|
|
func (i implementation) Search(query string, data interface{}) (interface{}, error) {
|
|
if query, err := i.Query(query); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return query.Search(data)
|
|
}
|
|
}
|