blob: 71f6cbaf3c7d63415b9cc16cbb1036c1bd778d31 [file] [log] [blame]
syntax = "proto3";
package xds.type.v3;
import "google/api/expr/v1alpha1/checked.proto";
import "google/api/expr/v1alpha1/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 {
option (validate.required) = true;
// Parsed expression in abstract syntax tree (AST) form.
google.api.expr.v1alpha1.ParsedExpr parsed_expr = 1;
// Parsed expression in abstract syntax tree (AST) form that has been successfully type checked.
google.api.expr.v1alpha1.CheckedExpr checked_expr = 2;
}
}
// 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;
}