(e *cel.Env, _ cel.ValidatorConfig, a *ast.AST, iss *cel.Issues)
| 628 | } |
| 629 | |
| 630 | func (v networkFormatValidator) Validate(e *cel.Env, _ cel.ValidatorConfig, a *ast.AST, iss *cel.Issues) { |
| 631 | root := ast.NavigateAST(a) |
| 632 | funcCalls := ast.MatchDescendants(root, ast.FunctionMatcher(v.funcName)) |
| 633 | for _, call := range funcCalls { |
| 634 | callArgs := call.AsCall().Args() |
| 635 | if len(callArgs) <= v.argNum { |
| 636 | continue |
| 637 | } |
| 638 | litArg := callArgs[v.argNum] |
| 639 | if litArg.Kind() != ast.LiteralKind { |
| 640 | continue |
| 641 | } |
| 642 | if err := v.check(e, call, litArg); err != nil { |
| 643 | iss.ReportErrorAtID(litArg.ID(), "invalid %s argument: %v", v.funcName, err) |
| 644 | } |
| 645 | } |
| 646 | } |
| 647 | |
| 648 | func checkIP(e *cel.Env, call, arg ast.Expr) error { |
| 649 | pattern := arg.AsLiteral().Value().(string) |
nothing calls this directly
no test coverage detected