(e *cel.Env, _ cel.ValidatorConfig, a *ast.AST, iss *cel.Issues)
| 589 | } |
| 590 | |
| 591 | func (v networkFormatValidator) Validate(e *cel.Env, _ cel.ValidatorConfig, a *ast.AST, iss *cel.Issues) { |
| 592 | root := ast.NavigateAST(a) |
| 593 | funcCalls := ast.MatchDescendants(root, ast.FunctionMatcher(v.funcName)) |
| 594 | for _, call := range funcCalls { |
| 595 | callArgs := call.AsCall().Args() |
| 596 | if len(callArgs) <= v.argNum { |
| 597 | continue |
| 598 | } |
| 599 | litArg := callArgs[v.argNum] |
| 600 | if litArg.Kind() != ast.LiteralKind { |
| 601 | continue |
| 602 | } |
| 603 | if err := v.check(e, call, litArg); err != nil { |
| 604 | iss.ReportErrorAtID(litArg.ID(), "invalid %s argument: %v", v.funcName, err) |
| 605 | } |
| 606 | } |
| 607 | } |
| 608 | |
| 609 | func checkIP(e *cel.Env, call, arg ast.Expr) error { |
| 610 | pattern := arg.AsLiteral().Value().(string) |
nothing calls this directly
no test coverage detected