quilkin_proto/generated/envoy/service/discovery/
v3.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct DiscoveryRequest {
4    #[prost(string, tag = "1")]
5    pub version_info: ::prost::alloc::string::String,
6    #[prost(message, optional, tag = "2")]
7    pub node: ::core::option::Option<super::super::super::config::core::v3::Node>,
8    #[prost(string, repeated, tag = "3")]
9    pub resource_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
10    #[prost(string, tag = "4")]
11    pub type_url: ::prost::alloc::string::String,
12    #[prost(string, tag = "5")]
13    pub response_nonce: ::prost::alloc::string::String,
14    #[prost(message, optional, tag = "6")]
15    pub error_detail: ::core::option::Option<super::super::super::super::google::rpc::Status>,
16}
17#[derive(Clone, PartialEq, ::prost::Message)]
18pub struct DiscoveryResponse {
19    #[prost(string, tag = "1")]
20    pub version_info: ::prost::alloc::string::String,
21    #[prost(message, repeated, tag = "2")]
22    pub resources: ::prost::alloc::vec::Vec<::prost_types::Any>,
23    #[prost(bool, tag = "3")]
24    pub canary: bool,
25    #[prost(string, tag = "4")]
26    pub type_url: ::prost::alloc::string::String,
27    #[prost(string, tag = "5")]
28    pub nonce: ::prost::alloc::string::String,
29    #[prost(message, optional, tag = "6")]
30    pub control_plane: ::core::option::Option<super::super::super::config::core::v3::ControlPlane>,
31}
32#[derive(Clone, PartialEq, ::prost::Message)]
33pub struct DeltaDiscoveryRequest {
34    #[prost(message, optional, tag = "1")]
35    pub node: ::core::option::Option<super::super::super::config::core::v3::Node>,
36    #[prost(string, tag = "2")]
37    pub type_url: ::prost::alloc::string::String,
38    #[prost(string, repeated, tag = "3")]
39    pub resource_names_subscribe: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
40    #[prost(string, repeated, tag = "4")]
41    pub resource_names_unsubscribe: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
42    #[prost(map = "string, string", tag = "5")]
43    pub initial_resource_versions:
44        ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
45    #[prost(string, tag = "6")]
46    pub response_nonce: ::prost::alloc::string::String,
47    #[prost(message, optional, tag = "7")]
48    pub error_detail: ::core::option::Option<super::super::super::super::google::rpc::Status>,
49}
50#[derive(Clone, PartialEq, ::prost::Message)]
51pub struct DeltaDiscoveryResponse {
52    #[prost(string, tag = "1")]
53    pub system_version_info: ::prost::alloc::string::String,
54    #[prost(message, repeated, tag = "2")]
55    pub resources: ::prost::alloc::vec::Vec<Resource>,
56    #[prost(string, tag = "4")]
57    pub type_url: ::prost::alloc::string::String,
58    #[prost(string, repeated, tag = "6")]
59    pub removed_resources: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
60    #[prost(string, tag = "5")]
61    pub nonce: ::prost::alloc::string::String,
62    #[prost(message, optional, tag = "7")]
63    pub control_plane: ::core::option::Option<super::super::super::config::core::v3::ControlPlane>,
64}
65#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
66pub struct Resource {
67    #[prost(string, tag = "3")]
68    pub name: ::prost::alloc::string::String,
69    #[prost(string, repeated, tag = "4")]
70    pub aliases: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
71    #[prost(string, tag = "1")]
72    pub version: ::prost::alloc::string::String,
73    #[prost(message, optional, tag = "2")]
74    pub resource: ::core::option::Option<::prost_types::Any>,
75    #[prost(message, optional, tag = "6")]
76    pub ttl: ::core::option::Option<::prost_types::Duration>,
77    #[prost(message, optional, tag = "7")]
78    pub cache_control: ::core::option::Option<resource::CacheControl>,
79}
80/// Nested message and enum types in `Resource`.
81pub mod resource {
82    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
83    pub struct CacheControl {
84        #[prost(bool, tag = "1")]
85        pub do_not_cache: bool,
86    }
87}
88#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
89pub struct AdsDummy {}
90/// Generated client implementations.
91pub mod aggregated_discovery_service_client {
92    #![allow(
93        unused_variables,
94        dead_code,
95        missing_docs,
96        clippy::wildcard_imports,
97        clippy::let_unit_value
98    )]
99    use tonic::codegen::http::Uri;
100    use tonic::codegen::*;
101    /// See https://github.com/envoyproxy/envoy-api#apis for a description of the
102    /// role of ADS and how it is intended to be used by a management server. ADS
103    /// requests have the same structure as their singleton xDS counterparts, but can
104    /// multiplex many resource types on a single stream. The type_url in the
105    /// DiscoveryRequest/DiscoveryResponse provides sufficient information to recover
106    /// the multiplexed singleton APIs at the Envoy instance and management server.
107    #[derive(Debug, Clone)]
108    pub struct AggregatedDiscoveryServiceClient<T> {
109        inner: tonic::client::Grpc<T>,
110    }
111    impl AggregatedDiscoveryServiceClient<tonic::transport::Channel> {
112        /// Attempt to create a new client by connecting to a given endpoint.
113        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
114        where
115            D: TryInto<tonic::transport::Endpoint>,
116            D::Error: Into<StdError>,
117        {
118            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
119            Ok(Self::new(conn))
120        }
121    }
122    impl<T> AggregatedDiscoveryServiceClient<T>
123    where
124        T: tonic::client::GrpcService<tonic::body::Body>,
125        T::Error: Into<StdError>,
126        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
127        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
128    {
129        pub fn new(inner: T) -> Self {
130            let inner = tonic::client::Grpc::new(inner);
131            Self { inner }
132        }
133        pub fn with_origin(inner: T, origin: Uri) -> Self {
134            let inner = tonic::client::Grpc::with_origin(inner, origin);
135            Self { inner }
136        }
137        pub fn with_interceptor<F>(
138            inner: T,
139            interceptor: F,
140        ) -> AggregatedDiscoveryServiceClient<InterceptedService<T, F>>
141        where
142            F: tonic::service::Interceptor,
143            T::ResponseBody: Default,
144            T: tonic::codegen::Service<
145                    http::Request<tonic::body::Body>,
146                    Response = http::Response<
147                        <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
148                    >,
149                >,
150            <T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
151                Into<StdError> + std::marker::Send + std::marker::Sync,
152        {
153            AggregatedDiscoveryServiceClient::new(InterceptedService::new(inner, interceptor))
154        }
155        /// Compress requests with the given encoding.
156        ///
157        /// This requires the server to support it otherwise it might respond with an
158        /// error.
159        #[must_use]
160        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
161            self.inner = self.inner.send_compressed(encoding);
162            self
163        }
164        /// Enable decompressing responses.
165        #[must_use]
166        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
167            self.inner = self.inner.accept_compressed(encoding);
168            self
169        }
170        /// Limits the maximum size of a decoded message.
171        ///
172        /// Default: `4MB`
173        #[must_use]
174        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
175            self.inner = self.inner.max_decoding_message_size(limit);
176            self
177        }
178        /// Limits the maximum size of an encoded message.
179        ///
180        /// Default: `usize::MAX`
181        #[must_use]
182        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
183            self.inner = self.inner.max_encoding_message_size(limit);
184            self
185        }
186        /// This is a gRPC-only API.
187        pub async fn stream_aggregated_resources(
188            &mut self,
189            request: impl tonic::IntoStreamingRequest<Message = super::DiscoveryRequest>,
190        ) -> std::result::Result<
191            tonic::Response<tonic::codec::Streaming<super::DiscoveryResponse>>,
192            tonic::Status,
193        > {
194            self.inner.ready().await.map_err(|e| {
195                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
196            })?;
197            let codec = tonic_prost::ProstCodec::default();
198            let path = http::uri::PathAndQuery::from_static(
199                "/envoy.service.discovery.v3.AggregatedDiscoveryService/StreamAggregatedResources",
200            );
201            let mut req = request.into_streaming_request();
202            req.extensions_mut().insert(GrpcMethod::new(
203                "envoy.service.discovery.v3.AggregatedDiscoveryService",
204                "StreamAggregatedResources",
205            ));
206            self.inner.streaming(req, path, codec).await
207        }
208        pub async fn delta_aggregated_resources(
209            &mut self,
210            request: impl tonic::IntoStreamingRequest<Message = super::DeltaDiscoveryRequest>,
211        ) -> std::result::Result<
212            tonic::Response<tonic::codec::Streaming<super::DeltaDiscoveryResponse>>,
213            tonic::Status,
214        > {
215            self.inner.ready().await.map_err(|e| {
216                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
217            })?;
218            let codec = tonic_prost::ProstCodec::default();
219            let path = http::uri::PathAndQuery::from_static(
220                "/envoy.service.discovery.v3.AggregatedDiscoveryService/DeltaAggregatedResources",
221            );
222            let mut req = request.into_streaming_request();
223            req.extensions_mut().insert(GrpcMethod::new(
224                "envoy.service.discovery.v3.AggregatedDiscoveryService",
225                "DeltaAggregatedResources",
226            ));
227            self.inner.streaming(req, path, codec).await
228        }
229    }
230}
231/// Generated server implementations.
232pub mod aggregated_discovery_service_server {
233    #![allow(
234        unused_variables,
235        dead_code,
236        missing_docs,
237        clippy::wildcard_imports,
238        clippy::let_unit_value
239    )]
240    use tonic::codegen::*;
241    /// Generated trait containing gRPC methods that should be implemented for use with AggregatedDiscoveryServiceServer.
242    #[async_trait]
243    pub trait AggregatedDiscoveryService: std::marker::Send + std::marker::Sync + 'static {
244        /// Server streaming response type for the StreamAggregatedResources method.
245        type StreamAggregatedResourcesStream: tonic::codegen::tokio_stream::Stream<
246                Item = std::result::Result<super::DiscoveryResponse, tonic::Status>,
247            > + std::marker::Send
248            + 'static;
249        /// This is a gRPC-only API.
250        async fn stream_aggregated_resources(
251            &self,
252            request: tonic::Request<tonic::Streaming<super::DiscoveryRequest>>,
253        ) -> std::result::Result<
254            tonic::Response<Self::StreamAggregatedResourcesStream>,
255            tonic::Status,
256        >;
257        /// Server streaming response type for the DeltaAggregatedResources method.
258        type DeltaAggregatedResourcesStream: tonic::codegen::tokio_stream::Stream<
259                Item = std::result::Result<super::DeltaDiscoveryResponse, tonic::Status>,
260            > + std::marker::Send
261            + 'static;
262        async fn delta_aggregated_resources(
263            &self,
264            request: tonic::Request<tonic::Streaming<super::DeltaDiscoveryRequest>>,
265        ) -> std::result::Result<tonic::Response<Self::DeltaAggregatedResourcesStream>, tonic::Status>;
266    }
267    /// See https://github.com/envoyproxy/envoy-api#apis for a description of the
268    /// role of ADS and how it is intended to be used by a management server. ADS
269    /// requests have the same structure as their singleton xDS counterparts, but can
270    /// multiplex many resource types on a single stream. The type_url in the
271    /// DiscoveryRequest/DiscoveryResponse provides sufficient information to recover
272    /// the multiplexed singleton APIs at the Envoy instance and management server.
273    #[derive(Debug)]
274    pub struct AggregatedDiscoveryServiceServer<T> {
275        inner: Arc<T>,
276        accept_compression_encodings: EnabledCompressionEncodings,
277        send_compression_encodings: EnabledCompressionEncodings,
278        max_decoding_message_size: Option<usize>,
279        max_encoding_message_size: Option<usize>,
280    }
281    impl<T> AggregatedDiscoveryServiceServer<T> {
282        pub fn new(inner: T) -> Self {
283            Self::from_arc(Arc::new(inner))
284        }
285        pub fn from_arc(inner: Arc<T>) -> Self {
286            Self {
287                inner,
288                accept_compression_encodings: Default::default(),
289                send_compression_encodings: Default::default(),
290                max_decoding_message_size: None,
291                max_encoding_message_size: None,
292            }
293        }
294        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
295        where
296            F: tonic::service::Interceptor,
297        {
298            InterceptedService::new(Self::new(inner), interceptor)
299        }
300        /// Enable decompressing requests with the given encoding.
301        #[must_use]
302        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
303            self.accept_compression_encodings.enable(encoding);
304            self
305        }
306        /// Compress responses with the given encoding, if the client supports it.
307        #[must_use]
308        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
309            self.send_compression_encodings.enable(encoding);
310            self
311        }
312        /// Limits the maximum size of a decoded message.
313        ///
314        /// Default: `4MB`
315        #[must_use]
316        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
317            self.max_decoding_message_size = Some(limit);
318            self
319        }
320        /// Limits the maximum size of an encoded message.
321        ///
322        /// Default: `usize::MAX`
323        #[must_use]
324        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
325            self.max_encoding_message_size = Some(limit);
326            self
327        }
328    }
329    impl<T, B> tonic::codegen::Service<http::Request<B>> for AggregatedDiscoveryServiceServer<T>
330    where
331        T: AggregatedDiscoveryService,
332        B: Body + std::marker::Send + 'static,
333        B::Error: Into<StdError> + std::marker::Send + 'static,
334    {
335        type Response = http::Response<tonic::body::Body>;
336        type Error = std::convert::Infallible;
337        type Future = BoxFuture<Self::Response, Self::Error>;
338        fn poll_ready(
339            &mut self,
340            _cx: &mut Context<'_>,
341        ) -> Poll<std::result::Result<(), Self::Error>> {
342            Poll::Ready(Ok(()))
343        }
344        fn call(&mut self, req: http::Request<B>) -> Self::Future {
345            match req.uri().path() {
346                "/envoy.service.discovery.v3.AggregatedDiscoveryService/StreamAggregatedResources" =>
347                {
348                    #[allow(non_camel_case_types)]
349                    struct StreamAggregatedResourcesSvc<T: AggregatedDiscoveryService>(pub Arc<T>);
350                    impl<T: AggregatedDiscoveryService>
351                        tonic::server::StreamingService<super::DiscoveryRequest>
352                        for StreamAggregatedResourcesSvc<T>
353                    {
354                        type Response = super::DiscoveryResponse;
355                        type ResponseStream = T::StreamAggregatedResourcesStream;
356                        type Future =
357                            BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
358                        fn call(
359                            &mut self,
360                            request: tonic::Request<tonic::Streaming<super::DiscoveryRequest>>,
361                        ) -> Self::Future {
362                            let inner = Arc::clone(&self.0);
363                            let fut = async move {
364                                <T as AggregatedDiscoveryService>::stream_aggregated_resources(
365                                    &inner, request,
366                                )
367                                .await
368                            };
369                            Box::pin(fut)
370                        }
371                    }
372                    let accept_compression_encodings = self.accept_compression_encodings;
373                    let send_compression_encodings = self.send_compression_encodings;
374                    let max_decoding_message_size = self.max_decoding_message_size;
375                    let max_encoding_message_size = self.max_encoding_message_size;
376                    let inner = self.inner.clone();
377                    let fut = async move {
378                        let method = StreamAggregatedResourcesSvc(inner);
379                        let codec = tonic_prost::ProstCodec::default();
380                        let mut grpc = tonic::server::Grpc::new(codec)
381                            .apply_compression_config(
382                                accept_compression_encodings,
383                                send_compression_encodings,
384                            )
385                            .apply_max_message_size_config(
386                                max_decoding_message_size,
387                                max_encoding_message_size,
388                            );
389                        let res = grpc.streaming(method, req).await;
390                        Ok(res)
391                    };
392                    Box::pin(fut)
393                }
394                "/envoy.service.discovery.v3.AggregatedDiscoveryService/DeltaAggregatedResources" =>
395                {
396                    #[allow(non_camel_case_types)]
397                    struct DeltaAggregatedResourcesSvc<T: AggregatedDiscoveryService>(pub Arc<T>);
398                    impl<T: AggregatedDiscoveryService>
399                        tonic::server::StreamingService<super::DeltaDiscoveryRequest>
400                        for DeltaAggregatedResourcesSvc<T>
401                    {
402                        type Response = super::DeltaDiscoveryResponse;
403                        type ResponseStream = T::DeltaAggregatedResourcesStream;
404                        type Future =
405                            BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
406                        fn call(
407                            &mut self,
408                            request: tonic::Request<tonic::Streaming<super::DeltaDiscoveryRequest>>,
409                        ) -> Self::Future {
410                            let inner = Arc::clone(&self.0);
411                            let fut = async move {
412                                <T as AggregatedDiscoveryService>::delta_aggregated_resources(
413                                    &inner, request,
414                                )
415                                .await
416                            };
417                            Box::pin(fut)
418                        }
419                    }
420                    let accept_compression_encodings = self.accept_compression_encodings;
421                    let send_compression_encodings = self.send_compression_encodings;
422                    let max_decoding_message_size = self.max_decoding_message_size;
423                    let max_encoding_message_size = self.max_encoding_message_size;
424                    let inner = self.inner.clone();
425                    let fut = async move {
426                        let method = DeltaAggregatedResourcesSvc(inner);
427                        let codec = tonic_prost::ProstCodec::default();
428                        let mut grpc = tonic::server::Grpc::new(codec)
429                            .apply_compression_config(
430                                accept_compression_encodings,
431                                send_compression_encodings,
432                            )
433                            .apply_max_message_size_config(
434                                max_decoding_message_size,
435                                max_encoding_message_size,
436                            );
437                        let res = grpc.streaming(method, req).await;
438                        Ok(res)
439                    };
440                    Box::pin(fut)
441                }
442                _ => Box::pin(async move {
443                    let mut response = http::Response::new(tonic::body::Body::default());
444                    let headers = response.headers_mut();
445                    headers.insert(
446                        tonic::Status::GRPC_STATUS,
447                        (tonic::Code::Unimplemented as i32).into(),
448                    );
449                    headers.insert(
450                        http::header::CONTENT_TYPE,
451                        tonic::metadata::GRPC_CONTENT_TYPE,
452                    );
453                    Ok(response)
454                }),
455            }
456        }
457    }
458    impl<T> Clone for AggregatedDiscoveryServiceServer<T> {
459        fn clone(&self) -> Self {
460            let inner = self.inner.clone();
461            Self {
462                inner,
463                accept_compression_encodings: self.accept_compression_encodings,
464                send_compression_encodings: self.send_compression_encodings,
465                max_decoding_message_size: self.max_decoding_message_size,
466                max_encoding_message_size: self.max_encoding_message_size,
467            }
468        }
469    }
470    /// Generated gRPC service name
471    pub const SERVICE_NAME: &str = "envoy.service.discovery.v3.AggregatedDiscoveryService";
472    impl<T> tonic::server::NamedService for AggregatedDiscoveryServiceServer<T> {
473        const NAME: &'static str = SERVICE_NAME;
474    }
475}