Skip to content

Commit b58d958

Browse files
committed
feat(Type url): add type url with helper to pack any types
1 parent 729fcdf commit b58d958

File tree

308 files changed

+14026
-207
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

308 files changed

+14026
-207
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
**/target
22
**/.DS_Store
33
**/.vscode
4-
Cargo.lock
4+
**/.idea
5+
Cargo.lock

envoy-types/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ tonic = { version = "0.14", default-features = false, features = [
2323
"transport",
2424
] }
2525
tonic-prost = "0.14"
26+
prost-build = "0.14"
2627

2728
[dev-dependencies]
2829
glob = "0.3"

envoy-types/src/generated/cel.expr.rs

Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ pub struct ParsedExpr {
99
#[prost(message, optional, tag = "3")]
1010
pub source_info: ::core::option::Option<SourceInfo>,
1111
}
12+
impl ::prost::Name for ParsedExpr {
13+
const NAME: &'static str = "ParsedExpr";
14+
const PACKAGE: &'static str = "cel.expr";
15+
fn full_name() -> ::prost::alloc::string::String {
16+
"cel.expr.ParsedExpr".into()
17+
}
18+
fn type_url() -> ::prost::alloc::string::String {
19+
"type.googleapis.com/cel.expr.ParsedExpr".into()
20+
}
21+
}
1222
/// An abstract representation of a common expression.
1323
///
1424
/// Expressions are abstractly represented as a collection of identifiers,
@@ -50,6 +60,16 @@ pub mod expr {
5060
#[prost(string, tag = "1")]
5161
pub name: ::prost::alloc::string::String,
5262
}
63+
impl ::prost::Name for Ident {
64+
const NAME: &'static str = "Ident";
65+
const PACKAGE: &'static str = "cel.expr";
66+
fn full_name() -> ::prost::alloc::string::String {
67+
"cel.expr.Expr.Ident".into()
68+
}
69+
fn type_url() -> ::prost::alloc::string::String {
70+
"type.googleapis.com/cel.expr.Expr.Ident".into()
71+
}
72+
}
5373
/// A field selection expression. e.g. `request.auth`.
5474
#[derive(Clone, PartialEq, ::prost::Message)]
5575
pub struct Select {
@@ -71,6 +91,16 @@ pub mod expr {
7191
#[prost(bool, tag = "3")]
7292
pub test_only: bool,
7393
}
94+
impl ::prost::Name for Select {
95+
const NAME: &'static str = "Select";
96+
const PACKAGE: &'static str = "cel.expr";
97+
fn full_name() -> ::prost::alloc::string::String {
98+
"cel.expr.Expr.Select".into()
99+
}
100+
fn type_url() -> ::prost::alloc::string::String {
101+
"type.googleapis.com/cel.expr.Expr.Select".into()
102+
}
103+
}
74104
/// A call expression, including calls to predefined functions and operators.
75105
///
76106
/// For example, `value == 10`, `size(map_value)`.
@@ -87,6 +117,16 @@ pub mod expr {
87117
#[prost(message, repeated, tag = "3")]
88118
pub args: ::prost::alloc::vec::Vec<super::Expr>,
89119
}
120+
impl ::prost::Name for Call {
121+
const NAME: &'static str = "Call";
122+
const PACKAGE: &'static str = "cel.expr";
123+
fn full_name() -> ::prost::alloc::string::String {
124+
"cel.expr.Expr.Call".into()
125+
}
126+
fn type_url() -> ::prost::alloc::string::String {
127+
"type.googleapis.com/cel.expr.Expr.Call".into()
128+
}
129+
}
90130
/// A list creation expression.
91131
///
92132
/// Lists may either be homogenous, e.g. `\[1, 2, 3\]`, or heterogeneous, e.g.
@@ -105,6 +145,16 @@ pub mod expr {
105145
#[prost(int32, repeated, tag = "2")]
106146
pub optional_indices: ::prost::alloc::vec::Vec<i32>,
107147
}
148+
impl ::prost::Name for CreateList {
149+
const NAME: &'static str = "CreateList";
150+
const PACKAGE: &'static str = "cel.expr";
151+
fn full_name() -> ::prost::alloc::string::String {
152+
"cel.expr.Expr.CreateList".into()
153+
}
154+
fn type_url() -> ::prost::alloc::string::String {
155+
"type.googleapis.com/cel.expr.Expr.CreateList".into()
156+
}
157+
}
108158
/// A map or message creation expression.
109159
///
110160
/// Maps are constructed as `{'key_name': 'value'}`. Message construction is
@@ -157,6 +207,26 @@ pub mod expr {
157207
MapKey(super::super::super::Expr),
158208
}
159209
}
210+
impl ::prost::Name for Entry {
211+
const NAME: &'static str = "Entry";
212+
const PACKAGE: &'static str = "cel.expr";
213+
fn full_name() -> ::prost::alloc::string::String {
214+
"cel.expr.Expr.CreateStruct.Entry".into()
215+
}
216+
fn type_url() -> ::prost::alloc::string::String {
217+
"type.googleapis.com/cel.expr.Expr.CreateStruct.Entry".into()
218+
}
219+
}
220+
}
221+
impl ::prost::Name for CreateStruct {
222+
const NAME: &'static str = "CreateStruct";
223+
const PACKAGE: &'static str = "cel.expr";
224+
fn full_name() -> ::prost::alloc::string::String {
225+
"cel.expr.Expr.CreateStruct".into()
226+
}
227+
fn type_url() -> ::prost::alloc::string::String {
228+
"type.googleapis.com/cel.expr.Expr.CreateStruct".into()
229+
}
160230
}
161231
/// A comprehension expression applied to a list or map.
162232
///
@@ -252,6 +322,16 @@ pub mod expr {
252322
#[prost(message, optional, boxed, tag = "7")]
253323
pub result: ::core::option::Option<::prost::alloc::boxed::Box<super::Expr>>,
254324
}
325+
impl ::prost::Name for Comprehension {
326+
const NAME: &'static str = "Comprehension";
327+
const PACKAGE: &'static str = "cel.expr";
328+
fn full_name() -> ::prost::alloc::string::String {
329+
"cel.expr.Expr.Comprehension".into()
330+
}
331+
fn type_url() -> ::prost::alloc::string::String {
332+
"type.googleapis.com/cel.expr.Expr.Comprehension".into()
333+
}
334+
}
255335
/// Required. Variants of expressions.
256336
#[derive(Clone, PartialEq, ::prost::Oneof)]
257337
pub enum ExprKind {
@@ -278,6 +358,16 @@ pub mod expr {
278358
ComprehensionExpr(::prost::alloc::boxed::Box<Comprehension>),
279359
}
280360
}
361+
impl ::prost::Name for Expr {
362+
const NAME: &'static str = "Expr";
363+
const PACKAGE: &'static str = "cel.expr";
364+
fn full_name() -> ::prost::alloc::string::String {
365+
"cel.expr.Expr".into()
366+
}
367+
fn type_url() -> ::prost::alloc::string::String {
368+
"type.googleapis.com/cel.expr.Expr".into()
369+
}
370+
}
281371
/// Represents a primitive literal.
282372
///
283373
/// Named 'Constant' here for backwards compatibility.
@@ -339,6 +429,16 @@ pub mod constant {
339429
TimestampValue(super::super::super::google::protobuf::Timestamp),
340430
}
341431
}
432+
impl ::prost::Name for Constant {
433+
const NAME: &'static str = "Constant";
434+
const PACKAGE: &'static str = "cel.expr";
435+
fn full_name() -> ::prost::alloc::string::String {
436+
"cel.expr.Constant".into()
437+
}
438+
fn type_url() -> ::prost::alloc::string::String {
439+
"type.googleapis.com/cel.expr.Constant".into()
440+
}
441+
}
342442
/// Source information collected at parse time.
343443
#[derive(Clone, PartialEq, ::prost::Message)]
344444
pub struct SourceInfo {
@@ -417,6 +517,16 @@ pub mod source_info {
417517
#[prost(int64, tag = "2")]
418518
pub minor: i64,
419519
}
520+
impl ::prost::Name for Version {
521+
const NAME: &'static str = "Version";
522+
const PACKAGE: &'static str = "cel.expr";
523+
fn full_name() -> ::prost::alloc::string::String {
524+
"cel.expr.SourceInfo.Extension.Version".into()
525+
}
526+
fn type_url() -> ::prost::alloc::string::String {
527+
"type.googleapis.com/cel.expr.SourceInfo.Extension.Version".into()
528+
}
529+
}
420530
/// CEL component specifier.
421531
#[derive(
422532
Clone,
@@ -467,6 +577,26 @@ pub mod source_info {
467577
}
468578
}
469579
}
580+
impl ::prost::Name for Extension {
581+
const NAME: &'static str = "Extension";
582+
const PACKAGE: &'static str = "cel.expr";
583+
fn full_name() -> ::prost::alloc::string::String {
584+
"cel.expr.SourceInfo.Extension".into()
585+
}
586+
fn type_url() -> ::prost::alloc::string::String {
587+
"type.googleapis.com/cel.expr.SourceInfo.Extension".into()
588+
}
589+
}
590+
}
591+
impl ::prost::Name for SourceInfo {
592+
const NAME: &'static str = "SourceInfo";
593+
const PACKAGE: &'static str = "cel.expr";
594+
fn full_name() -> ::prost::alloc::string::String {
595+
"cel.expr.SourceInfo".into()
596+
}
597+
fn type_url() -> ::prost::alloc::string::String {
598+
"type.googleapis.com/cel.expr.SourceInfo".into()
599+
}
470600
}
471601
/// A CEL expression which has been successfully type checked.
472602
#[derive(Clone, PartialEq, ::prost::Message)]
@@ -513,6 +643,16 @@ pub struct CheckedExpr {
513643
#[prost(message, optional, tag = "4")]
514644
pub expr: ::core::option::Option<Expr>,
515645
}
646+
impl ::prost::Name for CheckedExpr {
647+
const NAME: &'static str = "CheckedExpr";
648+
const PACKAGE: &'static str = "cel.expr";
649+
fn full_name() -> ::prost::alloc::string::String {
650+
"cel.expr.CheckedExpr".into()
651+
}
652+
fn type_url() -> ::prost::alloc::string::String {
653+
"type.googleapis.com/cel.expr.CheckedExpr".into()
654+
}
655+
}
516656
/// Represents a CEL type.
517657
#[derive(Clone, PartialEq, ::prost::Message)]
518658
pub struct Type {
@@ -532,6 +672,16 @@ pub mod r#type {
532672
#[prost(message, optional, boxed, tag = "1")]
533673
pub elem_type: ::core::option::Option<::prost::alloc::boxed::Box<super::Type>>,
534674
}
675+
impl ::prost::Name for ListType {
676+
const NAME: &'static str = "ListType";
677+
const PACKAGE: &'static str = "cel.expr";
678+
fn full_name() -> ::prost::alloc::string::String {
679+
"cel.expr.Type.ListType".into()
680+
}
681+
fn type_url() -> ::prost::alloc::string::String {
682+
"type.googleapis.com/cel.expr.Type.ListType".into()
683+
}
684+
}
535685
/// Map type with parameterized key and value types, e.g. `map<string, int>`.
536686
#[derive(Clone, PartialEq, ::prost::Message)]
537687
pub struct MapType {
@@ -542,6 +692,16 @@ pub mod r#type {
542692
#[prost(message, optional, boxed, tag = "2")]
543693
pub value_type: ::core::option::Option<::prost::alloc::boxed::Box<super::Type>>,
544694
}
695+
impl ::prost::Name for MapType {
696+
const NAME: &'static str = "MapType";
697+
const PACKAGE: &'static str = "cel.expr";
698+
fn full_name() -> ::prost::alloc::string::String {
699+
"cel.expr.Type.MapType".into()
700+
}
701+
fn type_url() -> ::prost::alloc::string::String {
702+
"type.googleapis.com/cel.expr.Type.MapType".into()
703+
}
704+
}
545705
/// Function type with result and arg types.
546706
#[derive(Clone, PartialEq, ::prost::Message)]
547707
pub struct FunctionType {
@@ -552,6 +712,16 @@ pub mod r#type {
552712
#[prost(message, repeated, tag = "2")]
553713
pub arg_types: ::prost::alloc::vec::Vec<super::Type>,
554714
}
715+
impl ::prost::Name for FunctionType {
716+
const NAME: &'static str = "FunctionType";
717+
const PACKAGE: &'static str = "cel.expr";
718+
fn full_name() -> ::prost::alloc::string::String {
719+
"cel.expr.Type.FunctionType".into()
720+
}
721+
fn type_url() -> ::prost::alloc::string::String {
722+
"type.googleapis.com/cel.expr.Type.FunctionType".into()
723+
}
724+
}
555725
/// Application defined abstract type.
556726
#[derive(Clone, PartialEq, ::prost::Message)]
557727
pub struct AbstractType {
@@ -562,6 +732,16 @@ pub mod r#type {
562732
#[prost(message, repeated, tag = "2")]
563733
pub parameter_types: ::prost::alloc::vec::Vec<super::Type>,
564734
}
735+
impl ::prost::Name for AbstractType {
736+
const NAME: &'static str = "AbstractType";
737+
const PACKAGE: &'static str = "cel.expr";
738+
fn full_name() -> ::prost::alloc::string::String {
739+
"cel.expr.Type.AbstractType".into()
740+
}
741+
fn type_url() -> ::prost::alloc::string::String {
742+
"type.googleapis.com/cel.expr.Type.AbstractType".into()
743+
}
744+
}
565745
/// CEL primitive types.
566746
#[derive(
567747
Clone,
@@ -742,6 +922,16 @@ pub mod r#type {
742922
AbstractType(AbstractType),
743923
}
744924
}
925+
impl ::prost::Name for Type {
926+
const NAME: &'static str = "Type";
927+
const PACKAGE: &'static str = "cel.expr";
928+
fn full_name() -> ::prost::alloc::string::String {
929+
"cel.expr.Type".into()
930+
}
931+
fn type_url() -> ::prost::alloc::string::String {
932+
"type.googleapis.com/cel.expr.Type".into()
933+
}
934+
}
745935
/// Represents a declaration of a named value or function.
746936
///
747937
/// A declaration is part of the contract between the expression, the agent
@@ -801,6 +991,16 @@ pub mod decl {
801991
#[prost(string, tag = "3")]
802992
pub doc: ::prost::alloc::string::String,
803993
}
994+
impl ::prost::Name for IdentDecl {
995+
const NAME: &'static str = "IdentDecl";
996+
const PACKAGE: &'static str = "cel.expr";
997+
fn full_name() -> ::prost::alloc::string::String {
998+
"cel.expr.Decl.IdentDecl".into()
999+
}
1000+
fn type_url() -> ::prost::alloc::string::String {
1001+
"type.googleapis.com/cel.expr.Decl.IdentDecl".into()
1002+
}
1003+
}
8041004
/// Function declaration specifies one or more overloads which indicate the
8051005
/// function's parameter types and return type.
8061006
///
@@ -904,6 +1104,26 @@ pub mod decl {
9041104
#[prost(string, tag = "6")]
9051105
pub doc: ::prost::alloc::string::String,
9061106
}
1107+
impl ::prost::Name for Overload {
1108+
const NAME: &'static str = "Overload";
1109+
const PACKAGE: &'static str = "cel.expr";
1110+
fn full_name() -> ::prost::alloc::string::String {
1111+
"cel.expr.Decl.FunctionDecl.Overload".into()
1112+
}
1113+
fn type_url() -> ::prost::alloc::string::String {
1114+
"type.googleapis.com/cel.expr.Decl.FunctionDecl.Overload".into()
1115+
}
1116+
}
1117+
}
1118+
impl ::prost::Name for FunctionDecl {
1119+
const NAME: &'static str = "FunctionDecl";
1120+
const PACKAGE: &'static str = "cel.expr";
1121+
fn full_name() -> ::prost::alloc::string::String {
1122+
"cel.expr.Decl.FunctionDecl".into()
1123+
}
1124+
fn type_url() -> ::prost::alloc::string::String {
1125+
"type.googleapis.com/cel.expr.Decl.FunctionDecl".into()
1126+
}
9071127
}
9081128
/// Required. The declaration kind.
9091129
#[derive(Clone, PartialEq, ::prost::Oneof)]
@@ -916,6 +1136,16 @@ pub mod decl {
9161136
Function(FunctionDecl),
9171137
}
9181138
}
1139+
impl ::prost::Name for Decl {
1140+
const NAME: &'static str = "Decl";
1141+
const PACKAGE: &'static str = "cel.expr";
1142+
fn full_name() -> ::prost::alloc::string::String {
1143+
"cel.expr.Decl".into()
1144+
}
1145+
fn type_url() -> ::prost::alloc::string::String {
1146+
"type.googleapis.com/cel.expr.Decl".into()
1147+
}
1148+
}
9191149
/// Describes a resolved reference to a declaration.
9201150
#[derive(Clone, PartialEq, ::prost::Message)]
9211151
pub struct Reference {
@@ -938,3 +1168,13 @@ pub struct Reference {
9381168
#[prost(message, optional, tag = "4")]
9391169
pub value: ::core::option::Option<Constant>,
9401170
}
1171+
impl ::prost::Name for Reference {
1172+
const NAME: &'static str = "Reference";
1173+
const PACKAGE: &'static str = "cel.expr";
1174+
fn full_name() -> ::prost::alloc::string::String {
1175+
"cel.expr.Reference".into()
1176+
}
1177+
fn type_url() -> ::prost::alloc::string::String {
1178+
"type.googleapis.com/cel.expr.Reference".into()
1179+
}
1180+
}

0 commit comments

Comments
 (0)