risingwave_pb/
user.serde.rs

1use crate::user::*;
2impl serde::Serialize for AuthInfo {
3    #[allow(deprecated)]
4    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5    where
6        S: serde::Serializer,
7    {
8        use serde::ser::SerializeStruct;
9        let mut len = 0;
10        if self.encryption_type != 0 {
11            len += 1;
12        }
13        if !self.encrypted_value.is_empty() {
14            len += 1;
15        }
16        if !self.metadata.is_empty() {
17            len += 1;
18        }
19        let mut struct_ser = serializer.serialize_struct("user.AuthInfo", len)?;
20        if self.encryption_type != 0 {
21            let v = auth_info::EncryptionType::try_from(self.encryption_type)
22                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.encryption_type)))?;
23            struct_ser.serialize_field("encryptionType", &v)?;
24        }
25        if !self.encrypted_value.is_empty() {
26            #[allow(clippy::needless_borrow)]
27            #[allow(clippy::needless_borrows_for_generic_args)]
28            struct_ser.serialize_field("encryptedValue", pbjson::private::base64::encode(&self.encrypted_value).as_str())?;
29        }
30        if !self.metadata.is_empty() {
31            struct_ser.serialize_field("metadata", &self.metadata)?;
32        }
33        struct_ser.end()
34    }
35}
36impl<'de> serde::Deserialize<'de> for AuthInfo {
37    #[allow(deprecated)]
38    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
39    where
40        D: serde::Deserializer<'de>,
41    {
42        const FIELDS: &[&str] = &[
43            "encryption_type",
44            "encryptionType",
45            "encrypted_value",
46            "encryptedValue",
47            "metadata",
48        ];
49
50        #[allow(clippy::enum_variant_names)]
51        enum GeneratedField {
52            EncryptionType,
53            EncryptedValue,
54            Metadata,
55        }
56        impl<'de> serde::Deserialize<'de> for GeneratedField {
57            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
58            where
59                D: serde::Deserializer<'de>,
60            {
61                struct GeneratedVisitor;
62
63                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
64                    type Value = GeneratedField;
65
66                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
67                        write!(formatter, "expected one of: {:?}", &FIELDS)
68                    }
69
70                    #[allow(unused_variables)]
71                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
72                    where
73                        E: serde::de::Error,
74                    {
75                        match value {
76                            "encryptionType" | "encryption_type" => Ok(GeneratedField::EncryptionType),
77                            "encryptedValue" | "encrypted_value" => Ok(GeneratedField::EncryptedValue),
78                            "metadata" => Ok(GeneratedField::Metadata),
79                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
80                        }
81                    }
82                }
83                deserializer.deserialize_identifier(GeneratedVisitor)
84            }
85        }
86        struct GeneratedVisitor;
87        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
88            type Value = AuthInfo;
89
90            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
91                formatter.write_str("struct user.AuthInfo")
92            }
93
94            fn visit_map<V>(self, mut map_: V) -> std::result::Result<AuthInfo, V::Error>
95                where
96                    V: serde::de::MapAccess<'de>,
97            {
98                let mut encryption_type__ = None;
99                let mut encrypted_value__ = None;
100                let mut metadata__ = None;
101                while let Some(k) = map_.next_key()? {
102                    match k {
103                        GeneratedField::EncryptionType => {
104                            if encryption_type__.is_some() {
105                                return Err(serde::de::Error::duplicate_field("encryptionType"));
106                            }
107                            encryption_type__ = Some(map_.next_value::<auth_info::EncryptionType>()? as i32);
108                        }
109                        GeneratedField::EncryptedValue => {
110                            if encrypted_value__.is_some() {
111                                return Err(serde::de::Error::duplicate_field("encryptedValue"));
112                            }
113                            encrypted_value__ = 
114                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
115                            ;
116                        }
117                        GeneratedField::Metadata => {
118                            if metadata__.is_some() {
119                                return Err(serde::de::Error::duplicate_field("metadata"));
120                            }
121                            metadata__ = Some(
122                                map_.next_value::<std::collections::HashMap<_, _>>()?
123                            );
124                        }
125                    }
126                }
127                Ok(AuthInfo {
128                    encryption_type: encryption_type__.unwrap_or_default(),
129                    encrypted_value: encrypted_value__.unwrap_or_default(),
130                    metadata: metadata__.unwrap_or_default(),
131                })
132            }
133        }
134        deserializer.deserialize_struct("user.AuthInfo", FIELDS, GeneratedVisitor)
135    }
136}
137impl serde::Serialize for auth_info::EncryptionType {
138    #[allow(deprecated)]
139    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
140    where
141        S: serde::Serializer,
142    {
143        let variant = match self {
144            Self::Unspecified => "UNSPECIFIED",
145            Self::Plaintext => "PLAINTEXT",
146            Self::Sha256 => "SHA256",
147            Self::Md5 => "MD5",
148            Self::Oauth => "OAUTH",
149        };
150        serializer.serialize_str(variant)
151    }
152}
153impl<'de> serde::Deserialize<'de> for auth_info::EncryptionType {
154    #[allow(deprecated)]
155    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
156    where
157        D: serde::Deserializer<'de>,
158    {
159        const FIELDS: &[&str] = &[
160            "UNSPECIFIED",
161            "PLAINTEXT",
162            "SHA256",
163            "MD5",
164            "OAUTH",
165        ];
166
167        struct GeneratedVisitor;
168
169        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
170            type Value = auth_info::EncryptionType;
171
172            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
173                write!(formatter, "expected one of: {:?}", &FIELDS)
174            }
175
176            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
177            where
178                E: serde::de::Error,
179            {
180                i32::try_from(v)
181                    .ok()
182                    .and_then(|x| x.try_into().ok())
183                    .ok_or_else(|| {
184                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
185                    })
186            }
187
188            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
189            where
190                E: serde::de::Error,
191            {
192                i32::try_from(v)
193                    .ok()
194                    .and_then(|x| x.try_into().ok())
195                    .ok_or_else(|| {
196                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
197                    })
198            }
199
200            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
201            where
202                E: serde::de::Error,
203            {
204                match value {
205                    "UNSPECIFIED" => Ok(auth_info::EncryptionType::Unspecified),
206                    "PLAINTEXT" => Ok(auth_info::EncryptionType::Plaintext),
207                    "SHA256" => Ok(auth_info::EncryptionType::Sha256),
208                    "MD5" => Ok(auth_info::EncryptionType::Md5),
209                    "OAUTH" => Ok(auth_info::EncryptionType::Oauth),
210                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
211                }
212            }
213        }
214        deserializer.deserialize_any(GeneratedVisitor)
215    }
216}
217impl serde::Serialize for CreateUserRequest {
218    #[allow(deprecated)]
219    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
220    where
221        S: serde::Serializer,
222    {
223        use serde::ser::SerializeStruct;
224        let mut len = 0;
225        if self.user.is_some() {
226            len += 1;
227        }
228        let mut struct_ser = serializer.serialize_struct("user.CreateUserRequest", len)?;
229        if let Some(v) = self.user.as_ref() {
230            struct_ser.serialize_field("user", v)?;
231        }
232        struct_ser.end()
233    }
234}
235impl<'de> serde::Deserialize<'de> for CreateUserRequest {
236    #[allow(deprecated)]
237    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
238    where
239        D: serde::Deserializer<'de>,
240    {
241        const FIELDS: &[&str] = &[
242            "user",
243        ];
244
245        #[allow(clippy::enum_variant_names)]
246        enum GeneratedField {
247            User,
248        }
249        impl<'de> serde::Deserialize<'de> for GeneratedField {
250            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
251            where
252                D: serde::Deserializer<'de>,
253            {
254                struct GeneratedVisitor;
255
256                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
257                    type Value = GeneratedField;
258
259                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
260                        write!(formatter, "expected one of: {:?}", &FIELDS)
261                    }
262
263                    #[allow(unused_variables)]
264                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
265                    where
266                        E: serde::de::Error,
267                    {
268                        match value {
269                            "user" => Ok(GeneratedField::User),
270                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
271                        }
272                    }
273                }
274                deserializer.deserialize_identifier(GeneratedVisitor)
275            }
276        }
277        struct GeneratedVisitor;
278        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
279            type Value = CreateUserRequest;
280
281            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
282                formatter.write_str("struct user.CreateUserRequest")
283            }
284
285            fn visit_map<V>(self, mut map_: V) -> std::result::Result<CreateUserRequest, V::Error>
286                where
287                    V: serde::de::MapAccess<'de>,
288            {
289                let mut user__ = None;
290                while let Some(k) = map_.next_key()? {
291                    match k {
292                        GeneratedField::User => {
293                            if user__.is_some() {
294                                return Err(serde::de::Error::duplicate_field("user"));
295                            }
296                            user__ = map_.next_value()?;
297                        }
298                    }
299                }
300                Ok(CreateUserRequest {
301                    user: user__,
302                })
303            }
304        }
305        deserializer.deserialize_struct("user.CreateUserRequest", FIELDS, GeneratedVisitor)
306    }
307}
308impl serde::Serialize for CreateUserResponse {
309    #[allow(deprecated)]
310    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
311    where
312        S: serde::Serializer,
313    {
314        use serde::ser::SerializeStruct;
315        let mut len = 0;
316        if self.status.is_some() {
317            len += 1;
318        }
319        if self.version != 0 {
320            len += 1;
321        }
322        let mut struct_ser = serializer.serialize_struct("user.CreateUserResponse", len)?;
323        if let Some(v) = self.status.as_ref() {
324            struct_ser.serialize_field("status", v)?;
325        }
326        if self.version != 0 {
327            #[allow(clippy::needless_borrow)]
328            #[allow(clippy::needless_borrows_for_generic_args)]
329            struct_ser.serialize_field("version", ToString::to_string(&self.version).as_str())?;
330        }
331        struct_ser.end()
332    }
333}
334impl<'de> serde::Deserialize<'de> for CreateUserResponse {
335    #[allow(deprecated)]
336    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
337    where
338        D: serde::Deserializer<'de>,
339    {
340        const FIELDS: &[&str] = &[
341            "status",
342            "version",
343        ];
344
345        #[allow(clippy::enum_variant_names)]
346        enum GeneratedField {
347            Status,
348            Version,
349        }
350        impl<'de> serde::Deserialize<'de> for GeneratedField {
351            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
352            where
353                D: serde::Deserializer<'de>,
354            {
355                struct GeneratedVisitor;
356
357                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
358                    type Value = GeneratedField;
359
360                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
361                        write!(formatter, "expected one of: {:?}", &FIELDS)
362                    }
363
364                    #[allow(unused_variables)]
365                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
366                    where
367                        E: serde::de::Error,
368                    {
369                        match value {
370                            "status" => Ok(GeneratedField::Status),
371                            "version" => Ok(GeneratedField::Version),
372                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
373                        }
374                    }
375                }
376                deserializer.deserialize_identifier(GeneratedVisitor)
377            }
378        }
379        struct GeneratedVisitor;
380        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
381            type Value = CreateUserResponse;
382
383            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
384                formatter.write_str("struct user.CreateUserResponse")
385            }
386
387            fn visit_map<V>(self, mut map_: V) -> std::result::Result<CreateUserResponse, V::Error>
388                where
389                    V: serde::de::MapAccess<'de>,
390            {
391                let mut status__ = None;
392                let mut version__ = None;
393                while let Some(k) = map_.next_key()? {
394                    match k {
395                        GeneratedField::Status => {
396                            if status__.is_some() {
397                                return Err(serde::de::Error::duplicate_field("status"));
398                            }
399                            status__ = map_.next_value()?;
400                        }
401                        GeneratedField::Version => {
402                            if version__.is_some() {
403                                return Err(serde::de::Error::duplicate_field("version"));
404                            }
405                            version__ = 
406                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
407                            ;
408                        }
409                    }
410                }
411                Ok(CreateUserResponse {
412                    status: status__,
413                    version: version__.unwrap_or_default(),
414                })
415            }
416        }
417        deserializer.deserialize_struct("user.CreateUserResponse", FIELDS, GeneratedVisitor)
418    }
419}
420impl serde::Serialize for DropUserRequest {
421    #[allow(deprecated)]
422    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
423    where
424        S: serde::Serializer,
425    {
426        use serde::ser::SerializeStruct;
427        let mut len = 0;
428        if self.user_id != 0 {
429            len += 1;
430        }
431        let mut struct_ser = serializer.serialize_struct("user.DropUserRequest", len)?;
432        if self.user_id != 0 {
433            struct_ser.serialize_field("userId", &self.user_id)?;
434        }
435        struct_ser.end()
436    }
437}
438impl<'de> serde::Deserialize<'de> for DropUserRequest {
439    #[allow(deprecated)]
440    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
441    where
442        D: serde::Deserializer<'de>,
443    {
444        const FIELDS: &[&str] = &[
445            "user_id",
446            "userId",
447        ];
448
449        #[allow(clippy::enum_variant_names)]
450        enum GeneratedField {
451            UserId,
452        }
453        impl<'de> serde::Deserialize<'de> for GeneratedField {
454            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
455            where
456                D: serde::Deserializer<'de>,
457            {
458                struct GeneratedVisitor;
459
460                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
461                    type Value = GeneratedField;
462
463                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
464                        write!(formatter, "expected one of: {:?}", &FIELDS)
465                    }
466
467                    #[allow(unused_variables)]
468                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
469                    where
470                        E: serde::de::Error,
471                    {
472                        match value {
473                            "userId" | "user_id" => Ok(GeneratedField::UserId),
474                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
475                        }
476                    }
477                }
478                deserializer.deserialize_identifier(GeneratedVisitor)
479            }
480        }
481        struct GeneratedVisitor;
482        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
483            type Value = DropUserRequest;
484
485            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
486                formatter.write_str("struct user.DropUserRequest")
487            }
488
489            fn visit_map<V>(self, mut map_: V) -> std::result::Result<DropUserRequest, V::Error>
490                where
491                    V: serde::de::MapAccess<'de>,
492            {
493                let mut user_id__ = None;
494                while let Some(k) = map_.next_key()? {
495                    match k {
496                        GeneratedField::UserId => {
497                            if user_id__.is_some() {
498                                return Err(serde::de::Error::duplicate_field("userId"));
499                            }
500                            user_id__ = 
501                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
502                            ;
503                        }
504                    }
505                }
506                Ok(DropUserRequest {
507                    user_id: user_id__.unwrap_or_default(),
508                })
509            }
510        }
511        deserializer.deserialize_struct("user.DropUserRequest", FIELDS, GeneratedVisitor)
512    }
513}
514impl serde::Serialize for DropUserResponse {
515    #[allow(deprecated)]
516    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
517    where
518        S: serde::Serializer,
519    {
520        use serde::ser::SerializeStruct;
521        let mut len = 0;
522        if self.status.is_some() {
523            len += 1;
524        }
525        if self.version != 0 {
526            len += 1;
527        }
528        let mut struct_ser = serializer.serialize_struct("user.DropUserResponse", len)?;
529        if let Some(v) = self.status.as_ref() {
530            struct_ser.serialize_field("status", v)?;
531        }
532        if self.version != 0 {
533            #[allow(clippy::needless_borrow)]
534            #[allow(clippy::needless_borrows_for_generic_args)]
535            struct_ser.serialize_field("version", ToString::to_string(&self.version).as_str())?;
536        }
537        struct_ser.end()
538    }
539}
540impl<'de> serde::Deserialize<'de> for DropUserResponse {
541    #[allow(deprecated)]
542    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
543    where
544        D: serde::Deserializer<'de>,
545    {
546        const FIELDS: &[&str] = &[
547            "status",
548            "version",
549        ];
550
551        #[allow(clippy::enum_variant_names)]
552        enum GeneratedField {
553            Status,
554            Version,
555        }
556        impl<'de> serde::Deserialize<'de> for GeneratedField {
557            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
558            where
559                D: serde::Deserializer<'de>,
560            {
561                struct GeneratedVisitor;
562
563                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
564                    type Value = GeneratedField;
565
566                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
567                        write!(formatter, "expected one of: {:?}", &FIELDS)
568                    }
569
570                    #[allow(unused_variables)]
571                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
572                    where
573                        E: serde::de::Error,
574                    {
575                        match value {
576                            "status" => Ok(GeneratedField::Status),
577                            "version" => Ok(GeneratedField::Version),
578                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
579                        }
580                    }
581                }
582                deserializer.deserialize_identifier(GeneratedVisitor)
583            }
584        }
585        struct GeneratedVisitor;
586        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
587            type Value = DropUserResponse;
588
589            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
590                formatter.write_str("struct user.DropUserResponse")
591            }
592
593            fn visit_map<V>(self, mut map_: V) -> std::result::Result<DropUserResponse, V::Error>
594                where
595                    V: serde::de::MapAccess<'de>,
596            {
597                let mut status__ = None;
598                let mut version__ = None;
599                while let Some(k) = map_.next_key()? {
600                    match k {
601                        GeneratedField::Status => {
602                            if status__.is_some() {
603                                return Err(serde::de::Error::duplicate_field("status"));
604                            }
605                            status__ = map_.next_value()?;
606                        }
607                        GeneratedField::Version => {
608                            if version__.is_some() {
609                                return Err(serde::de::Error::duplicate_field("version"));
610                            }
611                            version__ = 
612                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
613                            ;
614                        }
615                    }
616                }
617                Ok(DropUserResponse {
618                    status: status__,
619                    version: version__.unwrap_or_default(),
620                })
621            }
622        }
623        deserializer.deserialize_struct("user.DropUserResponse", FIELDS, GeneratedVisitor)
624    }
625}
626impl serde::Serialize for GrantPrivilege {
627    #[allow(deprecated)]
628    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
629    where
630        S: serde::Serializer,
631    {
632        use serde::ser::SerializeStruct;
633        let mut len = 0;
634        if !self.action_with_opts.is_empty() {
635            len += 1;
636        }
637        if self.object.is_some() {
638            len += 1;
639        }
640        let mut struct_ser = serializer.serialize_struct("user.GrantPrivilege", len)?;
641        if !self.action_with_opts.is_empty() {
642            struct_ser.serialize_field("actionWithOpts", &self.action_with_opts)?;
643        }
644        if let Some(v) = self.object.as_ref() {
645            match v {
646                grant_privilege::Object::DatabaseId(v) => {
647                    struct_ser.serialize_field("databaseId", v)?;
648                }
649                grant_privilege::Object::SchemaId(v) => {
650                    struct_ser.serialize_field("schemaId", v)?;
651                }
652                grant_privilege::Object::TableId(v) => {
653                    struct_ser.serialize_field("tableId", v)?;
654                }
655                grant_privilege::Object::SourceId(v) => {
656                    struct_ser.serialize_field("sourceId", v)?;
657                }
658                grant_privilege::Object::SinkId(v) => {
659                    struct_ser.serialize_field("sinkId", v)?;
660                }
661                grant_privilege::Object::ViewId(v) => {
662                    struct_ser.serialize_field("viewId", v)?;
663                }
664                grant_privilege::Object::FunctionId(v) => {
665                    struct_ser.serialize_field("functionId", v)?;
666                }
667                grant_privilege::Object::SubscriptionId(v) => {
668                    struct_ser.serialize_field("subscriptionId", v)?;
669                }
670                grant_privilege::Object::ConnectionId(v) => {
671                    struct_ser.serialize_field("connectionId", v)?;
672                }
673                grant_privilege::Object::SecretId(v) => {
674                    struct_ser.serialize_field("secretId", v)?;
675                }
676            }
677        }
678        struct_ser.end()
679    }
680}
681impl<'de> serde::Deserialize<'de> for GrantPrivilege {
682    #[allow(deprecated)]
683    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
684    where
685        D: serde::Deserializer<'de>,
686    {
687        const FIELDS: &[&str] = &[
688            "action_with_opts",
689            "actionWithOpts",
690            "database_id",
691            "databaseId",
692            "schema_id",
693            "schemaId",
694            "table_id",
695            "tableId",
696            "source_id",
697            "sourceId",
698            "sink_id",
699            "sinkId",
700            "view_id",
701            "viewId",
702            "function_id",
703            "functionId",
704            "subscription_id",
705            "subscriptionId",
706            "connection_id",
707            "connectionId",
708            "secret_id",
709            "secretId",
710        ];
711
712        #[allow(clippy::enum_variant_names)]
713        enum GeneratedField {
714            ActionWithOpts,
715            DatabaseId,
716            SchemaId,
717            TableId,
718            SourceId,
719            SinkId,
720            ViewId,
721            FunctionId,
722            SubscriptionId,
723            ConnectionId,
724            SecretId,
725        }
726        impl<'de> serde::Deserialize<'de> for GeneratedField {
727            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
728            where
729                D: serde::Deserializer<'de>,
730            {
731                struct GeneratedVisitor;
732
733                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
734                    type Value = GeneratedField;
735
736                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
737                        write!(formatter, "expected one of: {:?}", &FIELDS)
738                    }
739
740                    #[allow(unused_variables)]
741                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
742                    where
743                        E: serde::de::Error,
744                    {
745                        match value {
746                            "actionWithOpts" | "action_with_opts" => Ok(GeneratedField::ActionWithOpts),
747                            "databaseId" | "database_id" => Ok(GeneratedField::DatabaseId),
748                            "schemaId" | "schema_id" => Ok(GeneratedField::SchemaId),
749                            "tableId" | "table_id" => Ok(GeneratedField::TableId),
750                            "sourceId" | "source_id" => Ok(GeneratedField::SourceId),
751                            "sinkId" | "sink_id" => Ok(GeneratedField::SinkId),
752                            "viewId" | "view_id" => Ok(GeneratedField::ViewId),
753                            "functionId" | "function_id" => Ok(GeneratedField::FunctionId),
754                            "subscriptionId" | "subscription_id" => Ok(GeneratedField::SubscriptionId),
755                            "connectionId" | "connection_id" => Ok(GeneratedField::ConnectionId),
756                            "secretId" | "secret_id" => Ok(GeneratedField::SecretId),
757                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
758                        }
759                    }
760                }
761                deserializer.deserialize_identifier(GeneratedVisitor)
762            }
763        }
764        struct GeneratedVisitor;
765        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
766            type Value = GrantPrivilege;
767
768            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
769                formatter.write_str("struct user.GrantPrivilege")
770            }
771
772            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GrantPrivilege, V::Error>
773                where
774                    V: serde::de::MapAccess<'de>,
775            {
776                let mut action_with_opts__ = None;
777                let mut object__ = None;
778                while let Some(k) = map_.next_key()? {
779                    match k {
780                        GeneratedField::ActionWithOpts => {
781                            if action_with_opts__.is_some() {
782                                return Err(serde::de::Error::duplicate_field("actionWithOpts"));
783                            }
784                            action_with_opts__ = Some(map_.next_value()?);
785                        }
786                        GeneratedField::DatabaseId => {
787                            if object__.is_some() {
788                                return Err(serde::de::Error::duplicate_field("databaseId"));
789                            }
790                            object__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| grant_privilege::Object::DatabaseId(x.0));
791                        }
792                        GeneratedField::SchemaId => {
793                            if object__.is_some() {
794                                return Err(serde::de::Error::duplicate_field("schemaId"));
795                            }
796                            object__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| grant_privilege::Object::SchemaId(x.0));
797                        }
798                        GeneratedField::TableId => {
799                            if object__.is_some() {
800                                return Err(serde::de::Error::duplicate_field("tableId"));
801                            }
802                            object__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| grant_privilege::Object::TableId(x.0));
803                        }
804                        GeneratedField::SourceId => {
805                            if object__.is_some() {
806                                return Err(serde::de::Error::duplicate_field("sourceId"));
807                            }
808                            object__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| grant_privilege::Object::SourceId(x.0));
809                        }
810                        GeneratedField::SinkId => {
811                            if object__.is_some() {
812                                return Err(serde::de::Error::duplicate_field("sinkId"));
813                            }
814                            object__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| grant_privilege::Object::SinkId(x.0));
815                        }
816                        GeneratedField::ViewId => {
817                            if object__.is_some() {
818                                return Err(serde::de::Error::duplicate_field("viewId"));
819                            }
820                            object__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| grant_privilege::Object::ViewId(x.0));
821                        }
822                        GeneratedField::FunctionId => {
823                            if object__.is_some() {
824                                return Err(serde::de::Error::duplicate_field("functionId"));
825                            }
826                            object__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| grant_privilege::Object::FunctionId(x.0));
827                        }
828                        GeneratedField::SubscriptionId => {
829                            if object__.is_some() {
830                                return Err(serde::de::Error::duplicate_field("subscriptionId"));
831                            }
832                            object__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| grant_privilege::Object::SubscriptionId(x.0));
833                        }
834                        GeneratedField::ConnectionId => {
835                            if object__.is_some() {
836                                return Err(serde::de::Error::duplicate_field("connectionId"));
837                            }
838                            object__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| grant_privilege::Object::ConnectionId(x.0));
839                        }
840                        GeneratedField::SecretId => {
841                            if object__.is_some() {
842                                return Err(serde::de::Error::duplicate_field("secretId"));
843                            }
844                            object__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| grant_privilege::Object::SecretId(x.0));
845                        }
846                    }
847                }
848                Ok(GrantPrivilege {
849                    action_with_opts: action_with_opts__.unwrap_or_default(),
850                    object: object__,
851                })
852            }
853        }
854        deserializer.deserialize_struct("user.GrantPrivilege", FIELDS, GeneratedVisitor)
855    }
856}
857impl serde::Serialize for grant_privilege::Action {
858    #[allow(deprecated)]
859    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
860    where
861        S: serde::Serializer,
862    {
863        let variant = match self {
864            Self::Unspecified => "UNSPECIFIED",
865            Self::Select => "SELECT",
866            Self::Insert => "INSERT",
867            Self::Update => "UPDATE",
868            Self::Delete => "DELETE",
869            Self::Create => "CREATE",
870            Self::Connect => "CONNECT",
871            Self::Usage => "USAGE",
872            Self::Execute => "EXECUTE",
873        };
874        serializer.serialize_str(variant)
875    }
876}
877impl<'de> serde::Deserialize<'de> for grant_privilege::Action {
878    #[allow(deprecated)]
879    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
880    where
881        D: serde::Deserializer<'de>,
882    {
883        const FIELDS: &[&str] = &[
884            "UNSPECIFIED",
885            "SELECT",
886            "INSERT",
887            "UPDATE",
888            "DELETE",
889            "CREATE",
890            "CONNECT",
891            "USAGE",
892            "EXECUTE",
893        ];
894
895        struct GeneratedVisitor;
896
897        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
898            type Value = grant_privilege::Action;
899
900            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
901                write!(formatter, "expected one of: {:?}", &FIELDS)
902            }
903
904            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
905            where
906                E: serde::de::Error,
907            {
908                i32::try_from(v)
909                    .ok()
910                    .and_then(|x| x.try_into().ok())
911                    .ok_or_else(|| {
912                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
913                    })
914            }
915
916            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
917            where
918                E: serde::de::Error,
919            {
920                i32::try_from(v)
921                    .ok()
922                    .and_then(|x| x.try_into().ok())
923                    .ok_or_else(|| {
924                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
925                    })
926            }
927
928            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
929            where
930                E: serde::de::Error,
931            {
932                match value {
933                    "UNSPECIFIED" => Ok(grant_privilege::Action::Unspecified),
934                    "SELECT" => Ok(grant_privilege::Action::Select),
935                    "INSERT" => Ok(grant_privilege::Action::Insert),
936                    "UPDATE" => Ok(grant_privilege::Action::Update),
937                    "DELETE" => Ok(grant_privilege::Action::Delete),
938                    "CREATE" => Ok(grant_privilege::Action::Create),
939                    "CONNECT" => Ok(grant_privilege::Action::Connect),
940                    "USAGE" => Ok(grant_privilege::Action::Usage),
941                    "EXECUTE" => Ok(grant_privilege::Action::Execute),
942                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
943                }
944            }
945        }
946        deserializer.deserialize_any(GeneratedVisitor)
947    }
948}
949impl serde::Serialize for grant_privilege::ActionWithGrantOption {
950    #[allow(deprecated)]
951    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
952    where
953        S: serde::Serializer,
954    {
955        use serde::ser::SerializeStruct;
956        let mut len = 0;
957        if self.action != 0 {
958            len += 1;
959        }
960        if self.with_grant_option {
961            len += 1;
962        }
963        if self.granted_by != 0 {
964            len += 1;
965        }
966        let mut struct_ser = serializer.serialize_struct("user.GrantPrivilege.ActionWithGrantOption", len)?;
967        if self.action != 0 {
968            let v = grant_privilege::Action::try_from(self.action)
969                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.action)))?;
970            struct_ser.serialize_field("action", &v)?;
971        }
972        if self.with_grant_option {
973            struct_ser.serialize_field("withGrantOption", &self.with_grant_option)?;
974        }
975        if self.granted_by != 0 {
976            struct_ser.serialize_field("grantedBy", &self.granted_by)?;
977        }
978        struct_ser.end()
979    }
980}
981impl<'de> serde::Deserialize<'de> for grant_privilege::ActionWithGrantOption {
982    #[allow(deprecated)]
983    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
984    where
985        D: serde::Deserializer<'de>,
986    {
987        const FIELDS: &[&str] = &[
988            "action",
989            "with_grant_option",
990            "withGrantOption",
991            "granted_by",
992            "grantedBy",
993        ];
994
995        #[allow(clippy::enum_variant_names)]
996        enum GeneratedField {
997            Action,
998            WithGrantOption,
999            GrantedBy,
1000        }
1001        impl<'de> serde::Deserialize<'de> for GeneratedField {
1002            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1003            where
1004                D: serde::Deserializer<'de>,
1005            {
1006                struct GeneratedVisitor;
1007
1008                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1009                    type Value = GeneratedField;
1010
1011                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1012                        write!(formatter, "expected one of: {:?}", &FIELDS)
1013                    }
1014
1015                    #[allow(unused_variables)]
1016                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1017                    where
1018                        E: serde::de::Error,
1019                    {
1020                        match value {
1021                            "action" => Ok(GeneratedField::Action),
1022                            "withGrantOption" | "with_grant_option" => Ok(GeneratedField::WithGrantOption),
1023                            "grantedBy" | "granted_by" => Ok(GeneratedField::GrantedBy),
1024                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
1025                        }
1026                    }
1027                }
1028                deserializer.deserialize_identifier(GeneratedVisitor)
1029            }
1030        }
1031        struct GeneratedVisitor;
1032        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1033            type Value = grant_privilege::ActionWithGrantOption;
1034
1035            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1036                formatter.write_str("struct user.GrantPrivilege.ActionWithGrantOption")
1037            }
1038
1039            fn visit_map<V>(self, mut map_: V) -> std::result::Result<grant_privilege::ActionWithGrantOption, V::Error>
1040                where
1041                    V: serde::de::MapAccess<'de>,
1042            {
1043                let mut action__ = None;
1044                let mut with_grant_option__ = None;
1045                let mut granted_by__ = None;
1046                while let Some(k) = map_.next_key()? {
1047                    match k {
1048                        GeneratedField::Action => {
1049                            if action__.is_some() {
1050                                return Err(serde::de::Error::duplicate_field("action"));
1051                            }
1052                            action__ = Some(map_.next_value::<grant_privilege::Action>()? as i32);
1053                        }
1054                        GeneratedField::WithGrantOption => {
1055                            if with_grant_option__.is_some() {
1056                                return Err(serde::de::Error::duplicate_field("withGrantOption"));
1057                            }
1058                            with_grant_option__ = Some(map_.next_value()?);
1059                        }
1060                        GeneratedField::GrantedBy => {
1061                            if granted_by__.is_some() {
1062                                return Err(serde::de::Error::duplicate_field("grantedBy"));
1063                            }
1064                            granted_by__ = 
1065                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1066                            ;
1067                        }
1068                    }
1069                }
1070                Ok(grant_privilege::ActionWithGrantOption {
1071                    action: action__.unwrap_or_default(),
1072                    with_grant_option: with_grant_option__.unwrap_or_default(),
1073                    granted_by: granted_by__.unwrap_or_default(),
1074                })
1075            }
1076        }
1077        deserializer.deserialize_struct("user.GrantPrivilege.ActionWithGrantOption", FIELDS, GeneratedVisitor)
1078    }
1079}
1080impl serde::Serialize for GrantPrivilegeRequest {
1081    #[allow(deprecated)]
1082    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1083    where
1084        S: serde::Serializer,
1085    {
1086        use serde::ser::SerializeStruct;
1087        let mut len = 0;
1088        if !self.user_ids.is_empty() {
1089            len += 1;
1090        }
1091        if !self.privileges.is_empty() {
1092            len += 1;
1093        }
1094        if self.with_grant_option {
1095            len += 1;
1096        }
1097        if self.granted_by != 0 {
1098            len += 1;
1099        }
1100        let mut struct_ser = serializer.serialize_struct("user.GrantPrivilegeRequest", len)?;
1101        if !self.user_ids.is_empty() {
1102            struct_ser.serialize_field("userIds", &self.user_ids)?;
1103        }
1104        if !self.privileges.is_empty() {
1105            struct_ser.serialize_field("privileges", &self.privileges)?;
1106        }
1107        if self.with_grant_option {
1108            struct_ser.serialize_field("withGrantOption", &self.with_grant_option)?;
1109        }
1110        if self.granted_by != 0 {
1111            struct_ser.serialize_field("grantedBy", &self.granted_by)?;
1112        }
1113        struct_ser.end()
1114    }
1115}
1116impl<'de> serde::Deserialize<'de> for GrantPrivilegeRequest {
1117    #[allow(deprecated)]
1118    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1119    where
1120        D: serde::Deserializer<'de>,
1121    {
1122        const FIELDS: &[&str] = &[
1123            "user_ids",
1124            "userIds",
1125            "privileges",
1126            "with_grant_option",
1127            "withGrantOption",
1128            "granted_by",
1129            "grantedBy",
1130        ];
1131
1132        #[allow(clippy::enum_variant_names)]
1133        enum GeneratedField {
1134            UserIds,
1135            Privileges,
1136            WithGrantOption,
1137            GrantedBy,
1138        }
1139        impl<'de> serde::Deserialize<'de> for GeneratedField {
1140            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1141            where
1142                D: serde::Deserializer<'de>,
1143            {
1144                struct GeneratedVisitor;
1145
1146                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1147                    type Value = GeneratedField;
1148
1149                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1150                        write!(formatter, "expected one of: {:?}", &FIELDS)
1151                    }
1152
1153                    #[allow(unused_variables)]
1154                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1155                    where
1156                        E: serde::de::Error,
1157                    {
1158                        match value {
1159                            "userIds" | "user_ids" => Ok(GeneratedField::UserIds),
1160                            "privileges" => Ok(GeneratedField::Privileges),
1161                            "withGrantOption" | "with_grant_option" => Ok(GeneratedField::WithGrantOption),
1162                            "grantedBy" | "granted_by" => Ok(GeneratedField::GrantedBy),
1163                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
1164                        }
1165                    }
1166                }
1167                deserializer.deserialize_identifier(GeneratedVisitor)
1168            }
1169        }
1170        struct GeneratedVisitor;
1171        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1172            type Value = GrantPrivilegeRequest;
1173
1174            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1175                formatter.write_str("struct user.GrantPrivilegeRequest")
1176            }
1177
1178            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GrantPrivilegeRequest, V::Error>
1179                where
1180                    V: serde::de::MapAccess<'de>,
1181            {
1182                let mut user_ids__ = None;
1183                let mut privileges__ = None;
1184                let mut with_grant_option__ = None;
1185                let mut granted_by__ = None;
1186                while let Some(k) = map_.next_key()? {
1187                    match k {
1188                        GeneratedField::UserIds => {
1189                            if user_ids__.is_some() {
1190                                return Err(serde::de::Error::duplicate_field("userIds"));
1191                            }
1192                            user_ids__ = 
1193                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
1194                                    .into_iter().map(|x| x.0).collect())
1195                            ;
1196                        }
1197                        GeneratedField::Privileges => {
1198                            if privileges__.is_some() {
1199                                return Err(serde::de::Error::duplicate_field("privileges"));
1200                            }
1201                            privileges__ = Some(map_.next_value()?);
1202                        }
1203                        GeneratedField::WithGrantOption => {
1204                            if with_grant_option__.is_some() {
1205                                return Err(serde::de::Error::duplicate_field("withGrantOption"));
1206                            }
1207                            with_grant_option__ = Some(map_.next_value()?);
1208                        }
1209                        GeneratedField::GrantedBy => {
1210                            if granted_by__.is_some() {
1211                                return Err(serde::de::Error::duplicate_field("grantedBy"));
1212                            }
1213                            granted_by__ = 
1214                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1215                            ;
1216                        }
1217                    }
1218                }
1219                Ok(GrantPrivilegeRequest {
1220                    user_ids: user_ids__.unwrap_or_default(),
1221                    privileges: privileges__.unwrap_or_default(),
1222                    with_grant_option: with_grant_option__.unwrap_or_default(),
1223                    granted_by: granted_by__.unwrap_or_default(),
1224                })
1225            }
1226        }
1227        deserializer.deserialize_struct("user.GrantPrivilegeRequest", FIELDS, GeneratedVisitor)
1228    }
1229}
1230impl serde::Serialize for GrantPrivilegeResponse {
1231    #[allow(deprecated)]
1232    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1233    where
1234        S: serde::Serializer,
1235    {
1236        use serde::ser::SerializeStruct;
1237        let mut len = 0;
1238        if self.status.is_some() {
1239            len += 1;
1240        }
1241        if self.version != 0 {
1242            len += 1;
1243        }
1244        let mut struct_ser = serializer.serialize_struct("user.GrantPrivilegeResponse", len)?;
1245        if let Some(v) = self.status.as_ref() {
1246            struct_ser.serialize_field("status", v)?;
1247        }
1248        if self.version != 0 {
1249            #[allow(clippy::needless_borrow)]
1250            #[allow(clippy::needless_borrows_for_generic_args)]
1251            struct_ser.serialize_field("version", ToString::to_string(&self.version).as_str())?;
1252        }
1253        struct_ser.end()
1254    }
1255}
1256impl<'de> serde::Deserialize<'de> for GrantPrivilegeResponse {
1257    #[allow(deprecated)]
1258    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1259    where
1260        D: serde::Deserializer<'de>,
1261    {
1262        const FIELDS: &[&str] = &[
1263            "status",
1264            "version",
1265        ];
1266
1267        #[allow(clippy::enum_variant_names)]
1268        enum GeneratedField {
1269            Status,
1270            Version,
1271        }
1272        impl<'de> serde::Deserialize<'de> for GeneratedField {
1273            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1274            where
1275                D: serde::Deserializer<'de>,
1276            {
1277                struct GeneratedVisitor;
1278
1279                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1280                    type Value = GeneratedField;
1281
1282                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1283                        write!(formatter, "expected one of: {:?}", &FIELDS)
1284                    }
1285
1286                    #[allow(unused_variables)]
1287                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1288                    where
1289                        E: serde::de::Error,
1290                    {
1291                        match value {
1292                            "status" => Ok(GeneratedField::Status),
1293                            "version" => Ok(GeneratedField::Version),
1294                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
1295                        }
1296                    }
1297                }
1298                deserializer.deserialize_identifier(GeneratedVisitor)
1299            }
1300        }
1301        struct GeneratedVisitor;
1302        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1303            type Value = GrantPrivilegeResponse;
1304
1305            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1306                formatter.write_str("struct user.GrantPrivilegeResponse")
1307            }
1308
1309            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GrantPrivilegeResponse, V::Error>
1310                where
1311                    V: serde::de::MapAccess<'de>,
1312            {
1313                let mut status__ = None;
1314                let mut version__ = None;
1315                while let Some(k) = map_.next_key()? {
1316                    match k {
1317                        GeneratedField::Status => {
1318                            if status__.is_some() {
1319                                return Err(serde::de::Error::duplicate_field("status"));
1320                            }
1321                            status__ = map_.next_value()?;
1322                        }
1323                        GeneratedField::Version => {
1324                            if version__.is_some() {
1325                                return Err(serde::de::Error::duplicate_field("version"));
1326                            }
1327                            version__ = 
1328                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1329                            ;
1330                        }
1331                    }
1332                }
1333                Ok(GrantPrivilegeResponse {
1334                    status: status__,
1335                    version: version__.unwrap_or_default(),
1336                })
1337            }
1338        }
1339        deserializer.deserialize_struct("user.GrantPrivilegeResponse", FIELDS, GeneratedVisitor)
1340    }
1341}
1342impl serde::Serialize for RevokePrivilegeRequest {
1343    #[allow(deprecated)]
1344    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1345    where
1346        S: serde::Serializer,
1347    {
1348        use serde::ser::SerializeStruct;
1349        let mut len = 0;
1350        if !self.user_ids.is_empty() {
1351            len += 1;
1352        }
1353        if !self.privileges.is_empty() {
1354            len += 1;
1355        }
1356        if self.granted_by != 0 {
1357            len += 1;
1358        }
1359        if self.revoke_by != 0 {
1360            len += 1;
1361        }
1362        if self.revoke_grant_option {
1363            len += 1;
1364        }
1365        if self.cascade {
1366            len += 1;
1367        }
1368        let mut struct_ser = serializer.serialize_struct("user.RevokePrivilegeRequest", len)?;
1369        if !self.user_ids.is_empty() {
1370            struct_ser.serialize_field("userIds", &self.user_ids)?;
1371        }
1372        if !self.privileges.is_empty() {
1373            struct_ser.serialize_field("privileges", &self.privileges)?;
1374        }
1375        if self.granted_by != 0 {
1376            struct_ser.serialize_field("grantedBy", &self.granted_by)?;
1377        }
1378        if self.revoke_by != 0 {
1379            struct_ser.serialize_field("revokeBy", &self.revoke_by)?;
1380        }
1381        if self.revoke_grant_option {
1382            struct_ser.serialize_field("revokeGrantOption", &self.revoke_grant_option)?;
1383        }
1384        if self.cascade {
1385            struct_ser.serialize_field("cascade", &self.cascade)?;
1386        }
1387        struct_ser.end()
1388    }
1389}
1390impl<'de> serde::Deserialize<'de> for RevokePrivilegeRequest {
1391    #[allow(deprecated)]
1392    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1393    where
1394        D: serde::Deserializer<'de>,
1395    {
1396        const FIELDS: &[&str] = &[
1397            "user_ids",
1398            "userIds",
1399            "privileges",
1400            "granted_by",
1401            "grantedBy",
1402            "revoke_by",
1403            "revokeBy",
1404            "revoke_grant_option",
1405            "revokeGrantOption",
1406            "cascade",
1407        ];
1408
1409        #[allow(clippy::enum_variant_names)]
1410        enum GeneratedField {
1411            UserIds,
1412            Privileges,
1413            GrantedBy,
1414            RevokeBy,
1415            RevokeGrantOption,
1416            Cascade,
1417        }
1418        impl<'de> serde::Deserialize<'de> for GeneratedField {
1419            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1420            where
1421                D: serde::Deserializer<'de>,
1422            {
1423                struct GeneratedVisitor;
1424
1425                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1426                    type Value = GeneratedField;
1427
1428                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1429                        write!(formatter, "expected one of: {:?}", &FIELDS)
1430                    }
1431
1432                    #[allow(unused_variables)]
1433                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1434                    where
1435                        E: serde::de::Error,
1436                    {
1437                        match value {
1438                            "userIds" | "user_ids" => Ok(GeneratedField::UserIds),
1439                            "privileges" => Ok(GeneratedField::Privileges),
1440                            "grantedBy" | "granted_by" => Ok(GeneratedField::GrantedBy),
1441                            "revokeBy" | "revoke_by" => Ok(GeneratedField::RevokeBy),
1442                            "revokeGrantOption" | "revoke_grant_option" => Ok(GeneratedField::RevokeGrantOption),
1443                            "cascade" => Ok(GeneratedField::Cascade),
1444                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
1445                        }
1446                    }
1447                }
1448                deserializer.deserialize_identifier(GeneratedVisitor)
1449            }
1450        }
1451        struct GeneratedVisitor;
1452        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1453            type Value = RevokePrivilegeRequest;
1454
1455            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1456                formatter.write_str("struct user.RevokePrivilegeRequest")
1457            }
1458
1459            fn visit_map<V>(self, mut map_: V) -> std::result::Result<RevokePrivilegeRequest, V::Error>
1460                where
1461                    V: serde::de::MapAccess<'de>,
1462            {
1463                let mut user_ids__ = None;
1464                let mut privileges__ = None;
1465                let mut granted_by__ = None;
1466                let mut revoke_by__ = None;
1467                let mut revoke_grant_option__ = None;
1468                let mut cascade__ = None;
1469                while let Some(k) = map_.next_key()? {
1470                    match k {
1471                        GeneratedField::UserIds => {
1472                            if user_ids__.is_some() {
1473                                return Err(serde::de::Error::duplicate_field("userIds"));
1474                            }
1475                            user_ids__ = 
1476                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
1477                                    .into_iter().map(|x| x.0).collect())
1478                            ;
1479                        }
1480                        GeneratedField::Privileges => {
1481                            if privileges__.is_some() {
1482                                return Err(serde::de::Error::duplicate_field("privileges"));
1483                            }
1484                            privileges__ = Some(map_.next_value()?);
1485                        }
1486                        GeneratedField::GrantedBy => {
1487                            if granted_by__.is_some() {
1488                                return Err(serde::de::Error::duplicate_field("grantedBy"));
1489                            }
1490                            granted_by__ = 
1491                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1492                            ;
1493                        }
1494                        GeneratedField::RevokeBy => {
1495                            if revoke_by__.is_some() {
1496                                return Err(serde::de::Error::duplicate_field("revokeBy"));
1497                            }
1498                            revoke_by__ = 
1499                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1500                            ;
1501                        }
1502                        GeneratedField::RevokeGrantOption => {
1503                            if revoke_grant_option__.is_some() {
1504                                return Err(serde::de::Error::duplicate_field("revokeGrantOption"));
1505                            }
1506                            revoke_grant_option__ = Some(map_.next_value()?);
1507                        }
1508                        GeneratedField::Cascade => {
1509                            if cascade__.is_some() {
1510                                return Err(serde::de::Error::duplicate_field("cascade"));
1511                            }
1512                            cascade__ = Some(map_.next_value()?);
1513                        }
1514                    }
1515                }
1516                Ok(RevokePrivilegeRequest {
1517                    user_ids: user_ids__.unwrap_or_default(),
1518                    privileges: privileges__.unwrap_or_default(),
1519                    granted_by: granted_by__.unwrap_or_default(),
1520                    revoke_by: revoke_by__.unwrap_or_default(),
1521                    revoke_grant_option: revoke_grant_option__.unwrap_or_default(),
1522                    cascade: cascade__.unwrap_or_default(),
1523                })
1524            }
1525        }
1526        deserializer.deserialize_struct("user.RevokePrivilegeRequest", FIELDS, GeneratedVisitor)
1527    }
1528}
1529impl serde::Serialize for RevokePrivilegeResponse {
1530    #[allow(deprecated)]
1531    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1532    where
1533        S: serde::Serializer,
1534    {
1535        use serde::ser::SerializeStruct;
1536        let mut len = 0;
1537        if self.status.is_some() {
1538            len += 1;
1539        }
1540        if self.version != 0 {
1541            len += 1;
1542        }
1543        let mut struct_ser = serializer.serialize_struct("user.RevokePrivilegeResponse", len)?;
1544        if let Some(v) = self.status.as_ref() {
1545            struct_ser.serialize_field("status", v)?;
1546        }
1547        if self.version != 0 {
1548            #[allow(clippy::needless_borrow)]
1549            #[allow(clippy::needless_borrows_for_generic_args)]
1550            struct_ser.serialize_field("version", ToString::to_string(&self.version).as_str())?;
1551        }
1552        struct_ser.end()
1553    }
1554}
1555impl<'de> serde::Deserialize<'de> for RevokePrivilegeResponse {
1556    #[allow(deprecated)]
1557    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1558    where
1559        D: serde::Deserializer<'de>,
1560    {
1561        const FIELDS: &[&str] = &[
1562            "status",
1563            "version",
1564        ];
1565
1566        #[allow(clippy::enum_variant_names)]
1567        enum GeneratedField {
1568            Status,
1569            Version,
1570        }
1571        impl<'de> serde::Deserialize<'de> for GeneratedField {
1572            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1573            where
1574                D: serde::Deserializer<'de>,
1575            {
1576                struct GeneratedVisitor;
1577
1578                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1579                    type Value = GeneratedField;
1580
1581                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1582                        write!(formatter, "expected one of: {:?}", &FIELDS)
1583                    }
1584
1585                    #[allow(unused_variables)]
1586                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1587                    where
1588                        E: serde::de::Error,
1589                    {
1590                        match value {
1591                            "status" => Ok(GeneratedField::Status),
1592                            "version" => Ok(GeneratedField::Version),
1593                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
1594                        }
1595                    }
1596                }
1597                deserializer.deserialize_identifier(GeneratedVisitor)
1598            }
1599        }
1600        struct GeneratedVisitor;
1601        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1602            type Value = RevokePrivilegeResponse;
1603
1604            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1605                formatter.write_str("struct user.RevokePrivilegeResponse")
1606            }
1607
1608            fn visit_map<V>(self, mut map_: V) -> std::result::Result<RevokePrivilegeResponse, V::Error>
1609                where
1610                    V: serde::de::MapAccess<'de>,
1611            {
1612                let mut status__ = None;
1613                let mut version__ = None;
1614                while let Some(k) = map_.next_key()? {
1615                    match k {
1616                        GeneratedField::Status => {
1617                            if status__.is_some() {
1618                                return Err(serde::de::Error::duplicate_field("status"));
1619                            }
1620                            status__ = map_.next_value()?;
1621                        }
1622                        GeneratedField::Version => {
1623                            if version__.is_some() {
1624                                return Err(serde::de::Error::duplicate_field("version"));
1625                            }
1626                            version__ = 
1627                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1628                            ;
1629                        }
1630                    }
1631                }
1632                Ok(RevokePrivilegeResponse {
1633                    status: status__,
1634                    version: version__.unwrap_or_default(),
1635                })
1636            }
1637        }
1638        deserializer.deserialize_struct("user.RevokePrivilegeResponse", FIELDS, GeneratedVisitor)
1639    }
1640}
1641impl serde::Serialize for UpdateUserRequest {
1642    #[allow(deprecated)]
1643    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1644    where
1645        S: serde::Serializer,
1646    {
1647        use serde::ser::SerializeStruct;
1648        let mut len = 0;
1649        if self.user.is_some() {
1650            len += 1;
1651        }
1652        if !self.update_fields.is_empty() {
1653            len += 1;
1654        }
1655        let mut struct_ser = serializer.serialize_struct("user.UpdateUserRequest", len)?;
1656        if let Some(v) = self.user.as_ref() {
1657            struct_ser.serialize_field("user", v)?;
1658        }
1659        if !self.update_fields.is_empty() {
1660            let v = self.update_fields.iter().cloned().map(|v| {
1661                update_user_request::UpdateField::try_from(v)
1662                    .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", v)))
1663                }).collect::<std::result::Result<Vec<_>, _>>()?;
1664            struct_ser.serialize_field("updateFields", &v)?;
1665        }
1666        struct_ser.end()
1667    }
1668}
1669impl<'de> serde::Deserialize<'de> for UpdateUserRequest {
1670    #[allow(deprecated)]
1671    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1672    where
1673        D: serde::Deserializer<'de>,
1674    {
1675        const FIELDS: &[&str] = &[
1676            "user",
1677            "update_fields",
1678            "updateFields",
1679        ];
1680
1681        #[allow(clippy::enum_variant_names)]
1682        enum GeneratedField {
1683            User,
1684            UpdateFields,
1685        }
1686        impl<'de> serde::Deserialize<'de> for GeneratedField {
1687            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1688            where
1689                D: serde::Deserializer<'de>,
1690            {
1691                struct GeneratedVisitor;
1692
1693                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1694                    type Value = GeneratedField;
1695
1696                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1697                        write!(formatter, "expected one of: {:?}", &FIELDS)
1698                    }
1699
1700                    #[allow(unused_variables)]
1701                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1702                    where
1703                        E: serde::de::Error,
1704                    {
1705                        match value {
1706                            "user" => Ok(GeneratedField::User),
1707                            "updateFields" | "update_fields" => Ok(GeneratedField::UpdateFields),
1708                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
1709                        }
1710                    }
1711                }
1712                deserializer.deserialize_identifier(GeneratedVisitor)
1713            }
1714        }
1715        struct GeneratedVisitor;
1716        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1717            type Value = UpdateUserRequest;
1718
1719            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1720                formatter.write_str("struct user.UpdateUserRequest")
1721            }
1722
1723            fn visit_map<V>(self, mut map_: V) -> std::result::Result<UpdateUserRequest, V::Error>
1724                where
1725                    V: serde::de::MapAccess<'de>,
1726            {
1727                let mut user__ = None;
1728                let mut update_fields__ = None;
1729                while let Some(k) = map_.next_key()? {
1730                    match k {
1731                        GeneratedField::User => {
1732                            if user__.is_some() {
1733                                return Err(serde::de::Error::duplicate_field("user"));
1734                            }
1735                            user__ = map_.next_value()?;
1736                        }
1737                        GeneratedField::UpdateFields => {
1738                            if update_fields__.is_some() {
1739                                return Err(serde::de::Error::duplicate_field("updateFields"));
1740                            }
1741                            update_fields__ = Some(map_.next_value::<Vec<update_user_request::UpdateField>>()?.into_iter().map(|x| x as i32).collect());
1742                        }
1743                    }
1744                }
1745                Ok(UpdateUserRequest {
1746                    user: user__,
1747                    update_fields: update_fields__.unwrap_or_default(),
1748                })
1749            }
1750        }
1751        deserializer.deserialize_struct("user.UpdateUserRequest", FIELDS, GeneratedVisitor)
1752    }
1753}
1754impl serde::Serialize for update_user_request::UpdateField {
1755    #[allow(deprecated)]
1756    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1757    where
1758        S: serde::Serializer,
1759    {
1760        let variant = match self {
1761            Self::Unspecified => "UNSPECIFIED",
1762            Self::Super => "SUPER",
1763            Self::Login => "LOGIN",
1764            Self::CreateDb => "CREATE_DB",
1765            Self::AuthInfo => "AUTH_INFO",
1766            Self::Rename => "RENAME",
1767            Self::CreateUser => "CREATE_USER",
1768        };
1769        serializer.serialize_str(variant)
1770    }
1771}
1772impl<'de> serde::Deserialize<'de> for update_user_request::UpdateField {
1773    #[allow(deprecated)]
1774    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1775    where
1776        D: serde::Deserializer<'de>,
1777    {
1778        const FIELDS: &[&str] = &[
1779            "UNSPECIFIED",
1780            "SUPER",
1781            "LOGIN",
1782            "CREATE_DB",
1783            "AUTH_INFO",
1784            "RENAME",
1785            "CREATE_USER",
1786        ];
1787
1788        struct GeneratedVisitor;
1789
1790        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1791            type Value = update_user_request::UpdateField;
1792
1793            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1794                write!(formatter, "expected one of: {:?}", &FIELDS)
1795            }
1796
1797            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
1798            where
1799                E: serde::de::Error,
1800            {
1801                i32::try_from(v)
1802                    .ok()
1803                    .and_then(|x| x.try_into().ok())
1804                    .ok_or_else(|| {
1805                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
1806                    })
1807            }
1808
1809            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
1810            where
1811                E: serde::de::Error,
1812            {
1813                i32::try_from(v)
1814                    .ok()
1815                    .and_then(|x| x.try_into().ok())
1816                    .ok_or_else(|| {
1817                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
1818                    })
1819            }
1820
1821            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1822            where
1823                E: serde::de::Error,
1824            {
1825                match value {
1826                    "UNSPECIFIED" => Ok(update_user_request::UpdateField::Unspecified),
1827                    "SUPER" => Ok(update_user_request::UpdateField::Super),
1828                    "LOGIN" => Ok(update_user_request::UpdateField::Login),
1829                    "CREATE_DB" => Ok(update_user_request::UpdateField::CreateDb),
1830                    "AUTH_INFO" => Ok(update_user_request::UpdateField::AuthInfo),
1831                    "RENAME" => Ok(update_user_request::UpdateField::Rename),
1832                    "CREATE_USER" => Ok(update_user_request::UpdateField::CreateUser),
1833                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
1834                }
1835            }
1836        }
1837        deserializer.deserialize_any(GeneratedVisitor)
1838    }
1839}
1840impl serde::Serialize for UpdateUserResponse {
1841    #[allow(deprecated)]
1842    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1843    where
1844        S: serde::Serializer,
1845    {
1846        use serde::ser::SerializeStruct;
1847        let mut len = 0;
1848        if self.status.is_some() {
1849            len += 1;
1850        }
1851        if self.version != 0 {
1852            len += 1;
1853        }
1854        let mut struct_ser = serializer.serialize_struct("user.UpdateUserResponse", len)?;
1855        if let Some(v) = self.status.as_ref() {
1856            struct_ser.serialize_field("status", v)?;
1857        }
1858        if self.version != 0 {
1859            #[allow(clippy::needless_borrow)]
1860            #[allow(clippy::needless_borrows_for_generic_args)]
1861            struct_ser.serialize_field("version", ToString::to_string(&self.version).as_str())?;
1862        }
1863        struct_ser.end()
1864    }
1865}
1866impl<'de> serde::Deserialize<'de> for UpdateUserResponse {
1867    #[allow(deprecated)]
1868    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1869    where
1870        D: serde::Deserializer<'de>,
1871    {
1872        const FIELDS: &[&str] = &[
1873            "status",
1874            "version",
1875        ];
1876
1877        #[allow(clippy::enum_variant_names)]
1878        enum GeneratedField {
1879            Status,
1880            Version,
1881        }
1882        impl<'de> serde::Deserialize<'de> for GeneratedField {
1883            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1884            where
1885                D: serde::Deserializer<'de>,
1886            {
1887                struct GeneratedVisitor;
1888
1889                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1890                    type Value = GeneratedField;
1891
1892                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1893                        write!(formatter, "expected one of: {:?}", &FIELDS)
1894                    }
1895
1896                    #[allow(unused_variables)]
1897                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1898                    where
1899                        E: serde::de::Error,
1900                    {
1901                        match value {
1902                            "status" => Ok(GeneratedField::Status),
1903                            "version" => Ok(GeneratedField::Version),
1904                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
1905                        }
1906                    }
1907                }
1908                deserializer.deserialize_identifier(GeneratedVisitor)
1909            }
1910        }
1911        struct GeneratedVisitor;
1912        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1913            type Value = UpdateUserResponse;
1914
1915            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1916                formatter.write_str("struct user.UpdateUserResponse")
1917            }
1918
1919            fn visit_map<V>(self, mut map_: V) -> std::result::Result<UpdateUserResponse, V::Error>
1920                where
1921                    V: serde::de::MapAccess<'de>,
1922            {
1923                let mut status__ = None;
1924                let mut version__ = None;
1925                while let Some(k) = map_.next_key()? {
1926                    match k {
1927                        GeneratedField::Status => {
1928                            if status__.is_some() {
1929                                return Err(serde::de::Error::duplicate_field("status"));
1930                            }
1931                            status__ = map_.next_value()?;
1932                        }
1933                        GeneratedField::Version => {
1934                            if version__.is_some() {
1935                                return Err(serde::de::Error::duplicate_field("version"));
1936                            }
1937                            version__ = 
1938                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1939                            ;
1940                        }
1941                    }
1942                }
1943                Ok(UpdateUserResponse {
1944                    status: status__,
1945                    version: version__.unwrap_or_default(),
1946                })
1947            }
1948        }
1949        deserializer.deserialize_struct("user.UpdateUserResponse", FIELDS, GeneratedVisitor)
1950    }
1951}
1952impl serde::Serialize for UserInfo {
1953    #[allow(deprecated)]
1954    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1955    where
1956        S: serde::Serializer,
1957    {
1958        use serde::ser::SerializeStruct;
1959        let mut len = 0;
1960        if self.id != 0 {
1961            len += 1;
1962        }
1963        if !self.name.is_empty() {
1964            len += 1;
1965        }
1966        if self.is_super {
1967            len += 1;
1968        }
1969        if self.can_create_db {
1970            len += 1;
1971        }
1972        if self.can_create_user {
1973            len += 1;
1974        }
1975        if self.can_login {
1976            len += 1;
1977        }
1978        if self.auth_info.is_some() {
1979            len += 1;
1980        }
1981        if !self.grant_privileges.is_empty() {
1982            len += 1;
1983        }
1984        let mut struct_ser = serializer.serialize_struct("user.UserInfo", len)?;
1985        if self.id != 0 {
1986            struct_ser.serialize_field("id", &self.id)?;
1987        }
1988        if !self.name.is_empty() {
1989            struct_ser.serialize_field("name", &self.name)?;
1990        }
1991        if self.is_super {
1992            struct_ser.serialize_field("isSuper", &self.is_super)?;
1993        }
1994        if self.can_create_db {
1995            struct_ser.serialize_field("canCreateDb", &self.can_create_db)?;
1996        }
1997        if self.can_create_user {
1998            struct_ser.serialize_field("canCreateUser", &self.can_create_user)?;
1999        }
2000        if self.can_login {
2001            struct_ser.serialize_field("canLogin", &self.can_login)?;
2002        }
2003        if let Some(v) = self.auth_info.as_ref() {
2004            struct_ser.serialize_field("authInfo", v)?;
2005        }
2006        if !self.grant_privileges.is_empty() {
2007            struct_ser.serialize_field("grantPrivileges", &self.grant_privileges)?;
2008        }
2009        struct_ser.end()
2010    }
2011}
2012impl<'de> serde::Deserialize<'de> for UserInfo {
2013    #[allow(deprecated)]
2014    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2015    where
2016        D: serde::Deserializer<'de>,
2017    {
2018        const FIELDS: &[&str] = &[
2019            "id",
2020            "name",
2021            "is_super",
2022            "isSuper",
2023            "can_create_db",
2024            "canCreateDb",
2025            "can_create_user",
2026            "canCreateUser",
2027            "can_login",
2028            "canLogin",
2029            "auth_info",
2030            "authInfo",
2031            "grant_privileges",
2032            "grantPrivileges",
2033        ];
2034
2035        #[allow(clippy::enum_variant_names)]
2036        enum GeneratedField {
2037            Id,
2038            Name,
2039            IsSuper,
2040            CanCreateDb,
2041            CanCreateUser,
2042            CanLogin,
2043            AuthInfo,
2044            GrantPrivileges,
2045        }
2046        impl<'de> serde::Deserialize<'de> for GeneratedField {
2047            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
2048            where
2049                D: serde::Deserializer<'de>,
2050            {
2051                struct GeneratedVisitor;
2052
2053                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
2054                    type Value = GeneratedField;
2055
2056                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2057                        write!(formatter, "expected one of: {:?}", &FIELDS)
2058                    }
2059
2060                    #[allow(unused_variables)]
2061                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
2062                    where
2063                        E: serde::de::Error,
2064                    {
2065                        match value {
2066                            "id" => Ok(GeneratedField::Id),
2067                            "name" => Ok(GeneratedField::Name),
2068                            "isSuper" | "is_super" => Ok(GeneratedField::IsSuper),
2069                            "canCreateDb" | "can_create_db" => Ok(GeneratedField::CanCreateDb),
2070                            "canCreateUser" | "can_create_user" => Ok(GeneratedField::CanCreateUser),
2071                            "canLogin" | "can_login" => Ok(GeneratedField::CanLogin),
2072                            "authInfo" | "auth_info" => Ok(GeneratedField::AuthInfo),
2073                            "grantPrivileges" | "grant_privileges" => Ok(GeneratedField::GrantPrivileges),
2074                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
2075                        }
2076                    }
2077                }
2078                deserializer.deserialize_identifier(GeneratedVisitor)
2079            }
2080        }
2081        struct GeneratedVisitor;
2082        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
2083            type Value = UserInfo;
2084
2085            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2086                formatter.write_str("struct user.UserInfo")
2087            }
2088
2089            fn visit_map<V>(self, mut map_: V) -> std::result::Result<UserInfo, V::Error>
2090                where
2091                    V: serde::de::MapAccess<'de>,
2092            {
2093                let mut id__ = None;
2094                let mut name__ = None;
2095                let mut is_super__ = None;
2096                let mut can_create_db__ = None;
2097                let mut can_create_user__ = None;
2098                let mut can_login__ = None;
2099                let mut auth_info__ = None;
2100                let mut grant_privileges__ = None;
2101                while let Some(k) = map_.next_key()? {
2102                    match k {
2103                        GeneratedField::Id => {
2104                            if id__.is_some() {
2105                                return Err(serde::de::Error::duplicate_field("id"));
2106                            }
2107                            id__ = 
2108                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
2109                            ;
2110                        }
2111                        GeneratedField::Name => {
2112                            if name__.is_some() {
2113                                return Err(serde::de::Error::duplicate_field("name"));
2114                            }
2115                            name__ = Some(map_.next_value()?);
2116                        }
2117                        GeneratedField::IsSuper => {
2118                            if is_super__.is_some() {
2119                                return Err(serde::de::Error::duplicate_field("isSuper"));
2120                            }
2121                            is_super__ = Some(map_.next_value()?);
2122                        }
2123                        GeneratedField::CanCreateDb => {
2124                            if can_create_db__.is_some() {
2125                                return Err(serde::de::Error::duplicate_field("canCreateDb"));
2126                            }
2127                            can_create_db__ = Some(map_.next_value()?);
2128                        }
2129                        GeneratedField::CanCreateUser => {
2130                            if can_create_user__.is_some() {
2131                                return Err(serde::de::Error::duplicate_field("canCreateUser"));
2132                            }
2133                            can_create_user__ = Some(map_.next_value()?);
2134                        }
2135                        GeneratedField::CanLogin => {
2136                            if can_login__.is_some() {
2137                                return Err(serde::de::Error::duplicate_field("canLogin"));
2138                            }
2139                            can_login__ = Some(map_.next_value()?);
2140                        }
2141                        GeneratedField::AuthInfo => {
2142                            if auth_info__.is_some() {
2143                                return Err(serde::de::Error::duplicate_field("authInfo"));
2144                            }
2145                            auth_info__ = map_.next_value()?;
2146                        }
2147                        GeneratedField::GrantPrivileges => {
2148                            if grant_privileges__.is_some() {
2149                                return Err(serde::de::Error::duplicate_field("grantPrivileges"));
2150                            }
2151                            grant_privileges__ = Some(map_.next_value()?);
2152                        }
2153                    }
2154                }
2155                Ok(UserInfo {
2156                    id: id__.unwrap_or_default(),
2157                    name: name__.unwrap_or_default(),
2158                    is_super: is_super__.unwrap_or_default(),
2159                    can_create_db: can_create_db__.unwrap_or_default(),
2160                    can_create_user: can_create_user__.unwrap_or_default(),
2161                    can_login: can_login__.unwrap_or_default(),
2162                    auth_info: auth_info__,
2163                    grant_privileges: grant_privileges__.unwrap_or_default(),
2164                })
2165            }
2166        }
2167        deserializer.deserialize_struct("user.UserInfo", FIELDS, GeneratedVisitor)
2168    }
2169}