CreateAST creates a CEL AST from a checked expression file. The file must be in one of the following formats: - Binarypb - Textproto
(_ Compiler)
| 470 | // - Binarypb |
| 471 | // - Textproto |
| 472 | func (c *CompiledExpression) CreateAST(_ Compiler) (*cel.Ast, map[string]any, error) { |
| 473 | var expr exprpb.CheckedExpr |
| 474 | format := InferFileFormat(c.Path) |
| 475 | if format != BinaryProto && format != TextProto { |
| 476 | return nil, nil, fmt.Errorf("invalid file extension wanted: .binarypb or .textproto found: %v", format) |
| 477 | } |
| 478 | if err := loadProtoFile(c.Path, format, &expr); err != nil { |
| 479 | return nil, nil, err |
| 480 | } |
| 481 | return cel.CheckedExprToAst(&expr), nil, nil |
| 482 | } |
| 483 | |
| 484 | // FileExpression is an InputExpression which loads a CEL expression or policy from a file. |
| 485 | type FileExpression struct { |
nothing calls this directly
no test coverage detected