xds_api/generated/google.api.expr.v1alpha1.rs
1// This file is @generated by prost-build.
2/// An expression together with source information as returned by the parser.
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct ParsedExpr {
5 /// The parsed expression.
6 #[prost(message, optional, tag = "2")]
7 pub expr: ::core::option::Option<Expr>,
8 /// The source info derived from input that generated the parsed `expr`.
9 #[prost(message, optional, tag = "3")]
10 pub source_info: ::core::option::Option<SourceInfo>,
11}
12impl ::prost::Name for ParsedExpr {
13 const NAME: &'static str = "ParsedExpr";
14 const PACKAGE: &'static str = "google.api.expr.v1alpha1";
15 fn full_name() -> ::prost::alloc::string::String {
16 "google.api.expr.v1alpha1.ParsedExpr".into()
17 }
18 fn type_url() -> ::prost::alloc::string::String {
19 "/google.api.expr.v1alpha1.ParsedExpr".into()
20 }
21}
22/// An abstract representation of a common expression.
23///
24/// Expressions are abstractly represented as a collection of identifiers,
25/// select statements, function calls, literals, and comprehensions. All
26/// operators with the exception of the '.' operator are modelled as function
27/// calls. This makes it easy to represent new operators into the existing AST.
28///
29/// All references within expressions must resolve to a [Decl][google.api.expr.v1alpha1.Decl] provided at
30/// type-check for an expression to be valid. A reference may either be a bare
31/// identifier `name` or a qualified identifier `google.api.name`. References
32/// may either refer to a value or a function declaration.
33///
34/// For example, the expression `google.api.name.startsWith('expr')` references
35/// the declaration `google.api.name` within a [Expr.Select][google.api.expr.v1alpha1.Expr.Select] expression, and
36/// the function declaration `startsWith`.
37#[derive(Clone, PartialEq, ::prost::Message)]
38pub struct Expr {
39 /// Required. An id assigned to this node by the parser which is unique in a
40 /// given expression tree. This is used to associate type information and other
41 /// attributes to a node in the parse tree.
42 #[prost(int64, tag = "2")]
43 pub id: i64,
44 /// Required. Variants of expressions.
45 #[prost(oneof = "expr::ExprKind", tags = "3, 4, 5, 6, 7, 8, 9")]
46 pub expr_kind: ::core::option::Option<expr::ExprKind>,
47}
48/// Nested message and enum types in `Expr`.
49pub mod expr {
50 /// An identifier expression. e.g. `request`.
51 #[derive(Clone, PartialEq, ::prost::Message)]
52 pub struct Ident {
53 /// Required. Holds a single, unqualified identifier, possibly preceded by a
54 /// '.'.
55 ///
56 /// Qualified names are represented by the [Expr.Select][google.api.expr.v1alpha1.Expr.Select] expression.
57 #[prost(string, tag = "1")]
58 pub name: ::prost::alloc::string::String,
59 }
60 impl ::prost::Name for Ident {
61 const NAME: &'static str = "Ident";
62 const PACKAGE: &'static str = "google.api.expr.v1alpha1";
63 fn full_name() -> ::prost::alloc::string::String {
64 "google.api.expr.v1alpha1.Expr.Ident".into()
65 }
66 fn type_url() -> ::prost::alloc::string::String {
67 "/google.api.expr.v1alpha1.Expr.Ident".into()
68 }
69 }
70 /// A field selection expression. e.g. `request.auth`.
71 #[derive(Clone, PartialEq, ::prost::Message)]
72 pub struct Select {
73 /// Required. The target of the selection expression.
74 ///
75 /// For example, in the select expression `request.auth`, the `request`
76 /// portion of the expression is the `operand`.
77 #[prost(message, optional, boxed, tag = "1")]
78 pub operand: ::core::option::Option<::prost::alloc::boxed::Box<super::Expr>>,
79 /// Required. The name of the field to select.
80 ///
81 /// For example, in the select expression `request.auth`, the `auth` portion
82 /// of the expression would be the `field`.
83 #[prost(string, tag = "2")]
84 pub field: ::prost::alloc::string::String,
85 /// Whether the select is to be interpreted as a field presence test.
86 ///
87 /// This results from the macro `has(request.auth)`.
88 #[prost(bool, tag = "3")]
89 pub test_only: bool,
90 }
91 impl ::prost::Name for Select {
92 const NAME: &'static str = "Select";
93 const PACKAGE: &'static str = "google.api.expr.v1alpha1";
94 fn full_name() -> ::prost::alloc::string::String {
95 "google.api.expr.v1alpha1.Expr.Select".into()
96 }
97 fn type_url() -> ::prost::alloc::string::String {
98 "/google.api.expr.v1alpha1.Expr.Select".into()
99 }
100 }
101 /// A call expression, including calls to predefined functions and operators.
102 ///
103 /// For example, `value == 10`, `size(map_value)`.
104 #[derive(Clone, PartialEq, ::prost::Message)]
105 pub struct Call {
106 /// The target of an method call-style expression. For example, `x` in
107 /// `x.f()`.
108 #[prost(message, optional, boxed, tag = "1")]
109 pub target: ::core::option::Option<::prost::alloc::boxed::Box<super::Expr>>,
110 /// Required. The name of the function or method being called.
111 #[prost(string, tag = "2")]
112 pub function: ::prost::alloc::string::String,
113 /// The arguments.
114 #[prost(message, repeated, tag = "3")]
115 pub args: ::prost::alloc::vec::Vec<super::Expr>,
116 }
117 impl ::prost::Name for Call {
118 const NAME: &'static str = "Call";
119 const PACKAGE: &'static str = "google.api.expr.v1alpha1";
120 fn full_name() -> ::prost::alloc::string::String {
121 "google.api.expr.v1alpha1.Expr.Call".into()
122 }
123 fn type_url() -> ::prost::alloc::string::String {
124 "/google.api.expr.v1alpha1.Expr.Call".into()
125 }
126 }
127 /// A list creation expression.
128 ///
129 /// Lists may either be homogenous, e.g. `\[1, 2, 3\]`, or heterogeneous, e.g.
130 /// `dyn(\[1, 'hello', 2.0\])`
131 #[derive(Clone, PartialEq, ::prost::Message)]
132 pub struct CreateList {
133 /// The elements part of the list.
134 #[prost(message, repeated, tag = "1")]
135 pub elements: ::prost::alloc::vec::Vec<super::Expr>,
136 /// The indices within the elements list which are marked as optional
137 /// elements.
138 ///
139 /// When an optional-typed value is present, the value it contains
140 /// is included in the list. If the optional-typed value is absent, the list
141 /// element is omitted from the CreateList result.
142 #[prost(int32, repeated, tag = "2")]
143 pub optional_indices: ::prost::alloc::vec::Vec<i32>,
144 }
145 impl ::prost::Name for CreateList {
146 const NAME: &'static str = "CreateList";
147 const PACKAGE: &'static str = "google.api.expr.v1alpha1";
148 fn full_name() -> ::prost::alloc::string::String {
149 "google.api.expr.v1alpha1.Expr.CreateList".into()
150 }
151 fn type_url() -> ::prost::alloc::string::String {
152 "/google.api.expr.v1alpha1.Expr.CreateList".into()
153 }
154 }
155 /// A map or message creation expression.
156 ///
157 /// Maps are constructed as `{'key_name': 'value'}`. Message construction is
158 /// similar, but prefixed with a type name and composed of field ids:
159 /// `types.MyType{field_id: 'value'}`.
160 #[derive(Clone, PartialEq, ::prost::Message)]
161 pub struct CreateStruct {
162 /// The type name of the message to be created, empty when creating map
163 /// literals.
164 #[prost(string, tag = "1")]
165 pub message_name: ::prost::alloc::string::String,
166 /// The entries in the creation expression.
167 #[prost(message, repeated, tag = "2")]
168 pub entries: ::prost::alloc::vec::Vec<create_struct::Entry>,
169 }
170 /// Nested message and enum types in `CreateStruct`.
171 pub mod create_struct {
172 /// Represents an entry.
173 #[derive(Clone, PartialEq, ::prost::Message)]
174 pub struct Entry {
175 /// Required. An id assigned to this node by the parser which is unique
176 /// in a given expression tree. This is used to associate type
177 /// information and other attributes to the node.
178 #[prost(int64, tag = "1")]
179 pub id: i64,
180 /// Required. The value assigned to the key.
181 ///
182 /// If the optional_entry field is true, the expression must resolve to an
183 /// optional-typed value. If the optional value is present, the key will be
184 /// set; however, if the optional value is absent, the key will be unset.
185 #[prost(message, optional, tag = "4")]
186 pub value: ::core::option::Option<super::super::Expr>,
187 /// Whether the key-value pair is optional.
188 #[prost(bool, tag = "5")]
189 pub optional_entry: bool,
190 /// The `Entry` key kinds.
191 #[prost(oneof = "entry::KeyKind", tags = "2, 3")]
192 pub key_kind: ::core::option::Option<entry::KeyKind>,
193 }
194 /// Nested message and enum types in `Entry`.
195 pub mod entry {
196 /// The `Entry` key kinds.
197 #[derive(Clone, PartialEq, ::prost::Oneof)]
198 pub enum KeyKind {
199 /// The field key for a message creator statement.
200 #[prost(string, tag = "2")]
201 FieldKey(::prost::alloc::string::String),
202 /// The key expression for a map creation statement.
203 #[prost(message, tag = "3")]
204 MapKey(super::super::super::Expr),
205 }
206 }
207 impl ::prost::Name for Entry {
208 const NAME: &'static str = "Entry";
209 const PACKAGE: &'static str = "google.api.expr.v1alpha1";
210 fn full_name() -> ::prost::alloc::string::String {
211 "google.api.expr.v1alpha1.Expr.CreateStruct.Entry".into()
212 }
213 fn type_url() -> ::prost::alloc::string::String {
214 "/google.api.expr.v1alpha1.Expr.CreateStruct.Entry".into()
215 }
216 }
217 }
218 impl ::prost::Name for CreateStruct {
219 const NAME: &'static str = "CreateStruct";
220 const PACKAGE: &'static str = "google.api.expr.v1alpha1";
221 fn full_name() -> ::prost::alloc::string::String {
222 "google.api.expr.v1alpha1.Expr.CreateStruct".into()
223 }
224 fn type_url() -> ::prost::alloc::string::String {
225 "/google.api.expr.v1alpha1.Expr.CreateStruct".into()
226 }
227 }
228 /// A comprehension expression applied to a list or map.
229 ///
230 /// Comprehensions are not part of the core syntax, but enabled with macros.
231 /// A macro matches a specific call signature within a parsed AST and replaces
232 /// the call with an alternate AST block. Macro expansion happens at parse
233 /// time.
234 ///
235 /// The following macros are supported within CEL:
236 ///
237 /// Aggregate type macros may be applied to all elements in a list or all keys
238 /// in a map:
239 ///
240 /// * `all`, `exists`, `exists_one` - test a predicate expression against
241 /// the inputs and return `true` if the predicate is satisfied for all,
242 /// any, or only one value `list.all(x, x < 10)`.
243 /// * `filter` - test a predicate expression against the inputs and return
244 /// the subset of elements which satisfy the predicate:
245 /// `payments.filter(p, p > 1000)`.
246 /// * `map` - apply an expression to all elements in the input and return the
247 /// output aggregate type: `\[1, 2, 3\].map(i, i * i)`.
248 ///
249 /// The `has(m.x)` macro tests whether the property `x` is present in struct
250 /// `m`. The semantics of this macro depend on the type of `m`. For proto2
251 /// messages `has(m.x)` is defined as 'defined, but not set`. For proto3, the
252 /// macro tests whether the property is set to its default. For map and struct
253 /// types, the macro tests whether the property `x` is defined on `m`.
254 #[derive(Clone, PartialEq, ::prost::Message)]
255 pub struct Comprehension {
256 /// The name of the iteration variable.
257 #[prost(string, tag = "1")]
258 pub iter_var: ::prost::alloc::string::String,
259 /// The range over which var iterates.
260 #[prost(message, optional, boxed, tag = "2")]
261 pub iter_range: ::core::option::Option<::prost::alloc::boxed::Box<super::Expr>>,
262 /// The name of the variable used for accumulation of the result.
263 #[prost(string, tag = "3")]
264 pub accu_var: ::prost::alloc::string::String,
265 /// The initial value of the accumulator.
266 #[prost(message, optional, boxed, tag = "4")]
267 pub accu_init: ::core::option::Option<::prost::alloc::boxed::Box<super::Expr>>,
268 /// An expression which can contain iter_var and accu_var.
269 ///
270 /// Returns false when the result has been computed and may be used as
271 /// a hint to short-circuit the remainder of the comprehension.
272 #[prost(message, optional, boxed, tag = "5")]
273 pub loop_condition: ::core::option::Option<
274 ::prost::alloc::boxed::Box<super::Expr>,
275 >,
276 /// An expression which can contain iter_var and accu_var.
277 ///
278 /// Computes the next value of accu_var.
279 #[prost(message, optional, boxed, tag = "6")]
280 pub loop_step: ::core::option::Option<::prost::alloc::boxed::Box<super::Expr>>,
281 /// An expression which can contain accu_var.
282 ///
283 /// Computes the result.
284 #[prost(message, optional, boxed, tag = "7")]
285 pub result: ::core::option::Option<::prost::alloc::boxed::Box<super::Expr>>,
286 }
287 impl ::prost::Name for Comprehension {
288 const NAME: &'static str = "Comprehension";
289 const PACKAGE: &'static str = "google.api.expr.v1alpha1";
290 fn full_name() -> ::prost::alloc::string::String {
291 "google.api.expr.v1alpha1.Expr.Comprehension".into()
292 }
293 fn type_url() -> ::prost::alloc::string::String {
294 "/google.api.expr.v1alpha1.Expr.Comprehension".into()
295 }
296 }
297 /// Required. Variants of expressions.
298 #[derive(Clone, PartialEq, ::prost::Oneof)]
299 pub enum ExprKind {
300 /// A literal expression.
301 #[prost(message, tag = "3")]
302 ConstExpr(super::Constant),
303 /// An identifier expression.
304 #[prost(message, tag = "4")]
305 IdentExpr(Ident),
306 /// A field selection expression, e.g. `request.auth`.
307 #[prost(message, tag = "5")]
308 SelectExpr(::prost::alloc::boxed::Box<Select>),
309 /// A call expression, including calls to predefined functions and operators.
310 #[prost(message, tag = "6")]
311 CallExpr(::prost::alloc::boxed::Box<Call>),
312 /// A list creation expression.
313 #[prost(message, tag = "7")]
314 ListExpr(CreateList),
315 /// A map or message creation expression.
316 #[prost(message, tag = "8")]
317 StructExpr(CreateStruct),
318 /// A comprehension expression.
319 #[prost(message, tag = "9")]
320 ComprehensionExpr(::prost::alloc::boxed::Box<Comprehension>),
321 }
322}
323impl ::prost::Name for Expr {
324 const NAME: &'static str = "Expr";
325 const PACKAGE: &'static str = "google.api.expr.v1alpha1";
326 fn full_name() -> ::prost::alloc::string::String {
327 "google.api.expr.v1alpha1.Expr".into()
328 }
329 fn type_url() -> ::prost::alloc::string::String {
330 "/google.api.expr.v1alpha1.Expr".into()
331 }
332}
333/// Represents a primitive literal.
334///
335/// Named 'Constant' here for backwards compatibility.
336///
337/// This is similar as the primitives supported in the well-known type
338/// `google.protobuf.Value`, but richer so it can represent CEL's full range of
339/// primitives.
340///
341/// Lists and structs are not included as constants as these aggregate types may
342/// contain [Expr][google.api.expr.v1alpha1.Expr] elements which require evaluation and are thus not constant.
343///
344/// Examples of literals include: `"hello"`, `b'bytes'`, `1u`, `4.2`, `-2`,
345/// `true`, `null`.
346#[derive(Clone, PartialEq, ::prost::Message)]
347pub struct Constant {
348 /// Required. The valid constant kinds.
349 #[prost(oneof = "constant::ConstantKind", tags = "1, 2, 3, 4, 5, 6, 7, 8, 9")]
350 pub constant_kind: ::core::option::Option<constant::ConstantKind>,
351}
352/// Nested message and enum types in `Constant`.
353pub mod constant {
354 /// Required. The valid constant kinds.
355 #[derive(Clone, PartialEq, ::prost::Oneof)]
356 pub enum ConstantKind {
357 /// null value.
358 #[prost(
359 enumeration = "super::super::super::super::protobuf::NullValue",
360 tag = "1"
361 )]
362 NullValue(i32),
363 /// boolean value.
364 #[prost(bool, tag = "2")]
365 BoolValue(bool),
366 /// int64 value.
367 #[prost(int64, tag = "3")]
368 Int64Value(i64),
369 /// uint64 value.
370 #[prost(uint64, tag = "4")]
371 Uint64Value(u64),
372 /// double value.
373 #[prost(double, tag = "5")]
374 DoubleValue(f64),
375 /// string value.
376 #[prost(string, tag = "6")]
377 StringValue(::prost::alloc::string::String),
378 /// bytes value.
379 #[prost(bytes, tag = "7")]
380 BytesValue(::prost::alloc::vec::Vec<u8>),
381 /// protobuf.Duration value.
382 ///
383 /// Deprecated: duration is no longer considered a builtin cel type.
384 #[prost(message, tag = "8")]
385 DurationValue(super::super::super::super::protobuf::Duration),
386 /// protobuf.Timestamp value.
387 ///
388 /// Deprecated: timestamp is no longer considered a builtin cel type.
389 #[prost(message, tag = "9")]
390 TimestampValue(super::super::super::super::protobuf::Timestamp),
391 }
392}
393impl ::prost::Name for Constant {
394 const NAME: &'static str = "Constant";
395 const PACKAGE: &'static str = "google.api.expr.v1alpha1";
396 fn full_name() -> ::prost::alloc::string::String {
397 "google.api.expr.v1alpha1.Constant".into()
398 }
399 fn type_url() -> ::prost::alloc::string::String {
400 "/google.api.expr.v1alpha1.Constant".into()
401 }
402}
403/// Source information collected at parse time.
404#[derive(Clone, PartialEq, ::prost::Message)]
405pub struct SourceInfo {
406 /// The syntax version of the source, e.g. `cel1`.
407 #[prost(string, tag = "1")]
408 pub syntax_version: ::prost::alloc::string::String,
409 /// The location name. All position information attached to an expression is
410 /// relative to this location.
411 ///
412 /// The location could be a file, UI element, or similar. For example,
413 /// `acme/app/AnvilPolicy.cel`.
414 #[prost(string, tag = "2")]
415 pub location: ::prost::alloc::string::String,
416 /// Monotonically increasing list of code point offsets where newlines
417 /// `\n` appear.
418 ///
419 /// The line number of a given position is the index `i` where for a given
420 /// `id` the `line_offsets\[i\] < id_positions\[id\] < line_offsets\[i+1\]`. The
421 /// column may be derivd from `id_positions\[id\] - line_offsets\[i\]`.
422 #[prost(int32, repeated, tag = "3")]
423 pub line_offsets: ::prost::alloc::vec::Vec<i32>,
424 /// A map from the parse node id (e.g. `Expr.id`) to the code point offset
425 /// within the source.
426 #[prost(map = "int64, int32", tag = "4")]
427 pub positions: ::std::collections::HashMap<i64, i32>,
428 /// A map from the parse node id where a macro replacement was made to the
429 /// call `Expr` that resulted in a macro expansion.
430 ///
431 /// For example, `has(value.field)` is a function call that is replaced by a
432 /// `test_only` field selection in the AST. Likewise, the call
433 /// `list.exists(e, e > 10)` translates to a comprehension expression. The key
434 /// in the map corresponds to the expression id of the expanded macro, and the
435 /// value is the call `Expr` that was replaced.
436 #[prost(map = "int64, message", tag = "5")]
437 pub macro_calls: ::std::collections::HashMap<i64, Expr>,
438}
439impl ::prost::Name for SourceInfo {
440 const NAME: &'static str = "SourceInfo";
441 const PACKAGE: &'static str = "google.api.expr.v1alpha1";
442 fn full_name() -> ::prost::alloc::string::String {
443 "google.api.expr.v1alpha1.SourceInfo".into()
444 }
445 fn type_url() -> ::prost::alloc::string::String {
446 "/google.api.expr.v1alpha1.SourceInfo".into()
447 }
448}
449/// A specific position in source.
450#[derive(Clone, PartialEq, ::prost::Message)]
451pub struct SourcePosition {
452 /// The soucre location name (e.g. file name).
453 #[prost(string, tag = "1")]
454 pub location: ::prost::alloc::string::String,
455 /// The UTF-8 code unit offset.
456 #[prost(int32, tag = "2")]
457 pub offset: i32,
458 /// The 1-based index of the starting line in the source text
459 /// where the issue occurs, or 0 if unknown.
460 #[prost(int32, tag = "3")]
461 pub line: i32,
462 /// The 0-based index of the starting position within the line of source text
463 /// where the issue occurs. Only meaningful if line is nonzero.
464 #[prost(int32, tag = "4")]
465 pub column: i32,
466}
467impl ::prost::Name for SourcePosition {
468 const NAME: &'static str = "SourcePosition";
469 const PACKAGE: &'static str = "google.api.expr.v1alpha1";
470 fn full_name() -> ::prost::alloc::string::String {
471 "google.api.expr.v1alpha1.SourcePosition".into()
472 }
473 fn type_url() -> ::prost::alloc::string::String {
474 "/google.api.expr.v1alpha1.SourcePosition".into()
475 }
476}
477/// A CEL expression which has been successfully type checked.
478#[derive(Clone, PartialEq, ::prost::Message)]
479pub struct CheckedExpr {
480 /// A map from expression ids to resolved references.
481 ///
482 /// The following entries are in this table:
483 ///
484 /// - An Ident or Select expression is represented here if it resolves to a
485 /// declaration. For instance, if `a.b.c` is represented by
486 /// `select(select(id(a), b), c)`, and `a.b` resolves to a declaration,
487 /// while `c` is a field selection, then the reference is attached to the
488 /// nested select expression (but not to the id or or the outer select).
489 /// In turn, if `a` resolves to a declaration and `b.c` are field selections,
490 /// the reference is attached to the ident expression.
491 /// - Every Call expression has an entry here, identifying the function being
492 /// called.
493 /// - Every CreateStruct expression for a message has an entry, identifying
494 /// the message.
495 #[prost(map = "int64, message", tag = "2")]
496 pub reference_map: ::std::collections::HashMap<i64, Reference>,
497 /// A map from expression ids to types.
498 ///
499 /// Every expression node which has a type different than DYN has a mapping
500 /// here. If an expression has type DYN, it is omitted from this map to save
501 /// space.
502 #[prost(map = "int64, message", tag = "3")]
503 pub type_map: ::std::collections::HashMap<i64, Type>,
504 /// The source info derived from input that generated the parsed `expr` and
505 /// any optimizations made during the type-checking pass.
506 #[prost(message, optional, tag = "5")]
507 pub source_info: ::core::option::Option<SourceInfo>,
508 /// The expr version indicates the major / minor version number of the `expr`
509 /// representation.
510 ///
511 /// The most common reason for a version change will be to indicate to the CEL
512 /// runtimes that transformations have been performed on the expr during static
513 /// analysis. In some cases, this will save the runtime the work of applying
514 /// the same or similar transformations prior to evaluation.
515 #[prost(string, tag = "6")]
516 pub expr_version: ::prost::alloc::string::String,
517 /// The checked expression. Semantically equivalent to the parsed `expr`, but
518 /// may have structural differences.
519 #[prost(message, optional, tag = "4")]
520 pub expr: ::core::option::Option<Expr>,
521}
522impl ::prost::Name for CheckedExpr {
523 const NAME: &'static str = "CheckedExpr";
524 const PACKAGE: &'static str = "google.api.expr.v1alpha1";
525 fn full_name() -> ::prost::alloc::string::String {
526 "google.api.expr.v1alpha1.CheckedExpr".into()
527 }
528 fn type_url() -> ::prost::alloc::string::String {
529 "/google.api.expr.v1alpha1.CheckedExpr".into()
530 }
531}
532/// Represents a CEL type.
533#[derive(Clone, PartialEq, ::prost::Message)]
534pub struct Type {
535 /// The kind of type.
536 #[prost(
537 oneof = "r#type::TypeKind",
538 tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14"
539 )]
540 pub type_kind: ::core::option::Option<r#type::TypeKind>,
541}
542/// Nested message and enum types in `Type`.
543pub mod r#type {
544 /// List type with typed elements, e.g. `list<example.proto.MyMessage>`.
545 #[derive(Clone, PartialEq, ::prost::Message)]
546 pub struct ListType {
547 /// The element type.
548 #[prost(message, optional, boxed, tag = "1")]
549 pub elem_type: ::core::option::Option<::prost::alloc::boxed::Box<super::Type>>,
550 }
551 impl ::prost::Name for ListType {
552 const NAME: &'static str = "ListType";
553 const PACKAGE: &'static str = "google.api.expr.v1alpha1";
554 fn full_name() -> ::prost::alloc::string::String {
555 "google.api.expr.v1alpha1.Type.ListType".into()
556 }
557 fn type_url() -> ::prost::alloc::string::String {
558 "/google.api.expr.v1alpha1.Type.ListType".into()
559 }
560 }
561 /// Map type with parameterized key and value types, e.g. `map<string, int>`.
562 #[derive(Clone, PartialEq, ::prost::Message)]
563 pub struct MapType {
564 /// The type of the key.
565 #[prost(message, optional, boxed, tag = "1")]
566 pub key_type: ::core::option::Option<::prost::alloc::boxed::Box<super::Type>>,
567 /// The type of the value.
568 #[prost(message, optional, boxed, tag = "2")]
569 pub value_type: ::core::option::Option<::prost::alloc::boxed::Box<super::Type>>,
570 }
571 impl ::prost::Name for MapType {
572 const NAME: &'static str = "MapType";
573 const PACKAGE: &'static str = "google.api.expr.v1alpha1";
574 fn full_name() -> ::prost::alloc::string::String {
575 "google.api.expr.v1alpha1.Type.MapType".into()
576 }
577 fn type_url() -> ::prost::alloc::string::String {
578 "/google.api.expr.v1alpha1.Type.MapType".into()
579 }
580 }
581 /// Function type with result and arg types.
582 #[derive(Clone, PartialEq, ::prost::Message)]
583 pub struct FunctionType {
584 /// Result type of the function.
585 #[prost(message, optional, boxed, tag = "1")]
586 pub result_type: ::core::option::Option<::prost::alloc::boxed::Box<super::Type>>,
587 /// Argument types of the function.
588 #[prost(message, repeated, tag = "2")]
589 pub arg_types: ::prost::alloc::vec::Vec<super::Type>,
590 }
591 impl ::prost::Name for FunctionType {
592 const NAME: &'static str = "FunctionType";
593 const PACKAGE: &'static str = "google.api.expr.v1alpha1";
594 fn full_name() -> ::prost::alloc::string::String {
595 "google.api.expr.v1alpha1.Type.FunctionType".into()
596 }
597 fn type_url() -> ::prost::alloc::string::String {
598 "/google.api.expr.v1alpha1.Type.FunctionType".into()
599 }
600 }
601 /// Application defined abstract type.
602 #[derive(Clone, PartialEq, ::prost::Message)]
603 pub struct AbstractType {
604 /// The fully qualified name of this abstract type.
605 #[prost(string, tag = "1")]
606 pub name: ::prost::alloc::string::String,
607 /// Parameter types for this abstract type.
608 #[prost(message, repeated, tag = "2")]
609 pub parameter_types: ::prost::alloc::vec::Vec<super::Type>,
610 }
611 impl ::prost::Name for AbstractType {
612 const NAME: &'static str = "AbstractType";
613 const PACKAGE: &'static str = "google.api.expr.v1alpha1";
614 fn full_name() -> ::prost::alloc::string::String {
615 "google.api.expr.v1alpha1.Type.AbstractType".into()
616 }
617 fn type_url() -> ::prost::alloc::string::String {
618 "/google.api.expr.v1alpha1.Type.AbstractType".into()
619 }
620 }
621 /// CEL primitive types.
622 #[derive(
623 Clone,
624 Copy,
625 Debug,
626 PartialEq,
627 Eq,
628 Hash,
629 PartialOrd,
630 Ord,
631 ::prost::Enumeration
632 )]
633 #[repr(i32)]
634 pub enum PrimitiveType {
635 /// Unspecified type.
636 Unspecified = 0,
637 /// Boolean type.
638 Bool = 1,
639 /// Int64 type.
640 ///
641 /// Proto-based integer values are widened to int64.
642 Int64 = 2,
643 /// Uint64 type.
644 ///
645 /// Proto-based unsigned integer values are widened to uint64.
646 Uint64 = 3,
647 /// Double type.
648 ///
649 /// Proto-based float values are widened to double values.
650 Double = 4,
651 /// String type.
652 String = 5,
653 /// Bytes type.
654 Bytes = 6,
655 }
656 impl PrimitiveType {
657 /// String value of the enum field names used in the ProtoBuf definition.
658 ///
659 /// The values are not transformed in any way and thus are considered stable
660 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
661 pub fn as_str_name(&self) -> &'static str {
662 match self {
663 Self::Unspecified => "PRIMITIVE_TYPE_UNSPECIFIED",
664 Self::Bool => "BOOL",
665 Self::Int64 => "INT64",
666 Self::Uint64 => "UINT64",
667 Self::Double => "DOUBLE",
668 Self::String => "STRING",
669 Self::Bytes => "BYTES",
670 }
671 }
672 /// Creates an enum from field names used in the ProtoBuf definition.
673 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
674 match value {
675 "PRIMITIVE_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
676 "BOOL" => Some(Self::Bool),
677 "INT64" => Some(Self::Int64),
678 "UINT64" => Some(Self::Uint64),
679 "DOUBLE" => Some(Self::Double),
680 "STRING" => Some(Self::String),
681 "BYTES" => Some(Self::Bytes),
682 _ => None,
683 }
684 }
685 }
686 /// Well-known protobuf types treated with first-class support in CEL.
687 #[derive(
688 Clone,
689 Copy,
690 Debug,
691 PartialEq,
692 Eq,
693 Hash,
694 PartialOrd,
695 Ord,
696 ::prost::Enumeration
697 )]
698 #[repr(i32)]
699 pub enum WellKnownType {
700 /// Unspecified type.
701 Unspecified = 0,
702 /// Well-known protobuf.Any type.
703 ///
704 /// Any types are a polymorphic message type. During type-checking they are
705 /// treated like `DYN` types, but at runtime they are resolved to a specific
706 /// message type specified at evaluation time.
707 Any = 1,
708 /// Well-known protobuf.Timestamp type, internally referenced as `timestamp`.
709 Timestamp = 2,
710 /// Well-known protobuf.Duration type, internally referenced as `duration`.
711 Duration = 3,
712 }
713 impl WellKnownType {
714 /// String value of the enum field names used in the ProtoBuf definition.
715 ///
716 /// The values are not transformed in any way and thus are considered stable
717 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
718 pub fn as_str_name(&self) -> &'static str {
719 match self {
720 Self::Unspecified => "WELL_KNOWN_TYPE_UNSPECIFIED",
721 Self::Any => "ANY",
722 Self::Timestamp => "TIMESTAMP",
723 Self::Duration => "DURATION",
724 }
725 }
726 /// Creates an enum from field names used in the ProtoBuf definition.
727 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
728 match value {
729 "WELL_KNOWN_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
730 "ANY" => Some(Self::Any),
731 "TIMESTAMP" => Some(Self::Timestamp),
732 "DURATION" => Some(Self::Duration),
733 _ => None,
734 }
735 }
736 }
737 /// The kind of type.
738 #[derive(Clone, PartialEq, ::prost::Oneof)]
739 pub enum TypeKind {
740 /// Dynamic type.
741 #[prost(message, tag = "1")]
742 Dyn(super::super::super::super::protobuf::Empty),
743 /// Null value.
744 #[prost(
745 enumeration = "super::super::super::super::protobuf::NullValue",
746 tag = "2"
747 )]
748 Null(i32),
749 /// Primitive types: `true`, `1u`, `-2.0`, `'string'`, `b'bytes'`.
750 #[prost(enumeration = "PrimitiveType", tag = "3")]
751 Primitive(i32),
752 /// Wrapper of a primitive type, e.g. `google.protobuf.Int64Value`.
753 #[prost(enumeration = "PrimitiveType", tag = "4")]
754 Wrapper(i32),
755 /// Well-known protobuf type such as `google.protobuf.Timestamp`.
756 #[prost(enumeration = "WellKnownType", tag = "5")]
757 WellKnown(i32),
758 /// Parameterized list with elements of `list_type`, e.g. `list<timestamp>`.
759 #[prost(message, tag = "6")]
760 ListType(::prost::alloc::boxed::Box<ListType>),
761 /// Parameterized map with typed keys and values.
762 #[prost(message, tag = "7")]
763 MapType(::prost::alloc::boxed::Box<MapType>),
764 /// Function type.
765 #[prost(message, tag = "8")]
766 Function(::prost::alloc::boxed::Box<FunctionType>),
767 /// Protocol buffer message type.
768 ///
769 /// The `message_type` string specifies the qualified message type name. For
770 /// example, `google.plus.Profile`.
771 #[prost(string, tag = "9")]
772 MessageType(::prost::alloc::string::String),
773 /// Type param type.
774 ///
775 /// The `type_param` string specifies the type parameter name, e.g. `list<E>`
776 /// would be a `list_type` whose element type was a `type_param` type
777 /// named `E`.
778 #[prost(string, tag = "10")]
779 TypeParam(::prost::alloc::string::String),
780 /// Type type.
781 ///
782 /// The `type` value specifies the target type. e.g. int is type with a
783 /// target type of `Primitive.INT`.
784 #[prost(message, tag = "11")]
785 Type(::prost::alloc::boxed::Box<super::Type>),
786 /// Error type.
787 ///
788 /// During type-checking if an expression is an error, its type is propagated
789 /// as the `ERROR` type. This permits the type-checker to discover other
790 /// errors present in the expression.
791 #[prost(message, tag = "12")]
792 Error(super::super::super::super::protobuf::Empty),
793 /// Abstract, application defined type.
794 #[prost(message, tag = "14")]
795 AbstractType(AbstractType),
796 }
797}
798impl ::prost::Name for Type {
799 const NAME: &'static str = "Type";
800 const PACKAGE: &'static str = "google.api.expr.v1alpha1";
801 fn full_name() -> ::prost::alloc::string::String {
802 "google.api.expr.v1alpha1.Type".into()
803 }
804 fn type_url() -> ::prost::alloc::string::String {
805 "/google.api.expr.v1alpha1.Type".into()
806 }
807}
808/// Represents a declaration of a named value or function.
809///
810/// A declaration is part of the contract between the expression, the agent
811/// evaluating that expression, and the caller requesting evaluation.
812#[derive(Clone, PartialEq, ::prost::Message)]
813pub struct Decl {
814 /// The fully qualified name of the declaration.
815 ///
816 /// Declarations are organized in containers and this represents the full path
817 /// to the declaration in its container, as in `google.api.expr.Decl`.
818 ///
819 /// Declarations used as
820 /// [FunctionDecl.Overload][google.api.expr.v1alpha1.Decl.FunctionDecl.Overload]
821 /// parameters may or may not have a name depending on whether the overload is
822 /// function declaration or a function definition containing a result
823 /// [Expr][google.api.expr.v1alpha1.Expr].
824 #[prost(string, tag = "1")]
825 pub name: ::prost::alloc::string::String,
826 /// Required. The declaration kind.
827 #[prost(oneof = "decl::DeclKind", tags = "2, 3")]
828 pub decl_kind: ::core::option::Option<decl::DeclKind>,
829}
830/// Nested message and enum types in `Decl`.
831pub mod decl {
832 /// Identifier declaration which specifies its type and optional `Expr` value.
833 ///
834 /// An identifier without a value is a declaration that must be provided at
835 /// evaluation time. An identifier with a value should resolve to a constant,
836 /// but may be used in conjunction with other identifiers bound at evaluation
837 /// time.
838 #[derive(Clone, PartialEq, ::prost::Message)]
839 pub struct IdentDecl {
840 /// Required. The type of the identifier.
841 #[prost(message, optional, tag = "1")]
842 pub r#type: ::core::option::Option<super::Type>,
843 /// The constant value of the identifier. If not specified, the identifier
844 /// must be supplied at evaluation time.
845 #[prost(message, optional, tag = "2")]
846 pub value: ::core::option::Option<super::Constant>,
847 /// Documentation string for the identifier.
848 #[prost(string, tag = "3")]
849 pub doc: ::prost::alloc::string::String,
850 }
851 impl ::prost::Name for IdentDecl {
852 const NAME: &'static str = "IdentDecl";
853 const PACKAGE: &'static str = "google.api.expr.v1alpha1";
854 fn full_name() -> ::prost::alloc::string::String {
855 "google.api.expr.v1alpha1.Decl.IdentDecl".into()
856 }
857 fn type_url() -> ::prost::alloc::string::String {
858 "/google.api.expr.v1alpha1.Decl.IdentDecl".into()
859 }
860 }
861 /// Function declaration specifies one or more overloads which indicate the
862 /// function's parameter types and return type.
863 ///
864 /// Functions have no observable side-effects (there may be side-effects like
865 /// logging which are not observable from CEL).
866 #[derive(Clone, PartialEq, ::prost::Message)]
867 pub struct FunctionDecl {
868 /// Required. List of function overloads, must contain at least one overload.
869 #[prost(message, repeated, tag = "1")]
870 pub overloads: ::prost::alloc::vec::Vec<function_decl::Overload>,
871 }
872 /// Nested message and enum types in `FunctionDecl`.
873 pub mod function_decl {
874 /// An overload indicates a function's parameter types and return type, and
875 /// may optionally include a function body described in terms of
876 /// [Expr][google.api.expr.v1alpha1.Expr] values.
877 ///
878 /// Functions overloads are declared in either a function or method
879 /// call-style. For methods, the `params\[0\]` is the expected type of the
880 /// target receiver.
881 ///
882 /// Overloads must have non-overlapping argument types after erasure of all
883 /// parameterized type variables (similar as type erasure in Java).
884 #[derive(Clone, PartialEq, ::prost::Message)]
885 pub struct Overload {
886 /// Required. Globally unique overload name of the function which reflects
887 /// the function name and argument types.
888 ///
889 /// This will be used by a [Reference][google.api.expr.v1alpha1.Reference]
890 /// to indicate the `overload_id` that was resolved for the function
891 /// `name`.
892 #[prost(string, tag = "1")]
893 pub overload_id: ::prost::alloc::string::String,
894 /// List of function parameter [Type][google.api.expr.v1alpha1.Type]
895 /// values.
896 ///
897 /// Param types are disjoint after generic type parameters have been
898 /// replaced with the type `DYN`. Since the `DYN` type is compatible with
899 /// any other type, this means that if `A` is a type parameter, the
900 /// function types `int<A>` and `int<int>` are not disjoint. Likewise,
901 /// `map<string, string>` is not disjoint from `map<K, V>`.
902 ///
903 /// When the `result_type` of a function is a generic type param, the
904 /// type param name also appears as the `type` of on at least one params.
905 #[prost(message, repeated, tag = "2")]
906 pub params: ::prost::alloc::vec::Vec<super::super::Type>,
907 /// The type param names associated with the function declaration.
908 ///
909 /// For example, `function ex<K,V>(K key, map<K, V> map) : V` would yield
910 /// the type params of `K, V`.
911 #[prost(string, repeated, tag = "3")]
912 pub type_params: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
913 /// Required. The result type of the function. For example, the operator
914 /// `string.isEmpty()` would have `result_type` of `kind: BOOL`.
915 #[prost(message, optional, tag = "4")]
916 pub result_type: ::core::option::Option<super::super::Type>,
917 /// Whether the function is to be used in a method call-style `x.f(...)`
918 /// or a function call-style `f(x, ...)`.
919 ///
920 /// For methods, the first parameter declaration, `params\[0\]` is the
921 /// expected type of the target receiver.
922 #[prost(bool, tag = "5")]
923 pub is_instance_function: bool,
924 /// Documentation string for the overload.
925 #[prost(string, tag = "6")]
926 pub doc: ::prost::alloc::string::String,
927 }
928 impl ::prost::Name for Overload {
929 const NAME: &'static str = "Overload";
930 const PACKAGE: &'static str = "google.api.expr.v1alpha1";
931 fn full_name() -> ::prost::alloc::string::String {
932 "google.api.expr.v1alpha1.Decl.FunctionDecl.Overload".into()
933 }
934 fn type_url() -> ::prost::alloc::string::String {
935 "/google.api.expr.v1alpha1.Decl.FunctionDecl.Overload".into()
936 }
937 }
938 }
939 impl ::prost::Name for FunctionDecl {
940 const NAME: &'static str = "FunctionDecl";
941 const PACKAGE: &'static str = "google.api.expr.v1alpha1";
942 fn full_name() -> ::prost::alloc::string::String {
943 "google.api.expr.v1alpha1.Decl.FunctionDecl".into()
944 }
945 fn type_url() -> ::prost::alloc::string::String {
946 "/google.api.expr.v1alpha1.Decl.FunctionDecl".into()
947 }
948 }
949 /// Required. The declaration kind.
950 #[derive(Clone, PartialEq, ::prost::Oneof)]
951 pub enum DeclKind {
952 /// Identifier declaration.
953 #[prost(message, tag = "2")]
954 Ident(IdentDecl),
955 /// Function declaration.
956 #[prost(message, tag = "3")]
957 Function(FunctionDecl),
958 }
959}
960impl ::prost::Name for Decl {
961 const NAME: &'static str = "Decl";
962 const PACKAGE: &'static str = "google.api.expr.v1alpha1";
963 fn full_name() -> ::prost::alloc::string::String {
964 "google.api.expr.v1alpha1.Decl".into()
965 }
966 fn type_url() -> ::prost::alloc::string::String {
967 "/google.api.expr.v1alpha1.Decl".into()
968 }
969}
970/// Describes a resolved reference to a declaration.
971#[derive(Clone, PartialEq, ::prost::Message)]
972pub struct Reference {
973 /// The fully qualified name of the declaration.
974 #[prost(string, tag = "1")]
975 pub name: ::prost::alloc::string::String,
976 /// For references to functions, this is a list of `Overload.overload_id`
977 /// values which match according to typing rules.
978 ///
979 /// If the list has more than one element, overload resolution among the
980 /// presented candidates must happen at runtime because of dynamic types. The
981 /// type checker attempts to narrow down this list as much as possible.
982 ///
983 /// Empty if this is not a reference to a
984 /// [Decl.FunctionDecl][google.api.expr.v1alpha1.Decl.FunctionDecl].
985 #[prost(string, repeated, tag = "3")]
986 pub overload_id: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
987 /// For references to constants, this may contain the value of the
988 /// constant if known at compile time.
989 #[prost(message, optional, tag = "4")]
990 pub value: ::core::option::Option<Constant>,
991}
992impl ::prost::Name for Reference {
993 const NAME: &'static str = "Reference";
994 const PACKAGE: &'static str = "google.api.expr.v1alpha1";
995 fn full_name() -> ::prost::alloc::string::String {
996 "google.api.expr.v1alpha1.Reference".into()
997 }
998 fn type_url() -> ::prost::alloc::string::String {
999 "/google.api.expr.v1alpha1.Reference".into()
1000 }
1001}