celMatcherStringListMacroExpander validates that the macro is called with a variable number of string arguments (at least one). The arguments are collected into a single list argument the following function call returned: <funcName>(request, [args])
(funcName string)
| 590 | // The arguments are collected into a single list argument the following |
| 591 | // function call returned: <funcName>(request, [args]) |
| 592 | func celMatcherStringListMacroExpander(funcName string) cel.MacroFactory { |
| 593 | return func(eh cel.MacroExprFactory, target ast.Expr, args []ast.Expr) (ast.Expr, *common.Error) { |
| 594 | matchArgs := []ast.Expr{} |
| 595 | if len(args) == 0 { |
| 596 | return nil, eh.NewError(0, "matcher requires at least one argument") |
| 597 | } |
| 598 | for _, arg := range args { |
| 599 | if isCELStringExpr(arg) { |
| 600 | matchArgs = append(matchArgs, arg) |
| 601 | } else { |
| 602 | return nil, eh.NewError(arg.ID(), "matcher arguments must be string constants") |
| 603 | } |
| 604 | } |
| 605 | return eh.NewCall(funcName, eh.NewIdent(CELRequestVarName), eh.NewList(matchArgs...)), nil |
| 606 | } |
| 607 | } |
| 608 | |
| 609 | // celMatcherStringMacroExpander validates that the macro is called a single |
| 610 | // string argument. |
no test coverage detected