risingwave_pb/
user.rs

1// This file is @generated by prost-build.
2/// AuthInfo is the information required to login to a server.
3#[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}
16/// Nested message and enum types in `AuthInfo`.
17pub 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        /// String value of the enum field names used in the ProtoBuf definition.
40        ///
41        /// The values are not transformed in any way and thus are considered stable
42        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
43        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        /// Creates an enum from field names used in the ProtoBuf definition.
53        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/// User defines a user in the system.
66#[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    /// / Granted privileges will be only updated through the command of GRANT/REVOKE.
84    #[prost(message, repeated, tag = "8")]
85    pub grant_privileges: ::prost::alloc::vec::Vec<GrantPrivilege>,
86    #[prost(bool, tag = "9")]
87    pub is_admin: bool,
88}
89/// GrantPrivilege defines a privilege granted to a user.
90#[derive(prost_helpers::AnyPB)]
91#[derive(Clone, PartialEq, ::prost::Message)]
92pub struct GrantPrivilege {
93    #[prost(message, repeated, tag = "20")]
94    pub action_with_opts: ::prost::alloc::vec::Vec<
95        grant_privilege::ActionWithGrantOption,
96    >,
97    #[prost(oneof = "grant_privilege::Object", tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10")]
98    pub object: ::core::option::Option<grant_privilege::Object>,
99}
100/// Nested message and enum types in `GrantPrivilege`.
101pub mod grant_privilege {
102    #[derive(prost_helpers::AnyPB)]
103    #[derive(Clone, Copy, PartialEq, ::prost::Message)]
104    pub struct ActionWithGrantOption {
105        #[prost(enumeration = "super::Action", tag = "1")]
106        pub action: i32,
107        #[prost(bool, tag = "2")]
108        pub with_grant_option: bool,
109        #[prost(uint32, tag = "3")]
110        pub granted_by: u32,
111    }
112    #[derive(prost_helpers::AnyPB)]
113    #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
114    pub enum Object {
115        #[prost(uint32, tag = "1")]
116        DatabaseId(u32),
117        #[prost(uint32, tag = "2")]
118        SchemaId(u32),
119        #[prost(uint32, tag = "3")]
120        TableId(u32),
121        #[prost(uint32, tag = "4")]
122        SourceId(u32),
123        #[prost(uint32, tag = "5")]
124        SinkId(u32),
125        #[prost(uint32, tag = "6")]
126        ViewId(u32),
127        #[prost(uint32, tag = "7")]
128        FunctionId(u32),
129        #[prost(uint32, tag = "8")]
130        SubscriptionId(u32),
131        #[prost(uint32, tag = "9")]
132        ConnectionId(u32),
133        #[prost(uint32, tag = "10")]
134        SecretId(u32),
135    }
136}
137#[derive(prost_helpers::AnyPB)]
138#[derive(Clone, PartialEq, ::prost::Message)]
139pub struct CreateUserRequest {
140    #[prost(message, optional, tag = "1")]
141    pub user: ::core::option::Option<UserInfo>,
142}
143#[derive(prost_helpers::AnyPB)]
144#[derive(Clone, PartialEq, ::prost::Message)]
145pub struct CreateUserResponse {
146    #[prost(message, optional, tag = "1")]
147    pub status: ::core::option::Option<super::common::Status>,
148    #[prost(uint64, tag = "2")]
149    pub version: u64,
150}
151#[derive(prost_helpers::AnyPB)]
152#[derive(Clone, Copy, PartialEq, ::prost::Message)]
153pub struct DropUserRequest {
154    #[prost(uint32, tag = "1")]
155    pub user_id: u32,
156}
157#[derive(prost_helpers::AnyPB)]
158#[derive(Clone, PartialEq, ::prost::Message)]
159pub struct DropUserResponse {
160    #[prost(message, optional, tag = "1")]
161    pub status: ::core::option::Option<super::common::Status>,
162    #[prost(uint64, tag = "2")]
163    pub version: u64,
164}
165#[derive(prost_helpers::AnyPB)]
166#[derive(Clone, PartialEq, ::prost::Message)]
167pub struct UpdateUserRequest {
168    #[prost(message, optional, tag = "1")]
169    pub user: ::core::option::Option<UserInfo>,
170    #[prost(enumeration = "update_user_request::UpdateField", repeated, tag = "2")]
171    pub update_fields: ::prost::alloc::vec::Vec<i32>,
172}
173/// Nested message and enum types in `UpdateUserRequest`.
174pub mod update_user_request {
175    #[derive(prost_helpers::AnyPB)]
176    #[derive(
177        Clone,
178        Copy,
179        Debug,
180        PartialEq,
181        Eq,
182        Hash,
183        PartialOrd,
184        Ord,
185        ::prost::Enumeration
186    )]
187    #[repr(i32)]
188    pub enum UpdateField {
189        Unspecified = 0,
190        Super = 1,
191        Login = 2,
192        CreateDb = 3,
193        AuthInfo = 4,
194        Rename = 5,
195        CreateUser = 6,
196        Admin = 7,
197    }
198    impl UpdateField {
199        /// String value of the enum field names used in the ProtoBuf definition.
200        ///
201        /// The values are not transformed in any way and thus are considered stable
202        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
203        pub fn as_str_name(&self) -> &'static str {
204            match self {
205                Self::Unspecified => "UNSPECIFIED",
206                Self::Super => "SUPER",
207                Self::Login => "LOGIN",
208                Self::CreateDb => "CREATE_DB",
209                Self::AuthInfo => "AUTH_INFO",
210                Self::Rename => "RENAME",
211                Self::CreateUser => "CREATE_USER",
212                Self::Admin => "ADMIN",
213            }
214        }
215        /// Creates an enum from field names used in the ProtoBuf definition.
216        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
217            match value {
218                "UNSPECIFIED" => Some(Self::Unspecified),
219                "SUPER" => Some(Self::Super),
220                "LOGIN" => Some(Self::Login),
221                "CREATE_DB" => Some(Self::CreateDb),
222                "AUTH_INFO" => Some(Self::AuthInfo),
223                "RENAME" => Some(Self::Rename),
224                "CREATE_USER" => Some(Self::CreateUser),
225                "ADMIN" => Some(Self::Admin),
226                _ => None,
227            }
228        }
229    }
230}
231#[derive(prost_helpers::AnyPB)]
232#[derive(Clone, PartialEq, ::prost::Message)]
233pub struct UpdateUserResponse {
234    #[prost(message, optional, tag = "1")]
235    pub status: ::core::option::Option<super::common::Status>,
236    #[prost(uint64, tag = "2")]
237    pub version: u64,
238}
239#[derive(prost_helpers::AnyPB)]
240#[derive(Clone, PartialEq, ::prost::Message)]
241pub struct GrantPrivilegeRequest {
242    #[prost(uint32, repeated, tag = "1")]
243    pub user_ids: ::prost::alloc::vec::Vec<u32>,
244    #[prost(message, repeated, tag = "2")]
245    pub privileges: ::prost::alloc::vec::Vec<GrantPrivilege>,
246    #[prost(bool, tag = "3")]
247    pub with_grant_option: bool,
248    #[prost(uint32, tag = "4")]
249    pub granted_by: u32,
250}
251#[derive(prost_helpers::AnyPB)]
252#[derive(Clone, PartialEq, ::prost::Message)]
253pub struct GrantPrivilegeResponse {
254    #[prost(message, optional, tag = "1")]
255    pub status: ::core::option::Option<super::common::Status>,
256    #[prost(uint64, tag = "2")]
257    pub version: u64,
258}
259#[derive(prost_helpers::AnyPB)]
260#[derive(Clone, PartialEq, ::prost::Message)]
261pub struct RevokePrivilegeRequest {
262    #[prost(uint32, repeated, tag = "1")]
263    pub user_ids: ::prost::alloc::vec::Vec<u32>,
264    #[prost(message, repeated, tag = "2")]
265    pub privileges: ::prost::alloc::vec::Vec<GrantPrivilege>,
266    #[prost(uint32, tag = "3")]
267    pub granted_by: u32,
268    #[prost(uint32, tag = "4")]
269    pub revoke_by: u32,
270    #[prost(bool, tag = "5")]
271    pub revoke_grant_option: bool,
272    #[prost(bool, tag = "6")]
273    pub cascade: bool,
274}
275#[derive(prost_helpers::AnyPB)]
276#[derive(Clone, PartialEq, ::prost::Message)]
277pub struct RevokePrivilegeResponse {
278    #[prost(message, optional, tag = "1")]
279    pub status: ::core::option::Option<super::common::Status>,
280    #[prost(uint64, tag = "2")]
281    pub version: u64,
282}
283#[derive(prost_helpers::AnyPB)]
284#[derive(Clone, PartialEq, ::prost::Message)]
285pub struct AlterDefaultPrivilegeRequest {
286    #[prost(uint32, repeated, tag = "1")]
287    pub user_ids: ::prost::alloc::vec::Vec<u32>,
288    #[prost(uint32, tag = "2")]
289    pub database_id: u32,
290    #[prost(uint32, repeated, tag = "3")]
291    pub schema_ids: ::prost::alloc::vec::Vec<u32>,
292    #[prost(uint32, tag = "6")]
293    pub granted_by: u32,
294    #[prost(oneof = "alter_default_privilege_request::Operation", tags = "4, 5")]
295    pub operation: ::core::option::Option<alter_default_privilege_request::Operation>,
296}
297/// Nested message and enum types in `AlterDefaultPrivilegeRequest`.
298pub mod alter_default_privilege_request {
299    #[derive(prost_helpers::AnyPB)]
300    #[derive(Clone, PartialEq, ::prost::Message)]
301    pub struct GrantPrivilege {
302        #[prost(enumeration = "super::Action", repeated, tag = "1")]
303        pub actions: ::prost::alloc::vec::Vec<i32>,
304        #[prost(enumeration = "super::super::common::ObjectType", tag = "2")]
305        pub object_type: i32,
306        #[prost(uint32, repeated, tag = "3")]
307        pub grantees: ::prost::alloc::vec::Vec<u32>,
308        #[prost(bool, tag = "4")]
309        pub with_grant_option: bool,
310    }
311    #[derive(prost_helpers::AnyPB)]
312    #[derive(Clone, PartialEq, ::prost::Message)]
313    pub struct RevokePrivilege {
314        #[prost(enumeration = "super::Action", repeated, tag = "1")]
315        pub actions: ::prost::alloc::vec::Vec<i32>,
316        #[prost(enumeration = "super::super::common::ObjectType", tag = "2")]
317        pub object_type: i32,
318        #[prost(uint32, repeated, tag = "3")]
319        pub grantees: ::prost::alloc::vec::Vec<u32>,
320        #[prost(bool, tag = "4")]
321        pub revoke_grant_option: bool,
322    }
323    #[derive(prost_helpers::AnyPB)]
324    #[derive(Clone, PartialEq, ::prost::Oneof)]
325    pub enum Operation {
326        #[prost(message, tag = "4")]
327        GrantPrivilege(GrantPrivilege),
328        #[prost(message, tag = "5")]
329        RevokePrivilege(RevokePrivilege),
330    }
331}
332#[derive(prost_helpers::AnyPB)]
333#[derive(Clone, PartialEq, ::prost::Message)]
334pub struct AlterDefaultPrivilegeResponse {
335    #[prost(message, optional, tag = "1")]
336    pub status: ::core::option::Option<super::common::Status>,
337}
338#[derive(prost_helpers::AnyPB)]
339#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
340#[repr(i32)]
341pub enum Action {
342    Unspecified = 0,
343    Select = 1,
344    Insert = 2,
345    Update = 3,
346    Delete = 4,
347    Create = 5,
348    Connect = 6,
349    Usage = 7,
350    Execute = 8,
351}
352impl Action {
353    /// String value of the enum field names used in the ProtoBuf definition.
354    ///
355    /// The values are not transformed in any way and thus are considered stable
356    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
357    pub fn as_str_name(&self) -> &'static str {
358        match self {
359            Self::Unspecified => "UNSPECIFIED",
360            Self::Select => "SELECT",
361            Self::Insert => "INSERT",
362            Self::Update => "UPDATE",
363            Self::Delete => "DELETE",
364            Self::Create => "CREATE",
365            Self::Connect => "CONNECT",
366            Self::Usage => "USAGE",
367            Self::Execute => "EXECUTE",
368        }
369    }
370    /// Creates an enum from field names used in the ProtoBuf definition.
371    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
372        match value {
373            "UNSPECIFIED" => Some(Self::Unspecified),
374            "SELECT" => Some(Self::Select),
375            "INSERT" => Some(Self::Insert),
376            "UPDATE" => Some(Self::Update),
377            "DELETE" => Some(Self::Delete),
378            "CREATE" => Some(Self::Create),
379            "CONNECT" => Some(Self::Connect),
380            "USAGE" => Some(Self::Usage),
381            "EXECUTE" => Some(Self::Execute),
382            _ => None,
383        }
384    }
385}
386/// Generated client implementations.
387pub mod user_service_client {
388    #![allow(
389        unused_variables,
390        dead_code,
391        missing_docs,
392        clippy::wildcard_imports,
393        clippy::let_unit_value,
394    )]
395    use tonic::codegen::*;
396    use tonic::codegen::http::Uri;
397    #[derive(Debug, Clone)]
398    pub struct UserServiceClient<T> {
399        inner: tonic::client::Grpc<T>,
400    }
401    impl UserServiceClient<tonic::transport::Channel> {
402        /// Attempt to create a new client by connecting to a given endpoint.
403        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
404        where
405            D: TryInto<tonic::transport::Endpoint>,
406            D::Error: Into<StdError>,
407        {
408            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
409            Ok(Self::new(conn))
410        }
411    }
412    impl<T> UserServiceClient<T>
413    where
414        T: tonic::client::GrpcService<tonic::body::BoxBody>,
415        T::Error: Into<StdError>,
416        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
417        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
418    {
419        pub fn new(inner: T) -> Self {
420            let inner = tonic::client::Grpc::new(inner);
421            Self { inner }
422        }
423        pub fn with_origin(inner: T, origin: Uri) -> Self {
424            let inner = tonic::client::Grpc::with_origin(inner, origin);
425            Self { inner }
426        }
427        pub fn with_interceptor<F>(
428            inner: T,
429            interceptor: F,
430        ) -> UserServiceClient<InterceptedService<T, F>>
431        where
432            F: tonic::service::Interceptor,
433            T::ResponseBody: Default,
434            T: tonic::codegen::Service<
435                http::Request<tonic::body::BoxBody>,
436                Response = http::Response<
437                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
438                >,
439            >,
440            <T as tonic::codegen::Service<
441                http::Request<tonic::body::BoxBody>,
442            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
443        {
444            UserServiceClient::new(InterceptedService::new(inner, interceptor))
445        }
446        /// Compress requests with the given encoding.
447        ///
448        /// This requires the server to support it otherwise it might respond with an
449        /// error.
450        #[must_use]
451        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
452            self.inner = self.inner.send_compressed(encoding);
453            self
454        }
455        /// Enable decompressing responses.
456        #[must_use]
457        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
458            self.inner = self.inner.accept_compressed(encoding);
459            self
460        }
461        /// Limits the maximum size of a decoded message.
462        ///
463        /// Default: `4MB`
464        #[must_use]
465        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
466            self.inner = self.inner.max_decoding_message_size(limit);
467            self
468        }
469        /// Limits the maximum size of an encoded message.
470        ///
471        /// Default: `usize::MAX`
472        #[must_use]
473        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
474            self.inner = self.inner.max_encoding_message_size(limit);
475            self
476        }
477        pub async fn create_user(
478            &mut self,
479            request: impl tonic::IntoRequest<super::CreateUserRequest>,
480        ) -> std::result::Result<
481            tonic::Response<super::CreateUserResponse>,
482            tonic::Status,
483        > {
484            self.inner
485                .ready()
486                .await
487                .map_err(|e| {
488                    tonic::Status::unknown(
489                        format!("Service was not ready: {}", e.into()),
490                    )
491                })?;
492            let codec = tonic::codec::ProstCodec::default();
493            let path = http::uri::PathAndQuery::from_static(
494                "/user.UserService/CreateUser",
495            );
496            let mut req = request.into_request();
497            req.extensions_mut()
498                .insert(GrpcMethod::new("user.UserService", "CreateUser"));
499            self.inner.unary(req, path, codec).await
500        }
501        pub async fn drop_user(
502            &mut self,
503            request: impl tonic::IntoRequest<super::DropUserRequest>,
504        ) -> std::result::Result<
505            tonic::Response<super::DropUserResponse>,
506            tonic::Status,
507        > {
508            self.inner
509                .ready()
510                .await
511                .map_err(|e| {
512                    tonic::Status::unknown(
513                        format!("Service was not ready: {}", e.into()),
514                    )
515                })?;
516            let codec = tonic::codec::ProstCodec::default();
517            let path = http::uri::PathAndQuery::from_static(
518                "/user.UserService/DropUser",
519            );
520            let mut req = request.into_request();
521            req.extensions_mut().insert(GrpcMethod::new("user.UserService", "DropUser"));
522            self.inner.unary(req, path, codec).await
523        }
524        pub async fn update_user(
525            &mut self,
526            request: impl tonic::IntoRequest<super::UpdateUserRequest>,
527        ) -> std::result::Result<
528            tonic::Response<super::UpdateUserResponse>,
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/UpdateUser",
542            );
543            let mut req = request.into_request();
544            req.extensions_mut()
545                .insert(GrpcMethod::new("user.UserService", "UpdateUser"));
546            self.inner.unary(req, path, codec).await
547        }
548        /// GrantPrivilege grants a privilege to a user.
549        pub async fn grant_privilege(
550            &mut self,
551            request: impl tonic::IntoRequest<super::GrantPrivilegeRequest>,
552        ) -> std::result::Result<
553            tonic::Response<super::GrantPrivilegeResponse>,
554            tonic::Status,
555        > {
556            self.inner
557                .ready()
558                .await
559                .map_err(|e| {
560                    tonic::Status::unknown(
561                        format!("Service was not ready: {}", e.into()),
562                    )
563                })?;
564            let codec = tonic::codec::ProstCodec::default();
565            let path = http::uri::PathAndQuery::from_static(
566                "/user.UserService/GrantPrivilege",
567            );
568            let mut req = request.into_request();
569            req.extensions_mut()
570                .insert(GrpcMethod::new("user.UserService", "GrantPrivilege"));
571            self.inner.unary(req, path, codec).await
572        }
573        /// RevokePrivilege revokes a privilege from a user.
574        pub async fn revoke_privilege(
575            &mut self,
576            request: impl tonic::IntoRequest<super::RevokePrivilegeRequest>,
577        ) -> std::result::Result<
578            tonic::Response<super::RevokePrivilegeResponse>,
579            tonic::Status,
580        > {
581            self.inner
582                .ready()
583                .await
584                .map_err(|e| {
585                    tonic::Status::unknown(
586                        format!("Service was not ready: {}", e.into()),
587                    )
588                })?;
589            let codec = tonic::codec::ProstCodec::default();
590            let path = http::uri::PathAndQuery::from_static(
591                "/user.UserService/RevokePrivilege",
592            );
593            let mut req = request.into_request();
594            req.extensions_mut()
595                .insert(GrpcMethod::new("user.UserService", "RevokePrivilege"));
596            self.inner.unary(req, path, codec).await
597        }
598        /// AlterDefaultPrivilege alters the default privileges.
599        pub async fn alter_default_privilege(
600            &mut self,
601            request: impl tonic::IntoRequest<super::AlterDefaultPrivilegeRequest>,
602        ) -> std::result::Result<
603            tonic::Response<super::AlterDefaultPrivilegeResponse>,
604            tonic::Status,
605        > {
606            self.inner
607                .ready()
608                .await
609                .map_err(|e| {
610                    tonic::Status::unknown(
611                        format!("Service was not ready: {}", e.into()),
612                    )
613                })?;
614            let codec = tonic::codec::ProstCodec::default();
615            let path = http::uri::PathAndQuery::from_static(
616                "/user.UserService/AlterDefaultPrivilege",
617            );
618            let mut req = request.into_request();
619            req.extensions_mut()
620                .insert(GrpcMethod::new("user.UserService", "AlterDefaultPrivilege"));
621            self.inner.unary(req, path, codec).await
622        }
623    }
624}
625/// Generated server implementations.
626pub mod user_service_server {
627    #![allow(
628        unused_variables,
629        dead_code,
630        missing_docs,
631        clippy::wildcard_imports,
632        clippy::let_unit_value,
633    )]
634    use tonic::codegen::*;
635    /// Generated trait containing gRPC methods that should be implemented for use with UserServiceServer.
636    #[async_trait]
637    pub trait UserService: std::marker::Send + std::marker::Sync + 'static {
638        async fn create_user(
639            &self,
640            request: tonic::Request<super::CreateUserRequest>,
641        ) -> std::result::Result<
642            tonic::Response<super::CreateUserResponse>,
643            tonic::Status,
644        >;
645        async fn drop_user(
646            &self,
647            request: tonic::Request<super::DropUserRequest>,
648        ) -> std::result::Result<
649            tonic::Response<super::DropUserResponse>,
650            tonic::Status,
651        >;
652        async fn update_user(
653            &self,
654            request: tonic::Request<super::UpdateUserRequest>,
655        ) -> std::result::Result<
656            tonic::Response<super::UpdateUserResponse>,
657            tonic::Status,
658        >;
659        /// GrantPrivilege grants a privilege to a user.
660        async fn grant_privilege(
661            &self,
662            request: tonic::Request<super::GrantPrivilegeRequest>,
663        ) -> std::result::Result<
664            tonic::Response<super::GrantPrivilegeResponse>,
665            tonic::Status,
666        >;
667        /// RevokePrivilege revokes a privilege from a user.
668        async fn revoke_privilege(
669            &self,
670            request: tonic::Request<super::RevokePrivilegeRequest>,
671        ) -> std::result::Result<
672            tonic::Response<super::RevokePrivilegeResponse>,
673            tonic::Status,
674        >;
675        /// AlterDefaultPrivilege alters the default privileges.
676        async fn alter_default_privilege(
677            &self,
678            request: tonic::Request<super::AlterDefaultPrivilegeRequest>,
679        ) -> std::result::Result<
680            tonic::Response<super::AlterDefaultPrivilegeResponse>,
681            tonic::Status,
682        >;
683    }
684    #[derive(Debug)]
685    pub struct UserServiceServer<T> {
686        inner: Arc<T>,
687        accept_compression_encodings: EnabledCompressionEncodings,
688        send_compression_encodings: EnabledCompressionEncodings,
689        max_decoding_message_size: Option<usize>,
690        max_encoding_message_size: Option<usize>,
691    }
692    impl<T> UserServiceServer<T> {
693        pub fn new(inner: T) -> Self {
694            Self::from_arc(Arc::new(inner))
695        }
696        pub fn from_arc(inner: Arc<T>) -> Self {
697            Self {
698                inner,
699                accept_compression_encodings: Default::default(),
700                send_compression_encodings: Default::default(),
701                max_decoding_message_size: None,
702                max_encoding_message_size: None,
703            }
704        }
705        pub fn with_interceptor<F>(
706            inner: T,
707            interceptor: F,
708        ) -> InterceptedService<Self, F>
709        where
710            F: tonic::service::Interceptor,
711        {
712            InterceptedService::new(Self::new(inner), interceptor)
713        }
714        /// Enable decompressing requests with the given encoding.
715        #[must_use]
716        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
717            self.accept_compression_encodings.enable(encoding);
718            self
719        }
720        /// Compress responses with the given encoding, if the client supports it.
721        #[must_use]
722        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
723            self.send_compression_encodings.enable(encoding);
724            self
725        }
726        /// Limits the maximum size of a decoded message.
727        ///
728        /// Default: `4MB`
729        #[must_use]
730        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
731            self.max_decoding_message_size = Some(limit);
732            self
733        }
734        /// Limits the maximum size of an encoded message.
735        ///
736        /// Default: `usize::MAX`
737        #[must_use]
738        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
739            self.max_encoding_message_size = Some(limit);
740            self
741        }
742    }
743    impl<T, B> tonic::codegen::Service<http::Request<B>> for UserServiceServer<T>
744    where
745        T: UserService,
746        B: Body + std::marker::Send + 'static,
747        B::Error: Into<StdError> + std::marker::Send + 'static,
748    {
749        type Response = http::Response<tonic::body::BoxBody>;
750        type Error = std::convert::Infallible;
751        type Future = BoxFuture<Self::Response, Self::Error>;
752        fn poll_ready(
753            &mut self,
754            _cx: &mut Context<'_>,
755        ) -> Poll<std::result::Result<(), Self::Error>> {
756            Poll::Ready(Ok(()))
757        }
758        fn call(&mut self, req: http::Request<B>) -> Self::Future {
759            match req.uri().path() {
760                "/user.UserService/CreateUser" => {
761                    #[allow(non_camel_case_types)]
762                    struct CreateUserSvc<T: UserService>(pub Arc<T>);
763                    impl<
764                        T: UserService,
765                    > tonic::server::UnaryService<super::CreateUserRequest>
766                    for CreateUserSvc<T> {
767                        type Response = super::CreateUserResponse;
768                        type Future = BoxFuture<
769                            tonic::Response<Self::Response>,
770                            tonic::Status,
771                        >;
772                        fn call(
773                            &mut self,
774                            request: tonic::Request<super::CreateUserRequest>,
775                        ) -> Self::Future {
776                            let inner = Arc::clone(&self.0);
777                            let fut = async move {
778                                <T as UserService>::create_user(&inner, request).await
779                            };
780                            Box::pin(fut)
781                        }
782                    }
783                    let accept_compression_encodings = self.accept_compression_encodings;
784                    let send_compression_encodings = self.send_compression_encodings;
785                    let max_decoding_message_size = self.max_decoding_message_size;
786                    let max_encoding_message_size = self.max_encoding_message_size;
787                    let inner = self.inner.clone();
788                    let fut = async move {
789                        let method = CreateUserSvc(inner);
790                        let codec = tonic::codec::ProstCodec::default();
791                        let mut grpc = tonic::server::Grpc::new(codec)
792                            .apply_compression_config(
793                                accept_compression_encodings,
794                                send_compression_encodings,
795                            )
796                            .apply_max_message_size_config(
797                                max_decoding_message_size,
798                                max_encoding_message_size,
799                            );
800                        let res = grpc.unary(method, req).await;
801                        Ok(res)
802                    };
803                    Box::pin(fut)
804                }
805                "/user.UserService/DropUser" => {
806                    #[allow(non_camel_case_types)]
807                    struct DropUserSvc<T: UserService>(pub Arc<T>);
808                    impl<
809                        T: UserService,
810                    > tonic::server::UnaryService<super::DropUserRequest>
811                    for DropUserSvc<T> {
812                        type Response = super::DropUserResponse;
813                        type Future = BoxFuture<
814                            tonic::Response<Self::Response>,
815                            tonic::Status,
816                        >;
817                        fn call(
818                            &mut self,
819                            request: tonic::Request<super::DropUserRequest>,
820                        ) -> Self::Future {
821                            let inner = Arc::clone(&self.0);
822                            let fut = async move {
823                                <T as UserService>::drop_user(&inner, request).await
824                            };
825                            Box::pin(fut)
826                        }
827                    }
828                    let accept_compression_encodings = self.accept_compression_encodings;
829                    let send_compression_encodings = self.send_compression_encodings;
830                    let max_decoding_message_size = self.max_decoding_message_size;
831                    let max_encoding_message_size = self.max_encoding_message_size;
832                    let inner = self.inner.clone();
833                    let fut = async move {
834                        let method = DropUserSvc(inner);
835                        let codec = tonic::codec::ProstCodec::default();
836                        let mut grpc = tonic::server::Grpc::new(codec)
837                            .apply_compression_config(
838                                accept_compression_encodings,
839                                send_compression_encodings,
840                            )
841                            .apply_max_message_size_config(
842                                max_decoding_message_size,
843                                max_encoding_message_size,
844                            );
845                        let res = grpc.unary(method, req).await;
846                        Ok(res)
847                    };
848                    Box::pin(fut)
849                }
850                "/user.UserService/UpdateUser" => {
851                    #[allow(non_camel_case_types)]
852                    struct UpdateUserSvc<T: UserService>(pub Arc<T>);
853                    impl<
854                        T: UserService,
855                    > tonic::server::UnaryService<super::UpdateUserRequest>
856                    for UpdateUserSvc<T> {
857                        type Response = super::UpdateUserResponse;
858                        type Future = BoxFuture<
859                            tonic::Response<Self::Response>,
860                            tonic::Status,
861                        >;
862                        fn call(
863                            &mut self,
864                            request: tonic::Request<super::UpdateUserRequest>,
865                        ) -> Self::Future {
866                            let inner = Arc::clone(&self.0);
867                            let fut = async move {
868                                <T as UserService>::update_user(&inner, request).await
869                            };
870                            Box::pin(fut)
871                        }
872                    }
873                    let accept_compression_encodings = self.accept_compression_encodings;
874                    let send_compression_encodings = self.send_compression_encodings;
875                    let max_decoding_message_size = self.max_decoding_message_size;
876                    let max_encoding_message_size = self.max_encoding_message_size;
877                    let inner = self.inner.clone();
878                    let fut = async move {
879                        let method = UpdateUserSvc(inner);
880                        let codec = tonic::codec::ProstCodec::default();
881                        let mut grpc = tonic::server::Grpc::new(codec)
882                            .apply_compression_config(
883                                accept_compression_encodings,
884                                send_compression_encodings,
885                            )
886                            .apply_max_message_size_config(
887                                max_decoding_message_size,
888                                max_encoding_message_size,
889                            );
890                        let res = grpc.unary(method, req).await;
891                        Ok(res)
892                    };
893                    Box::pin(fut)
894                }
895                "/user.UserService/GrantPrivilege" => {
896                    #[allow(non_camel_case_types)]
897                    struct GrantPrivilegeSvc<T: UserService>(pub Arc<T>);
898                    impl<
899                        T: UserService,
900                    > tonic::server::UnaryService<super::GrantPrivilegeRequest>
901                    for GrantPrivilegeSvc<T> {
902                        type Response = super::GrantPrivilegeResponse;
903                        type Future = BoxFuture<
904                            tonic::Response<Self::Response>,
905                            tonic::Status,
906                        >;
907                        fn call(
908                            &mut self,
909                            request: tonic::Request<super::GrantPrivilegeRequest>,
910                        ) -> Self::Future {
911                            let inner = Arc::clone(&self.0);
912                            let fut = async move {
913                                <T as UserService>::grant_privilege(&inner, request).await
914                            };
915                            Box::pin(fut)
916                        }
917                    }
918                    let accept_compression_encodings = self.accept_compression_encodings;
919                    let send_compression_encodings = self.send_compression_encodings;
920                    let max_decoding_message_size = self.max_decoding_message_size;
921                    let max_encoding_message_size = self.max_encoding_message_size;
922                    let inner = self.inner.clone();
923                    let fut = async move {
924                        let method = GrantPrivilegeSvc(inner);
925                        let codec = tonic::codec::ProstCodec::default();
926                        let mut grpc = tonic::server::Grpc::new(codec)
927                            .apply_compression_config(
928                                accept_compression_encodings,
929                                send_compression_encodings,
930                            )
931                            .apply_max_message_size_config(
932                                max_decoding_message_size,
933                                max_encoding_message_size,
934                            );
935                        let res = grpc.unary(method, req).await;
936                        Ok(res)
937                    };
938                    Box::pin(fut)
939                }
940                "/user.UserService/RevokePrivilege" => {
941                    #[allow(non_camel_case_types)]
942                    struct RevokePrivilegeSvc<T: UserService>(pub Arc<T>);
943                    impl<
944                        T: UserService,
945                    > tonic::server::UnaryService<super::RevokePrivilegeRequest>
946                    for RevokePrivilegeSvc<T> {
947                        type Response = super::RevokePrivilegeResponse;
948                        type Future = BoxFuture<
949                            tonic::Response<Self::Response>,
950                            tonic::Status,
951                        >;
952                        fn call(
953                            &mut self,
954                            request: tonic::Request<super::RevokePrivilegeRequest>,
955                        ) -> Self::Future {
956                            let inner = Arc::clone(&self.0);
957                            let fut = async move {
958                                <T as UserService>::revoke_privilege(&inner, request).await
959                            };
960                            Box::pin(fut)
961                        }
962                    }
963                    let accept_compression_encodings = self.accept_compression_encodings;
964                    let send_compression_encodings = self.send_compression_encodings;
965                    let max_decoding_message_size = self.max_decoding_message_size;
966                    let max_encoding_message_size = self.max_encoding_message_size;
967                    let inner = self.inner.clone();
968                    let fut = async move {
969                        let method = RevokePrivilegeSvc(inner);
970                        let codec = tonic::codec::ProstCodec::default();
971                        let mut grpc = tonic::server::Grpc::new(codec)
972                            .apply_compression_config(
973                                accept_compression_encodings,
974                                send_compression_encodings,
975                            )
976                            .apply_max_message_size_config(
977                                max_decoding_message_size,
978                                max_encoding_message_size,
979                            );
980                        let res = grpc.unary(method, req).await;
981                        Ok(res)
982                    };
983                    Box::pin(fut)
984                }
985                "/user.UserService/AlterDefaultPrivilege" => {
986                    #[allow(non_camel_case_types)]
987                    struct AlterDefaultPrivilegeSvc<T: UserService>(pub Arc<T>);
988                    impl<
989                        T: UserService,
990                    > tonic::server::UnaryService<super::AlterDefaultPrivilegeRequest>
991                    for AlterDefaultPrivilegeSvc<T> {
992                        type Response = super::AlterDefaultPrivilegeResponse;
993                        type Future = BoxFuture<
994                            tonic::Response<Self::Response>,
995                            tonic::Status,
996                        >;
997                        fn call(
998                            &mut self,
999                            request: tonic::Request<super::AlterDefaultPrivilegeRequest>,
1000                        ) -> Self::Future {
1001                            let inner = Arc::clone(&self.0);
1002                            let fut = async move {
1003                                <T as UserService>::alter_default_privilege(&inner, request)
1004                                    .await
1005                            };
1006                            Box::pin(fut)
1007                        }
1008                    }
1009                    let accept_compression_encodings = self.accept_compression_encodings;
1010                    let send_compression_encodings = self.send_compression_encodings;
1011                    let max_decoding_message_size = self.max_decoding_message_size;
1012                    let max_encoding_message_size = self.max_encoding_message_size;
1013                    let inner = self.inner.clone();
1014                    let fut = async move {
1015                        let method = AlterDefaultPrivilegeSvc(inner);
1016                        let codec = tonic::codec::ProstCodec::default();
1017                        let mut grpc = tonic::server::Grpc::new(codec)
1018                            .apply_compression_config(
1019                                accept_compression_encodings,
1020                                send_compression_encodings,
1021                            )
1022                            .apply_max_message_size_config(
1023                                max_decoding_message_size,
1024                                max_encoding_message_size,
1025                            );
1026                        let res = grpc.unary(method, req).await;
1027                        Ok(res)
1028                    };
1029                    Box::pin(fut)
1030                }
1031                _ => {
1032                    Box::pin(async move {
1033                        let mut response = http::Response::new(empty_body());
1034                        let headers = response.headers_mut();
1035                        headers
1036                            .insert(
1037                                tonic::Status::GRPC_STATUS,
1038                                (tonic::Code::Unimplemented as i32).into(),
1039                            );
1040                        headers
1041                            .insert(
1042                                http::header::CONTENT_TYPE,
1043                                tonic::metadata::GRPC_CONTENT_TYPE,
1044                            );
1045                        Ok(response)
1046                    })
1047                }
1048            }
1049        }
1050    }
1051    impl<T> Clone for UserServiceServer<T> {
1052        fn clone(&self) -> Self {
1053            let inner = self.inner.clone();
1054            Self {
1055                inner,
1056                accept_compression_encodings: self.accept_compression_encodings,
1057                send_compression_encodings: self.send_compression_encodings,
1058                max_decoding_message_size: self.max_decoding_message_size,
1059                max_encoding_message_size: self.max_encoding_message_size,
1060            }
1061        }
1062    }
1063    /// Generated gRPC service name
1064    pub const SERVICE_NAME: &str = "user.UserService";
1065    impl<T> tonic::server::NamedService for UserServiceServer<T> {
1066        const NAME: &'static str = SERVICE_NAME;
1067    }
1068}