|
| 1 | +syntax = "proto3"; |
| 2 | + |
| 3 | +package xds.type.v3; |
| 4 | + |
| 5 | +import "google/api/expr/v1alpha1/checked.proto"; |
| 6 | +import "google/api/expr/v1alpha1/syntax.proto"; |
| 7 | +import "cel/expr/checked.proto"; |
| 8 | +import "cel/expr/syntax.proto"; |
| 9 | +import "google/protobuf/wrappers.proto"; |
| 10 | + |
| 11 | +import "xds/annotations/v3/status.proto"; |
| 12 | + |
| 13 | +import "validate/validate.proto"; |
| 14 | + |
| 15 | +option java_package = "com.github.xds.type.v3"; |
| 16 | +option java_outer_classname = "CelProto"; |
| 17 | +option java_multiple_files = true; |
| 18 | +option go_package = "github.com/cncf/xds/go/xds/type/v3"; |
| 19 | + |
| 20 | +option (xds.annotations.v3.file_status).work_in_progress = true; |
| 21 | + |
| 22 | +// [#protodoc-title: Common Expression Language (CEL)] |
| 23 | + |
| 24 | +// Either parsed or checked representation of the `Common Expression Language |
| 25 | +// <https://github.com/google/cel-spec>`_ (CEL) program. |
| 26 | +message CelExpression { |
| 27 | + oneof expr_specifier { |
| 28 | + // Parsed expression in abstract syntax tree (AST) form. |
| 29 | + // |
| 30 | + // Deprecated -- use ``cel_expr_parsed`` field instead. |
| 31 | + // If ``cel_expr_parsed`` or ``cel_expr_checked`` is set, this field is not used. |
| 32 | + google.api.expr.v1alpha1.ParsedExpr parsed_expr = 1 [deprecated = true]; |
| 33 | + |
| 34 | + // Parsed expression in abstract syntax tree (AST) form that has been successfully type checked. |
| 35 | + // |
| 36 | + // Deprecated -- use ``cel_expr_checked`` field instead. |
| 37 | + // If ``cel_expr_parsed`` or ``cel_expr_checked`` is set, this field is not used. |
| 38 | + google.api.expr.v1alpha1.CheckedExpr checked_expr = 2 [deprecated = true]; |
| 39 | + } |
| 40 | + |
| 41 | + // Parsed expression in abstract syntax tree (AST) form. |
| 42 | + // |
| 43 | + // If ``cel_expr_checked`` is set, this field is not used. |
| 44 | + cel.expr.ParsedExpr cel_expr_parsed = 3; |
| 45 | + |
| 46 | + // Parsed expression in abstract syntax tree (AST) form that has been successfully type checked. |
| 47 | + // |
| 48 | + // If set, takes precedence over ``cel_expr_parsed``. |
| 49 | + cel.expr.CheckedExpr cel_expr_checked = 4; |
| 50 | +} |
| 51 | + |
| 52 | +// Extracts a string by evaluating a `Common Expression Language |
| 53 | +// <https://github.com/google/cel-spec>`_ (CEL) expression against the standardized set of |
| 54 | +// :ref:`HTTP attributes <arch_overview_attributes>`. |
| 55 | +// |
| 56 | +// .. attention:: |
| 57 | +// |
| 58 | +// Besides CEL evaluation raising an error explicitly, CEL program returning a type other than |
| 59 | +// the ``string``, or not returning anything, are considered an error as well. |
| 60 | +// |
| 61 | +// [#comment:TODO(sergiitk): When implemented, add the extension tag.] |
| 62 | +message CelExtractString { |
| 63 | + // The CEL expression used to extract a string from the CEL environment. |
| 64 | + // the "subject string") that should be replaced. |
| 65 | + CelExpression expr_extract = 1 [(validate.rules).message = {required: true}]; |
| 66 | + |
| 67 | + // If CEL expression evaluates to an error, this value is be returned to the caller. |
| 68 | + // If not set, the error is propagated to the caller. |
| 69 | + google.protobuf.StringValue default_value = 2; |
| 70 | +} |
0 commit comments