Upgrade dependent version: github.com/open-policy-agent/opa (#5315)
Upgrade dependent version: github.com/open-policy-agent/opa v0.18.0 -> v0.45.0 Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io> Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io>
This commit is contained in:
12
vendor/github.com/open-policy-agent/opa/topdown/parse.go
generated
vendored
12
vendor/github.com/open-policy-agent/opa/topdown/parse.go
generated
vendored
@@ -7,6 +7,7 @@ package topdown
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/open-policy-agent/opa/ast"
|
||||
"github.com/open-policy-agent/opa/topdown/builtins"
|
||||
@@ -42,6 +43,17 @@ func builtinRegoParseModule(a, b ast.Value) (ast.Value, error) {
|
||||
return term.Value, nil
|
||||
}
|
||||
|
||||
func registerRegoMetadataBuiltinFunction(builtin *ast.Builtin) {
|
||||
f := func(BuiltinContext, []*ast.Term, func(*ast.Term) error) error {
|
||||
// The compiler should replace all usage of this function, so the only way to get here is within a query;
|
||||
// which cannot define rules.
|
||||
return fmt.Errorf("the %s function must only be called within the scope of a rule", builtin.Name)
|
||||
}
|
||||
RegisterBuiltinFunc(builtin.Name, f)
|
||||
}
|
||||
|
||||
func init() {
|
||||
RegisterFunctionalBuiltin2(ast.RegoParseModule.Name, builtinRegoParseModule)
|
||||
registerRegoMetadataBuiltinFunction(ast.RegoMetadataChain)
|
||||
registerRegoMetadataBuiltinFunction(ast.RegoMetadataRule)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user