-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Import CelMatcher and HttpAttributesCelMatchInput
http_inputs.proto provides HttpAttributesCelMatchInput, which can be used as a typed config in `bucket_matchers` predicate input.
- Loading branch information
Showing
4 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
xds/third_party/xds/src/main/proto/xds/type/matcher/v3/cel.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
syntax = "proto3"; | ||
|
||
package xds.type.matcher.v3; | ||
|
||
import "xds/annotations/v3/status.proto"; | ||
import "xds/type/v3/cel.proto"; | ||
|
||
import "validate/validate.proto"; | ||
|
||
option java_package = "com.github.xds.type.matcher.v3"; | ||
option java_outer_classname = "CelProto"; | ||
option java_multiple_files = true; | ||
option go_package = "github.com/cncf/xds/go/xds/type/matcher/v3"; | ||
|
||
option (xds.annotations.v3.file_status).work_in_progress = true; | ||
|
||
// [#protodoc-title: Common Expression Language (CEL) matchers] | ||
|
||
// Performs a match by evaluating a `Common Expression Language | ||
// <https://github.com/google/cel-spec>`_ (CEL) expression against the standardized set of | ||
// :ref:`HTTP attributes <arch_overview_attributes>` specified via ``HttpAttributesCelMatchInput``. | ||
// | ||
// .. attention:: | ||
// | ||
// The match is ``true``, iff the result of the evaluation is a bool AND true. | ||
// In all other cases, the match is ``false``, including but not limited to: non-bool types, | ||
// ``false``, ``null``,`` int(1)``, etc. | ||
// In case CEL expression raises an error, the result of the evaluation is interpreted "no match". | ||
// | ||
// Refer to :ref:`Unified Matcher API <envoy_v3_api_msg_.xds.type.matcher.v3.Matcher>` documentation | ||
// for usage details. | ||
// | ||
// [#comment:TODO(sergiitk): Link HttpAttributesMatchInput + usage example.] | ||
// [#comment:TODO(sergiitk): When implemented, add the extension tag.] | ||
message CelMatcher { | ||
// Either parsed or checked representation of the CEL program. | ||
type.v3.CelExpression expr_match = 1 [(validate.rules).message = {required: true}]; | ||
|
||
// Free-form description of the CEL AST, e.g. the original expression text, to be | ||
// used for debugging assistance. | ||
string description = 2; | ||
} |
27 changes: 27 additions & 0 deletions
27
xds/third_party/xds/src/main/proto/xds/type/matcher/v3/http_inputs.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
syntax = "proto3"; | ||
|
||
package xds.type.matcher.v3; | ||
|
||
import "xds/annotations/v3/status.proto"; | ||
|
||
option java_package = "com.github.xds.type.matcher.v3"; | ||
option java_outer_classname = "HttpInputsProto"; | ||
option java_multiple_files = true; | ||
option go_package = "github.com/cncf/xds/go/xds/type/matcher/v3"; | ||
|
||
option (xds.annotations.v3.file_status).work_in_progress = true; | ||
|
||
// [#protodoc-title: Common HTTP Inputs] | ||
|
||
// Specifies that matching should be performed on the set of :ref:`HTTP attributes | ||
// <arch_overview_attributes>`. | ||
// | ||
// The attributes will be exposed via `Common Expression Language | ||
// <https://github.com/google/cel-spec>`_ runtime to associated CEL matcher. | ||
// | ||
// Refer to :ref:`Unified Matcher API <envoy_v3_api_msg_.xds.type.matcher.v3.Matcher>` documentation | ||
// for usage details. | ||
// | ||
// [#comment:TODO(sergiitk): When implemented, add the extension tag.] | ||
message HttpAttributesCelMatchInput { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
syntax = "proto3"; | ||
|
||
package xds.type.v3; | ||
|
||
import "google/api/expr/v1alpha1/checked.proto"; | ||
import "google/api/expr/v1alpha1/syntax.proto"; | ||
import "cel/expr/checked.proto"; | ||
import "cel/expr/syntax.proto"; | ||
import "google/protobuf/wrappers.proto"; | ||
|
||
import "xds/annotations/v3/status.proto"; | ||
|
||
import "validate/validate.proto"; | ||
|
||
option java_package = "com.github.xds.type.v3"; | ||
option java_outer_classname = "CelProto"; | ||
option java_multiple_files = true; | ||
option go_package = "github.com/cncf/xds/go/xds/type/v3"; | ||
|
||
option (xds.annotations.v3.file_status).work_in_progress = true; | ||
|
||
// [#protodoc-title: Common Expression Language (CEL)] | ||
|
||
// Either parsed or checked representation of the `Common Expression Language | ||
// <https://github.com/google/cel-spec>`_ (CEL) program. | ||
message CelExpression { | ||
oneof expr_specifier { | ||
// Parsed expression in abstract syntax tree (AST) form. | ||
// | ||
// Deprecated -- use ``cel_expr_parsed`` field instead. | ||
// If ``cel_expr_parsed`` or ``cel_expr_checked`` is set, this field is not used. | ||
google.api.expr.v1alpha1.ParsedExpr parsed_expr = 1 [deprecated = true]; | ||
|
||
// Parsed expression in abstract syntax tree (AST) form that has been successfully type checked. | ||
// | ||
// Deprecated -- use ``cel_expr_checked`` field instead. | ||
// If ``cel_expr_parsed`` or ``cel_expr_checked`` is set, this field is not used. | ||
google.api.expr.v1alpha1.CheckedExpr checked_expr = 2 [deprecated = true]; | ||
} | ||
|
||
// Parsed expression in abstract syntax tree (AST) form. | ||
// | ||
// If ``cel_expr_checked`` is set, this field is not used. | ||
cel.expr.ParsedExpr cel_expr_parsed = 3; | ||
|
||
// Parsed expression in abstract syntax tree (AST) form that has been successfully type checked. | ||
// | ||
// If set, takes precedence over ``cel_expr_parsed``. | ||
cel.expr.CheckedExpr cel_expr_checked = 4; | ||
} | ||
|
||
// Extracts a string by evaluating a `Common Expression Language | ||
// <https://github.com/google/cel-spec>`_ (CEL) expression against the standardized set of | ||
// :ref:`HTTP attributes <arch_overview_attributes>`. | ||
// | ||
// .. attention:: | ||
// | ||
// Besides CEL evaluation raising an error explicitly, CEL program returning a type other than | ||
// the ``string``, or not returning anything, are considered an error as well. | ||
// | ||
// [#comment:TODO(sergiitk): When implemented, add the extension tag.] | ||
message CelExtractString { | ||
// The CEL expression used to extract a string from the CEL environment. | ||
// the "subject string") that should be replaced. | ||
CelExpression expr_extract = 1 [(validate.rules).message = {required: true}]; | ||
|
||
// If CEL expression evaluates to an error, this value is be returned to the caller. | ||
// If not set, the error is propagated to the caller. | ||
google.protobuf.StringValue default_value = 2; | ||
} |