| 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 |
// Unparsed expression in string form. For example, ``request.headers['x-env'] == 'prod'`` will |
| 52 |
// get ``x-env`` header value and compare it with ``prod``. |
| 53 |
// Check the `Common Expression Language <https://github.com/google/cel-spec>`_ for more details. |
| 54 |
// |
| 55 |
// If set, takes precedence over ``cel_expr_parsed`` and ``cel_expr_checked``. |
| 56 |
string cel_expr_string = 5; |
| 57 |
} |
| 58 |
|
| 59 |
// Extracts a string by evaluating a `Common Expression Language |
| 60 |
// <https://github.com/google/cel-spec>`_ (CEL) expression against the standardized set of |
| 61 |
// :ref:`HTTP attributes <arch_overview_attributes>`. |
| 62 |
// |
| 63 |
// .. attention:: |
| 64 |
// |
| 65 |
// Besides CEL evaluation raising an error explicitly, CEL program returning a type other than |
| 66 |
// the ``string``, or not returning anything, are considered an error as well. |
| 67 |
// |
| 68 |
// [#comment:TODO(sergiitk): When implemented, add the extension tag.] |
| 69 |
message CelExtractString { |
| 70 |
// The CEL expression used to extract a string from the CEL environment. |
| 71 |
// the "subject string") that should be replaced. |
| 72 |
CelExpression expr_extract = 1 [(validate.rules).message = {required: true}]; |
| 73 |
|
| 74 |
// If CEL expression evaluates to an error, this value is be returned to the caller. |
| 75 |
// If not set, the error is propagated to the caller. |
| 76 |
google.protobuf.StringValue default_value = 2; |
| 77 |
} |