(e *cel.Env, _ cel.ValidatorConfig, a *ast.AST, iss *cel.Issues)
| 653 | } |
| 654 | |
| 655 | func (v networkFormatValidator) Validate(e *cel.Env, _ cel.ValidatorConfig, a *ast.AST, iss *cel.Issues) { |
| 656 | root := ast.NavigateAST(a) |
| 657 | funcCalls := ast.MatchDescendants(root, ast.FunctionMatcher(v.funcName)) |
| 658 | for _, call := range funcCalls { |
| 659 | callArgs := call.AsCall().Args() |
| 660 | if len(callArgs) <= v.argNum { |
| 661 | continue |
| 662 | } |
| 663 | litArg := callArgs[v.argNum] |
| 664 | if litArg.Kind() != ast.LiteralKind { |
| 665 | continue |
| 666 | } |
| 667 | if err := v.check(e, call, litArg); err != nil { |
| 668 | iss.ReportErrorAtID(litArg.ID(), "invalid %s argument: %v", v.funcName, err) |
| 669 | } |
| 670 | } |
| 671 | } |
| 672 | |
| 673 | func checkIP(e *cel.Env, call, arg ast.Expr) error { |
| 674 | pattern := arg.AsLiteral().Value().(string) |
nothing calls this directly
no test coverage detected