1#[derive(prost_helpers::AnyPB)]
4#[derive(Clone, PartialEq, ::prost::Message)]
5pub struct AuthInfo {
6 #[prost(enumeration = "auth_info::EncryptionType", tag = "1")]
7 pub encryption_type: i32,
8 #[prost(bytes = "vec", tag = "2")]
9 pub encrypted_value: ::prost::alloc::vec::Vec<u8>,
10 #[prost(map = "string, string", tag = "3")]
11 pub metadata: ::std::collections::HashMap<
12 ::prost::alloc::string::String,
13 ::prost::alloc::string::String,
14 >,
15}
16pub mod auth_info {
18 #[derive(prost_helpers::AnyPB)]
19 #[derive(
20 Clone,
21 Copy,
22 Debug,
23 PartialEq,
24 Eq,
25 Hash,
26 PartialOrd,
27 Ord,
28 ::prost::Enumeration
29 )]
30 #[repr(i32)]
31 pub enum EncryptionType {
32 Unspecified = 0,
33 Plaintext = 1,
34 Sha256 = 2,
35 Md5 = 3,
36 Oauth = 4,
37 }
38 impl EncryptionType {
39 pub fn as_str_name(&self) -> &'static str {
44 match self {
45 Self::Unspecified => "UNSPECIFIED",
46 Self::Plaintext => "PLAINTEXT",
47 Self::Sha256 => "SHA256",
48 Self::Md5 => "MD5",
49 Self::Oauth => "OAUTH",
50 }
51 }
52 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
54 match value {
55 "UNSPECIFIED" => Some(Self::Unspecified),
56 "PLAINTEXT" => Some(Self::Plaintext),
57 "SHA256" => Some(Self::Sha256),
58 "MD5" => Some(Self::Md5),
59 "OAUTH" => Some(Self::Oauth),
60 _ => None,
61 }
62 }
63 }
64}
65#[derive(prost_helpers::AnyPB)]
67#[derive(Clone, PartialEq, ::prost::Message)]
68pub struct UserInfo {
69 #[prost(uint32, tag = "1")]
70 pub id: u32,
71 #[prost(string, tag = "2")]
72 pub name: ::prost::alloc::string::String,
73 #[prost(bool, tag = "3")]
74 pub is_super: bool,
75 #[prost(bool, tag = "4")]
76 pub can_create_db: bool,
77 #[prost(bool, tag = "5")]
78 pub can_create_user: bool,
79 #[prost(bool, tag = "6")]
80 pub can_login: bool,
81 #[prost(message, optional, tag = "7")]
82 pub auth_info: ::core::option::Option<AuthInfo>,
83 #[prost(message, repeated, tag = "8")]
85 pub grant_privileges: ::prost::alloc::vec::Vec<GrantPrivilege>,
86}
87#[derive(prost_helpers::AnyPB)]
89#[derive(Clone, PartialEq, ::prost::Message)]
90pub struct GrantPrivilege {
91 #[prost(message, repeated, tag = "20")]
92 pub action_with_opts: ::prost::alloc::vec::Vec<
93 grant_privilege::ActionWithGrantOption,
94 >,
95 #[prost(oneof = "grant_privilege::Object", tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10")]
96 pub object: ::core::option::Option<grant_privilege::Object>,
97}
98pub mod grant_privilege {
100 #[derive(prost_helpers::AnyPB)]
101 #[derive(Clone, Copy, PartialEq, ::prost::Message)]
102 pub struct ActionWithGrantOption {
103 #[prost(enumeration = "Action", tag = "1")]
104 pub action: i32,
105 #[prost(bool, tag = "2")]
106 pub with_grant_option: bool,
107 #[prost(uint32, tag = "3")]
108 pub granted_by: u32,
109 }
110 #[derive(prost_helpers::AnyPB)]
111 #[derive(
112 Clone,
113 Copy,
114 Debug,
115 PartialEq,
116 Eq,
117 Hash,
118 PartialOrd,
119 Ord,
120 ::prost::Enumeration
121 )]
122 #[repr(i32)]
123 pub enum Action {
124 Unspecified = 0,
125 Select = 1,
126 Insert = 2,
127 Update = 3,
128 Delete = 4,
129 Create = 5,
130 Connect = 6,
131 Usage = 7,
132 Execute = 8,
133 }
134 impl Action {
135 pub fn as_str_name(&self) -> &'static str {
140 match self {
141 Self::Unspecified => "UNSPECIFIED",
142 Self::Select => "SELECT",
143 Self::Insert => "INSERT",
144 Self::Update => "UPDATE",
145 Self::Delete => "DELETE",
146 Self::Create => "CREATE",
147 Self::Connect => "CONNECT",
148 Self::Usage => "USAGE",
149 Self::Execute => "EXECUTE",
150 }
151 }
152 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
154 match value {
155 "UNSPECIFIED" => Some(Self::Unspecified),
156 "SELECT" => Some(Self::Select),
157 "INSERT" => Some(Self::Insert),
158 "UPDATE" => Some(Self::Update),
159 "DELETE" => Some(Self::Delete),
160 "CREATE" => Some(Self::Create),
161 "CONNECT" => Some(Self::Connect),
162 "USAGE" => Some(Self::Usage),
163 "EXECUTE" => Some(Self::Execute),
164 _ => None,
165 }
166 }
167 }
168 #[derive(prost_helpers::AnyPB)]
169 #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
170 pub enum Object {
171 #[prost(uint32, tag = "1")]
172 DatabaseId(u32),
173 #[prost(uint32, tag = "2")]
174 SchemaId(u32),
175 #[prost(uint32, tag = "3")]
176 TableId(u32),
177 #[prost(uint32, tag = "4")]
178 SourceId(u32),
179 #[prost(uint32, tag = "5")]
180 SinkId(u32),
181 #[prost(uint32, tag = "6")]
182 ViewId(u32),
183 #[prost(uint32, tag = "7")]
184 FunctionId(u32),
185 #[prost(uint32, tag = "8")]
186 SubscriptionId(u32),
187 #[prost(uint32, tag = "9")]
188 ConnectionId(u32),
189 #[prost(uint32, tag = "10")]
190 SecretId(u32),
191 }
192}
193#[derive(prost_helpers::AnyPB)]
194#[derive(Clone, PartialEq, ::prost::Message)]
195pub struct CreateUserRequest {
196 #[prost(message, optional, tag = "1")]
197 pub user: ::core::option::Option<UserInfo>,
198}
199#[derive(prost_helpers::AnyPB)]
200#[derive(Clone, PartialEq, ::prost::Message)]
201pub struct CreateUserResponse {
202 #[prost(message, optional, tag = "1")]
203 pub status: ::core::option::Option<super::common::Status>,
204 #[prost(uint64, tag = "2")]
205 pub version: u64,
206}
207#[derive(prost_helpers::AnyPB)]
208#[derive(Clone, Copy, PartialEq, ::prost::Message)]
209pub struct DropUserRequest {
210 #[prost(uint32, tag = "1")]
211 pub user_id: u32,
212}
213#[derive(prost_helpers::AnyPB)]
214#[derive(Clone, PartialEq, ::prost::Message)]
215pub struct DropUserResponse {
216 #[prost(message, optional, tag = "1")]
217 pub status: ::core::option::Option<super::common::Status>,
218 #[prost(uint64, tag = "2")]
219 pub version: u64,
220}
221#[derive(prost_helpers::AnyPB)]
222#[derive(Clone, PartialEq, ::prost::Message)]
223pub struct UpdateUserRequest {
224 #[prost(message, optional, tag = "1")]
225 pub user: ::core::option::Option<UserInfo>,
226 #[prost(enumeration = "update_user_request::UpdateField", repeated, tag = "2")]
227 pub update_fields: ::prost::alloc::vec::Vec<i32>,
228}
229pub mod update_user_request {
231 #[derive(prost_helpers::AnyPB)]
232 #[derive(
233 Clone,
234 Copy,
235 Debug,
236 PartialEq,
237 Eq,
238 Hash,
239 PartialOrd,
240 Ord,
241 ::prost::Enumeration
242 )]
243 #[repr(i32)]
244 pub enum UpdateField {
245 Unspecified = 0,
246 Super = 1,
247 Login = 2,
248 CreateDb = 3,
249 AuthInfo = 4,
250 Rename = 5,
251 CreateUser = 6,
252 }
253 impl UpdateField {
254 pub fn as_str_name(&self) -> &'static str {
259 match self {
260 Self::Unspecified => "UNSPECIFIED",
261 Self::Super => "SUPER",
262 Self::Login => "LOGIN",
263 Self::CreateDb => "CREATE_DB",
264 Self::AuthInfo => "AUTH_INFO",
265 Self::Rename => "RENAME",
266 Self::CreateUser => "CREATE_USER",
267 }
268 }
269 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
271 match value {
272 "UNSPECIFIED" => Some(Self::Unspecified),
273 "SUPER" => Some(Self::Super),
274 "LOGIN" => Some(Self::Login),
275 "CREATE_DB" => Some(Self::CreateDb),
276 "AUTH_INFO" => Some(Self::AuthInfo),
277 "RENAME" => Some(Self::Rename),
278 "CREATE_USER" => Some(Self::CreateUser),
279 _ => None,
280 }
281 }
282 }
283}
284#[derive(prost_helpers::AnyPB)]
285#[derive(Clone, PartialEq, ::prost::Message)]
286pub struct UpdateUserResponse {
287 #[prost(message, optional, tag = "1")]
288 pub status: ::core::option::Option<super::common::Status>,
289 #[prost(uint64, tag = "2")]
290 pub version: u64,
291}
292#[derive(prost_helpers::AnyPB)]
293#[derive(Clone, PartialEq, ::prost::Message)]
294pub struct GrantPrivilegeRequest {
295 #[prost(uint32, repeated, tag = "1")]
296 pub user_ids: ::prost::alloc::vec::Vec<u32>,
297 #[prost(message, repeated, tag = "2")]
298 pub privileges: ::prost::alloc::vec::Vec<GrantPrivilege>,
299 #[prost(bool, tag = "3")]
300 pub with_grant_option: bool,
301 #[prost(uint32, tag = "4")]
302 pub granted_by: u32,
303}
304#[derive(prost_helpers::AnyPB)]
305#[derive(Clone, PartialEq, ::prost::Message)]
306pub struct GrantPrivilegeResponse {
307 #[prost(message, optional, tag = "1")]
308 pub status: ::core::option::Option<super::common::Status>,
309 #[prost(uint64, tag = "2")]
310 pub version: u64,
311}
312#[derive(prost_helpers::AnyPB)]
313#[derive(Clone, PartialEq, ::prost::Message)]
314pub struct RevokePrivilegeRequest {
315 #[prost(uint32, repeated, tag = "1")]
316 pub user_ids: ::prost::alloc::vec::Vec<u32>,
317 #[prost(message, repeated, tag = "2")]
318 pub privileges: ::prost::alloc::vec::Vec<GrantPrivilege>,
319 #[prost(uint32, tag = "3")]
320 pub granted_by: u32,
321 #[prost(uint32, tag = "4")]
322 pub revoke_by: u32,
323 #[prost(bool, tag = "5")]
324 pub revoke_grant_option: bool,
325 #[prost(bool, tag = "6")]
326 pub cascade: bool,
327}
328#[derive(prost_helpers::AnyPB)]
329#[derive(Clone, PartialEq, ::prost::Message)]
330pub struct RevokePrivilegeResponse {
331 #[prost(message, optional, tag = "1")]
332 pub status: ::core::option::Option<super::common::Status>,
333 #[prost(uint64, tag = "2")]
334 pub version: u64,
335}
336pub mod user_service_client {
338 #![allow(
339 unused_variables,
340 dead_code,
341 missing_docs,
342 clippy::wildcard_imports,
343 clippy::let_unit_value,
344 )]
345 use tonic::codegen::*;
346 use tonic::codegen::http::Uri;
347 #[derive(Debug, Clone)]
348 pub struct UserServiceClient<T> {
349 inner: tonic::client::Grpc<T>,
350 }
351 impl UserServiceClient<tonic::transport::Channel> {
352 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
354 where
355 D: TryInto<tonic::transport::Endpoint>,
356 D::Error: Into<StdError>,
357 {
358 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
359 Ok(Self::new(conn))
360 }
361 }
362 impl<T> UserServiceClient<T>
363 where
364 T: tonic::client::GrpcService<tonic::body::BoxBody>,
365 T::Error: Into<StdError>,
366 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
367 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
368 {
369 pub fn new(inner: T) -> Self {
370 let inner = tonic::client::Grpc::new(inner);
371 Self { inner }
372 }
373 pub fn with_origin(inner: T, origin: Uri) -> Self {
374 let inner = tonic::client::Grpc::with_origin(inner, origin);
375 Self { inner }
376 }
377 pub fn with_interceptor<F>(
378 inner: T,
379 interceptor: F,
380 ) -> UserServiceClient<InterceptedService<T, F>>
381 where
382 F: tonic::service::Interceptor,
383 T::ResponseBody: Default,
384 T: tonic::codegen::Service<
385 http::Request<tonic::body::BoxBody>,
386 Response = http::Response<
387 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
388 >,
389 >,
390 <T as tonic::codegen::Service<
391 http::Request<tonic::body::BoxBody>,
392 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
393 {
394 UserServiceClient::new(InterceptedService::new(inner, interceptor))
395 }
396 #[must_use]
401 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
402 self.inner = self.inner.send_compressed(encoding);
403 self
404 }
405 #[must_use]
407 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
408 self.inner = self.inner.accept_compressed(encoding);
409 self
410 }
411 #[must_use]
415 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
416 self.inner = self.inner.max_decoding_message_size(limit);
417 self
418 }
419 #[must_use]
423 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
424 self.inner = self.inner.max_encoding_message_size(limit);
425 self
426 }
427 pub async fn create_user(
428 &mut self,
429 request: impl tonic::IntoRequest<super::CreateUserRequest>,
430 ) -> std::result::Result<
431 tonic::Response<super::CreateUserResponse>,
432 tonic::Status,
433 > {
434 self.inner
435 .ready()
436 .await
437 .map_err(|e| {
438 tonic::Status::unknown(
439 format!("Service was not ready: {}", e.into()),
440 )
441 })?;
442 let codec = tonic::codec::ProstCodec::default();
443 let path = http::uri::PathAndQuery::from_static(
444 "/user.UserService/CreateUser",
445 );
446 let mut req = request.into_request();
447 req.extensions_mut()
448 .insert(GrpcMethod::new("user.UserService", "CreateUser"));
449 self.inner.unary(req, path, codec).await
450 }
451 pub async fn drop_user(
452 &mut self,
453 request: impl tonic::IntoRequest<super::DropUserRequest>,
454 ) -> std::result::Result<
455 tonic::Response<super::DropUserResponse>,
456 tonic::Status,
457 > {
458 self.inner
459 .ready()
460 .await
461 .map_err(|e| {
462 tonic::Status::unknown(
463 format!("Service was not ready: {}", e.into()),
464 )
465 })?;
466 let codec = tonic::codec::ProstCodec::default();
467 let path = http::uri::PathAndQuery::from_static(
468 "/user.UserService/DropUser",
469 );
470 let mut req = request.into_request();
471 req.extensions_mut().insert(GrpcMethod::new("user.UserService", "DropUser"));
472 self.inner.unary(req, path, codec).await
473 }
474 pub async fn update_user(
475 &mut self,
476 request: impl tonic::IntoRequest<super::UpdateUserRequest>,
477 ) -> std::result::Result<
478 tonic::Response<super::UpdateUserResponse>,
479 tonic::Status,
480 > {
481 self.inner
482 .ready()
483 .await
484 .map_err(|e| {
485 tonic::Status::unknown(
486 format!("Service was not ready: {}", e.into()),
487 )
488 })?;
489 let codec = tonic::codec::ProstCodec::default();
490 let path = http::uri::PathAndQuery::from_static(
491 "/user.UserService/UpdateUser",
492 );
493 let mut req = request.into_request();
494 req.extensions_mut()
495 .insert(GrpcMethod::new("user.UserService", "UpdateUser"));
496 self.inner.unary(req, path, codec).await
497 }
498 pub async fn grant_privilege(
500 &mut self,
501 request: impl tonic::IntoRequest<super::GrantPrivilegeRequest>,
502 ) -> std::result::Result<
503 tonic::Response<super::GrantPrivilegeResponse>,
504 tonic::Status,
505 > {
506 self.inner
507 .ready()
508 .await
509 .map_err(|e| {
510 tonic::Status::unknown(
511 format!("Service was not ready: {}", e.into()),
512 )
513 })?;
514 let codec = tonic::codec::ProstCodec::default();
515 let path = http::uri::PathAndQuery::from_static(
516 "/user.UserService/GrantPrivilege",
517 );
518 let mut req = request.into_request();
519 req.extensions_mut()
520 .insert(GrpcMethod::new("user.UserService", "GrantPrivilege"));
521 self.inner.unary(req, path, codec).await
522 }
523 pub async fn revoke_privilege(
525 &mut self,
526 request: impl tonic::IntoRequest<super::RevokePrivilegeRequest>,
527 ) -> std::result::Result<
528 tonic::Response<super::RevokePrivilegeResponse>,
529 tonic::Status,
530 > {
531 self.inner
532 .ready()
533 .await
534 .map_err(|e| {
535 tonic::Status::unknown(
536 format!("Service was not ready: {}", e.into()),
537 )
538 })?;
539 let codec = tonic::codec::ProstCodec::default();
540 let path = http::uri::PathAndQuery::from_static(
541 "/user.UserService/RevokePrivilege",
542 );
543 let mut req = request.into_request();
544 req.extensions_mut()
545 .insert(GrpcMethod::new("user.UserService", "RevokePrivilege"));
546 self.inner.unary(req, path, codec).await
547 }
548 }
549}
550pub mod user_service_server {
552 #![allow(
553 unused_variables,
554 dead_code,
555 missing_docs,
556 clippy::wildcard_imports,
557 clippy::let_unit_value,
558 )]
559 use tonic::codegen::*;
560 #[async_trait]
562 pub trait UserService: std::marker::Send + std::marker::Sync + 'static {
563 async fn create_user(
564 &self,
565 request: tonic::Request<super::CreateUserRequest>,
566 ) -> std::result::Result<
567 tonic::Response<super::CreateUserResponse>,
568 tonic::Status,
569 >;
570 async fn drop_user(
571 &self,
572 request: tonic::Request<super::DropUserRequest>,
573 ) -> std::result::Result<
574 tonic::Response<super::DropUserResponse>,
575 tonic::Status,
576 >;
577 async fn update_user(
578 &self,
579 request: tonic::Request<super::UpdateUserRequest>,
580 ) -> std::result::Result<
581 tonic::Response<super::UpdateUserResponse>,
582 tonic::Status,
583 >;
584 async fn grant_privilege(
586 &self,
587 request: tonic::Request<super::GrantPrivilegeRequest>,
588 ) -> std::result::Result<
589 tonic::Response<super::GrantPrivilegeResponse>,
590 tonic::Status,
591 >;
592 async fn revoke_privilege(
594 &self,
595 request: tonic::Request<super::RevokePrivilegeRequest>,
596 ) -> std::result::Result<
597 tonic::Response<super::RevokePrivilegeResponse>,
598 tonic::Status,
599 >;
600 }
601 #[derive(Debug)]
602 pub struct UserServiceServer<T> {
603 inner: Arc<T>,
604 accept_compression_encodings: EnabledCompressionEncodings,
605 send_compression_encodings: EnabledCompressionEncodings,
606 max_decoding_message_size: Option<usize>,
607 max_encoding_message_size: Option<usize>,
608 }
609 impl<T> UserServiceServer<T> {
610 pub fn new(inner: T) -> Self {
611 Self::from_arc(Arc::new(inner))
612 }
613 pub fn from_arc(inner: Arc<T>) -> Self {
614 Self {
615 inner,
616 accept_compression_encodings: Default::default(),
617 send_compression_encodings: Default::default(),
618 max_decoding_message_size: None,
619 max_encoding_message_size: None,
620 }
621 }
622 pub fn with_interceptor<F>(
623 inner: T,
624 interceptor: F,
625 ) -> InterceptedService<Self, F>
626 where
627 F: tonic::service::Interceptor,
628 {
629 InterceptedService::new(Self::new(inner), interceptor)
630 }
631 #[must_use]
633 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
634 self.accept_compression_encodings.enable(encoding);
635 self
636 }
637 #[must_use]
639 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
640 self.send_compression_encodings.enable(encoding);
641 self
642 }
643 #[must_use]
647 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
648 self.max_decoding_message_size = Some(limit);
649 self
650 }
651 #[must_use]
655 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
656 self.max_encoding_message_size = Some(limit);
657 self
658 }
659 }
660 impl<T, B> tonic::codegen::Service<http::Request<B>> for UserServiceServer<T>
661 where
662 T: UserService,
663 B: Body + std::marker::Send + 'static,
664 B::Error: Into<StdError> + std::marker::Send + 'static,
665 {
666 type Response = http::Response<tonic::body::BoxBody>;
667 type Error = std::convert::Infallible;
668 type Future = BoxFuture<Self::Response, Self::Error>;
669 fn poll_ready(
670 &mut self,
671 _cx: &mut Context<'_>,
672 ) -> Poll<std::result::Result<(), Self::Error>> {
673 Poll::Ready(Ok(()))
674 }
675 fn call(&mut self, req: http::Request<B>) -> Self::Future {
676 match req.uri().path() {
677 "/user.UserService/CreateUser" => {
678 #[allow(non_camel_case_types)]
679 struct CreateUserSvc<T: UserService>(pub Arc<T>);
680 impl<
681 T: UserService,
682 > tonic::server::UnaryService<super::CreateUserRequest>
683 for CreateUserSvc<T> {
684 type Response = super::CreateUserResponse;
685 type Future = BoxFuture<
686 tonic::Response<Self::Response>,
687 tonic::Status,
688 >;
689 fn call(
690 &mut self,
691 request: tonic::Request<super::CreateUserRequest>,
692 ) -> Self::Future {
693 let inner = Arc::clone(&self.0);
694 let fut = async move {
695 <T as UserService>::create_user(&inner, request).await
696 };
697 Box::pin(fut)
698 }
699 }
700 let accept_compression_encodings = self.accept_compression_encodings;
701 let send_compression_encodings = self.send_compression_encodings;
702 let max_decoding_message_size = self.max_decoding_message_size;
703 let max_encoding_message_size = self.max_encoding_message_size;
704 let inner = self.inner.clone();
705 let fut = async move {
706 let method = CreateUserSvc(inner);
707 let codec = tonic::codec::ProstCodec::default();
708 let mut grpc = tonic::server::Grpc::new(codec)
709 .apply_compression_config(
710 accept_compression_encodings,
711 send_compression_encodings,
712 )
713 .apply_max_message_size_config(
714 max_decoding_message_size,
715 max_encoding_message_size,
716 );
717 let res = grpc.unary(method, req).await;
718 Ok(res)
719 };
720 Box::pin(fut)
721 }
722 "/user.UserService/DropUser" => {
723 #[allow(non_camel_case_types)]
724 struct DropUserSvc<T: UserService>(pub Arc<T>);
725 impl<
726 T: UserService,
727 > tonic::server::UnaryService<super::DropUserRequest>
728 for DropUserSvc<T> {
729 type Response = super::DropUserResponse;
730 type Future = BoxFuture<
731 tonic::Response<Self::Response>,
732 tonic::Status,
733 >;
734 fn call(
735 &mut self,
736 request: tonic::Request<super::DropUserRequest>,
737 ) -> Self::Future {
738 let inner = Arc::clone(&self.0);
739 let fut = async move {
740 <T as UserService>::drop_user(&inner, request).await
741 };
742 Box::pin(fut)
743 }
744 }
745 let accept_compression_encodings = self.accept_compression_encodings;
746 let send_compression_encodings = self.send_compression_encodings;
747 let max_decoding_message_size = self.max_decoding_message_size;
748 let max_encoding_message_size = self.max_encoding_message_size;
749 let inner = self.inner.clone();
750 let fut = async move {
751 let method = DropUserSvc(inner);
752 let codec = tonic::codec::ProstCodec::default();
753 let mut grpc = tonic::server::Grpc::new(codec)
754 .apply_compression_config(
755 accept_compression_encodings,
756 send_compression_encodings,
757 )
758 .apply_max_message_size_config(
759 max_decoding_message_size,
760 max_encoding_message_size,
761 );
762 let res = grpc.unary(method, req).await;
763 Ok(res)
764 };
765 Box::pin(fut)
766 }
767 "/user.UserService/UpdateUser" => {
768 #[allow(non_camel_case_types)]
769 struct UpdateUserSvc<T: UserService>(pub Arc<T>);
770 impl<
771 T: UserService,
772 > tonic::server::UnaryService<super::UpdateUserRequest>
773 for UpdateUserSvc<T> {
774 type Response = super::UpdateUserResponse;
775 type Future = BoxFuture<
776 tonic::Response<Self::Response>,
777 tonic::Status,
778 >;
779 fn call(
780 &mut self,
781 request: tonic::Request<super::UpdateUserRequest>,
782 ) -> Self::Future {
783 let inner = Arc::clone(&self.0);
784 let fut = async move {
785 <T as UserService>::update_user(&inner, request).await
786 };
787 Box::pin(fut)
788 }
789 }
790 let accept_compression_encodings = self.accept_compression_encodings;
791 let send_compression_encodings = self.send_compression_encodings;
792 let max_decoding_message_size = self.max_decoding_message_size;
793 let max_encoding_message_size = self.max_encoding_message_size;
794 let inner = self.inner.clone();
795 let fut = async move {
796 let method = UpdateUserSvc(inner);
797 let codec = tonic::codec::ProstCodec::default();
798 let mut grpc = tonic::server::Grpc::new(codec)
799 .apply_compression_config(
800 accept_compression_encodings,
801 send_compression_encodings,
802 )
803 .apply_max_message_size_config(
804 max_decoding_message_size,
805 max_encoding_message_size,
806 );
807 let res = grpc.unary(method, req).await;
808 Ok(res)
809 };
810 Box::pin(fut)
811 }
812 "/user.UserService/GrantPrivilege" => {
813 #[allow(non_camel_case_types)]
814 struct GrantPrivilegeSvc<T: UserService>(pub Arc<T>);
815 impl<
816 T: UserService,
817 > tonic::server::UnaryService<super::GrantPrivilegeRequest>
818 for GrantPrivilegeSvc<T> {
819 type Response = super::GrantPrivilegeResponse;
820 type Future = BoxFuture<
821 tonic::Response<Self::Response>,
822 tonic::Status,
823 >;
824 fn call(
825 &mut self,
826 request: tonic::Request<super::GrantPrivilegeRequest>,
827 ) -> Self::Future {
828 let inner = Arc::clone(&self.0);
829 let fut = async move {
830 <T as UserService>::grant_privilege(&inner, request).await
831 };
832 Box::pin(fut)
833 }
834 }
835 let accept_compression_encodings = self.accept_compression_encodings;
836 let send_compression_encodings = self.send_compression_encodings;
837 let max_decoding_message_size = self.max_decoding_message_size;
838 let max_encoding_message_size = self.max_encoding_message_size;
839 let inner = self.inner.clone();
840 let fut = async move {
841 let method = GrantPrivilegeSvc(inner);
842 let codec = tonic::codec::ProstCodec::default();
843 let mut grpc = tonic::server::Grpc::new(codec)
844 .apply_compression_config(
845 accept_compression_encodings,
846 send_compression_encodings,
847 )
848 .apply_max_message_size_config(
849 max_decoding_message_size,
850 max_encoding_message_size,
851 );
852 let res = grpc.unary(method, req).await;
853 Ok(res)
854 };
855 Box::pin(fut)
856 }
857 "/user.UserService/RevokePrivilege" => {
858 #[allow(non_camel_case_types)]
859 struct RevokePrivilegeSvc<T: UserService>(pub Arc<T>);
860 impl<
861 T: UserService,
862 > tonic::server::UnaryService<super::RevokePrivilegeRequest>
863 for RevokePrivilegeSvc<T> {
864 type Response = super::RevokePrivilegeResponse;
865 type Future = BoxFuture<
866 tonic::Response<Self::Response>,
867 tonic::Status,
868 >;
869 fn call(
870 &mut self,
871 request: tonic::Request<super::RevokePrivilegeRequest>,
872 ) -> Self::Future {
873 let inner = Arc::clone(&self.0);
874 let fut = async move {
875 <T as UserService>::revoke_privilege(&inner, request).await
876 };
877 Box::pin(fut)
878 }
879 }
880 let accept_compression_encodings = self.accept_compression_encodings;
881 let send_compression_encodings = self.send_compression_encodings;
882 let max_decoding_message_size = self.max_decoding_message_size;
883 let max_encoding_message_size = self.max_encoding_message_size;
884 let inner = self.inner.clone();
885 let fut = async move {
886 let method = RevokePrivilegeSvc(inner);
887 let codec = tonic::codec::ProstCodec::default();
888 let mut grpc = tonic::server::Grpc::new(codec)
889 .apply_compression_config(
890 accept_compression_encodings,
891 send_compression_encodings,
892 )
893 .apply_max_message_size_config(
894 max_decoding_message_size,
895 max_encoding_message_size,
896 );
897 let res = grpc.unary(method, req).await;
898 Ok(res)
899 };
900 Box::pin(fut)
901 }
902 _ => {
903 Box::pin(async move {
904 let mut response = http::Response::new(empty_body());
905 let headers = response.headers_mut();
906 headers
907 .insert(
908 tonic::Status::GRPC_STATUS,
909 (tonic::Code::Unimplemented as i32).into(),
910 );
911 headers
912 .insert(
913 http::header::CONTENT_TYPE,
914 tonic::metadata::GRPC_CONTENT_TYPE,
915 );
916 Ok(response)
917 })
918 }
919 }
920 }
921 }
922 impl<T> Clone for UserServiceServer<T> {
923 fn clone(&self) -> Self {
924 let inner = self.inner.clone();
925 Self {
926 inner,
927 accept_compression_encodings: self.accept_compression_encodings,
928 send_compression_encodings: self.send_compression_encodings,
929 max_decoding_message_size: self.max_decoding_message_size,
930 max_encoding_message_size: self.max_encoding_message_size,
931 }
932 }
933 }
934 pub const SERVICE_NAME: &str = "user.UserService";
936 impl<T> tonic::server::NamedService for UserServiceServer<T> {
937 const NAME: &'static str = SERVICE_NAME;
938 }
939}