Skip to content

Commit 54924e0

Browse files
committed
Import CelMatcher and HttpAttributesCelMatchInput
http_inputs.proto provides HttpAttributesCelMatchInput, which can be used as a typed config in `bucket_matchers` predicate input.
1 parent 99a64bd commit 54924e0

4 files changed

Lines changed: 142 additions & 0 deletions

File tree

xds/third_party/xds/import.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,12 @@ xds/core/v3/resource_locator.proto
4545
xds/core/v3/resource_name.proto
4646
xds/data/orca/v3/orca_load_report.proto
4747
xds/service/orca/v3/orca.proto
48+
xds/type/matcher/v3/cel.proto
4849
xds/type/matcher/v3/matcher.proto
4950
xds/type/matcher/v3/regex.proto
5051
xds/type/matcher/v3/string.proto
52+
xds/type/v3/cel.proto
53+
xds/type/matcher/v3/http_inputs.proto
5154
xds/type/v3/typed_struct.proto
5255
)
5356

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
syntax = "proto3";
2+
3+
package xds.type.matcher.v3;
4+
5+
import "xds/annotations/v3/status.proto";
6+
import "xds/type/v3/cel.proto";
7+
8+
import "validate/validate.proto";
9+
10+
option java_package = "com.github.xds.type.matcher.v3";
11+
option java_outer_classname = "CelProto";
12+
option java_multiple_files = true;
13+
option go_package = "github.com/cncf/xds/go/xds/type/matcher/v3";
14+
15+
option (xds.annotations.v3.file_status).work_in_progress = true;
16+
17+
// [#protodoc-title: Common Expression Language (CEL) matchers]
18+
19+
// Performs a match by evaluating a `Common Expression Language
20+
// <https://github.com/google/cel-spec>`_ (CEL) expression against the standardized set of
21+
// :ref:`HTTP attributes <arch_overview_attributes>` specified via ``HttpAttributesCelMatchInput``.
22+
//
23+
// .. attention::
24+
//
25+
// The match is ``true``, iff the result of the evaluation is a bool AND true.
26+
// In all other cases, the match is ``false``, including but not limited to: non-bool types,
27+
// ``false``, ``null``,`` int(1)``, etc.
28+
// In case CEL expression raises an error, the result of the evaluation is interpreted "no match".
29+
//
30+
// Refer to :ref:`Unified Matcher API <envoy_v3_api_msg_.xds.type.matcher.v3.Matcher>` documentation
31+
// for usage details.
32+
//
33+
// [#comment:TODO(sergiitk): Link HttpAttributesMatchInput + usage example.]
34+
// [#comment:TODO(sergiitk): When implemented, add the extension tag.]
35+
message CelMatcher {
36+
// Either parsed or checked representation of the CEL program.
37+
type.v3.CelExpression expr_match = 1 [(validate.rules).message = {required: true}];
38+
39+
// Free-form description of the CEL AST, e.g. the original expression text, to be
40+
// used for debugging assistance.
41+
string description = 2;
42+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
syntax = "proto3";
2+
3+
package xds.type.matcher.v3;
4+
5+
import "xds/annotations/v3/status.proto";
6+
7+
option java_package = "com.github.xds.type.matcher.v3";
8+
option java_outer_classname = "HttpInputsProto";
9+
option java_multiple_files = true;
10+
option go_package = "github.com/cncf/xds/go/xds/type/matcher/v3";
11+
12+
option (xds.annotations.v3.file_status).work_in_progress = true;
13+
14+
// [#protodoc-title: Common HTTP Inputs]
15+
16+
// Specifies that matching should be performed on the set of :ref:`HTTP attributes
17+
// <arch_overview_attributes>`.
18+
//
19+
// The attributes will be exposed via `Common Expression Language
20+
// <https://github.com/google/cel-spec>`_ runtime to associated CEL matcher.
21+
//
22+
// Refer to :ref:`Unified Matcher API <envoy_v3_api_msg_.xds.type.matcher.v3.Matcher>` documentation
23+
// for usage details.
24+
//
25+
// [#comment:TODO(sergiitk): When implemented, add the extension tag.]
26+
message HttpAttributesCelMatchInput {
27+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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

Comments
 (0)