datadiver_proto/
domain.rs

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