Skip to main content

ids_apis/
kdo.v1.system.tonic.rs

1// @generated
2/// Generated client implementations.
3pub mod system_service_client {
4    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
5    use tonic::codegen::*;
6    use tonic::codegen::http::Uri;
7    #[derive(Debug, Clone)]
8    pub struct SystemServiceClient<T> {
9        inner: tonic::client::Grpc<T>,
10    }
11    impl SystemServiceClient<tonic::transport::Channel> {
12        /// Attempt to create a new client by connecting to a given endpoint.
13        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
14        where
15            D: TryInto<tonic::transport::Endpoint>,
16            D::Error: Into<StdError>,
17        {
18            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
19            Ok(Self::new(conn))
20        }
21    }
22    impl<T> SystemServiceClient<T>
23    where
24        T: tonic::client::GrpcService<tonic::body::BoxBody>,
25        T::Error: Into<StdError>,
26        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
27        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
28    {
29        pub fn new(inner: T) -> Self {
30            let inner = tonic::client::Grpc::new(inner);
31            Self { inner }
32        }
33        pub fn with_origin(inner: T, origin: Uri) -> Self {
34            let inner = tonic::client::Grpc::with_origin(inner, origin);
35            Self { inner }
36        }
37        pub fn with_interceptor<F>(
38            inner: T,
39            interceptor: F,
40        ) -> SystemServiceClient<InterceptedService<T, F>>
41        where
42            F: tonic::service::Interceptor,
43            T::ResponseBody: Default,
44            T: tonic::codegen::Service<
45                http::Request<tonic::body::BoxBody>,
46                Response = http::Response<
47                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
48                >,
49            >,
50            <T as tonic::codegen::Service<
51                http::Request<tonic::body::BoxBody>,
52            >>::Error: Into<StdError> + Send + Sync,
53        {
54            SystemServiceClient::new(InterceptedService::new(inner, interceptor))
55        }
56        /// Compress requests with the given encoding.
57        ///
58        /// This requires the server to support it otherwise it might respond with an
59        /// error.
60        #[must_use]
61        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
62            self.inner = self.inner.send_compressed(encoding);
63            self
64        }
65        /// Enable decompressing responses.
66        #[must_use]
67        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
68            self.inner = self.inner.accept_compressed(encoding);
69            self
70        }
71        /// Limits the maximum size of a decoded message.
72        ///
73        /// Default: `4MB`
74        #[must_use]
75        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
76            self.inner = self.inner.max_decoding_message_size(limit);
77            self
78        }
79        /// Limits the maximum size of an encoded message.
80        ///
81        /// Default: `usize::MAX`
82        #[must_use]
83        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
84            self.inner = self.inner.max_encoding_message_size(limit);
85            self
86        }
87        pub async fn get_connection_info(
88            &mut self,
89            request: impl tonic::IntoRequest<super::GetConnectionInfoRequest>,
90        ) -> std::result::Result<
91            tonic::Response<super::GetConnectionInfoResponse>,
92            tonic::Status,
93        > {
94            self.inner
95                .ready()
96                .await
97                .map_err(|e| {
98                    tonic::Status::new(
99                        tonic::Code::Unknown,
100                        format!("Service was not ready: {}", e.into()),
101                    )
102                })?;
103            let codec = tonic::codec::ProstCodec::default();
104            let path = http::uri::PathAndQuery::from_static(
105                "/kdo.v1.system.SystemService/GetConnectionInfo",
106            );
107            let mut req = request.into_request();
108            req.extensions_mut()
109                .insert(
110                    GrpcMethod::new("kdo.v1.system.SystemService", "GetConnectionInfo"),
111                );
112            self.inner.unary(req, path, codec).await
113        }
114        pub async fn get_version_info(
115            &mut self,
116            request: impl tonic::IntoRequest<super::GetVersionInfoRequest>,
117        ) -> std::result::Result<
118            tonic::Response<super::GetVersionInfoResponse>,
119            tonic::Status,
120        > {
121            self.inner
122                .ready()
123                .await
124                .map_err(|e| {
125                    tonic::Status::new(
126                        tonic::Code::Unknown,
127                        format!("Service was not ready: {}", e.into()),
128                    )
129                })?;
130            let codec = tonic::codec::ProstCodec::default();
131            let path = http::uri::PathAndQuery::from_static(
132                "/kdo.v1.system.SystemService/GetVersionInfo",
133            );
134            let mut req = request.into_request();
135            req.extensions_mut()
136                .insert(
137                    GrpcMethod::new("kdo.v1.system.SystemService", "GetVersionInfo"),
138                );
139            self.inner.unary(req, path, codec).await
140        }
141    }
142}
143/// Generated server implementations.
144pub mod system_service_server {
145    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
146    use tonic::codegen::*;
147    /// Generated trait containing gRPC methods that should be implemented for use with SystemServiceServer.
148    #[async_trait]
149    pub trait SystemService: Send + Sync + 'static {
150        async fn get_connection_info(
151            &self,
152            request: tonic::Request<super::GetConnectionInfoRequest>,
153        ) -> std::result::Result<
154            tonic::Response<super::GetConnectionInfoResponse>,
155            tonic::Status,
156        >;
157        async fn get_version_info(
158            &self,
159            request: tonic::Request<super::GetVersionInfoRequest>,
160        ) -> std::result::Result<
161            tonic::Response<super::GetVersionInfoResponse>,
162            tonic::Status,
163        >;
164    }
165    #[derive(Debug)]
166    pub struct SystemServiceServer<T: SystemService> {
167        inner: Arc<T>,
168        accept_compression_encodings: EnabledCompressionEncodings,
169        send_compression_encodings: EnabledCompressionEncodings,
170        max_decoding_message_size: Option<usize>,
171        max_encoding_message_size: Option<usize>,
172    }
173    impl<T: SystemService> SystemServiceServer<T> {
174        pub fn new(inner: T) -> Self {
175            Self::from_arc(Arc::new(inner))
176        }
177        pub fn from_arc(inner: Arc<T>) -> Self {
178            Self {
179                inner,
180                accept_compression_encodings: Default::default(),
181                send_compression_encodings: Default::default(),
182                max_decoding_message_size: None,
183                max_encoding_message_size: None,
184            }
185        }
186        pub fn with_interceptor<F>(
187            inner: T,
188            interceptor: F,
189        ) -> InterceptedService<Self, F>
190        where
191            F: tonic::service::Interceptor,
192        {
193            InterceptedService::new(Self::new(inner), interceptor)
194        }
195        /// Enable decompressing requests with the given encoding.
196        #[must_use]
197        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
198            self.accept_compression_encodings.enable(encoding);
199            self
200        }
201        /// Compress responses with the given encoding, if the client supports it.
202        #[must_use]
203        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
204            self.send_compression_encodings.enable(encoding);
205            self
206        }
207        /// Limits the maximum size of a decoded message.
208        ///
209        /// Default: `4MB`
210        #[must_use]
211        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
212            self.max_decoding_message_size = Some(limit);
213            self
214        }
215        /// Limits the maximum size of an encoded message.
216        ///
217        /// Default: `usize::MAX`
218        #[must_use]
219        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
220            self.max_encoding_message_size = Some(limit);
221            self
222        }
223    }
224    impl<T, B> tonic::codegen::Service<http::Request<B>> for SystemServiceServer<T>
225    where
226        T: SystemService,
227        B: Body + Send + 'static,
228        B::Error: Into<StdError> + Send + 'static,
229    {
230        type Response = http::Response<tonic::body::BoxBody>;
231        type Error = std::convert::Infallible;
232        type Future = BoxFuture<Self::Response, Self::Error>;
233        fn poll_ready(
234            &mut self,
235            _cx: &mut Context<'_>,
236        ) -> Poll<std::result::Result<(), Self::Error>> {
237            Poll::Ready(Ok(()))
238        }
239        fn call(&mut self, req: http::Request<B>) -> Self::Future {
240            match req.uri().path() {
241                "/kdo.v1.system.SystemService/GetConnectionInfo" => {
242                    #[allow(non_camel_case_types)]
243                    struct GetConnectionInfoSvc<T: SystemService>(pub Arc<T>);
244                    impl<
245                        T: SystemService,
246                    > tonic::server::UnaryService<super::GetConnectionInfoRequest>
247                    for GetConnectionInfoSvc<T> {
248                        type Response = super::GetConnectionInfoResponse;
249                        type Future = BoxFuture<
250                            tonic::Response<Self::Response>,
251                            tonic::Status,
252                        >;
253                        fn call(
254                            &mut self,
255                            request: tonic::Request<super::GetConnectionInfoRequest>,
256                        ) -> Self::Future {
257                            let inner = Arc::clone(&self.0);
258                            let fut = async move {
259                                <T as SystemService>::get_connection_info(&inner, request)
260                                    .await
261                            };
262                            Box::pin(fut)
263                        }
264                    }
265                    let accept_compression_encodings = self.accept_compression_encodings;
266                    let send_compression_encodings = self.send_compression_encodings;
267                    let max_decoding_message_size = self.max_decoding_message_size;
268                    let max_encoding_message_size = self.max_encoding_message_size;
269                    let inner = self.inner.clone();
270                    let fut = async move {
271                        let method = GetConnectionInfoSvc(inner);
272                        let codec = tonic::codec::ProstCodec::default();
273                        let mut grpc = tonic::server::Grpc::new(codec)
274                            .apply_compression_config(
275                                accept_compression_encodings,
276                                send_compression_encodings,
277                            )
278                            .apply_max_message_size_config(
279                                max_decoding_message_size,
280                                max_encoding_message_size,
281                            );
282                        let res = grpc.unary(method, req).await;
283                        Ok(res)
284                    };
285                    Box::pin(fut)
286                }
287                "/kdo.v1.system.SystemService/GetVersionInfo" => {
288                    #[allow(non_camel_case_types)]
289                    struct GetVersionInfoSvc<T: SystemService>(pub Arc<T>);
290                    impl<
291                        T: SystemService,
292                    > tonic::server::UnaryService<super::GetVersionInfoRequest>
293                    for GetVersionInfoSvc<T> {
294                        type Response = super::GetVersionInfoResponse;
295                        type Future = BoxFuture<
296                            tonic::Response<Self::Response>,
297                            tonic::Status,
298                        >;
299                        fn call(
300                            &mut self,
301                            request: tonic::Request<super::GetVersionInfoRequest>,
302                        ) -> Self::Future {
303                            let inner = Arc::clone(&self.0);
304                            let fut = async move {
305                                <T as SystemService>::get_version_info(&inner, request)
306                                    .await
307                            };
308                            Box::pin(fut)
309                        }
310                    }
311                    let accept_compression_encodings = self.accept_compression_encodings;
312                    let send_compression_encodings = self.send_compression_encodings;
313                    let max_decoding_message_size = self.max_decoding_message_size;
314                    let max_encoding_message_size = self.max_encoding_message_size;
315                    let inner = self.inner.clone();
316                    let fut = async move {
317                        let method = GetVersionInfoSvc(inner);
318                        let codec = tonic::codec::ProstCodec::default();
319                        let mut grpc = tonic::server::Grpc::new(codec)
320                            .apply_compression_config(
321                                accept_compression_encodings,
322                                send_compression_encodings,
323                            )
324                            .apply_max_message_size_config(
325                                max_decoding_message_size,
326                                max_encoding_message_size,
327                            );
328                        let res = grpc.unary(method, req).await;
329                        Ok(res)
330                    };
331                    Box::pin(fut)
332                }
333                _ => {
334                    Box::pin(async move {
335                        Ok(
336                            http::Response::builder()
337                                .status(200)
338                                .header("grpc-status", tonic::Code::Unimplemented as i32)
339                                .header(
340                                    http::header::CONTENT_TYPE,
341                                    tonic::metadata::GRPC_CONTENT_TYPE,
342                                )
343                                .body(empty_body())
344                                .unwrap(),
345                        )
346                    })
347                }
348            }
349        }
350    }
351    impl<T: SystemService> Clone for SystemServiceServer<T> {
352        fn clone(&self) -> Self {
353            let inner = self.inner.clone();
354            Self {
355                inner,
356                accept_compression_encodings: self.accept_compression_encodings,
357                send_compression_encodings: self.send_compression_encodings,
358                max_decoding_message_size: self.max_decoding_message_size,
359                max_encoding_message_size: self.max_encoding_message_size,
360            }
361        }
362    }
363    impl<T: SystemService> tonic::server::NamedService for SystemServiceServer<T> {
364        const NAME: &'static str = "kdo.v1.system.SystemService";
365    }
366}