xds_api/generated/
envoy.service.runtime.v3.rs

1// This file is @generated by prost-build.
2/// \[#not-implemented-hide:\] Not configuration. Workaround c++ protobuf issue with importing
3/// services: <https://github.com/google/protobuf/issues/4221>
4#[derive(Clone, Copy, PartialEq, ::prost::Message)]
5pub struct RtdsDummy {}
6impl ::prost::Name for RtdsDummy {
7    const NAME: &'static str = "RtdsDummy";
8    const PACKAGE: &'static str = "envoy.service.runtime.v3";
9    fn full_name() -> ::prost::alloc::string::String {
10        "envoy.service.runtime.v3.RtdsDummy".into()
11    }
12    fn type_url() -> ::prost::alloc::string::String {
13        "type.googleapis.com/envoy.service.runtime.v3.RtdsDummy".into()
14    }
15}
16/// RTDS resource type. This describes a layer in the runtime virtual filesystem.
17#[derive(Clone, PartialEq, ::prost::Message)]
18pub struct Runtime {
19    /// Runtime resource name. This makes the Runtime a self-describing xDS
20    /// resource.
21    #[prost(string, tag = "1")]
22    pub name: ::prost::alloc::string::String,
23    #[prost(message, optional, tag = "2")]
24    pub layer: ::core::option::Option<
25        super::super::super::super::google::protobuf::Struct,
26    >,
27}
28impl ::prost::Name for Runtime {
29    const NAME: &'static str = "Runtime";
30    const PACKAGE: &'static str = "envoy.service.runtime.v3";
31    fn full_name() -> ::prost::alloc::string::String {
32        "envoy.service.runtime.v3.Runtime".into()
33    }
34    fn type_url() -> ::prost::alloc::string::String {
35        "type.googleapis.com/envoy.service.runtime.v3.Runtime".into()
36    }
37}
38/// Generated client implementations.
39pub mod runtime_discovery_service_client {
40    #![allow(
41        unused_variables,
42        dead_code,
43        missing_docs,
44        clippy::wildcard_imports,
45        clippy::let_unit_value,
46    )]
47    use tonic::codegen::*;
48    use tonic::codegen::http::Uri;
49    /// Discovery service for Runtime resources.
50    #[derive(Debug, Clone)]
51    pub struct RuntimeDiscoveryServiceClient<T> {
52        inner: tonic::client::Grpc<T>,
53    }
54    impl<T> RuntimeDiscoveryServiceClient<T>
55    where
56        T: tonic::client::GrpcService<tonic::body::BoxBody>,
57        T::Error: Into<StdError>,
58        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
59        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
60    {
61        pub fn new(inner: T) -> Self {
62            let inner = tonic::client::Grpc::new(inner);
63            Self { inner }
64        }
65        pub fn with_origin(inner: T, origin: Uri) -> Self {
66            let inner = tonic::client::Grpc::with_origin(inner, origin);
67            Self { inner }
68        }
69        pub fn with_interceptor<F>(
70            inner: T,
71            interceptor: F,
72        ) -> RuntimeDiscoveryServiceClient<InterceptedService<T, F>>
73        where
74            F: tonic::service::Interceptor,
75            T::ResponseBody: Default,
76            T: tonic::codegen::Service<
77                http::Request<tonic::body::BoxBody>,
78                Response = http::Response<
79                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
80                >,
81            >,
82            <T as tonic::codegen::Service<
83                http::Request<tonic::body::BoxBody>,
84            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
85        {
86            RuntimeDiscoveryServiceClient::new(
87                InterceptedService::new(inner, interceptor),
88            )
89        }
90        /// Compress requests with the given encoding.
91        ///
92        /// This requires the server to support it otherwise it might respond with an
93        /// error.
94        #[must_use]
95        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
96            self.inner = self.inner.send_compressed(encoding);
97            self
98        }
99        /// Enable decompressing responses.
100        #[must_use]
101        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
102            self.inner = self.inner.accept_compressed(encoding);
103            self
104        }
105        /// Limits the maximum size of a decoded message.
106        ///
107        /// Default: `4MB`
108        #[must_use]
109        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
110            self.inner = self.inner.max_decoding_message_size(limit);
111            self
112        }
113        /// Limits the maximum size of an encoded message.
114        ///
115        /// Default: `usize::MAX`
116        #[must_use]
117        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
118            self.inner = self.inner.max_encoding_message_size(limit);
119            self
120        }
121        pub async fn stream_runtime(
122            &mut self,
123            request: impl tonic::IntoStreamingRequest<
124                Message = super::super::super::discovery::v3::DiscoveryRequest,
125            >,
126        ) -> std::result::Result<
127            tonic::Response<
128                tonic::codec::Streaming<
129                    super::super::super::discovery::v3::DiscoveryResponse,
130                >,
131            >,
132            tonic::Status,
133        > {
134            self.inner
135                .ready()
136                .await
137                .map_err(|e| {
138                    tonic::Status::unknown(
139                        format!("Service was not ready: {}", e.into()),
140                    )
141                })?;
142            let codec = tonic::codec::ProstCodec::default();
143            let path = http::uri::PathAndQuery::from_static(
144                "/envoy.service.runtime.v3.RuntimeDiscoveryService/StreamRuntime",
145            );
146            let mut req = request.into_streaming_request();
147            req.extensions_mut()
148                .insert(
149                    GrpcMethod::new(
150                        "envoy.service.runtime.v3.RuntimeDiscoveryService",
151                        "StreamRuntime",
152                    ),
153                );
154            self.inner.streaming(req, path, codec).await
155        }
156        pub async fn delta_runtime(
157            &mut self,
158            request: impl tonic::IntoStreamingRequest<
159                Message = super::super::super::discovery::v3::DeltaDiscoveryRequest,
160            >,
161        ) -> std::result::Result<
162            tonic::Response<
163                tonic::codec::Streaming<
164                    super::super::super::discovery::v3::DeltaDiscoveryResponse,
165                >,
166            >,
167            tonic::Status,
168        > {
169            self.inner
170                .ready()
171                .await
172                .map_err(|e| {
173                    tonic::Status::unknown(
174                        format!("Service was not ready: {}", e.into()),
175                    )
176                })?;
177            let codec = tonic::codec::ProstCodec::default();
178            let path = http::uri::PathAndQuery::from_static(
179                "/envoy.service.runtime.v3.RuntimeDiscoveryService/DeltaRuntime",
180            );
181            let mut req = request.into_streaming_request();
182            req.extensions_mut()
183                .insert(
184                    GrpcMethod::new(
185                        "envoy.service.runtime.v3.RuntimeDiscoveryService",
186                        "DeltaRuntime",
187                    ),
188                );
189            self.inner.streaming(req, path, codec).await
190        }
191        pub async fn fetch_runtime(
192            &mut self,
193            request: impl tonic::IntoRequest<
194                super::super::super::discovery::v3::DiscoveryRequest,
195            >,
196        ) -> std::result::Result<
197            tonic::Response<super::super::super::discovery::v3::DiscoveryResponse>,
198            tonic::Status,
199        > {
200            self.inner
201                .ready()
202                .await
203                .map_err(|e| {
204                    tonic::Status::unknown(
205                        format!("Service was not ready: {}", e.into()),
206                    )
207                })?;
208            let codec = tonic::codec::ProstCodec::default();
209            let path = http::uri::PathAndQuery::from_static(
210                "/envoy.service.runtime.v3.RuntimeDiscoveryService/FetchRuntime",
211            );
212            let mut req = request.into_request();
213            req.extensions_mut()
214                .insert(
215                    GrpcMethod::new(
216                        "envoy.service.runtime.v3.RuntimeDiscoveryService",
217                        "FetchRuntime",
218                    ),
219                );
220            self.inner.unary(req, path, codec).await
221        }
222    }
223}
224/// Generated server implementations.
225pub mod runtime_discovery_service_server {
226    #![allow(
227        unused_variables,
228        dead_code,
229        missing_docs,
230        clippy::wildcard_imports,
231        clippy::let_unit_value,
232    )]
233    use tonic::codegen::*;
234    /// Generated trait containing gRPC methods that should be implemented for use with RuntimeDiscoveryServiceServer.
235    #[async_trait]
236    pub trait RuntimeDiscoveryService: std::marker::Send + std::marker::Sync + 'static {
237        /// Server streaming response type for the StreamRuntime method.
238        type StreamRuntimeStream: tonic::codegen::tokio_stream::Stream<
239                Item = std::result::Result<
240                    super::super::super::discovery::v3::DiscoveryResponse,
241                    tonic::Status,
242                >,
243            >
244            + std::marker::Send
245            + 'static;
246        async fn stream_runtime(
247            &self,
248            request: tonic::Request<
249                tonic::Streaming<super::super::super::discovery::v3::DiscoveryRequest>,
250            >,
251        ) -> std::result::Result<
252            tonic::Response<Self::StreamRuntimeStream>,
253            tonic::Status,
254        >;
255        /// Server streaming response type for the DeltaRuntime method.
256        type DeltaRuntimeStream: tonic::codegen::tokio_stream::Stream<
257                Item = std::result::Result<
258                    super::super::super::discovery::v3::DeltaDiscoveryResponse,
259                    tonic::Status,
260                >,
261            >
262            + std::marker::Send
263            + 'static;
264        async fn delta_runtime(
265            &self,
266            request: tonic::Request<
267                tonic::Streaming<
268                    super::super::super::discovery::v3::DeltaDiscoveryRequest,
269                >,
270            >,
271        ) -> std::result::Result<
272            tonic::Response<Self::DeltaRuntimeStream>,
273            tonic::Status,
274        >;
275        async fn fetch_runtime(
276            &self,
277            request: tonic::Request<super::super::super::discovery::v3::DiscoveryRequest>,
278        ) -> std::result::Result<
279            tonic::Response<super::super::super::discovery::v3::DiscoveryResponse>,
280            tonic::Status,
281        >;
282    }
283    /// Discovery service for Runtime resources.
284    #[derive(Debug)]
285    pub struct RuntimeDiscoveryServiceServer<T> {
286        inner: Arc<T>,
287        accept_compression_encodings: EnabledCompressionEncodings,
288        send_compression_encodings: EnabledCompressionEncodings,
289        max_decoding_message_size: Option<usize>,
290        max_encoding_message_size: Option<usize>,
291    }
292    impl<T> RuntimeDiscoveryServiceServer<T> {
293        pub fn new(inner: T) -> Self {
294            Self::from_arc(Arc::new(inner))
295        }
296        pub fn from_arc(inner: Arc<T>) -> Self {
297            Self {
298                inner,
299                accept_compression_encodings: Default::default(),
300                send_compression_encodings: Default::default(),
301                max_decoding_message_size: None,
302                max_encoding_message_size: None,
303            }
304        }
305        pub fn with_interceptor<F>(
306            inner: T,
307            interceptor: F,
308        ) -> InterceptedService<Self, F>
309        where
310            F: tonic::service::Interceptor,
311        {
312            InterceptedService::new(Self::new(inner), interceptor)
313        }
314        /// Enable decompressing requests with the given encoding.
315        #[must_use]
316        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
317            self.accept_compression_encodings.enable(encoding);
318            self
319        }
320        /// Compress responses with the given encoding, if the client supports it.
321        #[must_use]
322        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
323            self.send_compression_encodings.enable(encoding);
324            self
325        }
326        /// Limits the maximum size of a decoded message.
327        ///
328        /// Default: `4MB`
329        #[must_use]
330        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
331            self.max_decoding_message_size = Some(limit);
332            self
333        }
334        /// Limits the maximum size of an encoded message.
335        ///
336        /// Default: `usize::MAX`
337        #[must_use]
338        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
339            self.max_encoding_message_size = Some(limit);
340            self
341        }
342    }
343    impl<T, B> tonic::codegen::Service<http::Request<B>>
344    for RuntimeDiscoveryServiceServer<T>
345    where
346        T: RuntimeDiscoveryService,
347        B: Body + std::marker::Send + 'static,
348        B::Error: Into<StdError> + std::marker::Send + 'static,
349    {
350        type Response = http::Response<tonic::body::BoxBody>;
351        type Error = std::convert::Infallible;
352        type Future = BoxFuture<Self::Response, Self::Error>;
353        fn poll_ready(
354            &mut self,
355            _cx: &mut Context<'_>,
356        ) -> Poll<std::result::Result<(), Self::Error>> {
357            Poll::Ready(Ok(()))
358        }
359        fn call(&mut self, req: http::Request<B>) -> Self::Future {
360            match req.uri().path() {
361                "/envoy.service.runtime.v3.RuntimeDiscoveryService/StreamRuntime" => {
362                    #[allow(non_camel_case_types)]
363                    struct StreamRuntimeSvc<T: RuntimeDiscoveryService>(pub Arc<T>);
364                    impl<
365                        T: RuntimeDiscoveryService,
366                    > tonic::server::StreamingService<
367                        super::super::super::discovery::v3::DiscoveryRequest,
368                    > for StreamRuntimeSvc<T> {
369                        type Response = super::super::super::discovery::v3::DiscoveryResponse;
370                        type ResponseStream = T::StreamRuntimeStream;
371                        type Future = BoxFuture<
372                            tonic::Response<Self::ResponseStream>,
373                            tonic::Status,
374                        >;
375                        fn call(
376                            &mut self,
377                            request: tonic::Request<
378                                tonic::Streaming<
379                                    super::super::super::discovery::v3::DiscoveryRequest,
380                                >,
381                            >,
382                        ) -> Self::Future {
383                            let inner = Arc::clone(&self.0);
384                            let fut = async move {
385                                <T as RuntimeDiscoveryService>::stream_runtime(
386                                        &inner,
387                                        request,
388                                    )
389                                    .await
390                            };
391                            Box::pin(fut)
392                        }
393                    }
394                    let accept_compression_encodings = self.accept_compression_encodings;
395                    let send_compression_encodings = self.send_compression_encodings;
396                    let max_decoding_message_size = self.max_decoding_message_size;
397                    let max_encoding_message_size = self.max_encoding_message_size;
398                    let inner = self.inner.clone();
399                    let fut = async move {
400                        let method = StreamRuntimeSvc(inner);
401                        let codec = tonic::codec::ProstCodec::default();
402                        let mut grpc = tonic::server::Grpc::new(codec)
403                            .apply_compression_config(
404                                accept_compression_encodings,
405                                send_compression_encodings,
406                            )
407                            .apply_max_message_size_config(
408                                max_decoding_message_size,
409                                max_encoding_message_size,
410                            );
411                        let res = grpc.streaming(method, req).await;
412                        Ok(res)
413                    };
414                    Box::pin(fut)
415                }
416                "/envoy.service.runtime.v3.RuntimeDiscoveryService/DeltaRuntime" => {
417                    #[allow(non_camel_case_types)]
418                    struct DeltaRuntimeSvc<T: RuntimeDiscoveryService>(pub Arc<T>);
419                    impl<
420                        T: RuntimeDiscoveryService,
421                    > tonic::server::StreamingService<
422                        super::super::super::discovery::v3::DeltaDiscoveryRequest,
423                    > for DeltaRuntimeSvc<T> {
424                        type Response = super::super::super::discovery::v3::DeltaDiscoveryResponse;
425                        type ResponseStream = T::DeltaRuntimeStream;
426                        type Future = BoxFuture<
427                            tonic::Response<Self::ResponseStream>,
428                            tonic::Status,
429                        >;
430                        fn call(
431                            &mut self,
432                            request: tonic::Request<
433                                tonic::Streaming<
434                                    super::super::super::discovery::v3::DeltaDiscoveryRequest,
435                                >,
436                            >,
437                        ) -> Self::Future {
438                            let inner = Arc::clone(&self.0);
439                            let fut = async move {
440                                <T as RuntimeDiscoveryService>::delta_runtime(
441                                        &inner,
442                                        request,
443                                    )
444                                    .await
445                            };
446                            Box::pin(fut)
447                        }
448                    }
449                    let accept_compression_encodings = self.accept_compression_encodings;
450                    let send_compression_encodings = self.send_compression_encodings;
451                    let max_decoding_message_size = self.max_decoding_message_size;
452                    let max_encoding_message_size = self.max_encoding_message_size;
453                    let inner = self.inner.clone();
454                    let fut = async move {
455                        let method = DeltaRuntimeSvc(inner);
456                        let codec = tonic::codec::ProstCodec::default();
457                        let mut grpc = tonic::server::Grpc::new(codec)
458                            .apply_compression_config(
459                                accept_compression_encodings,
460                                send_compression_encodings,
461                            )
462                            .apply_max_message_size_config(
463                                max_decoding_message_size,
464                                max_encoding_message_size,
465                            );
466                        let res = grpc.streaming(method, req).await;
467                        Ok(res)
468                    };
469                    Box::pin(fut)
470                }
471                "/envoy.service.runtime.v3.RuntimeDiscoveryService/FetchRuntime" => {
472                    #[allow(non_camel_case_types)]
473                    struct FetchRuntimeSvc<T: RuntimeDiscoveryService>(pub Arc<T>);
474                    impl<
475                        T: RuntimeDiscoveryService,
476                    > tonic::server::UnaryService<
477                        super::super::super::discovery::v3::DiscoveryRequest,
478                    > for FetchRuntimeSvc<T> {
479                        type Response = super::super::super::discovery::v3::DiscoveryResponse;
480                        type Future = BoxFuture<
481                            tonic::Response<Self::Response>,
482                            tonic::Status,
483                        >;
484                        fn call(
485                            &mut self,
486                            request: tonic::Request<
487                                super::super::super::discovery::v3::DiscoveryRequest,
488                            >,
489                        ) -> Self::Future {
490                            let inner = Arc::clone(&self.0);
491                            let fut = async move {
492                                <T as RuntimeDiscoveryService>::fetch_runtime(
493                                        &inner,
494                                        request,
495                                    )
496                                    .await
497                            };
498                            Box::pin(fut)
499                        }
500                    }
501                    let accept_compression_encodings = self.accept_compression_encodings;
502                    let send_compression_encodings = self.send_compression_encodings;
503                    let max_decoding_message_size = self.max_decoding_message_size;
504                    let max_encoding_message_size = self.max_encoding_message_size;
505                    let inner = self.inner.clone();
506                    let fut = async move {
507                        let method = FetchRuntimeSvc(inner);
508                        let codec = tonic::codec::ProstCodec::default();
509                        let mut grpc = tonic::server::Grpc::new(codec)
510                            .apply_compression_config(
511                                accept_compression_encodings,
512                                send_compression_encodings,
513                            )
514                            .apply_max_message_size_config(
515                                max_decoding_message_size,
516                                max_encoding_message_size,
517                            );
518                        let res = grpc.unary(method, req).await;
519                        Ok(res)
520                    };
521                    Box::pin(fut)
522                }
523                _ => {
524                    Box::pin(async move {
525                        let mut response = http::Response::new(empty_body());
526                        let headers = response.headers_mut();
527                        headers
528                            .insert(
529                                tonic::Status::GRPC_STATUS,
530                                (tonic::Code::Unimplemented as i32).into(),
531                            );
532                        headers
533                            .insert(
534                                http::header::CONTENT_TYPE,
535                                tonic::metadata::GRPC_CONTENT_TYPE,
536                            );
537                        Ok(response)
538                    })
539                }
540            }
541        }
542    }
543    impl<T> Clone for RuntimeDiscoveryServiceServer<T> {
544        fn clone(&self) -> Self {
545            let inner = self.inner.clone();
546            Self {
547                inner,
548                accept_compression_encodings: self.accept_compression_encodings,
549                send_compression_encodings: self.send_compression_encodings,
550                max_decoding_message_size: self.max_decoding_message_size,
551                max_encoding_message_size: self.max_encoding_message_size,
552            }
553        }
554    }
555    /// Generated gRPC service name
556    pub const SERVICE_NAME: &str = "envoy.service.runtime.v3.RuntimeDiscoveryService";
557    impl<T> tonic::server::NamedService for RuntimeDiscoveryServiceServer<T> {
558        const NAME: &'static str = SERVICE_NAME;
559    }
560}