aboutsummaryrefslogtreecommitdiff
path: root/google/api/expr/v1alpha1
diff options
context:
space:
mode:
Diffstat (limited to 'google/api/expr/v1alpha1')
-rw-r--r--google/api/expr/v1alpha1/BUILD.bazel199
-rw-r--r--google/api/expr/v1alpha1/cel_gapic.yaml248
-rw-r--r--google/api/expr/v1alpha1/cel_service.proto44
-rw-r--r--google/api/expr/v1alpha1/checked.proto336
-rw-r--r--google/api/expr/v1alpha1/conformance_service.proto165
-rw-r--r--google/api/expr/v1alpha1/eval.proto119
-rw-r--r--google/api/expr/v1alpha1/explain.proto54
-rw-r--r--google/api/expr/v1alpha1/syntax.proto322
-rw-r--r--google/api/expr/v1alpha1/value.proto116
9 files changed, 1603 insertions, 0 deletions
diff --git a/google/api/expr/v1alpha1/BUILD.bazel b/google/api/expr/v1alpha1/BUILD.bazel
new file mode 100644
index 000000000..816426264
--- /dev/null
+++ b/google/api/expr/v1alpha1/BUILD.bazel
@@ -0,0 +1,199 @@
+# This is an API workspace, having public visibility by default makes perfect sense.
+package(default_visibility = ["//visibility:public"])
+
+##############################################################################
+# Common
+##############################################################################
+load("@com_google_api_codegen//rules_gapic:gapic.bzl", "proto_library_with_info")
+
+proto_library(
+ name = "cel_service_proto",
+ srcs = ["cel_service.proto"],
+ deps = [
+ ":conformance_service_proto",
+ ],
+)
+
+proto_library(
+ name = "checked_proto",
+ srcs = ["checked.proto"],
+ deps = [
+ ":syntax_proto",
+ "@com_google_protobuf//:empty_proto",
+ "@com_google_protobuf//:struct_proto",
+ ],
+)
+
+proto_library(
+ name = "conformance_service_proto",
+ srcs = ["conformance_service.proto"],
+ deps = [
+ ":checked_proto",
+ ":eval_proto",
+ ":syntax_proto",
+ "//google/rpc:status_proto",
+ ],
+)
+
+proto_library(
+ name = "eval_proto",
+ srcs = ["eval.proto"],
+ deps = [
+ ":value_proto",
+ "//google/rpc:status_proto",
+ ],
+)
+
+proto_library(
+ name = "explain_proto",
+ srcs = ["explain.proto"],
+ deps = [
+ ":value_proto",
+ ],
+)
+
+proto_library(
+ name = "syntax_proto",
+ srcs = ["syntax.proto"],
+ deps = [
+ "@com_google_protobuf//:duration_proto",
+ "@com_google_protobuf//:struct_proto",
+ "@com_google_protobuf//:timestamp_proto",
+ ],
+)
+
+proto_library(
+ name = "value_proto",
+ srcs = ["value.proto"],
+ deps = [
+ "@com_google_protobuf//:any_proto",
+ "@com_google_protobuf//:struct_proto",
+ ],
+)
+
+proto_library(
+ name = "cel_proto",
+ srcs = [
+ "cel_service.proto",
+ "checked.proto",
+ "conformance_service.proto",
+ "eval.proto",
+ "explain.proto",
+ "syntax.proto",
+ "value.proto",
+ ],
+ deps = [
+ "//google/rpc:status_proto",
+ "@com_google_protobuf//:any_proto",
+ "@com_google_protobuf//:duration_proto",
+ "@com_google_protobuf//:empty_proto",
+ "@com_google_protobuf//:struct_proto",
+ "@com_google_protobuf//:timestamp_proto",
+ ],
+)
+
+proto_library_with_info(
+ name = "cel_proto_with_info",
+ deps = [":cel_proto"],
+)
+
+##############################################################################
+# Java
+##############################################################################
+load("@io_grpc_grpc_java//:java_grpc_library.bzl", "java_grpc_library")
+load("@com_google_api_codegen//rules_gapic/java:java_gapic.bzl", "java_gapic_library")
+load("@com_google_api_codegen//rules_gapic/java:java_gapic_pkg.bzl", "java_gapic_assembly_gradle_pkg")
+
+_JAVA_GRPC_DEPS = [
+ "@com_google_api_grpc_proto_google_common_protos//jar",
+]
+
+java_proto_library(
+ name = "cel_java_proto",
+ deps = [":cel_proto"],
+)
+
+java_grpc_library(
+ name = "cel_java_grpc",
+ srcs = [":cel_proto"],
+ deps = [":cel_java_proto"] + _JAVA_GRPC_DEPS,
+)
+
+java_gapic_library(
+ name = "cel_java_gapic",
+ src = ":cel_proto_with_info",
+ gapic_yaml = "cel_gapic.yaml",
+ service_yaml = "//google/api/expr:cel.yaml",
+ test_deps = [":cel_java_grpc"],
+ deps = [":cel_java_proto"] + _JAVA_GRPC_DEPS,
+)
+
+[java_test(
+ name = test_name,
+ test_class = test_name,
+ runtime_deps = [":cel_java_gapic_test"],
+) for test_name in [
+ "com.google.cloud.api.expr.v1alpha1.CelServiceClientTest",
+ "com.google.cloud.api.expr.v1alpha1.ConformanceServiceClientTest",
+]]
+
+# Opensource Packages
+java_gapic_assembly_gradle_pkg(
+ name = "google-cloud-cel-v1alpha1-java",
+ client_deps = [":cel_java_gapic"],
+ client_group = "com.google.cloud",
+ client_test_deps = [":cel_java_gapic_test"],
+ grpc_deps = [":cel_java_grpc"],
+ grpc_group = "com.google.api.grpc",
+ proto_deps = [
+ ":cel_java_proto",
+ ":cel_proto",
+ ] + _JAVA_GRPC_DEPS,
+ version = "0.0.0-SNAPSHOT",
+)
+
+##############################################################################
+# Go
+##############################################################################
+load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+load("@com_google_api_codegen//rules_gapic/go:go_gapic.bzl", "go_gapic_srcjar", "go_gapic_library")
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+load("@com_google_api_codegen//rules_gapic/go:go_gapic_pkg.bzl", "go_gapic_assembly_pkg")
+
+go_proto_library(
+ name = "cel_go_proto",
+ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+ importpath = "google.golang.org/genproto/googleapis/api/expr/v1alpha1",
+ protos = [":cel_proto_with_info"],
+ deps = [
+ "//google/api:annotations_go_proto",
+ "//google/rpc:status_go_proto",
+ ],
+)
+
+go_gapic_library(
+ name = "cel_go_gapic",
+ src = ":cel_proto_with_info",
+ gapic_yaml = "cel_gapic.yaml",
+ importpath = "cloud.google.com/go/expr/apiv1alpha1",
+ service_yaml = "//google/api/expr:cel.yaml",
+ deps = [":cel_go_proto"],
+)
+
+go_test(
+ name = "cel_go_gapic_test",
+ srcs = [":cel_go_gapic_srcjar_test"],
+ embed = [":cel_go_gapic"],
+ importpath = "cloud.google.com/go/expr/apiv1alpha1",
+)
+
+# Opensource Packages
+go_gapic_assembly_pkg(
+ name = "gapi-cloud-cel-v1alpha1-go",
+ deps = [
+ ":cel_go_gapic",
+ ":cel_go_gapic_srcjar-smoke-test.srcjar",
+ ":cel_go_gapic_srcjar-test.srcjar",
+ ":cel_go_proto",
+ ],
+)
diff --git a/google/api/expr/v1alpha1/cel_gapic.yaml b/google/api/expr/v1alpha1/cel_gapic.yaml
new file mode 100644
index 000000000..d2213fc7e
--- /dev/null
+++ b/google/api/expr/v1alpha1/cel_gapic.yaml
@@ -0,0 +1,248 @@
+type: com.google.api.codegen.ConfigProto
+config_schema_version: 1.0.0
+# The settings of generated code in a specific language.
+language_settings:
+ java:
+ package_name: com.google.cloud.api.expr.v1alpha1
+ python:
+ package_name: google.cloud.api.expr_v1alpha1.gapic
+ go:
+ package_name: cloud.google.com/go/expr/apiv1alpha1
+ csharp:
+ package_name: Google.Api.Expr.V1alpha1
+ ruby:
+ package_name: Google::Cloud::Api::Expr::V1alpha1
+ php:
+ package_name: Google\Cloud\Api\Expr\V1alpha1
+ nodejs:
+ package_name: expr.v1alpha1
+# A list of API interface configurations.
+interfaces:
+ # The fully qualified name of the API interface.
+- name: google.api.expr.v1alpha1.CelService
+ # A list of resource collection configurations.
+ # Consists of a name_pattern and an entity_name.
+ # The name_pattern is a pattern to describe the names of the resources of this
+ # collection, using the platform's conventions for URI patterns. A generator
+ # may use this to generate methods to compose and decompose such names. The
+ # pattern should use named placeholders as in `shelves/{shelf}/books/{book}`;
+ # those will be taken as hints for the parameter names of the generated
+ # methods. If empty, no name methods are generated.
+ # The entity_name is the name to be used as a basis for generated methods and
+ # classes.
+ collections: []
+ # Definition for retryable codes.
+ retry_codes_def:
+ - name: idempotent
+ retry_codes:
+ - UNAVAILABLE
+ - DEADLINE_EXCEEDED
+ - name: non_idempotent
+ retry_codes: []
+ # Definition for retry/backoff parameters.
+ retry_params_def:
+ - name: default
+ initial_retry_delay_millis: 100
+ retry_delay_multiplier: 1.3
+ max_retry_delay_millis: 60000
+ initial_rpc_timeout_millis: 20000
+ rpc_timeout_multiplier: 1
+ max_rpc_timeout_millis: 20000
+ total_timeout_millis: 600000
+ # A list of method configurations.
+ # Common properties:
+ #
+ # name - The simple name of the method.
+ #
+ # flattening - Specifies the configuration for parameter flattening.
+ # Describes the parameter groups for which a generator should produce method
+ # overloads which allow a client to directly pass request message fields as
+ # method parameters. This information may or may not be used, depending on
+ # the target language.
+ # Consists of groups, which each represent a list of parameters to be
+ # flattened. Each parameter listed must be a field of the request message.
+ #
+ # required_fields - Fields that are always required for a request to be
+ # valid.
+ #
+ # resource_name_treatment - An enum that specifies how to treat the resource
+ # name formats defined in the field_name_patterns and
+ # response_field_name_patterns fields.
+ # UNSET: default value
+ # NONE: the collection configs will not be used by the generated code.
+ # VALIDATE: string fields will be validated by the client against the
+ # specified resource name formats.
+ # STATIC_TYPES: the client will use generated types for resource names.
+ #
+ # page_streaming - Specifies the configuration for paging.
+ # Describes information for generating a method which transforms a paging
+ # list RPC into a stream of resources.
+ # Consists of a request and a response.
+ # The request specifies request information of the list method. It defines
+ # which fields match the paging pattern in the request. The request consists
+ # of a page_size_field and a token_field. The page_size_field is the name of
+ # the optional field specifying the maximum number of elements to be
+ # returned in the response. The token_field is the name of the field in the
+ # request containing the page token.
+ # The response specifies response information of the list method. It defines
+ # which fields match the paging pattern in the response. The response
+ # consists of a token_field and a resources_field. The token_field is the
+ # name of the field in the response containing the next page token. The
+ # resources_field is the name of the field in the response containing the
+ # list of resources belonging to the page.
+ #
+ # retry_codes_name - Specifies the configuration for retryable codes. The
+ # name must be defined in interfaces.retry_codes_def.
+ #
+ # retry_params_name - Specifies the configuration for retry/backoff
+ # parameters. The name must be defined in interfaces.retry_params_def.
+ #
+ # field_name_patterns - Maps the field name of the request type to
+ # entity_name of interfaces.collections.
+ # Specifies the string pattern that the field must follow.
+ #
+ # timeout_millis - Specifies the default timeout for a non-retrying call. If
+ # the call is retrying, refer to retry_params_name instead.
+ methods:
+ - name: Parse
+ flattening:
+ groups:
+ - parameters:
+ - cel_source
+ required_fields:
+ - cel_source
+ retry_codes_name: non_idempotent
+ retry_params_name: default
+ timeout_millis: 60000
+ - name: Check
+ flattening:
+ groups:
+ - parameters:
+ - parsed_expr
+ required_fields:
+ - parsed_expr
+ retry_codes_name: non_idempotent
+ retry_params_name: default
+ timeout_millis: 60000
+ - name: Eval
+ flattening:
+ groups:
+ - parameters:
+ required_fields:
+ retry_codes_name: non_idempotent
+ retry_params_name: default
+ timeout_millis: 60000
+ # The fully qualified name of the API interface.
+- name: google.api.expr.v1alpha1.ConformanceService
+ # A list of resource collection configurations.
+ # Consists of a name_pattern and an entity_name.
+ # The name_pattern is a pattern to describe the names of the resources of this
+ # collection, using the platform's conventions for URI patterns. A generator
+ # may use this to generate methods to compose and decompose such names. The
+ # pattern should use named placeholders as in `shelves/{shelf}/books/{book}`;
+ # those will be taken as hints for the parameter names of the generated
+ # methods. If empty, no name methods are generated.
+ # The entity_name is the name to be used as a basis for generated methods and
+ # classes.
+ collections: []
+ # Definition for retryable codes.
+ retry_codes_def:
+ - name: idempotent
+ retry_codes:
+ - UNAVAILABLE
+ - DEADLINE_EXCEEDED
+ - name: non_idempotent
+ retry_codes: []
+ # Definition for retry/backoff parameters.
+ retry_params_def:
+ - name: default
+ initial_retry_delay_millis: 100
+ retry_delay_multiplier: 1.3
+ max_retry_delay_millis: 60000
+ initial_rpc_timeout_millis: 20000
+ rpc_timeout_multiplier: 1
+ max_rpc_timeout_millis: 20000
+ total_timeout_millis: 600000
+ # A list of method configurations.
+ # Common properties:
+ #
+ # name - The simple name of the method.
+ #
+ # flattening - Specifies the configuration for parameter flattening.
+ # Describes the parameter groups for which a generator should produce method
+ # overloads which allow a client to directly pass request message fields as
+ # method parameters. This information may or may not be used, depending on
+ # the target language.
+ # Consists of groups, which each represent a list of parameters to be
+ # flattened. Each parameter listed must be a field of the request message.
+ #
+ # required_fields - Fields that are always required for a request to be
+ # valid.
+ #
+ # resource_name_treatment - An enum that specifies how to treat the resource
+ # name formats defined in the field_name_patterns and
+ # response_field_name_patterns fields.
+ # UNSET: default value
+ # NONE: the collection configs will not be used by the generated code.
+ # VALIDATE: string fields will be validated by the client against the
+ # specified resource name formats.
+ # STATIC_TYPES: the client will use generated types for resource names.
+ #
+ # page_streaming - Specifies the configuration for paging.
+ # Describes information for generating a method which transforms a paging
+ # list RPC into a stream of resources.
+ # Consists of a request and a response.
+ # The request specifies request information of the list method. It defines
+ # which fields match the paging pattern in the request. The request consists
+ # of a page_size_field and a token_field. The page_size_field is the name of
+ # the optional field specifying the maximum number of elements to be
+ # returned in the response. The token_field is the name of the field in the
+ # request containing the page token.
+ # The response specifies response information of the list method. It defines
+ # which fields match the paging pattern in the response. The response
+ # consists of a token_field and a resources_field. The token_field is the
+ # name of the field in the response containing the next page token. The
+ # resources_field is the name of the field in the response containing the
+ # list of resources belonging to the page.
+ #
+ # retry_codes_name - Specifies the configuration for retryable codes. The
+ # name must be defined in interfaces.retry_codes_def.
+ #
+ # retry_params_name - Specifies the configuration for retry/backoff
+ # parameters. The name must be defined in interfaces.retry_params_def.
+ #
+ # field_name_patterns - Maps the field name of the request type to
+ # entity_name of interfaces.collections.
+ # Specifies the string pattern that the field must follow.
+ #
+ # timeout_millis - Specifies the default timeout for a non-retrying call. If
+ # the call is retrying, refer to retry_params_name instead.
+ methods:
+ - name: Parse
+ flattening:
+ groups:
+ - parameters:
+ - cel_source
+ required_fields:
+ - cel_source
+ retry_codes_name: non_idempotent
+ retry_params_name: default
+ timeout_millis: 60000
+ - name: Check
+ flattening:
+ groups:
+ - parameters:
+ - parsed_expr
+ required_fields:
+ - parsed_expr
+ retry_codes_name: non_idempotent
+ retry_params_name: default
+ timeout_millis: 60000
+ - name: Eval
+ flattening:
+ groups:
+ - parameters:
+ required_fields:
+ retry_codes_name: non_idempotent
+ retry_params_name: default
+ timeout_millis: 60000
diff --git a/google/api/expr/v1alpha1/cel_service.proto b/google/api/expr/v1alpha1/cel_service.proto
new file mode 100644
index 000000000..0bf649ff5
--- /dev/null
+++ b/google/api/expr/v1alpha1/cel_service.proto
@@ -0,0 +1,44 @@
+// Copyright 2018 Google LLC.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+syntax = "proto3";
+
+package google.api.expr.v1alpha1;
+
+import "google/api/expr/v1alpha1/conformance_service.proto";
+
+option cc_enable_arenas = true;
+option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr";
+option java_multiple_files = true;
+option java_outer_classname = "CelServiceProto";
+option java_package = "com.google.api.expr.v1alpha1";
+
+// Access a CEL implementation from another process or machine.
+// A CEL implementation is decomposed as a parser, a static checker,
+// and an evaluator. Every CEL implementation is expected to provide
+// a server for this API. The API will be used for conformance testing,
+// utilities, and execution as a service.
+service CelService {
+ // Transforms CEL source text into a parsed representation.
+ rpc Parse(ParseRequest) returns (ParseResponse) {}
+
+ // Runs static checks on a parsed CEL representation and return
+ // an annotated representation, or a set of issues.
+ rpc Check(CheckRequest) returns (CheckResponse) {}
+
+ // Evaluates a parsed or annotation CEL representation given
+ // values of external bindings.
+ rpc Eval(EvalRequest) returns (EvalResponse) {}
+}
diff --git a/google/api/expr/v1alpha1/checked.proto b/google/api/expr/v1alpha1/checked.proto
new file mode 100644
index 000000000..60dd09e20
--- /dev/null
+++ b/google/api/expr/v1alpha1/checked.proto
@@ -0,0 +1,336 @@
+// Copyright 2018 Google LLC.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+syntax = "proto3";
+
+package google.api.expr.v1alpha1;
+
+import "google/api/expr/v1alpha1/syntax.proto";
+import "google/protobuf/empty.proto";
+import "google/protobuf/struct.proto";
+
+option cc_enable_arenas = true;
+option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr";
+option java_multiple_files = true;
+option java_outer_classname = "DeclProto";
+option java_package = "com.google.api.expr.v1alpha1";
+
+// Protos for representing CEL declarations and typed checked expressions.
+
+// A CEL expression which has been successfully type checked.
+message CheckedExpr {
+ // A map from expression ids to resolved references.
+ //
+ // The following entries are in this table:
+ //
+ // - An Ident or Select expression is represented here if it resolves to a
+ // declaration. For instance, if `a.b.c` is represented by
+ // `select(select(id(a), b), c)`, and `a.b` resolves to a declaration,
+ // while `c` is a field selection, then the reference is attached to the
+ // nested select expression (but not to the id or or the outer select).
+ // In turn, if `a` resolves to a declaration and `b.c` are field selections,
+ // the reference is attached to the ident expression.
+ // - Every Call expression has an entry here, identifying the function being
+ // called.
+ // - Every CreateStruct expression for a message has an entry, identifying
+ // the message.
+ map<int64, Reference> reference_map = 2;
+
+ // A map from expression ids to types.
+ //
+ // Every expression node which has a type different than DYN has a mapping
+ // here. If an expression has type DYN, it is omitted from this map to save
+ // space.
+ map<int64, Type> type_map = 3;
+
+ // The source info derived from input that generated the parsed `expr` and
+ // any optimizations made during the type-checking pass.
+ SourceInfo source_info = 5;
+
+ // The checked expression. Semantically equivalent to the parsed `expr`, but
+ // may have structural differences.
+ Expr expr = 4;
+}
+
+// Represents a CEL type.
+message Type {
+ // List type with typed elements, e.g. `list<example.proto.MyMessage>`.
+ message ListType {
+ // The element type.
+ Type elem_type = 1;
+ }
+
+ // Map type with parameterized key and value types, e.g. `map<string, int>`.
+ message MapType {
+ // The type of the key.
+ Type key_type = 1;
+
+ // The type of the value.
+ Type value_type = 2;
+ }
+
+ // Function type with result and arg types.
+ message FunctionType {
+ // Result type of the function.
+ Type result_type = 1;
+
+ // Argument types of the function.
+ repeated Type arg_types = 2;
+ }
+
+ // Application defined abstract type.
+ message AbstractType {
+ // The fully qualified name of this abstract type.
+ string name = 1;
+
+ // Parameter types for this abstract type.
+ repeated Type parameter_types = 2;
+ }
+
+ // CEL primitive types.
+ enum PrimitiveType {
+ // Unspecified type.
+ PRIMITIVE_TYPE_UNSPECIFIED = 0;
+
+ // Boolean type.
+ BOOL = 1;
+
+ // Int64 type.
+ //
+ // Proto-based integer values are widened to int64.
+ INT64 = 2;
+
+ // Uint64 type.
+ //
+ // Proto-based unsigned integer values are widened to uint64.
+ UINT64 = 3;
+
+ // Double type.
+ //
+ // Proto-based float values are widened to double values.
+ DOUBLE = 4;
+
+ // String type.
+ STRING = 5;
+
+ // Bytes type.
+ BYTES = 6;
+ }
+
+ // Well-known protobuf types treated with first-class support in CEL.
+ enum WellKnownType {
+ // Unspecified type.
+ WELL_KNOWN_TYPE_UNSPECIFIED = 0;
+
+ // Well-known protobuf.Any type.
+ //
+ // Any types are a polymorphic message type. During type-checking they are
+ // treated like `DYN` types, but at runtime they are resolved to a specific
+ // message type specified at evaluation time.
+ ANY = 1;
+
+ // Well-known protobuf.Timestamp type, internally referenced as `timestamp`.
+ TIMESTAMP = 2;
+
+ // Well-known protobuf.Duration type, internally referenced as `duration`.
+ DURATION = 3;
+ }
+
+ // The kind of type.
+ oneof type_kind {
+ // Dynamic type.
+ google.protobuf.Empty dyn = 1;
+
+ // Null value.
+ google.protobuf.NullValue null = 2;
+
+ // Primitive types: `true`, `1u`, `-2.0`, `'string'`, `b'bytes'`.
+ PrimitiveType primitive = 3;
+
+ // Wrapper of a primitive type, e.g. `google.protobuf.Int64Value`.
+ PrimitiveType wrapper = 4;
+
+ // Well-known protobuf type such as `google.protobuf.Timestamp`.
+ WellKnownType well_known = 5;
+
+ // Parameterized list with elements of `list_type`, e.g. `list<timestamp>`.
+ ListType list_type = 6;
+
+ // Parameterized map with typed keys and values.
+ MapType map_type = 7;
+
+ // Function type.
+ FunctionType function = 8;
+
+ // Protocol buffer message type.
+ //
+ // The `message_type` string specifies the qualified message type name. For
+ // example, `google.plus.Profile`.
+ string message_type = 9;
+
+ // Type param type.
+ //
+ // The `type_param` string specifies the type parameter name, e.g. `list<E>`
+ // would be a `list_type` whose element type was a `type_param` type
+ // named `E`.
+ string type_param = 10;
+
+ // Type type.
+ //
+ // The `type` value specifies the target type. e.g. int is type with a
+ // target type of `Primitive.INT`.
+ Type type = 11;
+
+ // Error type.
+ //
+ // During type-checking if an expression is an error, its type is propagated
+ // as the `ERROR` type. This permits the type-checker to discover other
+ // errors present in the expression.
+ google.protobuf.Empty error = 12;
+
+ // Abstract, application defined type.
+ AbstractType abstract_type = 14;
+ }
+}
+
+// Represents a declaration of a named value or function.
+//
+// A declaration is part of the contract between the expression, the agent
+// evaluating that expression, and the caller requesting evaluation.
+message Decl {
+ // Identifier declaration which specifies its type and optional `Expr` value.
+ //
+ // An identifier without a value is a declaration that must be provided at
+ // evaluation time. An identifier with a value should resolve to a constant,
+ // but may be used in conjunction with other identifiers bound at evaluation
+ // time.
+ message IdentDecl {
+ // Required. The type of the identifier.
+ Type type = 1;
+
+ // The constant value of the identifier. If not specified, the identifier
+ // must be supplied at evaluation time.
+ Constant value = 2;
+
+ // Documentation string for the identifier.
+ string doc = 3;
+ }
+
+ // Function declaration specifies one or more overloads which indicate the
+ // function's parameter types and return type, and may optionally specify a
+ // function definition in terms of CEL expressions.
+ //
+ // Functions have no observable side-effects (there may be side-effects like
+ // logging which are not observable from CEL).
+ message FunctionDecl {
+ // An overload indicates a function's parameter types and return type, and
+ // may optionally include a function body described in terms of
+ // [Expr][google.api.expr.v1alpha1.Expr] values.
+ //
+ // Functions overloads are declared in either a function or method
+ // call-style. For methods, the `params[0]` is the expected type of the
+ // target receiver.
+ //
+ // Overloads must have non-overlapping argument types after erasure of all
+ // parameterized type variables (similar as type erasure in Java).
+ message Overload {
+ // Required. Globally unique overload name of the function which reflects
+ // the function name and argument types.
+ //
+ // This will be used by a [Reference][google.api.expr.v1alpha1.Reference]
+ // to indicate the `overload_id` that was resolved for the function
+ // `name`.
+ string overload_id = 1;
+
+ // List of function parameter [Type][google.api.expr.v1alpha1.Type]
+ // values.
+ //
+ // Param types are disjoint after generic type parameters have been
+ // replaced with the type `DYN`. Since the `DYN` type is compatible with
+ // any other type, this means that if `A` is a type parameter, the
+ // function types `int<A>` and `int<int>` are not disjoint. Likewise,
+ // `map<string, string>` is not disjoint from `map<K, V>`.
+ //
+ // When the `result_type` of a function is a generic type param, the
+ // type param name also appears as the `type` of on at least one params.
+ repeated Type params = 2;
+
+ // The type param names associated with the function declaration.
+ //
+ // For example, `function ex<K,V>(K key, map<K, V> map) : V` would yield
+ // the type params of `K, V`.
+ repeated string type_params = 3;
+
+ // Required. The result type of the function. For example, the operator
+ // `string.isEmpty()` would have `result_type` of `kind: BOOL`.
+ Type result_type = 4;
+
+ // Whether the function is to be used in a method call-style `x.f(...)`
+ // of a function call-style `f(x, ...)`.
+ //
+ // For methods, the first parameter declaration, `params[0]` is the
+ // expected type of the target receiver.
+ bool is_instance_function = 5;
+
+ // Documentation string for the overload.
+ string doc = 6;
+ }
+
+ // Required. List of function overloads, must contain at least one overload.
+ repeated Overload overloads = 1;
+ }
+
+ // The fully qualified name of the declaration.
+ //
+ // Declarations are organized in containers and this represents the full path
+ // to the declaration in its container, as in `google.api.expr.Decl`.
+ //
+ // Declarations used as
+ // [FunctionDecl.Overload][google.api.expr.v1alpha1.Decl.FunctionDecl.Overload]
+ // parameters may or may not have a name depending on whether the overload is
+ // function declaration or a function definition containing a result
+ // [Expr][google.api.expr.v1alpha1.Expr].
+ string name = 1;
+
+ // Required. The declaration kind.
+ oneof decl_kind {
+ // Identifier declaration.
+ IdentDecl ident = 2;
+
+ // Function declaration.
+ FunctionDecl function = 3;
+ }
+}
+
+// Describes a resolved reference to a declaration.
+message Reference {
+ // The fully qualified name of the declaration.
+ string name = 1;
+
+ // For references to functions, this is a list of `Overload.overload_id`
+ // values which match according to typing rules.
+ //
+ // If the list has more than one element, overload resolution among the
+ // presented candidates must happen at runtime because of dynamic types. The
+ // type checker attempts to narrow down this list as much as possible.
+ //
+ // Empty if this is not a reference to a
+ // [Decl.FunctionDecl][google.api.expr.v1alpha1.Decl.FunctionDecl].
+ repeated string overload_id = 3;
+
+ // For references to constants, this may contain the value of the
+ // constant if known at compile time.
+ Constant value = 4;
+}
diff --git a/google/api/expr/v1alpha1/conformance_service.proto b/google/api/expr/v1alpha1/conformance_service.proto
new file mode 100644
index 000000000..7a9321a0e
--- /dev/null
+++ b/google/api/expr/v1alpha1/conformance_service.proto
@@ -0,0 +1,165 @@
+// Copyright 2018 Google LLC.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+syntax = "proto3";
+
+package google.api.expr.v1alpha1;
+
+import "google/api/expr/v1alpha1/checked.proto";
+import "google/api/expr/v1alpha1/eval.proto";
+import "google/api/expr/v1alpha1/syntax.proto";
+import "google/rpc/status.proto";
+
+option cc_enable_arenas = true;
+option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr";
+option java_multiple_files = true;
+option java_outer_classname = "ConformanceServiceProto";
+option java_package = "com.google.api.expr.v1alpha1";
+
+// Access a CEL implementation from another process or machine.
+// A CEL implementation is decomposed as a parser, a static checker,
+// and an evaluator. Every CEL implementation is expected to provide
+// a server for this API. The API will be used for conformance testing
+// and other utilities.
+service ConformanceService {
+ // Transforms CEL source text into a parsed representation.
+ rpc Parse(ParseRequest) returns (ParseResponse) {}
+
+ // Runs static checks on a parsed CEL representation and return
+ // an annotated representation, or a set of issues.
+ rpc Check(CheckRequest) returns (CheckResponse) {}
+
+ // Evaluates a parsed or annotation CEL representation given
+ // values of external bindings.
+ rpc Eval(EvalRequest) returns (EvalResponse) {}
+}
+
+// Request message for the Parse method.
+message ParseRequest {
+ // Required. Source text in CEL syntax.
+ string cel_source = 1;
+
+ // Tag for version of CEL syntax, for future use.
+ string syntax_version = 2;
+
+ // File or resource for source text, used in
+ // [SourceInfo][google.api.expr.v1alpha1.SourceInfo].
+ string source_location = 3;
+
+ // Prevent macro expansion. See "Macros" in Language Defiinition.
+ bool disable_macros = 4;
+}
+
+// Response message for the Parse method.
+message ParseResponse {
+ // The parsed representation, or unset if parsing failed.
+ ParsedExpr parsed_expr = 1;
+
+ // Any number of issues with [StatusDetails][] as the details.
+ repeated google.rpc.Status issues = 2;
+}
+
+// Request message for the Check method.
+message CheckRequest {
+ // Required. The parsed representation of the CEL program.
+ ParsedExpr parsed_expr = 1;
+
+ // Declarations of types for external variables and functions.
+ // Required if program uses external variables or functions
+ // not in the default environment.
+ repeated Decl type_env = 2;
+
+ // The protocol buffer context. See "Name Resolution" in the
+ // Language Definition.
+ string container = 3;
+
+ // If true, use only the declarations in
+ // [type_env][google.api.expr.v1alpha1.CheckRequest.type_env]. If false
+ // (default), add declarations for the standard definitions to the type
+ // environment. See "Standard Definitions" in the Language Definition.
+ bool no_std_env = 4;
+}
+
+// Response message for the Check method.
+message CheckResponse {
+ // The annotated representation, or unset if checking failed.
+ CheckedExpr checked_expr = 1;
+
+ // Any number of issues with [StatusDetails][] as the details.
+ repeated google.rpc.Status issues = 2;
+}
+
+// Request message for the Eval method.
+message EvalRequest {
+ // Required. Either the parsed or annotated representation of the CEL program.
+ oneof expr_kind {
+ // Evaluate based on the parsed representation.
+ ParsedExpr parsed_expr = 1;
+
+ // Evaluate based on the checked representation.
+ CheckedExpr checked_expr = 2;
+ }
+
+ // Bindings for the external variables. The types SHOULD be compatible
+ // with the type environment in
+ // [CheckRequest][google.api.expr.v1alpha1.CheckRequest], if checked.
+ map<string, ExprValue> bindings = 3;
+
+ // SHOULD be the same container as used in
+ // [CheckRequest][google.api.expr.v1alpha1.CheckRequest], if checked.
+ string container = 4;
+}
+
+// Response message for the Eval method.
+message EvalResponse {
+ // The execution result, or unset if execution couldn't start.
+ ExprValue result = 1;
+
+ // Any number of issues with [StatusDetails][] as the details.
+ // Note that CEL execution errors are reified into
+ // [ExprValue][google.api.expr.v1alpha1.ExprValue]. Nevertheless, we'll allow
+ // out-of-band issues to be raised, which also makes the replies more regular.
+ repeated google.rpc.Status issues = 2;
+}
+
+// Warnings or errors in service execution are represented by
+// [google.rpc.Status][google.rpc.Status] messages, with the following message
+// in the details field.
+message IssueDetails {
+ // Severities of issues.
+ enum Severity {
+ // An unspecified severity.
+ SEVERITY_UNSPECIFIED = 0;
+
+ // Deprecation issue for statements and method that may no longer be
+ // supported or maintained.
+ DEPRECATION = 1;
+
+ // Warnings such as: unused variables.
+ WARNING = 2;
+
+ // Errors such as: unmatched curly braces or variable redefinition.
+ ERROR = 3;
+ }
+
+ // The severity of the issue.
+ Severity severity = 1;
+
+ // Position in the source, if known.
+ SourcePosition position = 2;
+
+ // Expression ID from [Expr][google.api.expr.v1alpha1.Expr], 0 if unknown.
+ int64 id = 3;
+}
diff --git a/google/api/expr/v1alpha1/eval.proto b/google/api/expr/v1alpha1/eval.proto
new file mode 100644
index 000000000..f516ba6bc
--- /dev/null
+++ b/google/api/expr/v1alpha1/eval.proto
@@ -0,0 +1,119 @@
+// Copyright 2018 Google LLC.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+syntax = "proto3";
+
+package google.api.expr.v1alpha1;
+
+import "google/api/expr/v1alpha1/value.proto";
+import "google/rpc/status.proto";
+
+option cc_enable_arenas = true;
+option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr";
+option java_multiple_files = true;
+option java_outer_classname = "EvalProto";
+option java_package = "com.google.api.expr.v1alpha1";
+
+// The state of an evaluation.
+//
+// Can represent an inital, partial, or completed state of evaluation.
+message EvalState {
+ // A single evalution result.
+ message Result {
+ // The id of the expression this result if for.
+ int64 expr = 1;
+
+ // The index in `values` of the resulting value.
+ int64 value = 2;
+ }
+
+ // The unique values referenced in this message.
+ repeated ExprValue values = 1;
+
+ // An ordered list of results.
+ //
+ // Tracks the flow of evaluation through the expression.
+ // May be sparse.
+ repeated Result results = 3;
+}
+
+// The value of an evaluated expression.
+message ExprValue {
+ // An expression can resolve to a value, error or unknown.
+ oneof kind {
+ // A concrete value.
+ Value value = 1;
+
+ // The set of errors in the critical path of evalution.
+ //
+ // Only errors in the critical path are included. For example,
+ // `(<error1> || true) && <error2>` will only result in `<error2>`,
+ // while `<error1> || <error2>` will result in both `<error1>` and
+ // `<error2>`.
+ //
+ // Errors cause by the presence of other errors are not included in the
+ // set. For example `<error1>.foo`, `foo(<error1>)`, and `<error1> + 1` will
+ // only result in `<error1>`.
+ //
+ // Multiple errors *might* be included when evaluation could result
+ // in different errors. For example `<error1> + <error2>` and
+ // `foo(<error1>, <error2>)` may result in `<error1>`, `<error2>` or both.
+ // The exact subset of errors included for this case is unspecified and
+ // depends on the implementation details of the evaluator.
+ ErrorSet error = 2;
+
+ // The set of unknowns in the critical path of evaluation.
+ //
+ // Unknown behaves identically to Error with regards to propagation.
+ // Specifically, only unknowns in the critical path are included, unknowns
+ // caused by the presence of other unknowns are not included, and multiple
+ // unknowns *might* be included included when evaluation could result in
+ // different unknowns. For example:
+ //
+ // (<unknown[1]> || true) && <unknown[2]> -> <unknown[2]>
+ // <unknown[1]> || <unknown[2]> -> <unknown[1,2]>
+ // <unknown[1]>.foo -> <unknown[1]>
+ // foo(<unknown[1]>) -> <unknown[1]>
+ // <unknown[1]> + <unknown[2]> -> <unknown[1]> or <unknown[2[>
+ //
+ // Unknown takes precidence over Error in cases where a `Value` can short
+ // circuit the result:
+ //
+ // <error> || <unknown> -> <unknown>
+ // <error> && <unknown> -> <unknown>
+ //
+ // Errors take precidence in all other cases:
+ //
+ // <unknown> + <error> -> <error>
+ // foo(<unknown>, <error>) -> <error>
+ UnknownSet unknown = 3;
+ }
+}
+
+// A set of errors.
+//
+// The errors included depend on the context. See `ExprValue.error`.
+message ErrorSet {
+ // The errors in the set.
+ repeated google.rpc.Status errors = 1;
+}
+
+// A set of expressions for which the value is unknown.
+//
+// The unknowns included depend on the context. See `ExprValue.unknown`.
+message UnknownSet {
+ // The ids of the expressions with unknown values.
+ repeated int64 exprs = 1;
+}
diff --git a/google/api/expr/v1alpha1/explain.proto b/google/api/expr/v1alpha1/explain.proto
new file mode 100644
index 000000000..089e144a1
--- /dev/null
+++ b/google/api/expr/v1alpha1/explain.proto
@@ -0,0 +1,54 @@
+// Copyright 2018 Google LLC.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+syntax = "proto3";
+
+package google.api.expr.v1alpha1;
+
+import "google/api/expr/v1alpha1/value.proto";
+
+option cc_enable_arenas = true;
+option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr";
+option java_multiple_files = true;
+option java_outer_classname = "ExplainProto";
+option java_package = "com.google.api.expr.v1alpha1";
+
+// Values of intermediate expressions produced when evaluating expression.
+// Deprecated, use `EvalState` instead.
+message Explain {
+ option deprecated = true;
+
+ // ID and value index of one step.
+ message ExprStep {
+ // ID of corresponding Expr node.
+ int64 id = 1;
+
+ // Index of the value in the values list.
+ int32 value_index = 2;
+ }
+
+ // All of the observed values.
+ //
+ // The field value_index is an index in the values list.
+ // Separating values from steps is needed to remove redundant values.
+ repeated Value values = 1;
+
+ // List of steps.
+ //
+ // Repeated evaluations of the same expression generate new ExprStep
+ // instances. The order of such ExprStep instances matches the order of
+ // elements returned by Comprehension.iter_range.
+ repeated ExprStep expr_steps = 2;
+}
diff --git a/google/api/expr/v1alpha1/syntax.proto b/google/api/expr/v1alpha1/syntax.proto
new file mode 100644
index 000000000..4a3cb907a
--- /dev/null
+++ b/google/api/expr/v1alpha1/syntax.proto
@@ -0,0 +1,322 @@
+// Copyright 2018 Google LLC.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+syntax = "proto3";
+
+package google.api.expr.v1alpha1;
+
+import "google/protobuf/duration.proto";
+import "google/protobuf/struct.proto";
+import "google/protobuf/timestamp.proto";
+
+option cc_enable_arenas = true;
+option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr";
+option java_multiple_files = true;
+option java_outer_classname = "SyntaxProto";
+option java_package = "com.google.api.expr.v1alpha1";
+
+// A representation of the abstract syntax of the Common Expression Language.
+
+// An expression together with source information as returned by the parser.
+message ParsedExpr {
+ // The parsed expression.
+ Expr expr = 2;
+
+ // The source info derived from input that generated the parsed `expr`.
+ SourceInfo source_info = 3;
+}
+
+// An abstract representation of a common expression.
+//
+// Expressions are abstractly represented as a collection of identifiers,
+// select statements, function calls, literals, and comprehensions. All
+// operators with the exception of the '.' operator are modelled as function
+// calls. This makes it easy to represent new operators into the existing AST.
+//
+// All references within expressions must resolve to a
+// [Decl][google.api.expr.v1alpha1.Decl] provided at type-check for an
+// expression to be valid. A reference may either be a bare identifier `name` or
+// a qualified identifier `google.api.name`. References may either refer to a
+// value or a function declaration.
+//
+// For example, the expression `google.api.name.startsWith('expr')` references
+// the declaration `google.api.name` within a
+// [Expr.Select][google.api.expr.v1alpha1.Expr.Select] expression, and the
+// function declaration `startsWith`.
+message Expr {
+ // An identifier expression. e.g. `request`.
+ message Ident {
+ // Required. Holds a single, unqualified identifier, possibly preceded by a
+ // '.'.
+ //
+ // Qualified names are represented by the
+ // [Expr.Select][google.api.expr.v1alpha1.Expr.Select] expression.
+ string name = 1;
+ }
+
+ // A field selection expression. e.g. `request.auth`.
+ message Select {
+ // Required. The target of the selection expression.
+ //
+ // For example, in the select expression `request.auth`, the `request`
+ // portion of the expression is the `operand`.
+ Expr operand = 1;
+
+ // Required. The name of the field to select.
+ //
+ // For example, in the select expression `request.auth`, the `auth` portion
+ // of the expression would be the `field`.
+ string field = 2;
+
+ // Whether the select is to be interpreted as a field presence test.
+ //
+ // This results from the macro `has(request.auth)`.
+ bool test_only = 3;
+ }
+
+ // A call expression, including calls to predefined functions and operators.
+ //
+ // For example, `value == 10`, `size(map_value)`.
+ message Call {
+ // The target of an method call-style expression. For example, `x` in
+ // `x.f()`.
+ Expr target = 1;
+
+ // Required. The name of the function or method being called.
+ string function = 2;
+
+ // The arguments.
+ repeated Expr args = 3;
+ }
+
+ // A list creation expression.
+ //
+ // Lists may either be homogenous, e.g. `[1, 2, 3]`, or heterogenous, e.g.
+ // `dyn([1, 'hello', 2.0])`
+ message CreateList {
+ // The elements part of the list.
+ repeated Expr elements = 1;
+ }
+
+ // A map or message creation expression.
+ //
+ // Maps are constructed as `{'key_name': 'value'}`. Message construction is
+ // similar, but prefixed with a type name and composed of field ids:
+ // `types.MyType{field_id: 'value'}`.
+ message CreateStruct {
+ // Represents an entry.
+ message Entry {
+ // Required. An id assigned to this node by the parser which is unique
+ // in a given expression tree. This is used to associate type
+ // information and other attributes to the node.
+ int64 id = 1;
+
+ // The `Entry` key kinds.
+ oneof key_kind {
+ // The field key for a message creator statement.
+ string field_key = 2;
+
+ // The key expression for a map creation statement.
+ Expr map_key = 3;
+ }
+
+ // Required. The value assigned to the key.
+ Expr value = 4;
+ }
+
+ // The type name of the message to be created, empty when creating map
+ // literals.
+ string message_name = 1;
+
+ // The entries in the creation expression.
+ repeated Entry entries = 2;
+ }
+
+ // A comprehension expression applied to a list or map.
+ //
+ // Comprehensions are not part of the core syntax, but enabled with macros.
+ // A macro matches a specific call signature within a parsed AST and replaces
+ // the call with an alternate AST block. Macro expansion happens at parse
+ // time.
+ //
+ // The following macros are supported within CEL:
+ //
+ // Aggregate type macros may be applied to all elements in a list or all keys
+ // in a map:
+ //
+ // * `all`, `exists`, `exists_one` - test a predicate expression against
+ // the inputs and return `true` if the predicate is satisfied for all,
+ // any, or only one value `list.all(x, x < 10)`.
+ // * `filter` - test a predicate expression against the inputs and return
+ // the subset of elements which satisfy the predicate:
+ // `payments.filter(p, p > 1000)`.
+ // * `map` - apply an expression to all elements in the input and return the
+ // output aggregate type: `[1, 2, 3].map(i, i * i)`.
+ //
+ // The `has(m.x)` macro tests whether the property `x` is present in struct
+ // `m`. The semantics of this macro depend on the type of `m`. For proto2
+ // messages `has(m.x)` is defined as 'defined, but not set`. For proto3, the
+ // macro tests whether the property is set to its default. For map and struct
+ // types, the macro tests whether the property `x` is defined on `m`.
+ message Comprehension {
+ // The name of the iteration variable.
+ string iter_var = 1;
+
+ // The range over which var iterates.
+ Expr iter_range = 2;
+
+ // The name of the variable used for accumulation of the result.
+ string accu_var = 3;
+
+ // The initial value of the accumulator.
+ Expr accu_init = 4;
+
+ // An expression which can contain iter_var and accu_var.
+ //
+ // Returns false when the result has been computed and may be used as
+ // a hint to short-circuit the remainder of the comprehension.
+ Expr loop_condition = 5;
+
+ // An expression which can contain iter_var and accu_var.
+ //
+ // Computes the next value of accu_var.
+ Expr loop_step = 6;
+
+ // An expression which can contain accu_var.
+ //
+ // Computes the result.
+ Expr result = 7;
+ }
+
+ // Required. An id assigned to this node by the parser which is unique in a
+ // given expression tree. This is used to associate type information and other
+ // attributes to a node in the parse tree.
+ int64 id = 2;
+
+ // Required. Variants of expressions.
+ oneof expr_kind {
+ // A literal expression.
+ Constant const_expr = 3;
+
+ // An identifier expression.
+ Ident ident_expr = 4;
+
+ // A field selection expression, e.g. `request.auth`.
+ Select select_expr = 5;
+
+ // A call expression, including calls to predefined functions and operators.
+ Call call_expr = 6;
+
+ // A list creation expression.
+ CreateList list_expr = 7;
+
+ // A map or message creation expression.
+ CreateStruct struct_expr = 8;
+
+ // A comprehension expression.
+ Comprehension comprehension_expr = 9;
+ }
+}
+
+// Represents a primitive literal.
+//
+// Named 'Constant' here for backwards compatibility.
+//
+// This is similar as the primitives supported in the well-known type
+// `google.protobuf.Value`, but richer so it can represent CEL's full range of
+// primitives.
+//
+// Lists and structs are not included as constants as these aggregate types may
+// contain [Expr][google.api.expr.v1alpha1.Expr] elements which require
+// evaluation and are thus not constant.
+//
+// Examples of literals include: `"hello"`, `b'bytes'`, `1u`, `4.2`, `-2`,
+// `true`, `null`.
+message Constant {
+ // Required. The valid constant kinds.
+ oneof constant_kind {
+ // null value.
+ google.protobuf.NullValue null_value = 1;
+
+ // boolean value.
+ bool bool_value = 2;
+
+ // int64 value.
+ int64 int64_value = 3;
+
+ // uint64 value.
+ uint64 uint64_value = 4;
+
+ // double value.
+ double double_value = 5;
+
+ // string value.
+ string string_value = 6;
+
+ // bytes value.
+ bytes bytes_value = 7;
+
+ // protobuf.Duration value.
+ //
+ // Deprecated: duration is no longer considered a builtin cel type.
+ google.protobuf.Duration duration_value = 8 [deprecated = true];
+
+ // protobuf.Timestamp value.
+ //
+ // Deprecated: timestamp is no longer considered a builtin cel type.
+ google.protobuf.Timestamp timestamp_value = 9 [deprecated = true];
+ }
+}
+
+// Source information collected at parse time.
+message SourceInfo {
+ // The syntax version of the source, e.g. `cel1`.
+ string syntax_version = 1;
+
+ // The location name. All position information attached to an expression is
+ // relative to this location.
+ //
+ // The location could be a file, UI element, or similar. For example,
+ // `acme/app/AnvilPolicy.cel`.
+ string location = 2;
+
+ // Monotonically increasing list of character offsets where newlines appear.
+ //
+ // The line number of a given position is the index `i` where for a given
+ // `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The
+ // column may be derivd from `id_positions[id] - line_offsets[i]`.
+ repeated int32 line_offsets = 3;
+
+ // A map from the parse node id (e.g. `Expr.id`) to the character offset
+ // within source.
+ map<int64, int32> positions = 4;
+}
+
+// A specific position in source.
+message SourcePosition {
+ // The soucre location name (e.g. file name).
+ string location = 1;
+
+ // The character offset.
+ int32 offset = 2;
+
+ // The 1-based index of the starting line in the source text
+ // where the issue occurs, or 0 if unknown.
+ int32 line = 3;
+
+ // The 0-based index of the starting position within the line of source text
+ // where the issue occurs. Only meaningful if line is nonzero.
+ int32 column = 4;
+}
diff --git a/google/api/expr/v1alpha1/value.proto b/google/api/expr/v1alpha1/value.proto
new file mode 100644
index 000000000..a0508ed91
--- /dev/null
+++ b/google/api/expr/v1alpha1/value.proto
@@ -0,0 +1,116 @@
+// Copyright 2018 Google LLC.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+syntax = "proto3";
+
+package google.api.expr.v1alpha1;
+
+import "google/protobuf/any.proto";
+import "google/protobuf/struct.proto";
+
+option cc_enable_arenas = true;
+option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr";
+option java_multiple_files = true;
+option java_outer_classname = "ValueProto";
+option java_package = "com.google.api.expr.v1alpha1";
+
+// Contains representations for CEL runtime values.
+
+// Represents a CEL value.
+//
+// This is similar to `google.protobuf.Value`, but can represent CEL's full
+// range of values.
+message Value {
+ // Required. The valid kinds of values.
+ oneof kind {
+ // Null value.
+ google.protobuf.NullValue null_value = 1;
+
+ // Boolean value.
+ bool bool_value = 2;
+
+ // Signed integer value.
+ int64 int64_value = 3;
+
+ // Unsigned integer value.
+ uint64 uint64_value = 4;
+
+ // Floating point value.
+ double double_value = 5;
+
+ // UTF-8 string value.
+ string string_value = 6;
+
+ // Byte string value.
+ bytes bytes_value = 7;
+
+ // An enum value.
+ EnumValue enum_value = 9;
+
+ // The proto message backing an object value.
+ google.protobuf.Any object_value = 10;
+
+ // Map value.
+ MapValue map_value = 11;
+
+ // List value.
+ ListValue list_value = 12;
+
+ // Type value.
+ string type_value = 15;
+ }
+}
+
+// An enum value.
+message EnumValue {
+ // The fully qualified name of the enum type.
+ string type = 1;
+
+ // The value of the enum.
+ int32 value = 2;
+}
+
+// A list.
+//
+// Wrapped in a message so 'not set' and empty can be differentiated, which is
+// required for use in a 'oneof'.
+message ListValue {
+ // The ordered values in the list.
+ repeated Value values = 1;
+}
+
+// A map.
+//
+// Wrapped in a message so 'not set' and empty can be differentiated, which is
+// required for use in a 'oneof'.
+message MapValue {
+ // An entry in the map.
+ message Entry {
+ // The key.
+ //
+ // Must be unique with in the map.
+ // Currently only boolean, int, uint, and string values can be keys.
+ Value key = 1;
+
+ // The value.
+ Value value = 2;
+ }
+
+ // The set of map entries.
+ //
+ // CEL has fewer restrictions on keys, so a protobuf map represenation
+ // cannot be used.
+ repeated Entry entries = 1;
+}