celMatcherStringMacroExpander validates that the macro is called a single string argument. The following function call is returned: <funcName>(request, arg)
(funcName string)
| 611 | // |
| 612 | // The following function call is returned: <funcName>(request, arg) |
| 613 | func celMatcherStringMacroExpander(funcName string) parser.MacroExpander { |
| 614 | return func(eh cel.MacroExprFactory, target ast.Expr, args []ast.Expr) (ast.Expr, *common.Error) { |
| 615 | if len(args) != 1 { |
| 616 | return nil, eh.NewError(0, "matcher requires one argument") |
| 617 | } |
| 618 | if isCELStringExpr(args[0]) { |
| 619 | return eh.NewCall(funcName, eh.NewIdent(CELRequestVarName), args[0]), nil |
| 620 | } |
| 621 | return nil, eh.NewError(args[0].ID(), "matcher argument must be a string literal") |
| 622 | } |
| 623 | } |
| 624 | |
| 625 | // celMatcherJSONMacroExpander validates that the macro is called a single |
| 626 | // map literal argument. |
no test coverage detected