google_cloud_sql_v1/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate lazy_static;
25extern crate reqwest;
26extern crate serde;
27extern crate serde_json;
28extern crate serde_with;
29extern crate std;
30extern crate tracing;
31extern crate wkt;
32
33/// Backup runs delete request.
34#[derive(Clone, Debug, Default, PartialEq)]
35#[non_exhaustive]
36pub struct SqlBackupRunsDeleteRequest {
37    /// The ID of the backup run to delete. To find a backup run ID, use the
38    /// [list](https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1/backupRuns/list)
39    /// method.
40    pub id: i64,
41
42    /// Cloud SQL instance ID. This does not include the project ID.
43    pub instance: std::string::String,
44
45    /// Project ID of the project that contains the instance.
46    pub project: std::string::String,
47
48    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
49}
50
51impl SqlBackupRunsDeleteRequest {
52    pub fn new() -> Self {
53        std::default::Default::default()
54    }
55
56    /// Sets the value of [id][crate::model::SqlBackupRunsDeleteRequest::id].
57    pub fn set_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
58        self.id = v.into();
59        self
60    }
61
62    /// Sets the value of [instance][crate::model::SqlBackupRunsDeleteRequest::instance].
63    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
64        self.instance = v.into();
65        self
66    }
67
68    /// Sets the value of [project][crate::model::SqlBackupRunsDeleteRequest::project].
69    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
70        self.project = v.into();
71        self
72    }
73}
74
75impl wkt::message::Message for SqlBackupRunsDeleteRequest {
76    fn typename() -> &'static str {
77        "type.googleapis.com/google.cloud.sql.v1.SqlBackupRunsDeleteRequest"
78    }
79}
80
81#[doc(hidden)]
82impl<'de> serde::de::Deserialize<'de> for SqlBackupRunsDeleteRequest {
83    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
84    where
85        D: serde::Deserializer<'de>,
86    {
87        #[allow(non_camel_case_types)]
88        #[doc(hidden)]
89        #[derive(PartialEq, Eq, Hash)]
90        enum __FieldTag {
91            __id,
92            __instance,
93            __project,
94            Unknown(std::string::String),
95        }
96        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
97            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
98            where
99                D: serde::Deserializer<'de>,
100            {
101                struct Visitor;
102                impl<'de> serde::de::Visitor<'de> for Visitor {
103                    type Value = __FieldTag;
104                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
105                        formatter.write_str("a field name for SqlBackupRunsDeleteRequest")
106                    }
107                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
108                    where
109                        E: serde::de::Error,
110                    {
111                        use std::result::Result::Ok;
112                        use std::string::ToString;
113                        match value {
114                            "id" => Ok(__FieldTag::__id),
115                            "instance" => Ok(__FieldTag::__instance),
116                            "project" => Ok(__FieldTag::__project),
117                            _ => Ok(__FieldTag::Unknown(value.to_string())),
118                        }
119                    }
120                }
121                deserializer.deserialize_identifier(Visitor)
122            }
123        }
124        struct Visitor;
125        impl<'de> serde::de::Visitor<'de> for Visitor {
126            type Value = SqlBackupRunsDeleteRequest;
127            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
128                formatter.write_str("struct SqlBackupRunsDeleteRequest")
129            }
130            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
131            where
132                A: serde::de::MapAccess<'de>,
133            {
134                #[allow(unused_imports)]
135                use serde::de::Error;
136                use std::option::Option::Some;
137                let mut fields = std::collections::HashSet::new();
138                let mut result = Self::Value::new();
139                while let Some(tag) = map.next_key::<__FieldTag>()? {
140                    #[allow(clippy::match_single_binding)]
141                    match tag {
142                        __FieldTag::__id => {
143                            if !fields.insert(__FieldTag::__id) {
144                                return std::result::Result::Err(A::Error::duplicate_field(
145                                    "multiple values for id",
146                                ));
147                            }
148                            struct __With(std::option::Option<i64>);
149                            impl<'de> serde::de::Deserialize<'de> for __With {
150                                fn deserialize<D>(
151                                    deserializer: D,
152                                ) -> std::result::Result<Self, D::Error>
153                                where
154                                    D: serde::de::Deserializer<'de>,
155                                {
156                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
157                                }
158                            }
159                            result.id = map.next_value::<__With>()?.0.unwrap_or_default();
160                        }
161                        __FieldTag::__instance => {
162                            if !fields.insert(__FieldTag::__instance) {
163                                return std::result::Result::Err(A::Error::duplicate_field(
164                                    "multiple values for instance",
165                                ));
166                            }
167                            result.instance = map
168                                .next_value::<std::option::Option<std::string::String>>()?
169                                .unwrap_or_default();
170                        }
171                        __FieldTag::__project => {
172                            if !fields.insert(__FieldTag::__project) {
173                                return std::result::Result::Err(A::Error::duplicate_field(
174                                    "multiple values for project",
175                                ));
176                            }
177                            result.project = map
178                                .next_value::<std::option::Option<std::string::String>>()?
179                                .unwrap_or_default();
180                        }
181                        __FieldTag::Unknown(key) => {
182                            let value = map.next_value::<serde_json::Value>()?;
183                            result._unknown_fields.insert(key, value);
184                        }
185                    }
186                }
187                std::result::Result::Ok(result)
188            }
189        }
190        deserializer.deserialize_any(Visitor)
191    }
192}
193
194#[doc(hidden)]
195impl serde::ser::Serialize for SqlBackupRunsDeleteRequest {
196    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
197    where
198        S: serde::ser::Serializer,
199    {
200        use serde::ser::SerializeMap;
201        #[allow(unused_imports)]
202        use std::option::Option::Some;
203        let mut state = serializer.serialize_map(std::option::Option::None)?;
204        if !wkt::internal::is_default(&self.id) {
205            struct __With<'a>(&'a i64);
206            impl<'a> serde::ser::Serialize for __With<'a> {
207                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
208                where
209                    S: serde::ser::Serializer,
210                {
211                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
212                }
213            }
214            state.serialize_entry("id", &__With(&self.id))?;
215        }
216        if !self.instance.is_empty() {
217            state.serialize_entry("instance", &self.instance)?;
218        }
219        if !self.project.is_empty() {
220            state.serialize_entry("project", &self.project)?;
221        }
222        if !self._unknown_fields.is_empty() {
223            for (key, value) in self._unknown_fields.iter() {
224                state.serialize_entry(key, &value)?;
225            }
226        }
227        state.end()
228    }
229}
230
231/// Backup runs get request.
232#[derive(Clone, Debug, Default, PartialEq)]
233#[non_exhaustive]
234pub struct SqlBackupRunsGetRequest {
235    /// The ID of this backup run.
236    pub id: i64,
237
238    /// Cloud SQL instance ID. This does not include the project ID.
239    pub instance: std::string::String,
240
241    /// Project ID of the project that contains the instance.
242    pub project: std::string::String,
243
244    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
245}
246
247impl SqlBackupRunsGetRequest {
248    pub fn new() -> Self {
249        std::default::Default::default()
250    }
251
252    /// Sets the value of [id][crate::model::SqlBackupRunsGetRequest::id].
253    pub fn set_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
254        self.id = v.into();
255        self
256    }
257
258    /// Sets the value of [instance][crate::model::SqlBackupRunsGetRequest::instance].
259    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
260        self.instance = v.into();
261        self
262    }
263
264    /// Sets the value of [project][crate::model::SqlBackupRunsGetRequest::project].
265    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
266        self.project = v.into();
267        self
268    }
269}
270
271impl wkt::message::Message for SqlBackupRunsGetRequest {
272    fn typename() -> &'static str {
273        "type.googleapis.com/google.cloud.sql.v1.SqlBackupRunsGetRequest"
274    }
275}
276
277#[doc(hidden)]
278impl<'de> serde::de::Deserialize<'de> for SqlBackupRunsGetRequest {
279    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
280    where
281        D: serde::Deserializer<'de>,
282    {
283        #[allow(non_camel_case_types)]
284        #[doc(hidden)]
285        #[derive(PartialEq, Eq, Hash)]
286        enum __FieldTag {
287            __id,
288            __instance,
289            __project,
290            Unknown(std::string::String),
291        }
292        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
293            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
294            where
295                D: serde::Deserializer<'de>,
296            {
297                struct Visitor;
298                impl<'de> serde::de::Visitor<'de> for Visitor {
299                    type Value = __FieldTag;
300                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
301                        formatter.write_str("a field name for SqlBackupRunsGetRequest")
302                    }
303                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
304                    where
305                        E: serde::de::Error,
306                    {
307                        use std::result::Result::Ok;
308                        use std::string::ToString;
309                        match value {
310                            "id" => Ok(__FieldTag::__id),
311                            "instance" => Ok(__FieldTag::__instance),
312                            "project" => Ok(__FieldTag::__project),
313                            _ => Ok(__FieldTag::Unknown(value.to_string())),
314                        }
315                    }
316                }
317                deserializer.deserialize_identifier(Visitor)
318            }
319        }
320        struct Visitor;
321        impl<'de> serde::de::Visitor<'de> for Visitor {
322            type Value = SqlBackupRunsGetRequest;
323            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
324                formatter.write_str("struct SqlBackupRunsGetRequest")
325            }
326            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
327            where
328                A: serde::de::MapAccess<'de>,
329            {
330                #[allow(unused_imports)]
331                use serde::de::Error;
332                use std::option::Option::Some;
333                let mut fields = std::collections::HashSet::new();
334                let mut result = Self::Value::new();
335                while let Some(tag) = map.next_key::<__FieldTag>()? {
336                    #[allow(clippy::match_single_binding)]
337                    match tag {
338                        __FieldTag::__id => {
339                            if !fields.insert(__FieldTag::__id) {
340                                return std::result::Result::Err(A::Error::duplicate_field(
341                                    "multiple values for id",
342                                ));
343                            }
344                            struct __With(std::option::Option<i64>);
345                            impl<'de> serde::de::Deserialize<'de> for __With {
346                                fn deserialize<D>(
347                                    deserializer: D,
348                                ) -> std::result::Result<Self, D::Error>
349                                where
350                                    D: serde::de::Deserializer<'de>,
351                                {
352                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
353                                }
354                            }
355                            result.id = map.next_value::<__With>()?.0.unwrap_or_default();
356                        }
357                        __FieldTag::__instance => {
358                            if !fields.insert(__FieldTag::__instance) {
359                                return std::result::Result::Err(A::Error::duplicate_field(
360                                    "multiple values for instance",
361                                ));
362                            }
363                            result.instance = map
364                                .next_value::<std::option::Option<std::string::String>>()?
365                                .unwrap_or_default();
366                        }
367                        __FieldTag::__project => {
368                            if !fields.insert(__FieldTag::__project) {
369                                return std::result::Result::Err(A::Error::duplicate_field(
370                                    "multiple values for project",
371                                ));
372                            }
373                            result.project = map
374                                .next_value::<std::option::Option<std::string::String>>()?
375                                .unwrap_or_default();
376                        }
377                        __FieldTag::Unknown(key) => {
378                            let value = map.next_value::<serde_json::Value>()?;
379                            result._unknown_fields.insert(key, value);
380                        }
381                    }
382                }
383                std::result::Result::Ok(result)
384            }
385        }
386        deserializer.deserialize_any(Visitor)
387    }
388}
389
390#[doc(hidden)]
391impl serde::ser::Serialize for SqlBackupRunsGetRequest {
392    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
393    where
394        S: serde::ser::Serializer,
395    {
396        use serde::ser::SerializeMap;
397        #[allow(unused_imports)]
398        use std::option::Option::Some;
399        let mut state = serializer.serialize_map(std::option::Option::None)?;
400        if !wkt::internal::is_default(&self.id) {
401            struct __With<'a>(&'a i64);
402            impl<'a> serde::ser::Serialize for __With<'a> {
403                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
404                where
405                    S: serde::ser::Serializer,
406                {
407                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
408                }
409            }
410            state.serialize_entry("id", &__With(&self.id))?;
411        }
412        if !self.instance.is_empty() {
413            state.serialize_entry("instance", &self.instance)?;
414        }
415        if !self.project.is_empty() {
416            state.serialize_entry("project", &self.project)?;
417        }
418        if !self._unknown_fields.is_empty() {
419            for (key, value) in self._unknown_fields.iter() {
420                state.serialize_entry(key, &value)?;
421            }
422        }
423        state.end()
424    }
425}
426
427/// Backup runs insert request.
428#[derive(Clone, Debug, Default, PartialEq)]
429#[non_exhaustive]
430pub struct SqlBackupRunsInsertRequest {
431    /// Cloud SQL instance ID. This does not include the project ID.
432    pub instance: std::string::String,
433
434    /// Project ID of the project that contains the instance.
435    pub project: std::string::String,
436
437    pub body: std::option::Option<crate::model::BackupRun>,
438
439    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
440}
441
442impl SqlBackupRunsInsertRequest {
443    pub fn new() -> Self {
444        std::default::Default::default()
445    }
446
447    /// Sets the value of [instance][crate::model::SqlBackupRunsInsertRequest::instance].
448    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
449        self.instance = v.into();
450        self
451    }
452
453    /// Sets the value of [project][crate::model::SqlBackupRunsInsertRequest::project].
454    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
455        self.project = v.into();
456        self
457    }
458
459    /// Sets the value of [body][crate::model::SqlBackupRunsInsertRequest::body].
460    pub fn set_body<T>(mut self, v: T) -> Self
461    where
462        T: std::convert::Into<crate::model::BackupRun>,
463    {
464        self.body = std::option::Option::Some(v.into());
465        self
466    }
467
468    /// Sets or clears the value of [body][crate::model::SqlBackupRunsInsertRequest::body].
469    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
470    where
471        T: std::convert::Into<crate::model::BackupRun>,
472    {
473        self.body = v.map(|x| x.into());
474        self
475    }
476}
477
478impl wkt::message::Message for SqlBackupRunsInsertRequest {
479    fn typename() -> &'static str {
480        "type.googleapis.com/google.cloud.sql.v1.SqlBackupRunsInsertRequest"
481    }
482}
483
484#[doc(hidden)]
485impl<'de> serde::de::Deserialize<'de> for SqlBackupRunsInsertRequest {
486    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
487    where
488        D: serde::Deserializer<'de>,
489    {
490        #[allow(non_camel_case_types)]
491        #[doc(hidden)]
492        #[derive(PartialEq, Eq, Hash)]
493        enum __FieldTag {
494            __instance,
495            __project,
496            __body,
497            Unknown(std::string::String),
498        }
499        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
500            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
501            where
502                D: serde::Deserializer<'de>,
503            {
504                struct Visitor;
505                impl<'de> serde::de::Visitor<'de> for Visitor {
506                    type Value = __FieldTag;
507                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
508                        formatter.write_str("a field name for SqlBackupRunsInsertRequest")
509                    }
510                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
511                    where
512                        E: serde::de::Error,
513                    {
514                        use std::result::Result::Ok;
515                        use std::string::ToString;
516                        match value {
517                            "instance" => Ok(__FieldTag::__instance),
518                            "project" => Ok(__FieldTag::__project),
519                            "body" => Ok(__FieldTag::__body),
520                            _ => Ok(__FieldTag::Unknown(value.to_string())),
521                        }
522                    }
523                }
524                deserializer.deserialize_identifier(Visitor)
525            }
526        }
527        struct Visitor;
528        impl<'de> serde::de::Visitor<'de> for Visitor {
529            type Value = SqlBackupRunsInsertRequest;
530            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
531                formatter.write_str("struct SqlBackupRunsInsertRequest")
532            }
533            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
534            where
535                A: serde::de::MapAccess<'de>,
536            {
537                #[allow(unused_imports)]
538                use serde::de::Error;
539                use std::option::Option::Some;
540                let mut fields = std::collections::HashSet::new();
541                let mut result = Self::Value::new();
542                while let Some(tag) = map.next_key::<__FieldTag>()? {
543                    #[allow(clippy::match_single_binding)]
544                    match tag {
545                        __FieldTag::__instance => {
546                            if !fields.insert(__FieldTag::__instance) {
547                                return std::result::Result::Err(A::Error::duplicate_field(
548                                    "multiple values for instance",
549                                ));
550                            }
551                            result.instance = map
552                                .next_value::<std::option::Option<std::string::String>>()?
553                                .unwrap_or_default();
554                        }
555                        __FieldTag::__project => {
556                            if !fields.insert(__FieldTag::__project) {
557                                return std::result::Result::Err(A::Error::duplicate_field(
558                                    "multiple values for project",
559                                ));
560                            }
561                            result.project = map
562                                .next_value::<std::option::Option<std::string::String>>()?
563                                .unwrap_or_default();
564                        }
565                        __FieldTag::__body => {
566                            if !fields.insert(__FieldTag::__body) {
567                                return std::result::Result::Err(A::Error::duplicate_field(
568                                    "multiple values for body",
569                                ));
570                            }
571                            result.body =
572                                map.next_value::<std::option::Option<crate::model::BackupRun>>()?;
573                        }
574                        __FieldTag::Unknown(key) => {
575                            let value = map.next_value::<serde_json::Value>()?;
576                            result._unknown_fields.insert(key, value);
577                        }
578                    }
579                }
580                std::result::Result::Ok(result)
581            }
582        }
583        deserializer.deserialize_any(Visitor)
584    }
585}
586
587#[doc(hidden)]
588impl serde::ser::Serialize for SqlBackupRunsInsertRequest {
589    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
590    where
591        S: serde::ser::Serializer,
592    {
593        use serde::ser::SerializeMap;
594        #[allow(unused_imports)]
595        use std::option::Option::Some;
596        let mut state = serializer.serialize_map(std::option::Option::None)?;
597        if !self.instance.is_empty() {
598            state.serialize_entry("instance", &self.instance)?;
599        }
600        if !self.project.is_empty() {
601            state.serialize_entry("project", &self.project)?;
602        }
603        if self.body.is_some() {
604            state.serialize_entry("body", &self.body)?;
605        }
606        if !self._unknown_fields.is_empty() {
607            for (key, value) in self._unknown_fields.iter() {
608                state.serialize_entry(key, &value)?;
609            }
610        }
611        state.end()
612    }
613}
614
615/// Backup runs list request.
616#[derive(Clone, Debug, Default, PartialEq)]
617#[non_exhaustive]
618pub struct SqlBackupRunsListRequest {
619    /// Cloud SQL instance ID, or "-" for all instances. This does not include
620    /// the project ID.
621    pub instance: std::string::String,
622
623    /// Maximum number of backup runs per response.
624    pub max_results: i32,
625
626    /// A previously-returned page token representing part of the larger set of
627    /// results to view.
628    pub page_token: std::string::String,
629
630    /// Project ID of the project that contains the instance.
631    pub project: std::string::String,
632
633    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
634}
635
636impl SqlBackupRunsListRequest {
637    pub fn new() -> Self {
638        std::default::Default::default()
639    }
640
641    /// Sets the value of [instance][crate::model::SqlBackupRunsListRequest::instance].
642    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
643        self.instance = v.into();
644        self
645    }
646
647    /// Sets the value of [max_results][crate::model::SqlBackupRunsListRequest::max_results].
648    pub fn set_max_results<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
649        self.max_results = v.into();
650        self
651    }
652
653    /// Sets the value of [page_token][crate::model::SqlBackupRunsListRequest::page_token].
654    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
655        self.page_token = v.into();
656        self
657    }
658
659    /// Sets the value of [project][crate::model::SqlBackupRunsListRequest::project].
660    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
661        self.project = v.into();
662        self
663    }
664}
665
666impl wkt::message::Message for SqlBackupRunsListRequest {
667    fn typename() -> &'static str {
668        "type.googleapis.com/google.cloud.sql.v1.SqlBackupRunsListRequest"
669    }
670}
671
672#[doc(hidden)]
673impl<'de> serde::de::Deserialize<'de> for SqlBackupRunsListRequest {
674    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
675    where
676        D: serde::Deserializer<'de>,
677    {
678        #[allow(non_camel_case_types)]
679        #[doc(hidden)]
680        #[derive(PartialEq, Eq, Hash)]
681        enum __FieldTag {
682            __instance,
683            __max_results,
684            __page_token,
685            __project,
686            Unknown(std::string::String),
687        }
688        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
689            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
690            where
691                D: serde::Deserializer<'de>,
692            {
693                struct Visitor;
694                impl<'de> serde::de::Visitor<'de> for Visitor {
695                    type Value = __FieldTag;
696                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
697                        formatter.write_str("a field name for SqlBackupRunsListRequest")
698                    }
699                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
700                    where
701                        E: serde::de::Error,
702                    {
703                        use std::result::Result::Ok;
704                        use std::string::ToString;
705                        match value {
706                            "instance" => Ok(__FieldTag::__instance),
707                            "maxResults" => Ok(__FieldTag::__max_results),
708                            "max_results" => Ok(__FieldTag::__max_results),
709                            "pageToken" => Ok(__FieldTag::__page_token),
710                            "page_token" => Ok(__FieldTag::__page_token),
711                            "project" => Ok(__FieldTag::__project),
712                            _ => Ok(__FieldTag::Unknown(value.to_string())),
713                        }
714                    }
715                }
716                deserializer.deserialize_identifier(Visitor)
717            }
718        }
719        struct Visitor;
720        impl<'de> serde::de::Visitor<'de> for Visitor {
721            type Value = SqlBackupRunsListRequest;
722            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
723                formatter.write_str("struct SqlBackupRunsListRequest")
724            }
725            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
726            where
727                A: serde::de::MapAccess<'de>,
728            {
729                #[allow(unused_imports)]
730                use serde::de::Error;
731                use std::option::Option::Some;
732                let mut fields = std::collections::HashSet::new();
733                let mut result = Self::Value::new();
734                while let Some(tag) = map.next_key::<__FieldTag>()? {
735                    #[allow(clippy::match_single_binding)]
736                    match tag {
737                        __FieldTag::__instance => {
738                            if !fields.insert(__FieldTag::__instance) {
739                                return std::result::Result::Err(A::Error::duplicate_field(
740                                    "multiple values for instance",
741                                ));
742                            }
743                            result.instance = map
744                                .next_value::<std::option::Option<std::string::String>>()?
745                                .unwrap_or_default();
746                        }
747                        __FieldTag::__max_results => {
748                            if !fields.insert(__FieldTag::__max_results) {
749                                return std::result::Result::Err(A::Error::duplicate_field(
750                                    "multiple values for max_results",
751                                ));
752                            }
753                            struct __With(std::option::Option<i32>);
754                            impl<'de> serde::de::Deserialize<'de> for __With {
755                                fn deserialize<D>(
756                                    deserializer: D,
757                                ) -> std::result::Result<Self, D::Error>
758                                where
759                                    D: serde::de::Deserializer<'de>,
760                                {
761                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
762                                }
763                            }
764                            result.max_results = map.next_value::<__With>()?.0.unwrap_or_default();
765                        }
766                        __FieldTag::__page_token => {
767                            if !fields.insert(__FieldTag::__page_token) {
768                                return std::result::Result::Err(A::Error::duplicate_field(
769                                    "multiple values for page_token",
770                                ));
771                            }
772                            result.page_token = map
773                                .next_value::<std::option::Option<std::string::String>>()?
774                                .unwrap_or_default();
775                        }
776                        __FieldTag::__project => {
777                            if !fields.insert(__FieldTag::__project) {
778                                return std::result::Result::Err(A::Error::duplicate_field(
779                                    "multiple values for project",
780                                ));
781                            }
782                            result.project = map
783                                .next_value::<std::option::Option<std::string::String>>()?
784                                .unwrap_or_default();
785                        }
786                        __FieldTag::Unknown(key) => {
787                            let value = map.next_value::<serde_json::Value>()?;
788                            result._unknown_fields.insert(key, value);
789                        }
790                    }
791                }
792                std::result::Result::Ok(result)
793            }
794        }
795        deserializer.deserialize_any(Visitor)
796    }
797}
798
799#[doc(hidden)]
800impl serde::ser::Serialize for SqlBackupRunsListRequest {
801    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
802    where
803        S: serde::ser::Serializer,
804    {
805        use serde::ser::SerializeMap;
806        #[allow(unused_imports)]
807        use std::option::Option::Some;
808        let mut state = serializer.serialize_map(std::option::Option::None)?;
809        if !self.instance.is_empty() {
810            state.serialize_entry("instance", &self.instance)?;
811        }
812        if !wkt::internal::is_default(&self.max_results) {
813            struct __With<'a>(&'a i32);
814            impl<'a> serde::ser::Serialize for __With<'a> {
815                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
816                where
817                    S: serde::ser::Serializer,
818                {
819                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
820                }
821            }
822            state.serialize_entry("maxResults", &__With(&self.max_results))?;
823        }
824        if !self.page_token.is_empty() {
825            state.serialize_entry("pageToken", &self.page_token)?;
826        }
827        if !self.project.is_empty() {
828            state.serialize_entry("project", &self.project)?;
829        }
830        if !self._unknown_fields.is_empty() {
831            for (key, value) in self._unknown_fields.iter() {
832                state.serialize_entry(key, &value)?;
833            }
834        }
835        state.end()
836    }
837}
838
839/// A BackupRun resource.
840#[derive(Clone, Debug, Default, PartialEq)]
841#[non_exhaustive]
842pub struct BackupRun {
843    /// This is always `sql#backupRun`.
844    pub kind: std::string::String,
845
846    /// The status of this run.
847    pub status: crate::model::SqlBackupRunStatus,
848
849    /// The time the run was enqueued in UTC timezone in
850    /// [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example
851    /// `2012-11-15T16:19:00.094Z`.
852    pub enqueued_time: std::option::Option<wkt::Timestamp>,
853
854    /// The identifier for this backup run. Unique only for a specific Cloud SQL
855    /// instance.
856    pub id: i64,
857
858    /// The time the backup operation actually started in UTC timezone in
859    /// [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example
860    /// `2012-11-15T16:19:00.094Z`.
861    pub start_time: std::option::Option<wkt::Timestamp>,
862
863    /// The time the backup operation completed in UTC timezone in
864    /// [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example
865    /// `2012-11-15T16:19:00.094Z`.
866    pub end_time: std::option::Option<wkt::Timestamp>,
867
868    /// Information about why the backup operation failed. This is only present if
869    /// the run has the FAILED status.
870    pub error: std::option::Option<crate::model::OperationError>,
871
872    /// The type of this run; can be either "AUTOMATED" or "ON_DEMAND" or "FINAL".
873    /// This field defaults to "ON_DEMAND" and is ignored, when specified for
874    /// insert requests.
875    pub r#type: crate::model::SqlBackupRunType,
876
877    /// The description of this run, only applicable to on-demand backups.
878    pub description: std::string::String,
879
880    /// The start time of the backup window during which this the backup was
881    /// attempted in [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for
882    /// example `2012-11-15T16:19:00.094Z`.
883    pub window_start_time: std::option::Option<wkt::Timestamp>,
884
885    /// Name of the database instance.
886    pub instance: std::string::String,
887
888    /// The URI of this resource.
889    pub self_link: std::string::String,
890
891    /// Location of the backups.
892    pub location: std::string::String,
893
894    /// Encryption configuration specific to a backup.
895    pub disk_encryption_configuration:
896        std::option::Option<crate::model::DiskEncryptionConfiguration>,
897
898    /// Encryption status specific to a backup.
899    pub disk_encryption_status: std::option::Option<crate::model::DiskEncryptionStatus>,
900
901    /// Specifies the kind of backup, PHYSICAL or DEFAULT_SNAPSHOT.
902    pub backup_kind: crate::model::SqlBackupKind,
903
904    /// Backup time zone to prevent restores to an instance with
905    /// a different time zone. Now relevant only for SQL Server.
906    pub time_zone: std::string::String,
907
908    /// Output only. The maximum chargeable bytes for the backup.
909    pub max_chargeable_bytes: std::option::Option<i64>,
910
911    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
912}
913
914impl BackupRun {
915    pub fn new() -> Self {
916        std::default::Default::default()
917    }
918
919    /// Sets the value of [kind][crate::model::BackupRun::kind].
920    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
921        self.kind = v.into();
922        self
923    }
924
925    /// Sets the value of [status][crate::model::BackupRun::status].
926    pub fn set_status<T: std::convert::Into<crate::model::SqlBackupRunStatus>>(
927        mut self,
928        v: T,
929    ) -> Self {
930        self.status = v.into();
931        self
932    }
933
934    /// Sets the value of [enqueued_time][crate::model::BackupRun::enqueued_time].
935    pub fn set_enqueued_time<T>(mut self, v: T) -> Self
936    where
937        T: std::convert::Into<wkt::Timestamp>,
938    {
939        self.enqueued_time = std::option::Option::Some(v.into());
940        self
941    }
942
943    /// Sets or clears the value of [enqueued_time][crate::model::BackupRun::enqueued_time].
944    pub fn set_or_clear_enqueued_time<T>(mut self, v: std::option::Option<T>) -> Self
945    where
946        T: std::convert::Into<wkt::Timestamp>,
947    {
948        self.enqueued_time = v.map(|x| x.into());
949        self
950    }
951
952    /// Sets the value of [id][crate::model::BackupRun::id].
953    pub fn set_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
954        self.id = v.into();
955        self
956    }
957
958    /// Sets the value of [start_time][crate::model::BackupRun::start_time].
959    pub fn set_start_time<T>(mut self, v: T) -> Self
960    where
961        T: std::convert::Into<wkt::Timestamp>,
962    {
963        self.start_time = std::option::Option::Some(v.into());
964        self
965    }
966
967    /// Sets or clears the value of [start_time][crate::model::BackupRun::start_time].
968    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
969    where
970        T: std::convert::Into<wkt::Timestamp>,
971    {
972        self.start_time = v.map(|x| x.into());
973        self
974    }
975
976    /// Sets the value of [end_time][crate::model::BackupRun::end_time].
977    pub fn set_end_time<T>(mut self, v: T) -> Self
978    where
979        T: std::convert::Into<wkt::Timestamp>,
980    {
981        self.end_time = std::option::Option::Some(v.into());
982        self
983    }
984
985    /// Sets or clears the value of [end_time][crate::model::BackupRun::end_time].
986    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
987    where
988        T: std::convert::Into<wkt::Timestamp>,
989    {
990        self.end_time = v.map(|x| x.into());
991        self
992    }
993
994    /// Sets the value of [error][crate::model::BackupRun::error].
995    pub fn set_error<T>(mut self, v: T) -> Self
996    where
997        T: std::convert::Into<crate::model::OperationError>,
998    {
999        self.error = std::option::Option::Some(v.into());
1000        self
1001    }
1002
1003    /// Sets or clears the value of [error][crate::model::BackupRun::error].
1004    pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
1005    where
1006        T: std::convert::Into<crate::model::OperationError>,
1007    {
1008        self.error = v.map(|x| x.into());
1009        self
1010    }
1011
1012    /// Sets the value of [r#type][crate::model::BackupRun::type].
1013    pub fn set_type<T: std::convert::Into<crate::model::SqlBackupRunType>>(mut self, v: T) -> Self {
1014        self.r#type = v.into();
1015        self
1016    }
1017
1018    /// Sets the value of [description][crate::model::BackupRun::description].
1019    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1020        self.description = v.into();
1021        self
1022    }
1023
1024    /// Sets the value of [window_start_time][crate::model::BackupRun::window_start_time].
1025    pub fn set_window_start_time<T>(mut self, v: T) -> Self
1026    where
1027        T: std::convert::Into<wkt::Timestamp>,
1028    {
1029        self.window_start_time = std::option::Option::Some(v.into());
1030        self
1031    }
1032
1033    /// Sets or clears the value of [window_start_time][crate::model::BackupRun::window_start_time].
1034    pub fn set_or_clear_window_start_time<T>(mut self, v: std::option::Option<T>) -> Self
1035    where
1036        T: std::convert::Into<wkt::Timestamp>,
1037    {
1038        self.window_start_time = v.map(|x| x.into());
1039        self
1040    }
1041
1042    /// Sets the value of [instance][crate::model::BackupRun::instance].
1043    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1044        self.instance = v.into();
1045        self
1046    }
1047
1048    /// Sets the value of [self_link][crate::model::BackupRun::self_link].
1049    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1050        self.self_link = v.into();
1051        self
1052    }
1053
1054    /// Sets the value of [location][crate::model::BackupRun::location].
1055    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1056        self.location = v.into();
1057        self
1058    }
1059
1060    /// Sets the value of [disk_encryption_configuration][crate::model::BackupRun::disk_encryption_configuration].
1061    pub fn set_disk_encryption_configuration<T>(mut self, v: T) -> Self
1062    where
1063        T: std::convert::Into<crate::model::DiskEncryptionConfiguration>,
1064    {
1065        self.disk_encryption_configuration = std::option::Option::Some(v.into());
1066        self
1067    }
1068
1069    /// Sets or clears the value of [disk_encryption_configuration][crate::model::BackupRun::disk_encryption_configuration].
1070    pub fn set_or_clear_disk_encryption_configuration<T>(
1071        mut self,
1072        v: std::option::Option<T>,
1073    ) -> Self
1074    where
1075        T: std::convert::Into<crate::model::DiskEncryptionConfiguration>,
1076    {
1077        self.disk_encryption_configuration = v.map(|x| x.into());
1078        self
1079    }
1080
1081    /// Sets the value of [disk_encryption_status][crate::model::BackupRun::disk_encryption_status].
1082    pub fn set_disk_encryption_status<T>(mut self, v: T) -> Self
1083    where
1084        T: std::convert::Into<crate::model::DiskEncryptionStatus>,
1085    {
1086        self.disk_encryption_status = std::option::Option::Some(v.into());
1087        self
1088    }
1089
1090    /// Sets or clears the value of [disk_encryption_status][crate::model::BackupRun::disk_encryption_status].
1091    pub fn set_or_clear_disk_encryption_status<T>(mut self, v: std::option::Option<T>) -> Self
1092    where
1093        T: std::convert::Into<crate::model::DiskEncryptionStatus>,
1094    {
1095        self.disk_encryption_status = v.map(|x| x.into());
1096        self
1097    }
1098
1099    /// Sets the value of [backup_kind][crate::model::BackupRun::backup_kind].
1100    pub fn set_backup_kind<T: std::convert::Into<crate::model::SqlBackupKind>>(
1101        mut self,
1102        v: T,
1103    ) -> Self {
1104        self.backup_kind = v.into();
1105        self
1106    }
1107
1108    /// Sets the value of [time_zone][crate::model::BackupRun::time_zone].
1109    pub fn set_time_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1110        self.time_zone = v.into();
1111        self
1112    }
1113
1114    /// Sets the value of [max_chargeable_bytes][crate::model::BackupRun::max_chargeable_bytes].
1115    pub fn set_max_chargeable_bytes<T>(mut self, v: T) -> Self
1116    where
1117        T: std::convert::Into<i64>,
1118    {
1119        self.max_chargeable_bytes = std::option::Option::Some(v.into());
1120        self
1121    }
1122
1123    /// Sets or clears the value of [max_chargeable_bytes][crate::model::BackupRun::max_chargeable_bytes].
1124    pub fn set_or_clear_max_chargeable_bytes<T>(mut self, v: std::option::Option<T>) -> Self
1125    where
1126        T: std::convert::Into<i64>,
1127    {
1128        self.max_chargeable_bytes = v.map(|x| x.into());
1129        self
1130    }
1131}
1132
1133impl wkt::message::Message for BackupRun {
1134    fn typename() -> &'static str {
1135        "type.googleapis.com/google.cloud.sql.v1.BackupRun"
1136    }
1137}
1138
1139#[doc(hidden)]
1140impl<'de> serde::de::Deserialize<'de> for BackupRun {
1141    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1142    where
1143        D: serde::Deserializer<'de>,
1144    {
1145        #[allow(non_camel_case_types)]
1146        #[doc(hidden)]
1147        #[derive(PartialEq, Eq, Hash)]
1148        enum __FieldTag {
1149            __kind,
1150            __status,
1151            __enqueued_time,
1152            __id,
1153            __start_time,
1154            __end_time,
1155            __error,
1156            __type,
1157            __description,
1158            __window_start_time,
1159            __instance,
1160            __self_link,
1161            __location,
1162            __disk_encryption_configuration,
1163            __disk_encryption_status,
1164            __backup_kind,
1165            __time_zone,
1166            __max_chargeable_bytes,
1167            Unknown(std::string::String),
1168        }
1169        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1170            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1171            where
1172                D: serde::Deserializer<'de>,
1173            {
1174                struct Visitor;
1175                impl<'de> serde::de::Visitor<'de> for Visitor {
1176                    type Value = __FieldTag;
1177                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1178                        formatter.write_str("a field name for BackupRun")
1179                    }
1180                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1181                    where
1182                        E: serde::de::Error,
1183                    {
1184                        use std::result::Result::Ok;
1185                        use std::string::ToString;
1186                        match value {
1187                            "kind" => Ok(__FieldTag::__kind),
1188                            "status" => Ok(__FieldTag::__status),
1189                            "enqueuedTime" => Ok(__FieldTag::__enqueued_time),
1190                            "enqueued_time" => Ok(__FieldTag::__enqueued_time),
1191                            "id" => Ok(__FieldTag::__id),
1192                            "startTime" => Ok(__FieldTag::__start_time),
1193                            "start_time" => Ok(__FieldTag::__start_time),
1194                            "endTime" => Ok(__FieldTag::__end_time),
1195                            "end_time" => Ok(__FieldTag::__end_time),
1196                            "error" => Ok(__FieldTag::__error),
1197                            "type" => Ok(__FieldTag::__type),
1198                            "description" => Ok(__FieldTag::__description),
1199                            "windowStartTime" => Ok(__FieldTag::__window_start_time),
1200                            "window_start_time" => Ok(__FieldTag::__window_start_time),
1201                            "instance" => Ok(__FieldTag::__instance),
1202                            "selfLink" => Ok(__FieldTag::__self_link),
1203                            "self_link" => Ok(__FieldTag::__self_link),
1204                            "location" => Ok(__FieldTag::__location),
1205                            "diskEncryptionConfiguration" => {
1206                                Ok(__FieldTag::__disk_encryption_configuration)
1207                            }
1208                            "disk_encryption_configuration" => {
1209                                Ok(__FieldTag::__disk_encryption_configuration)
1210                            }
1211                            "diskEncryptionStatus" => Ok(__FieldTag::__disk_encryption_status),
1212                            "disk_encryption_status" => Ok(__FieldTag::__disk_encryption_status),
1213                            "backupKind" => Ok(__FieldTag::__backup_kind),
1214                            "backup_kind" => Ok(__FieldTag::__backup_kind),
1215                            "timeZone" => Ok(__FieldTag::__time_zone),
1216                            "time_zone" => Ok(__FieldTag::__time_zone),
1217                            "maxChargeableBytes" => Ok(__FieldTag::__max_chargeable_bytes),
1218                            "max_chargeable_bytes" => Ok(__FieldTag::__max_chargeable_bytes),
1219                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1220                        }
1221                    }
1222                }
1223                deserializer.deserialize_identifier(Visitor)
1224            }
1225        }
1226        struct Visitor;
1227        impl<'de> serde::de::Visitor<'de> for Visitor {
1228            type Value = BackupRun;
1229            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1230                formatter.write_str("struct BackupRun")
1231            }
1232            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1233            where
1234                A: serde::de::MapAccess<'de>,
1235            {
1236                #[allow(unused_imports)]
1237                use serde::de::Error;
1238                use std::option::Option::Some;
1239                let mut fields = std::collections::HashSet::new();
1240                let mut result = Self::Value::new();
1241                while let Some(tag) = map.next_key::<__FieldTag>()? {
1242                    #[allow(clippy::match_single_binding)]
1243                    match tag {
1244                        __FieldTag::__kind => {
1245                            if !fields.insert(__FieldTag::__kind) {
1246                                return std::result::Result::Err(A::Error::duplicate_field(
1247                                    "multiple values for kind",
1248                                ));
1249                            }
1250                            result.kind = map
1251                                .next_value::<std::option::Option<std::string::String>>()?
1252                                .unwrap_or_default();
1253                        }
1254                        __FieldTag::__status => {
1255                            if !fields.insert(__FieldTag::__status) {
1256                                return std::result::Result::Err(A::Error::duplicate_field(
1257                                    "multiple values for status",
1258                                ));
1259                            }
1260                            result.status = map.next_value::<std::option::Option<crate::model::SqlBackupRunStatus>>()?.unwrap_or_default();
1261                        }
1262                        __FieldTag::__enqueued_time => {
1263                            if !fields.insert(__FieldTag::__enqueued_time) {
1264                                return std::result::Result::Err(A::Error::duplicate_field(
1265                                    "multiple values for enqueued_time",
1266                                ));
1267                            }
1268                            result.enqueued_time =
1269                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1270                        }
1271                        __FieldTag::__id => {
1272                            if !fields.insert(__FieldTag::__id) {
1273                                return std::result::Result::Err(A::Error::duplicate_field(
1274                                    "multiple values for id",
1275                                ));
1276                            }
1277                            struct __With(std::option::Option<i64>);
1278                            impl<'de> serde::de::Deserialize<'de> for __With {
1279                                fn deserialize<D>(
1280                                    deserializer: D,
1281                                ) -> std::result::Result<Self, D::Error>
1282                                where
1283                                    D: serde::de::Deserializer<'de>,
1284                                {
1285                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
1286                                }
1287                            }
1288                            result.id = map.next_value::<__With>()?.0.unwrap_or_default();
1289                        }
1290                        __FieldTag::__start_time => {
1291                            if !fields.insert(__FieldTag::__start_time) {
1292                                return std::result::Result::Err(A::Error::duplicate_field(
1293                                    "multiple values for start_time",
1294                                ));
1295                            }
1296                            result.start_time =
1297                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1298                        }
1299                        __FieldTag::__end_time => {
1300                            if !fields.insert(__FieldTag::__end_time) {
1301                                return std::result::Result::Err(A::Error::duplicate_field(
1302                                    "multiple values for end_time",
1303                                ));
1304                            }
1305                            result.end_time =
1306                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1307                        }
1308                        __FieldTag::__error => {
1309                            if !fields.insert(__FieldTag::__error) {
1310                                return std::result::Result::Err(A::Error::duplicate_field(
1311                                    "multiple values for error",
1312                                ));
1313                            }
1314                            result.error = map
1315                                .next_value::<std::option::Option<crate::model::OperationError>>(
1316                                )?;
1317                        }
1318                        __FieldTag::__type => {
1319                            if !fields.insert(__FieldTag::__type) {
1320                                return std::result::Result::Err(A::Error::duplicate_field(
1321                                    "multiple values for type",
1322                                ));
1323                            }
1324                            result.r#type = map
1325                                .next_value::<std::option::Option<crate::model::SqlBackupRunType>>(
1326                                )?
1327                                .unwrap_or_default();
1328                        }
1329                        __FieldTag::__description => {
1330                            if !fields.insert(__FieldTag::__description) {
1331                                return std::result::Result::Err(A::Error::duplicate_field(
1332                                    "multiple values for description",
1333                                ));
1334                            }
1335                            result.description = map
1336                                .next_value::<std::option::Option<std::string::String>>()?
1337                                .unwrap_or_default();
1338                        }
1339                        __FieldTag::__window_start_time => {
1340                            if !fields.insert(__FieldTag::__window_start_time) {
1341                                return std::result::Result::Err(A::Error::duplicate_field(
1342                                    "multiple values for window_start_time",
1343                                ));
1344                            }
1345                            result.window_start_time =
1346                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1347                        }
1348                        __FieldTag::__instance => {
1349                            if !fields.insert(__FieldTag::__instance) {
1350                                return std::result::Result::Err(A::Error::duplicate_field(
1351                                    "multiple values for instance",
1352                                ));
1353                            }
1354                            result.instance = map
1355                                .next_value::<std::option::Option<std::string::String>>()?
1356                                .unwrap_or_default();
1357                        }
1358                        __FieldTag::__self_link => {
1359                            if !fields.insert(__FieldTag::__self_link) {
1360                                return std::result::Result::Err(A::Error::duplicate_field(
1361                                    "multiple values for self_link",
1362                                ));
1363                            }
1364                            result.self_link = map
1365                                .next_value::<std::option::Option<std::string::String>>()?
1366                                .unwrap_or_default();
1367                        }
1368                        __FieldTag::__location => {
1369                            if !fields.insert(__FieldTag::__location) {
1370                                return std::result::Result::Err(A::Error::duplicate_field(
1371                                    "multiple values for location",
1372                                ));
1373                            }
1374                            result.location = map
1375                                .next_value::<std::option::Option<std::string::String>>()?
1376                                .unwrap_or_default();
1377                        }
1378                        __FieldTag::__disk_encryption_configuration => {
1379                            if !fields.insert(__FieldTag::__disk_encryption_configuration) {
1380                                return std::result::Result::Err(A::Error::duplicate_field(
1381                                    "multiple values for disk_encryption_configuration",
1382                                ));
1383                            }
1384                            result.disk_encryption_configuration = map.next_value::<std::option::Option<crate::model::DiskEncryptionConfiguration>>()?
1385                                ;
1386                        }
1387                        __FieldTag::__disk_encryption_status => {
1388                            if !fields.insert(__FieldTag::__disk_encryption_status) {
1389                                return std::result::Result::Err(A::Error::duplicate_field(
1390                                    "multiple values for disk_encryption_status",
1391                                ));
1392                            }
1393                            result.disk_encryption_status = map.next_value::<std::option::Option<crate::model::DiskEncryptionStatus>>()?
1394                                ;
1395                        }
1396                        __FieldTag::__backup_kind => {
1397                            if !fields.insert(__FieldTag::__backup_kind) {
1398                                return std::result::Result::Err(A::Error::duplicate_field(
1399                                    "multiple values for backup_kind",
1400                                ));
1401                            }
1402                            result.backup_kind = map
1403                                .next_value::<std::option::Option<crate::model::SqlBackupKind>>()?
1404                                .unwrap_or_default();
1405                        }
1406                        __FieldTag::__time_zone => {
1407                            if !fields.insert(__FieldTag::__time_zone) {
1408                                return std::result::Result::Err(A::Error::duplicate_field(
1409                                    "multiple values for time_zone",
1410                                ));
1411                            }
1412                            result.time_zone = map
1413                                .next_value::<std::option::Option<std::string::String>>()?
1414                                .unwrap_or_default();
1415                        }
1416                        __FieldTag::__max_chargeable_bytes => {
1417                            if !fields.insert(__FieldTag::__max_chargeable_bytes) {
1418                                return std::result::Result::Err(A::Error::duplicate_field(
1419                                    "multiple values for max_chargeable_bytes",
1420                                ));
1421                            }
1422                            struct __With(std::option::Option<i64>);
1423                            impl<'de> serde::de::Deserialize<'de> for __With {
1424                                fn deserialize<D>(
1425                                    deserializer: D,
1426                                ) -> std::result::Result<Self, D::Error>
1427                                where
1428                                    D: serde::de::Deserializer<'de>,
1429                                {
1430                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
1431                                }
1432                            }
1433                            result.max_chargeable_bytes = map.next_value::<__With>()?.0;
1434                        }
1435                        __FieldTag::Unknown(key) => {
1436                            let value = map.next_value::<serde_json::Value>()?;
1437                            result._unknown_fields.insert(key, value);
1438                        }
1439                    }
1440                }
1441                std::result::Result::Ok(result)
1442            }
1443        }
1444        deserializer.deserialize_any(Visitor)
1445    }
1446}
1447
1448#[doc(hidden)]
1449impl serde::ser::Serialize for BackupRun {
1450    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1451    where
1452        S: serde::ser::Serializer,
1453    {
1454        use serde::ser::SerializeMap;
1455        #[allow(unused_imports)]
1456        use std::option::Option::Some;
1457        let mut state = serializer.serialize_map(std::option::Option::None)?;
1458        if !self.kind.is_empty() {
1459            state.serialize_entry("kind", &self.kind)?;
1460        }
1461        if !wkt::internal::is_default(&self.status) {
1462            state.serialize_entry("status", &self.status)?;
1463        }
1464        if self.enqueued_time.is_some() {
1465            state.serialize_entry("enqueuedTime", &self.enqueued_time)?;
1466        }
1467        if !wkt::internal::is_default(&self.id) {
1468            struct __With<'a>(&'a i64);
1469            impl<'a> serde::ser::Serialize for __With<'a> {
1470                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1471                where
1472                    S: serde::ser::Serializer,
1473                {
1474                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
1475                }
1476            }
1477            state.serialize_entry("id", &__With(&self.id))?;
1478        }
1479        if self.start_time.is_some() {
1480            state.serialize_entry("startTime", &self.start_time)?;
1481        }
1482        if self.end_time.is_some() {
1483            state.serialize_entry("endTime", &self.end_time)?;
1484        }
1485        if self.error.is_some() {
1486            state.serialize_entry("error", &self.error)?;
1487        }
1488        if !wkt::internal::is_default(&self.r#type) {
1489            state.serialize_entry("type", &self.r#type)?;
1490        }
1491        if !self.description.is_empty() {
1492            state.serialize_entry("description", &self.description)?;
1493        }
1494        if self.window_start_time.is_some() {
1495            state.serialize_entry("windowStartTime", &self.window_start_time)?;
1496        }
1497        if !self.instance.is_empty() {
1498            state.serialize_entry("instance", &self.instance)?;
1499        }
1500        if !self.self_link.is_empty() {
1501            state.serialize_entry("selfLink", &self.self_link)?;
1502        }
1503        if !self.location.is_empty() {
1504            state.serialize_entry("location", &self.location)?;
1505        }
1506        if self.disk_encryption_configuration.is_some() {
1507            state.serialize_entry(
1508                "diskEncryptionConfiguration",
1509                &self.disk_encryption_configuration,
1510            )?;
1511        }
1512        if self.disk_encryption_status.is_some() {
1513            state.serialize_entry("diskEncryptionStatus", &self.disk_encryption_status)?;
1514        }
1515        if !wkt::internal::is_default(&self.backup_kind) {
1516            state.serialize_entry("backupKind", &self.backup_kind)?;
1517        }
1518        if !self.time_zone.is_empty() {
1519            state.serialize_entry("timeZone", &self.time_zone)?;
1520        }
1521        if self.max_chargeable_bytes.is_some() {
1522            struct __With<'a>(&'a std::option::Option<i64>);
1523            impl<'a> serde::ser::Serialize for __With<'a> {
1524                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1525                where
1526                    S: serde::ser::Serializer,
1527                {
1528                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
1529                        self.0, serializer,
1530                    )
1531                }
1532            }
1533            state.serialize_entry("maxChargeableBytes", &__With(&self.max_chargeable_bytes))?;
1534        }
1535        if !self._unknown_fields.is_empty() {
1536            for (key, value) in self._unknown_fields.iter() {
1537                state.serialize_entry(key, &value)?;
1538            }
1539        }
1540        state.end()
1541    }
1542}
1543
1544/// Backup run list results.
1545#[derive(Clone, Debug, Default, PartialEq)]
1546#[non_exhaustive]
1547pub struct BackupRunsListResponse {
1548    /// This is always `sql#backupRunsList`.
1549    pub kind: std::string::String,
1550
1551    /// A list of backup runs in reverse chronological order of the enqueued time.
1552    pub items: std::vec::Vec<crate::model::BackupRun>,
1553
1554    /// The continuation token, used to page through large result sets. Provide
1555    /// this value in a subsequent request to return the next page of results.
1556    pub next_page_token: std::string::String,
1557
1558    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1559}
1560
1561impl BackupRunsListResponse {
1562    pub fn new() -> Self {
1563        std::default::Default::default()
1564    }
1565
1566    /// Sets the value of [kind][crate::model::BackupRunsListResponse::kind].
1567    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1568        self.kind = v.into();
1569        self
1570    }
1571
1572    /// Sets the value of [items][crate::model::BackupRunsListResponse::items].
1573    pub fn set_items<T, V>(mut self, v: T) -> Self
1574    where
1575        T: std::iter::IntoIterator<Item = V>,
1576        V: std::convert::Into<crate::model::BackupRun>,
1577    {
1578        use std::iter::Iterator;
1579        self.items = v.into_iter().map(|i| i.into()).collect();
1580        self
1581    }
1582
1583    /// Sets the value of [next_page_token][crate::model::BackupRunsListResponse::next_page_token].
1584    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1585        self.next_page_token = v.into();
1586        self
1587    }
1588}
1589
1590impl wkt::message::Message for BackupRunsListResponse {
1591    fn typename() -> &'static str {
1592        "type.googleapis.com/google.cloud.sql.v1.BackupRunsListResponse"
1593    }
1594}
1595
1596#[doc(hidden)]
1597impl gax::paginator::internal::PageableResponse for BackupRunsListResponse {
1598    type PageItem = crate::model::BackupRun;
1599
1600    fn items(self) -> std::vec::Vec<Self::PageItem> {
1601        self.items
1602    }
1603
1604    fn next_page_token(&self) -> std::string::String {
1605        use std::clone::Clone;
1606        self.next_page_token.clone()
1607    }
1608}
1609
1610#[doc(hidden)]
1611impl<'de> serde::de::Deserialize<'de> for BackupRunsListResponse {
1612    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1613    where
1614        D: serde::Deserializer<'de>,
1615    {
1616        #[allow(non_camel_case_types)]
1617        #[doc(hidden)]
1618        #[derive(PartialEq, Eq, Hash)]
1619        enum __FieldTag {
1620            __kind,
1621            __items,
1622            __next_page_token,
1623            Unknown(std::string::String),
1624        }
1625        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1626            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1627            where
1628                D: serde::Deserializer<'de>,
1629            {
1630                struct Visitor;
1631                impl<'de> serde::de::Visitor<'de> for Visitor {
1632                    type Value = __FieldTag;
1633                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1634                        formatter.write_str("a field name for BackupRunsListResponse")
1635                    }
1636                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1637                    where
1638                        E: serde::de::Error,
1639                    {
1640                        use std::result::Result::Ok;
1641                        use std::string::ToString;
1642                        match value {
1643                            "kind" => Ok(__FieldTag::__kind),
1644                            "items" => Ok(__FieldTag::__items),
1645                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
1646                            "next_page_token" => Ok(__FieldTag::__next_page_token),
1647                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1648                        }
1649                    }
1650                }
1651                deserializer.deserialize_identifier(Visitor)
1652            }
1653        }
1654        struct Visitor;
1655        impl<'de> serde::de::Visitor<'de> for Visitor {
1656            type Value = BackupRunsListResponse;
1657            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1658                formatter.write_str("struct BackupRunsListResponse")
1659            }
1660            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1661            where
1662                A: serde::de::MapAccess<'de>,
1663            {
1664                #[allow(unused_imports)]
1665                use serde::de::Error;
1666                use std::option::Option::Some;
1667                let mut fields = std::collections::HashSet::new();
1668                let mut result = Self::Value::new();
1669                while let Some(tag) = map.next_key::<__FieldTag>()? {
1670                    #[allow(clippy::match_single_binding)]
1671                    match tag {
1672                        __FieldTag::__kind => {
1673                            if !fields.insert(__FieldTag::__kind) {
1674                                return std::result::Result::Err(A::Error::duplicate_field(
1675                                    "multiple values for kind",
1676                                ));
1677                            }
1678                            result.kind = map
1679                                .next_value::<std::option::Option<std::string::String>>()?
1680                                .unwrap_or_default();
1681                        }
1682                        __FieldTag::__items => {
1683                            if !fields.insert(__FieldTag::__items) {
1684                                return std::result::Result::Err(A::Error::duplicate_field(
1685                                    "multiple values for items",
1686                                ));
1687                            }
1688                            result.items = map.next_value::<std::option::Option<std::vec::Vec<crate::model::BackupRun>>>()?.unwrap_or_default();
1689                        }
1690                        __FieldTag::__next_page_token => {
1691                            if !fields.insert(__FieldTag::__next_page_token) {
1692                                return std::result::Result::Err(A::Error::duplicate_field(
1693                                    "multiple values for next_page_token",
1694                                ));
1695                            }
1696                            result.next_page_token = map
1697                                .next_value::<std::option::Option<std::string::String>>()?
1698                                .unwrap_or_default();
1699                        }
1700                        __FieldTag::Unknown(key) => {
1701                            let value = map.next_value::<serde_json::Value>()?;
1702                            result._unknown_fields.insert(key, value);
1703                        }
1704                    }
1705                }
1706                std::result::Result::Ok(result)
1707            }
1708        }
1709        deserializer.deserialize_any(Visitor)
1710    }
1711}
1712
1713#[doc(hidden)]
1714impl serde::ser::Serialize for BackupRunsListResponse {
1715    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1716    where
1717        S: serde::ser::Serializer,
1718    {
1719        use serde::ser::SerializeMap;
1720        #[allow(unused_imports)]
1721        use std::option::Option::Some;
1722        let mut state = serializer.serialize_map(std::option::Option::None)?;
1723        if !self.kind.is_empty() {
1724            state.serialize_entry("kind", &self.kind)?;
1725        }
1726        if !self.items.is_empty() {
1727            state.serialize_entry("items", &self.items)?;
1728        }
1729        if !self.next_page_token.is_empty() {
1730            state.serialize_entry("nextPageToken", &self.next_page_token)?;
1731        }
1732        if !self._unknown_fields.is_empty() {
1733            for (key, value) in self._unknown_fields.iter() {
1734                state.serialize_entry(key, &value)?;
1735            }
1736        }
1737        state.end()
1738    }
1739}
1740
1741/// Connect settings retrieval request.
1742#[derive(Clone, Debug, Default, PartialEq)]
1743#[non_exhaustive]
1744pub struct GetConnectSettingsRequest {
1745    /// Cloud SQL instance ID. This does not include the project ID.
1746    pub instance: std::string::String,
1747
1748    /// Project ID of the project that contains the instance.
1749    pub project: std::string::String,
1750
1751    /// Optional. Optional snapshot read timestamp to trade freshness for
1752    /// performance.
1753    pub read_time: std::option::Option<wkt::Timestamp>,
1754
1755    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1756}
1757
1758impl GetConnectSettingsRequest {
1759    pub fn new() -> Self {
1760        std::default::Default::default()
1761    }
1762
1763    /// Sets the value of [instance][crate::model::GetConnectSettingsRequest::instance].
1764    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1765        self.instance = v.into();
1766        self
1767    }
1768
1769    /// Sets the value of [project][crate::model::GetConnectSettingsRequest::project].
1770    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1771        self.project = v.into();
1772        self
1773    }
1774
1775    /// Sets the value of [read_time][crate::model::GetConnectSettingsRequest::read_time].
1776    pub fn set_read_time<T>(mut self, v: T) -> Self
1777    where
1778        T: std::convert::Into<wkt::Timestamp>,
1779    {
1780        self.read_time = std::option::Option::Some(v.into());
1781        self
1782    }
1783
1784    /// Sets or clears the value of [read_time][crate::model::GetConnectSettingsRequest::read_time].
1785    pub fn set_or_clear_read_time<T>(mut self, v: std::option::Option<T>) -> Self
1786    where
1787        T: std::convert::Into<wkt::Timestamp>,
1788    {
1789        self.read_time = v.map(|x| x.into());
1790        self
1791    }
1792}
1793
1794impl wkt::message::Message for GetConnectSettingsRequest {
1795    fn typename() -> &'static str {
1796        "type.googleapis.com/google.cloud.sql.v1.GetConnectSettingsRequest"
1797    }
1798}
1799
1800#[doc(hidden)]
1801impl<'de> serde::de::Deserialize<'de> for GetConnectSettingsRequest {
1802    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1803    where
1804        D: serde::Deserializer<'de>,
1805    {
1806        #[allow(non_camel_case_types)]
1807        #[doc(hidden)]
1808        #[derive(PartialEq, Eq, Hash)]
1809        enum __FieldTag {
1810            __instance,
1811            __project,
1812            __read_time,
1813            Unknown(std::string::String),
1814        }
1815        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1816            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1817            where
1818                D: serde::Deserializer<'de>,
1819            {
1820                struct Visitor;
1821                impl<'de> serde::de::Visitor<'de> for Visitor {
1822                    type Value = __FieldTag;
1823                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1824                        formatter.write_str("a field name for GetConnectSettingsRequest")
1825                    }
1826                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1827                    where
1828                        E: serde::de::Error,
1829                    {
1830                        use std::result::Result::Ok;
1831                        use std::string::ToString;
1832                        match value {
1833                            "instance" => Ok(__FieldTag::__instance),
1834                            "project" => Ok(__FieldTag::__project),
1835                            "readTime" => Ok(__FieldTag::__read_time),
1836                            "read_time" => Ok(__FieldTag::__read_time),
1837                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1838                        }
1839                    }
1840                }
1841                deserializer.deserialize_identifier(Visitor)
1842            }
1843        }
1844        struct Visitor;
1845        impl<'de> serde::de::Visitor<'de> for Visitor {
1846            type Value = GetConnectSettingsRequest;
1847            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1848                formatter.write_str("struct GetConnectSettingsRequest")
1849            }
1850            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1851            where
1852                A: serde::de::MapAccess<'de>,
1853            {
1854                #[allow(unused_imports)]
1855                use serde::de::Error;
1856                use std::option::Option::Some;
1857                let mut fields = std::collections::HashSet::new();
1858                let mut result = Self::Value::new();
1859                while let Some(tag) = map.next_key::<__FieldTag>()? {
1860                    #[allow(clippy::match_single_binding)]
1861                    match tag {
1862                        __FieldTag::__instance => {
1863                            if !fields.insert(__FieldTag::__instance) {
1864                                return std::result::Result::Err(A::Error::duplicate_field(
1865                                    "multiple values for instance",
1866                                ));
1867                            }
1868                            result.instance = map
1869                                .next_value::<std::option::Option<std::string::String>>()?
1870                                .unwrap_or_default();
1871                        }
1872                        __FieldTag::__project => {
1873                            if !fields.insert(__FieldTag::__project) {
1874                                return std::result::Result::Err(A::Error::duplicate_field(
1875                                    "multiple values for project",
1876                                ));
1877                            }
1878                            result.project = map
1879                                .next_value::<std::option::Option<std::string::String>>()?
1880                                .unwrap_or_default();
1881                        }
1882                        __FieldTag::__read_time => {
1883                            if !fields.insert(__FieldTag::__read_time) {
1884                                return std::result::Result::Err(A::Error::duplicate_field(
1885                                    "multiple values for read_time",
1886                                ));
1887                            }
1888                            result.read_time =
1889                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1890                        }
1891                        __FieldTag::Unknown(key) => {
1892                            let value = map.next_value::<serde_json::Value>()?;
1893                            result._unknown_fields.insert(key, value);
1894                        }
1895                    }
1896                }
1897                std::result::Result::Ok(result)
1898            }
1899        }
1900        deserializer.deserialize_any(Visitor)
1901    }
1902}
1903
1904#[doc(hidden)]
1905impl serde::ser::Serialize for GetConnectSettingsRequest {
1906    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1907    where
1908        S: serde::ser::Serializer,
1909    {
1910        use serde::ser::SerializeMap;
1911        #[allow(unused_imports)]
1912        use std::option::Option::Some;
1913        let mut state = serializer.serialize_map(std::option::Option::None)?;
1914        if !self.instance.is_empty() {
1915            state.serialize_entry("instance", &self.instance)?;
1916        }
1917        if !self.project.is_empty() {
1918            state.serialize_entry("project", &self.project)?;
1919        }
1920        if self.read_time.is_some() {
1921            state.serialize_entry("readTime", &self.read_time)?;
1922        }
1923        if !self._unknown_fields.is_empty() {
1924            for (key, value) in self._unknown_fields.iter() {
1925                state.serialize_entry(key, &value)?;
1926            }
1927        }
1928        state.end()
1929    }
1930}
1931
1932/// Connect settings retrieval response.
1933#[derive(Clone, Debug, Default, PartialEq)]
1934#[non_exhaustive]
1935pub struct ConnectSettings {
1936    /// This is always `sql#connectSettings`.
1937    pub kind: std::string::String,
1938
1939    /// SSL configuration.
1940    pub server_ca_cert: std::option::Option<crate::model::SslCert>,
1941
1942    /// The assigned IP addresses for the instance.
1943    pub ip_addresses: std::vec::Vec<crate::model::IpMapping>,
1944
1945    /// The cloud region for the instance. For example, `us-central1`,
1946    /// `europe-west1`. The region cannot be changed after instance creation.
1947    pub region: std::string::String,
1948
1949    /// The database engine type and version. The `databaseVersion`
1950    /// field cannot be changed after instance creation.
1951    /// MySQL instances: `MYSQL_8_0`, `MYSQL_5_7` (default),
1952    /// or `MYSQL_5_6`.
1953    /// PostgreSQL instances: `POSTGRES_9_6`, `POSTGRES_10`,
1954    /// `POSTGRES_11`, `POSTGRES_12` (default), `POSTGRES_13`, or `POSTGRES_14`.
1955    /// SQL Server instances: `SQLSERVER_2017_STANDARD` (default),
1956    /// `SQLSERVER_2017_ENTERPRISE`, `SQLSERVER_2017_EXPRESS`,
1957    /// `SQLSERVER_2017_WEB`, `SQLSERVER_2019_STANDARD`,
1958    /// `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`, or
1959    /// `SQLSERVER_2019_WEB`.
1960    pub database_version: crate::model::SqlDatabaseVersion,
1961
1962    /// `SECOND_GEN`: Cloud SQL database instance.
1963    /// `EXTERNAL`: A database server that is not managed by Google.
1964    /// This property is read-only; use the `tier` property in the `settings`
1965    /// object to determine the database type.
1966    pub backend_type: crate::model::SqlBackendType,
1967
1968    /// Whether PSC connectivity is enabled for this instance.
1969    pub psc_enabled: bool,
1970
1971    /// The dns name of the instance.
1972    pub dns_name: std::string::String,
1973
1974    /// Specify what type of CA is used for the server certificate.
1975    pub server_ca_mode: crate::model::connect_settings::CaMode,
1976
1977    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1978}
1979
1980impl ConnectSettings {
1981    pub fn new() -> Self {
1982        std::default::Default::default()
1983    }
1984
1985    /// Sets the value of [kind][crate::model::ConnectSettings::kind].
1986    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1987        self.kind = v.into();
1988        self
1989    }
1990
1991    /// Sets the value of [server_ca_cert][crate::model::ConnectSettings::server_ca_cert].
1992    pub fn set_server_ca_cert<T>(mut self, v: T) -> Self
1993    where
1994        T: std::convert::Into<crate::model::SslCert>,
1995    {
1996        self.server_ca_cert = std::option::Option::Some(v.into());
1997        self
1998    }
1999
2000    /// Sets or clears the value of [server_ca_cert][crate::model::ConnectSettings::server_ca_cert].
2001    pub fn set_or_clear_server_ca_cert<T>(mut self, v: std::option::Option<T>) -> Self
2002    where
2003        T: std::convert::Into<crate::model::SslCert>,
2004    {
2005        self.server_ca_cert = v.map(|x| x.into());
2006        self
2007    }
2008
2009    /// Sets the value of [ip_addresses][crate::model::ConnectSettings::ip_addresses].
2010    pub fn set_ip_addresses<T, V>(mut self, v: T) -> Self
2011    where
2012        T: std::iter::IntoIterator<Item = V>,
2013        V: std::convert::Into<crate::model::IpMapping>,
2014    {
2015        use std::iter::Iterator;
2016        self.ip_addresses = v.into_iter().map(|i| i.into()).collect();
2017        self
2018    }
2019
2020    /// Sets the value of [region][crate::model::ConnectSettings::region].
2021    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2022        self.region = v.into();
2023        self
2024    }
2025
2026    /// Sets the value of [database_version][crate::model::ConnectSettings::database_version].
2027    pub fn set_database_version<T: std::convert::Into<crate::model::SqlDatabaseVersion>>(
2028        mut self,
2029        v: T,
2030    ) -> Self {
2031        self.database_version = v.into();
2032        self
2033    }
2034
2035    /// Sets the value of [backend_type][crate::model::ConnectSettings::backend_type].
2036    pub fn set_backend_type<T: std::convert::Into<crate::model::SqlBackendType>>(
2037        mut self,
2038        v: T,
2039    ) -> Self {
2040        self.backend_type = v.into();
2041        self
2042    }
2043
2044    /// Sets the value of [psc_enabled][crate::model::ConnectSettings::psc_enabled].
2045    pub fn set_psc_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2046        self.psc_enabled = v.into();
2047        self
2048    }
2049
2050    /// Sets the value of [dns_name][crate::model::ConnectSettings::dns_name].
2051    pub fn set_dns_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2052        self.dns_name = v.into();
2053        self
2054    }
2055
2056    /// Sets the value of [server_ca_mode][crate::model::ConnectSettings::server_ca_mode].
2057    pub fn set_server_ca_mode<T: std::convert::Into<crate::model::connect_settings::CaMode>>(
2058        mut self,
2059        v: T,
2060    ) -> Self {
2061        self.server_ca_mode = v.into();
2062        self
2063    }
2064}
2065
2066impl wkt::message::Message for ConnectSettings {
2067    fn typename() -> &'static str {
2068        "type.googleapis.com/google.cloud.sql.v1.ConnectSettings"
2069    }
2070}
2071
2072#[doc(hidden)]
2073impl<'de> serde::de::Deserialize<'de> for ConnectSettings {
2074    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2075    where
2076        D: serde::Deserializer<'de>,
2077    {
2078        #[allow(non_camel_case_types)]
2079        #[doc(hidden)]
2080        #[derive(PartialEq, Eq, Hash)]
2081        enum __FieldTag {
2082            __kind,
2083            __server_ca_cert,
2084            __ip_addresses,
2085            __region,
2086            __database_version,
2087            __backend_type,
2088            __psc_enabled,
2089            __dns_name,
2090            __server_ca_mode,
2091            Unknown(std::string::String),
2092        }
2093        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2094            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2095            where
2096                D: serde::Deserializer<'de>,
2097            {
2098                struct Visitor;
2099                impl<'de> serde::de::Visitor<'de> for Visitor {
2100                    type Value = __FieldTag;
2101                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2102                        formatter.write_str("a field name for ConnectSettings")
2103                    }
2104                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2105                    where
2106                        E: serde::de::Error,
2107                    {
2108                        use std::result::Result::Ok;
2109                        use std::string::ToString;
2110                        match value {
2111                            "kind" => Ok(__FieldTag::__kind),
2112                            "serverCaCert" => Ok(__FieldTag::__server_ca_cert),
2113                            "server_ca_cert" => Ok(__FieldTag::__server_ca_cert),
2114                            "ipAddresses" => Ok(__FieldTag::__ip_addresses),
2115                            "ip_addresses" => Ok(__FieldTag::__ip_addresses),
2116                            "region" => Ok(__FieldTag::__region),
2117                            "databaseVersion" => Ok(__FieldTag::__database_version),
2118                            "database_version" => Ok(__FieldTag::__database_version),
2119                            "backendType" => Ok(__FieldTag::__backend_type),
2120                            "backend_type" => Ok(__FieldTag::__backend_type),
2121                            "pscEnabled" => Ok(__FieldTag::__psc_enabled),
2122                            "psc_enabled" => Ok(__FieldTag::__psc_enabled),
2123                            "dnsName" => Ok(__FieldTag::__dns_name),
2124                            "dns_name" => Ok(__FieldTag::__dns_name),
2125                            "serverCaMode" => Ok(__FieldTag::__server_ca_mode),
2126                            "server_ca_mode" => Ok(__FieldTag::__server_ca_mode),
2127                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2128                        }
2129                    }
2130                }
2131                deserializer.deserialize_identifier(Visitor)
2132            }
2133        }
2134        struct Visitor;
2135        impl<'de> serde::de::Visitor<'de> for Visitor {
2136            type Value = ConnectSettings;
2137            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2138                formatter.write_str("struct ConnectSettings")
2139            }
2140            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2141            where
2142                A: serde::de::MapAccess<'de>,
2143            {
2144                #[allow(unused_imports)]
2145                use serde::de::Error;
2146                use std::option::Option::Some;
2147                let mut fields = std::collections::HashSet::new();
2148                let mut result = Self::Value::new();
2149                while let Some(tag) = map.next_key::<__FieldTag>()? {
2150                    #[allow(clippy::match_single_binding)]
2151                    match tag {
2152                        __FieldTag::__kind => {
2153                            if !fields.insert(__FieldTag::__kind) {
2154                                return std::result::Result::Err(A::Error::duplicate_field(
2155                                    "multiple values for kind",
2156                                ));
2157                            }
2158                            result.kind = map
2159                                .next_value::<std::option::Option<std::string::String>>()?
2160                                .unwrap_or_default();
2161                        }
2162                        __FieldTag::__server_ca_cert => {
2163                            if !fields.insert(__FieldTag::__server_ca_cert) {
2164                                return std::result::Result::Err(A::Error::duplicate_field(
2165                                    "multiple values for server_ca_cert",
2166                                ));
2167                            }
2168                            result.server_ca_cert =
2169                                map.next_value::<std::option::Option<crate::model::SslCert>>()?;
2170                        }
2171                        __FieldTag::__ip_addresses => {
2172                            if !fields.insert(__FieldTag::__ip_addresses) {
2173                                return std::result::Result::Err(A::Error::duplicate_field(
2174                                    "multiple values for ip_addresses",
2175                                ));
2176                            }
2177                            result.ip_addresses = map.next_value::<std::option::Option<std::vec::Vec<crate::model::IpMapping>>>()?.unwrap_or_default();
2178                        }
2179                        __FieldTag::__region => {
2180                            if !fields.insert(__FieldTag::__region) {
2181                                return std::result::Result::Err(A::Error::duplicate_field(
2182                                    "multiple values for region",
2183                                ));
2184                            }
2185                            result.region = map
2186                                .next_value::<std::option::Option<std::string::String>>()?
2187                                .unwrap_or_default();
2188                        }
2189                        __FieldTag::__database_version => {
2190                            if !fields.insert(__FieldTag::__database_version) {
2191                                return std::result::Result::Err(A::Error::duplicate_field(
2192                                    "multiple values for database_version",
2193                                ));
2194                            }
2195                            result.database_version = map.next_value::<std::option::Option<crate::model::SqlDatabaseVersion>>()?.unwrap_or_default();
2196                        }
2197                        __FieldTag::__backend_type => {
2198                            if !fields.insert(__FieldTag::__backend_type) {
2199                                return std::result::Result::Err(A::Error::duplicate_field(
2200                                    "multiple values for backend_type",
2201                                ));
2202                            }
2203                            result.backend_type = map
2204                                .next_value::<std::option::Option<crate::model::SqlBackendType>>()?
2205                                .unwrap_or_default();
2206                        }
2207                        __FieldTag::__psc_enabled => {
2208                            if !fields.insert(__FieldTag::__psc_enabled) {
2209                                return std::result::Result::Err(A::Error::duplicate_field(
2210                                    "multiple values for psc_enabled",
2211                                ));
2212                            }
2213                            result.psc_enabled = map
2214                                .next_value::<std::option::Option<bool>>()?
2215                                .unwrap_or_default();
2216                        }
2217                        __FieldTag::__dns_name => {
2218                            if !fields.insert(__FieldTag::__dns_name) {
2219                                return std::result::Result::Err(A::Error::duplicate_field(
2220                                    "multiple values for dns_name",
2221                                ));
2222                            }
2223                            result.dns_name = map
2224                                .next_value::<std::option::Option<std::string::String>>()?
2225                                .unwrap_or_default();
2226                        }
2227                        __FieldTag::__server_ca_mode => {
2228                            if !fields.insert(__FieldTag::__server_ca_mode) {
2229                                return std::result::Result::Err(A::Error::duplicate_field(
2230                                    "multiple values for server_ca_mode",
2231                                ));
2232                            }
2233                            result.server_ca_mode = map.next_value::<std::option::Option<crate::model::connect_settings::CaMode>>()?.unwrap_or_default();
2234                        }
2235                        __FieldTag::Unknown(key) => {
2236                            let value = map.next_value::<serde_json::Value>()?;
2237                            result._unknown_fields.insert(key, value);
2238                        }
2239                    }
2240                }
2241                std::result::Result::Ok(result)
2242            }
2243        }
2244        deserializer.deserialize_any(Visitor)
2245    }
2246}
2247
2248#[doc(hidden)]
2249impl serde::ser::Serialize for ConnectSettings {
2250    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2251    where
2252        S: serde::ser::Serializer,
2253    {
2254        use serde::ser::SerializeMap;
2255        #[allow(unused_imports)]
2256        use std::option::Option::Some;
2257        let mut state = serializer.serialize_map(std::option::Option::None)?;
2258        if !self.kind.is_empty() {
2259            state.serialize_entry("kind", &self.kind)?;
2260        }
2261        if self.server_ca_cert.is_some() {
2262            state.serialize_entry("serverCaCert", &self.server_ca_cert)?;
2263        }
2264        if !self.ip_addresses.is_empty() {
2265            state.serialize_entry("ipAddresses", &self.ip_addresses)?;
2266        }
2267        if !self.region.is_empty() {
2268            state.serialize_entry("region", &self.region)?;
2269        }
2270        if !wkt::internal::is_default(&self.database_version) {
2271            state.serialize_entry("databaseVersion", &self.database_version)?;
2272        }
2273        if !wkt::internal::is_default(&self.backend_type) {
2274            state.serialize_entry("backendType", &self.backend_type)?;
2275        }
2276        if !wkt::internal::is_default(&self.psc_enabled) {
2277            state.serialize_entry("pscEnabled", &self.psc_enabled)?;
2278        }
2279        if !self.dns_name.is_empty() {
2280            state.serialize_entry("dnsName", &self.dns_name)?;
2281        }
2282        if !wkt::internal::is_default(&self.server_ca_mode) {
2283            state.serialize_entry("serverCaMode", &self.server_ca_mode)?;
2284        }
2285        if !self._unknown_fields.is_empty() {
2286            for (key, value) in self._unknown_fields.iter() {
2287                state.serialize_entry(key, &value)?;
2288            }
2289        }
2290        state.end()
2291    }
2292}
2293
2294/// Defines additional types related to [ConnectSettings].
2295pub mod connect_settings {
2296    #[allow(unused_imports)]
2297    use super::*;
2298
2299    /// Various Certificate Authority (CA) modes for certificate signing.
2300    ///
2301    /// # Working with unknown values
2302    ///
2303    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2304    /// additional enum variants at any time. Adding new variants is not considered
2305    /// a breaking change. Applications should write their code in anticipation of:
2306    ///
2307    /// - New values appearing in future releases of the client library, **and**
2308    /// - New values received dynamically, without application changes.
2309    ///
2310    /// Please consult the [Working with enums] section in the user guide for some
2311    /// guidelines.
2312    ///
2313    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2314    #[derive(Clone, Debug, PartialEq)]
2315    #[non_exhaustive]
2316    pub enum CaMode {
2317        /// CA mode is unknown.
2318        Unspecified,
2319        /// Google-managed self-signed internal CA.
2320        GoogleManagedInternalCa,
2321        /// Google-managed regional CA part of root CA hierarchy hosted on Google
2322        /// Cloud's Certificate Authority Service (CAS).
2323        GoogleManagedCasCa,
2324        /// If set, the enum was initialized with an unknown value.
2325        ///
2326        /// Applications can examine the value using [CaMode::value] or
2327        /// [CaMode::name].
2328        UnknownValue(ca_mode::UnknownValue),
2329    }
2330
2331    #[doc(hidden)]
2332    pub mod ca_mode {
2333        #[allow(unused_imports)]
2334        use super::*;
2335        #[derive(Clone, Debug, PartialEq)]
2336        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2337    }
2338
2339    impl CaMode {
2340        /// Gets the enum value.
2341        ///
2342        /// Returns `None` if the enum contains an unknown value deserialized from
2343        /// the string representation of enums.
2344        pub fn value(&self) -> std::option::Option<i32> {
2345            match self {
2346                Self::Unspecified => std::option::Option::Some(0),
2347                Self::GoogleManagedInternalCa => std::option::Option::Some(1),
2348                Self::GoogleManagedCasCa => std::option::Option::Some(2),
2349                Self::UnknownValue(u) => u.0.value(),
2350            }
2351        }
2352
2353        /// Gets the enum value as a string.
2354        ///
2355        /// Returns `None` if the enum contains an unknown value deserialized from
2356        /// the integer representation of enums.
2357        pub fn name(&self) -> std::option::Option<&str> {
2358            match self {
2359                Self::Unspecified => std::option::Option::Some("CA_MODE_UNSPECIFIED"),
2360                Self::GoogleManagedInternalCa => {
2361                    std::option::Option::Some("GOOGLE_MANAGED_INTERNAL_CA")
2362                }
2363                Self::GoogleManagedCasCa => std::option::Option::Some("GOOGLE_MANAGED_CAS_CA"),
2364                Self::UnknownValue(u) => u.0.name(),
2365            }
2366        }
2367    }
2368
2369    impl std::default::Default for CaMode {
2370        fn default() -> Self {
2371            use std::convert::From;
2372            Self::from(0)
2373        }
2374    }
2375
2376    impl std::fmt::Display for CaMode {
2377        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2378            wkt::internal::display_enum(f, self.name(), self.value())
2379        }
2380    }
2381
2382    impl std::convert::From<i32> for CaMode {
2383        fn from(value: i32) -> Self {
2384            match value {
2385                0 => Self::Unspecified,
2386                1 => Self::GoogleManagedInternalCa,
2387                2 => Self::GoogleManagedCasCa,
2388                _ => Self::UnknownValue(ca_mode::UnknownValue(
2389                    wkt::internal::UnknownEnumValue::Integer(value),
2390                )),
2391            }
2392        }
2393    }
2394
2395    impl std::convert::From<&str> for CaMode {
2396        fn from(value: &str) -> Self {
2397            use std::string::ToString;
2398            match value {
2399                "CA_MODE_UNSPECIFIED" => Self::Unspecified,
2400                "GOOGLE_MANAGED_INTERNAL_CA" => Self::GoogleManagedInternalCa,
2401                "GOOGLE_MANAGED_CAS_CA" => Self::GoogleManagedCasCa,
2402                _ => Self::UnknownValue(ca_mode::UnknownValue(
2403                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2404                )),
2405            }
2406        }
2407    }
2408
2409    impl serde::ser::Serialize for CaMode {
2410        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2411        where
2412            S: serde::Serializer,
2413        {
2414            match self {
2415                Self::Unspecified => serializer.serialize_i32(0),
2416                Self::GoogleManagedInternalCa => serializer.serialize_i32(1),
2417                Self::GoogleManagedCasCa => serializer.serialize_i32(2),
2418                Self::UnknownValue(u) => u.0.serialize(serializer),
2419            }
2420        }
2421    }
2422
2423    impl<'de> serde::de::Deserialize<'de> for CaMode {
2424        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2425        where
2426            D: serde::Deserializer<'de>,
2427        {
2428            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CaMode>::new(
2429                ".google.cloud.sql.v1.ConnectSettings.CaMode",
2430            ))
2431        }
2432    }
2433}
2434
2435/// Ephemeral certificate creation request.
2436#[derive(Clone, Debug, Default, PartialEq)]
2437#[non_exhaustive]
2438pub struct GenerateEphemeralCertRequest {
2439    /// Cloud SQL instance ID. This does not include the project ID.
2440    pub instance: std::string::String,
2441
2442    /// Project ID of the project that contains the instance.
2443    pub project: std::string::String,
2444
2445    /// PEM encoded public key to include in the signed certificate.
2446    pub public_key: std::string::String,
2447
2448    /// Optional. Access token to include in the signed certificate.
2449    pub access_token: std::string::String,
2450
2451    /// Optional. Optional snapshot read timestamp to trade freshness for
2452    /// performance.
2453    pub read_time: std::option::Option<wkt::Timestamp>,
2454
2455    /// Optional. If set, it will contain the cert valid duration.
2456    pub valid_duration: std::option::Option<wkt::Duration>,
2457
2458    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2459}
2460
2461impl GenerateEphemeralCertRequest {
2462    pub fn new() -> Self {
2463        std::default::Default::default()
2464    }
2465
2466    /// Sets the value of [instance][crate::model::GenerateEphemeralCertRequest::instance].
2467    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2468        self.instance = v.into();
2469        self
2470    }
2471
2472    /// Sets the value of [project][crate::model::GenerateEphemeralCertRequest::project].
2473    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2474        self.project = v.into();
2475        self
2476    }
2477
2478    /// Sets the value of [public_key][crate::model::GenerateEphemeralCertRequest::public_key].
2479    pub fn set_public_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2480        self.public_key = v.into();
2481        self
2482    }
2483
2484    /// Sets the value of [access_token][crate::model::GenerateEphemeralCertRequest::access_token].
2485    pub fn set_access_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2486        self.access_token = v.into();
2487        self
2488    }
2489
2490    /// Sets the value of [read_time][crate::model::GenerateEphemeralCertRequest::read_time].
2491    pub fn set_read_time<T>(mut self, v: T) -> Self
2492    where
2493        T: std::convert::Into<wkt::Timestamp>,
2494    {
2495        self.read_time = std::option::Option::Some(v.into());
2496        self
2497    }
2498
2499    /// Sets or clears the value of [read_time][crate::model::GenerateEphemeralCertRequest::read_time].
2500    pub fn set_or_clear_read_time<T>(mut self, v: std::option::Option<T>) -> Self
2501    where
2502        T: std::convert::Into<wkt::Timestamp>,
2503    {
2504        self.read_time = v.map(|x| x.into());
2505        self
2506    }
2507
2508    /// Sets the value of [valid_duration][crate::model::GenerateEphemeralCertRequest::valid_duration].
2509    pub fn set_valid_duration<T>(mut self, v: T) -> Self
2510    where
2511        T: std::convert::Into<wkt::Duration>,
2512    {
2513        self.valid_duration = std::option::Option::Some(v.into());
2514        self
2515    }
2516
2517    /// Sets or clears the value of [valid_duration][crate::model::GenerateEphemeralCertRequest::valid_duration].
2518    pub fn set_or_clear_valid_duration<T>(mut self, v: std::option::Option<T>) -> Self
2519    where
2520        T: std::convert::Into<wkt::Duration>,
2521    {
2522        self.valid_duration = v.map(|x| x.into());
2523        self
2524    }
2525}
2526
2527impl wkt::message::Message for GenerateEphemeralCertRequest {
2528    fn typename() -> &'static str {
2529        "type.googleapis.com/google.cloud.sql.v1.GenerateEphemeralCertRequest"
2530    }
2531}
2532
2533#[doc(hidden)]
2534impl<'de> serde::de::Deserialize<'de> for GenerateEphemeralCertRequest {
2535    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2536    where
2537        D: serde::Deserializer<'de>,
2538    {
2539        #[allow(non_camel_case_types)]
2540        #[doc(hidden)]
2541        #[derive(PartialEq, Eq, Hash)]
2542        enum __FieldTag {
2543            __instance,
2544            __project,
2545            __public_key,
2546            __access_token,
2547            __read_time,
2548            __valid_duration,
2549            Unknown(std::string::String),
2550        }
2551        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2552            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2553            where
2554                D: serde::Deserializer<'de>,
2555            {
2556                struct Visitor;
2557                impl<'de> serde::de::Visitor<'de> for Visitor {
2558                    type Value = __FieldTag;
2559                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2560                        formatter.write_str("a field name for GenerateEphemeralCertRequest")
2561                    }
2562                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2563                    where
2564                        E: serde::de::Error,
2565                    {
2566                        use std::result::Result::Ok;
2567                        use std::string::ToString;
2568                        match value {
2569                            "instance" => Ok(__FieldTag::__instance),
2570                            "project" => Ok(__FieldTag::__project),
2571                            "public_key" => Ok(__FieldTag::__public_key),
2572                            "access_token" => Ok(__FieldTag::__access_token),
2573                            "readTime" => Ok(__FieldTag::__read_time),
2574                            "read_time" => Ok(__FieldTag::__read_time),
2575                            "validDuration" => Ok(__FieldTag::__valid_duration),
2576                            "valid_duration" => Ok(__FieldTag::__valid_duration),
2577                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2578                        }
2579                    }
2580                }
2581                deserializer.deserialize_identifier(Visitor)
2582            }
2583        }
2584        struct Visitor;
2585        impl<'de> serde::de::Visitor<'de> for Visitor {
2586            type Value = GenerateEphemeralCertRequest;
2587            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2588                formatter.write_str("struct GenerateEphemeralCertRequest")
2589            }
2590            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2591            where
2592                A: serde::de::MapAccess<'de>,
2593            {
2594                #[allow(unused_imports)]
2595                use serde::de::Error;
2596                use std::option::Option::Some;
2597                let mut fields = std::collections::HashSet::new();
2598                let mut result = Self::Value::new();
2599                while let Some(tag) = map.next_key::<__FieldTag>()? {
2600                    #[allow(clippy::match_single_binding)]
2601                    match tag {
2602                        __FieldTag::__instance => {
2603                            if !fields.insert(__FieldTag::__instance) {
2604                                return std::result::Result::Err(A::Error::duplicate_field(
2605                                    "multiple values for instance",
2606                                ));
2607                            }
2608                            result.instance = map
2609                                .next_value::<std::option::Option<std::string::String>>()?
2610                                .unwrap_or_default();
2611                        }
2612                        __FieldTag::__project => {
2613                            if !fields.insert(__FieldTag::__project) {
2614                                return std::result::Result::Err(A::Error::duplicate_field(
2615                                    "multiple values for project",
2616                                ));
2617                            }
2618                            result.project = map
2619                                .next_value::<std::option::Option<std::string::String>>()?
2620                                .unwrap_or_default();
2621                        }
2622                        __FieldTag::__public_key => {
2623                            if !fields.insert(__FieldTag::__public_key) {
2624                                return std::result::Result::Err(A::Error::duplicate_field(
2625                                    "multiple values for public_key",
2626                                ));
2627                            }
2628                            result.public_key = map
2629                                .next_value::<std::option::Option<std::string::String>>()?
2630                                .unwrap_or_default();
2631                        }
2632                        __FieldTag::__access_token => {
2633                            if !fields.insert(__FieldTag::__access_token) {
2634                                return std::result::Result::Err(A::Error::duplicate_field(
2635                                    "multiple values for access_token",
2636                                ));
2637                            }
2638                            result.access_token = map
2639                                .next_value::<std::option::Option<std::string::String>>()?
2640                                .unwrap_or_default();
2641                        }
2642                        __FieldTag::__read_time => {
2643                            if !fields.insert(__FieldTag::__read_time) {
2644                                return std::result::Result::Err(A::Error::duplicate_field(
2645                                    "multiple values for read_time",
2646                                ));
2647                            }
2648                            result.read_time =
2649                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
2650                        }
2651                        __FieldTag::__valid_duration => {
2652                            if !fields.insert(__FieldTag::__valid_duration) {
2653                                return std::result::Result::Err(A::Error::duplicate_field(
2654                                    "multiple values for valid_duration",
2655                                ));
2656                            }
2657                            result.valid_duration =
2658                                map.next_value::<std::option::Option<wkt::Duration>>()?;
2659                        }
2660                        __FieldTag::Unknown(key) => {
2661                            let value = map.next_value::<serde_json::Value>()?;
2662                            result._unknown_fields.insert(key, value);
2663                        }
2664                    }
2665                }
2666                std::result::Result::Ok(result)
2667            }
2668        }
2669        deserializer.deserialize_any(Visitor)
2670    }
2671}
2672
2673#[doc(hidden)]
2674impl serde::ser::Serialize for GenerateEphemeralCertRequest {
2675    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2676    where
2677        S: serde::ser::Serializer,
2678    {
2679        use serde::ser::SerializeMap;
2680        #[allow(unused_imports)]
2681        use std::option::Option::Some;
2682        let mut state = serializer.serialize_map(std::option::Option::None)?;
2683        if !self.instance.is_empty() {
2684            state.serialize_entry("instance", &self.instance)?;
2685        }
2686        if !self.project.is_empty() {
2687            state.serialize_entry("project", &self.project)?;
2688        }
2689        if !self.public_key.is_empty() {
2690            state.serialize_entry("public_key", &self.public_key)?;
2691        }
2692        if !self.access_token.is_empty() {
2693            state.serialize_entry("access_token", &self.access_token)?;
2694        }
2695        if self.read_time.is_some() {
2696            state.serialize_entry("readTime", &self.read_time)?;
2697        }
2698        if self.valid_duration.is_some() {
2699            state.serialize_entry("validDuration", &self.valid_duration)?;
2700        }
2701        if !self._unknown_fields.is_empty() {
2702            for (key, value) in self._unknown_fields.iter() {
2703                state.serialize_entry(key, &value)?;
2704            }
2705        }
2706        state.end()
2707    }
2708}
2709
2710/// Ephemeral certificate creation request.
2711#[derive(Clone, Debug, Default, PartialEq)]
2712#[non_exhaustive]
2713pub struct GenerateEphemeralCertResponse {
2714    /// Generated cert
2715    pub ephemeral_cert: std::option::Option<crate::model::SslCert>,
2716
2717    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2718}
2719
2720impl GenerateEphemeralCertResponse {
2721    pub fn new() -> Self {
2722        std::default::Default::default()
2723    }
2724
2725    /// Sets the value of [ephemeral_cert][crate::model::GenerateEphemeralCertResponse::ephemeral_cert].
2726    pub fn set_ephemeral_cert<T>(mut self, v: T) -> Self
2727    where
2728        T: std::convert::Into<crate::model::SslCert>,
2729    {
2730        self.ephemeral_cert = std::option::Option::Some(v.into());
2731        self
2732    }
2733
2734    /// Sets or clears the value of [ephemeral_cert][crate::model::GenerateEphemeralCertResponse::ephemeral_cert].
2735    pub fn set_or_clear_ephemeral_cert<T>(mut self, v: std::option::Option<T>) -> Self
2736    where
2737        T: std::convert::Into<crate::model::SslCert>,
2738    {
2739        self.ephemeral_cert = v.map(|x| x.into());
2740        self
2741    }
2742}
2743
2744impl wkt::message::Message for GenerateEphemeralCertResponse {
2745    fn typename() -> &'static str {
2746        "type.googleapis.com/google.cloud.sql.v1.GenerateEphemeralCertResponse"
2747    }
2748}
2749
2750#[doc(hidden)]
2751impl<'de> serde::de::Deserialize<'de> for GenerateEphemeralCertResponse {
2752    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2753    where
2754        D: serde::Deserializer<'de>,
2755    {
2756        #[allow(non_camel_case_types)]
2757        #[doc(hidden)]
2758        #[derive(PartialEq, Eq, Hash)]
2759        enum __FieldTag {
2760            __ephemeral_cert,
2761            Unknown(std::string::String),
2762        }
2763        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2764            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2765            where
2766                D: serde::Deserializer<'de>,
2767            {
2768                struct Visitor;
2769                impl<'de> serde::de::Visitor<'de> for Visitor {
2770                    type Value = __FieldTag;
2771                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2772                        formatter.write_str("a field name for GenerateEphemeralCertResponse")
2773                    }
2774                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2775                    where
2776                        E: serde::de::Error,
2777                    {
2778                        use std::result::Result::Ok;
2779                        use std::string::ToString;
2780                        match value {
2781                            "ephemeralCert" => Ok(__FieldTag::__ephemeral_cert),
2782                            "ephemeral_cert" => Ok(__FieldTag::__ephemeral_cert),
2783                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2784                        }
2785                    }
2786                }
2787                deserializer.deserialize_identifier(Visitor)
2788            }
2789        }
2790        struct Visitor;
2791        impl<'de> serde::de::Visitor<'de> for Visitor {
2792            type Value = GenerateEphemeralCertResponse;
2793            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2794                formatter.write_str("struct GenerateEphemeralCertResponse")
2795            }
2796            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2797            where
2798                A: serde::de::MapAccess<'de>,
2799            {
2800                #[allow(unused_imports)]
2801                use serde::de::Error;
2802                use std::option::Option::Some;
2803                let mut fields = std::collections::HashSet::new();
2804                let mut result = Self::Value::new();
2805                while let Some(tag) = map.next_key::<__FieldTag>()? {
2806                    #[allow(clippy::match_single_binding)]
2807                    match tag {
2808                        __FieldTag::__ephemeral_cert => {
2809                            if !fields.insert(__FieldTag::__ephemeral_cert) {
2810                                return std::result::Result::Err(A::Error::duplicate_field(
2811                                    "multiple values for ephemeral_cert",
2812                                ));
2813                            }
2814                            result.ephemeral_cert =
2815                                map.next_value::<std::option::Option<crate::model::SslCert>>()?;
2816                        }
2817                        __FieldTag::Unknown(key) => {
2818                            let value = map.next_value::<serde_json::Value>()?;
2819                            result._unknown_fields.insert(key, value);
2820                        }
2821                    }
2822                }
2823                std::result::Result::Ok(result)
2824            }
2825        }
2826        deserializer.deserialize_any(Visitor)
2827    }
2828}
2829
2830#[doc(hidden)]
2831impl serde::ser::Serialize for GenerateEphemeralCertResponse {
2832    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2833    where
2834        S: serde::ser::Serializer,
2835    {
2836        use serde::ser::SerializeMap;
2837        #[allow(unused_imports)]
2838        use std::option::Option::Some;
2839        let mut state = serializer.serialize_map(std::option::Option::None)?;
2840        if self.ephemeral_cert.is_some() {
2841            state.serialize_entry("ephemeralCert", &self.ephemeral_cert)?;
2842        }
2843        if !self._unknown_fields.is_empty() {
2844            for (key, value) in self._unknown_fields.iter() {
2845                state.serialize_entry(key, &value)?;
2846            }
2847        }
2848        state.end()
2849    }
2850}
2851
2852/// Database delete request.
2853#[derive(Clone, Debug, Default, PartialEq)]
2854#[non_exhaustive]
2855pub struct SqlDatabasesDeleteRequest {
2856    /// Name of the database to be deleted in the instance.
2857    pub database: std::string::String,
2858
2859    /// Database instance ID. This does not include the project ID.
2860    pub instance: std::string::String,
2861
2862    /// Project ID of the project that contains the instance.
2863    pub project: std::string::String,
2864
2865    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2866}
2867
2868impl SqlDatabasesDeleteRequest {
2869    pub fn new() -> Self {
2870        std::default::Default::default()
2871    }
2872
2873    /// Sets the value of [database][crate::model::SqlDatabasesDeleteRequest::database].
2874    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2875        self.database = v.into();
2876        self
2877    }
2878
2879    /// Sets the value of [instance][crate::model::SqlDatabasesDeleteRequest::instance].
2880    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2881        self.instance = v.into();
2882        self
2883    }
2884
2885    /// Sets the value of [project][crate::model::SqlDatabasesDeleteRequest::project].
2886    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2887        self.project = v.into();
2888        self
2889    }
2890}
2891
2892impl wkt::message::Message for SqlDatabasesDeleteRequest {
2893    fn typename() -> &'static str {
2894        "type.googleapis.com/google.cloud.sql.v1.SqlDatabasesDeleteRequest"
2895    }
2896}
2897
2898#[doc(hidden)]
2899impl<'de> serde::de::Deserialize<'de> for SqlDatabasesDeleteRequest {
2900    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2901    where
2902        D: serde::Deserializer<'de>,
2903    {
2904        #[allow(non_camel_case_types)]
2905        #[doc(hidden)]
2906        #[derive(PartialEq, Eq, Hash)]
2907        enum __FieldTag {
2908            __database,
2909            __instance,
2910            __project,
2911            Unknown(std::string::String),
2912        }
2913        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2914            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2915            where
2916                D: serde::Deserializer<'de>,
2917            {
2918                struct Visitor;
2919                impl<'de> serde::de::Visitor<'de> for Visitor {
2920                    type Value = __FieldTag;
2921                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2922                        formatter.write_str("a field name for SqlDatabasesDeleteRequest")
2923                    }
2924                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2925                    where
2926                        E: serde::de::Error,
2927                    {
2928                        use std::result::Result::Ok;
2929                        use std::string::ToString;
2930                        match value {
2931                            "database" => Ok(__FieldTag::__database),
2932                            "instance" => Ok(__FieldTag::__instance),
2933                            "project" => Ok(__FieldTag::__project),
2934                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2935                        }
2936                    }
2937                }
2938                deserializer.deserialize_identifier(Visitor)
2939            }
2940        }
2941        struct Visitor;
2942        impl<'de> serde::de::Visitor<'de> for Visitor {
2943            type Value = SqlDatabasesDeleteRequest;
2944            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2945                formatter.write_str("struct SqlDatabasesDeleteRequest")
2946            }
2947            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2948            where
2949                A: serde::de::MapAccess<'de>,
2950            {
2951                #[allow(unused_imports)]
2952                use serde::de::Error;
2953                use std::option::Option::Some;
2954                let mut fields = std::collections::HashSet::new();
2955                let mut result = Self::Value::new();
2956                while let Some(tag) = map.next_key::<__FieldTag>()? {
2957                    #[allow(clippy::match_single_binding)]
2958                    match tag {
2959                        __FieldTag::__database => {
2960                            if !fields.insert(__FieldTag::__database) {
2961                                return std::result::Result::Err(A::Error::duplicate_field(
2962                                    "multiple values for database",
2963                                ));
2964                            }
2965                            result.database = map
2966                                .next_value::<std::option::Option<std::string::String>>()?
2967                                .unwrap_or_default();
2968                        }
2969                        __FieldTag::__instance => {
2970                            if !fields.insert(__FieldTag::__instance) {
2971                                return std::result::Result::Err(A::Error::duplicate_field(
2972                                    "multiple values for instance",
2973                                ));
2974                            }
2975                            result.instance = map
2976                                .next_value::<std::option::Option<std::string::String>>()?
2977                                .unwrap_or_default();
2978                        }
2979                        __FieldTag::__project => {
2980                            if !fields.insert(__FieldTag::__project) {
2981                                return std::result::Result::Err(A::Error::duplicate_field(
2982                                    "multiple values for project",
2983                                ));
2984                            }
2985                            result.project = map
2986                                .next_value::<std::option::Option<std::string::String>>()?
2987                                .unwrap_or_default();
2988                        }
2989                        __FieldTag::Unknown(key) => {
2990                            let value = map.next_value::<serde_json::Value>()?;
2991                            result._unknown_fields.insert(key, value);
2992                        }
2993                    }
2994                }
2995                std::result::Result::Ok(result)
2996            }
2997        }
2998        deserializer.deserialize_any(Visitor)
2999    }
3000}
3001
3002#[doc(hidden)]
3003impl serde::ser::Serialize for SqlDatabasesDeleteRequest {
3004    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3005    where
3006        S: serde::ser::Serializer,
3007    {
3008        use serde::ser::SerializeMap;
3009        #[allow(unused_imports)]
3010        use std::option::Option::Some;
3011        let mut state = serializer.serialize_map(std::option::Option::None)?;
3012        if !self.database.is_empty() {
3013            state.serialize_entry("database", &self.database)?;
3014        }
3015        if !self.instance.is_empty() {
3016            state.serialize_entry("instance", &self.instance)?;
3017        }
3018        if !self.project.is_empty() {
3019            state.serialize_entry("project", &self.project)?;
3020        }
3021        if !self._unknown_fields.is_empty() {
3022            for (key, value) in self._unknown_fields.iter() {
3023                state.serialize_entry(key, &value)?;
3024            }
3025        }
3026        state.end()
3027    }
3028}
3029
3030/// Database get request.
3031#[derive(Clone, Debug, Default, PartialEq)]
3032#[non_exhaustive]
3033pub struct SqlDatabasesGetRequest {
3034    /// Name of the database in the instance.
3035    pub database: std::string::String,
3036
3037    /// Database instance ID. This does not include the project ID.
3038    pub instance: std::string::String,
3039
3040    /// Project ID of the project that contains the instance.
3041    pub project: std::string::String,
3042
3043    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3044}
3045
3046impl SqlDatabasesGetRequest {
3047    pub fn new() -> Self {
3048        std::default::Default::default()
3049    }
3050
3051    /// Sets the value of [database][crate::model::SqlDatabasesGetRequest::database].
3052    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3053        self.database = v.into();
3054        self
3055    }
3056
3057    /// Sets the value of [instance][crate::model::SqlDatabasesGetRequest::instance].
3058    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3059        self.instance = v.into();
3060        self
3061    }
3062
3063    /// Sets the value of [project][crate::model::SqlDatabasesGetRequest::project].
3064    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3065        self.project = v.into();
3066        self
3067    }
3068}
3069
3070impl wkt::message::Message for SqlDatabasesGetRequest {
3071    fn typename() -> &'static str {
3072        "type.googleapis.com/google.cloud.sql.v1.SqlDatabasesGetRequest"
3073    }
3074}
3075
3076#[doc(hidden)]
3077impl<'de> serde::de::Deserialize<'de> for SqlDatabasesGetRequest {
3078    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3079    where
3080        D: serde::Deserializer<'de>,
3081    {
3082        #[allow(non_camel_case_types)]
3083        #[doc(hidden)]
3084        #[derive(PartialEq, Eq, Hash)]
3085        enum __FieldTag {
3086            __database,
3087            __instance,
3088            __project,
3089            Unknown(std::string::String),
3090        }
3091        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3092            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3093            where
3094                D: serde::Deserializer<'de>,
3095            {
3096                struct Visitor;
3097                impl<'de> serde::de::Visitor<'de> for Visitor {
3098                    type Value = __FieldTag;
3099                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3100                        formatter.write_str("a field name for SqlDatabasesGetRequest")
3101                    }
3102                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3103                    where
3104                        E: serde::de::Error,
3105                    {
3106                        use std::result::Result::Ok;
3107                        use std::string::ToString;
3108                        match value {
3109                            "database" => Ok(__FieldTag::__database),
3110                            "instance" => Ok(__FieldTag::__instance),
3111                            "project" => Ok(__FieldTag::__project),
3112                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3113                        }
3114                    }
3115                }
3116                deserializer.deserialize_identifier(Visitor)
3117            }
3118        }
3119        struct Visitor;
3120        impl<'de> serde::de::Visitor<'de> for Visitor {
3121            type Value = SqlDatabasesGetRequest;
3122            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3123                formatter.write_str("struct SqlDatabasesGetRequest")
3124            }
3125            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3126            where
3127                A: serde::de::MapAccess<'de>,
3128            {
3129                #[allow(unused_imports)]
3130                use serde::de::Error;
3131                use std::option::Option::Some;
3132                let mut fields = std::collections::HashSet::new();
3133                let mut result = Self::Value::new();
3134                while let Some(tag) = map.next_key::<__FieldTag>()? {
3135                    #[allow(clippy::match_single_binding)]
3136                    match tag {
3137                        __FieldTag::__database => {
3138                            if !fields.insert(__FieldTag::__database) {
3139                                return std::result::Result::Err(A::Error::duplicate_field(
3140                                    "multiple values for database",
3141                                ));
3142                            }
3143                            result.database = map
3144                                .next_value::<std::option::Option<std::string::String>>()?
3145                                .unwrap_or_default();
3146                        }
3147                        __FieldTag::__instance => {
3148                            if !fields.insert(__FieldTag::__instance) {
3149                                return std::result::Result::Err(A::Error::duplicate_field(
3150                                    "multiple values for instance",
3151                                ));
3152                            }
3153                            result.instance = map
3154                                .next_value::<std::option::Option<std::string::String>>()?
3155                                .unwrap_or_default();
3156                        }
3157                        __FieldTag::__project => {
3158                            if !fields.insert(__FieldTag::__project) {
3159                                return std::result::Result::Err(A::Error::duplicate_field(
3160                                    "multiple values for project",
3161                                ));
3162                            }
3163                            result.project = map
3164                                .next_value::<std::option::Option<std::string::String>>()?
3165                                .unwrap_or_default();
3166                        }
3167                        __FieldTag::Unknown(key) => {
3168                            let value = map.next_value::<serde_json::Value>()?;
3169                            result._unknown_fields.insert(key, value);
3170                        }
3171                    }
3172                }
3173                std::result::Result::Ok(result)
3174            }
3175        }
3176        deserializer.deserialize_any(Visitor)
3177    }
3178}
3179
3180#[doc(hidden)]
3181impl serde::ser::Serialize for SqlDatabasesGetRequest {
3182    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3183    where
3184        S: serde::ser::Serializer,
3185    {
3186        use serde::ser::SerializeMap;
3187        #[allow(unused_imports)]
3188        use std::option::Option::Some;
3189        let mut state = serializer.serialize_map(std::option::Option::None)?;
3190        if !self.database.is_empty() {
3191            state.serialize_entry("database", &self.database)?;
3192        }
3193        if !self.instance.is_empty() {
3194            state.serialize_entry("instance", &self.instance)?;
3195        }
3196        if !self.project.is_empty() {
3197            state.serialize_entry("project", &self.project)?;
3198        }
3199        if !self._unknown_fields.is_empty() {
3200            for (key, value) in self._unknown_fields.iter() {
3201                state.serialize_entry(key, &value)?;
3202            }
3203        }
3204        state.end()
3205    }
3206}
3207
3208/// Database insert request.
3209#[derive(Clone, Debug, Default, PartialEq)]
3210#[non_exhaustive]
3211pub struct SqlDatabasesInsertRequest {
3212    /// Database instance ID. This does not include the project ID.
3213    pub instance: std::string::String,
3214
3215    /// Project ID of the project that contains the instance.
3216    pub project: std::string::String,
3217
3218    pub body: std::option::Option<crate::model::Database>,
3219
3220    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3221}
3222
3223impl SqlDatabasesInsertRequest {
3224    pub fn new() -> Self {
3225        std::default::Default::default()
3226    }
3227
3228    /// Sets the value of [instance][crate::model::SqlDatabasesInsertRequest::instance].
3229    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3230        self.instance = v.into();
3231        self
3232    }
3233
3234    /// Sets the value of [project][crate::model::SqlDatabasesInsertRequest::project].
3235    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3236        self.project = v.into();
3237        self
3238    }
3239
3240    /// Sets the value of [body][crate::model::SqlDatabasesInsertRequest::body].
3241    pub fn set_body<T>(mut self, v: T) -> Self
3242    where
3243        T: std::convert::Into<crate::model::Database>,
3244    {
3245        self.body = std::option::Option::Some(v.into());
3246        self
3247    }
3248
3249    /// Sets or clears the value of [body][crate::model::SqlDatabasesInsertRequest::body].
3250    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
3251    where
3252        T: std::convert::Into<crate::model::Database>,
3253    {
3254        self.body = v.map(|x| x.into());
3255        self
3256    }
3257}
3258
3259impl wkt::message::Message for SqlDatabasesInsertRequest {
3260    fn typename() -> &'static str {
3261        "type.googleapis.com/google.cloud.sql.v1.SqlDatabasesInsertRequest"
3262    }
3263}
3264
3265#[doc(hidden)]
3266impl<'de> serde::de::Deserialize<'de> for SqlDatabasesInsertRequest {
3267    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3268    where
3269        D: serde::Deserializer<'de>,
3270    {
3271        #[allow(non_camel_case_types)]
3272        #[doc(hidden)]
3273        #[derive(PartialEq, Eq, Hash)]
3274        enum __FieldTag {
3275            __instance,
3276            __project,
3277            __body,
3278            Unknown(std::string::String),
3279        }
3280        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3281            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3282            where
3283                D: serde::Deserializer<'de>,
3284            {
3285                struct Visitor;
3286                impl<'de> serde::de::Visitor<'de> for Visitor {
3287                    type Value = __FieldTag;
3288                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3289                        formatter.write_str("a field name for SqlDatabasesInsertRequest")
3290                    }
3291                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3292                    where
3293                        E: serde::de::Error,
3294                    {
3295                        use std::result::Result::Ok;
3296                        use std::string::ToString;
3297                        match value {
3298                            "instance" => Ok(__FieldTag::__instance),
3299                            "project" => Ok(__FieldTag::__project),
3300                            "body" => Ok(__FieldTag::__body),
3301                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3302                        }
3303                    }
3304                }
3305                deserializer.deserialize_identifier(Visitor)
3306            }
3307        }
3308        struct Visitor;
3309        impl<'de> serde::de::Visitor<'de> for Visitor {
3310            type Value = SqlDatabasesInsertRequest;
3311            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3312                formatter.write_str("struct SqlDatabasesInsertRequest")
3313            }
3314            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3315            where
3316                A: serde::de::MapAccess<'de>,
3317            {
3318                #[allow(unused_imports)]
3319                use serde::de::Error;
3320                use std::option::Option::Some;
3321                let mut fields = std::collections::HashSet::new();
3322                let mut result = Self::Value::new();
3323                while let Some(tag) = map.next_key::<__FieldTag>()? {
3324                    #[allow(clippy::match_single_binding)]
3325                    match tag {
3326                        __FieldTag::__instance => {
3327                            if !fields.insert(__FieldTag::__instance) {
3328                                return std::result::Result::Err(A::Error::duplicate_field(
3329                                    "multiple values for instance",
3330                                ));
3331                            }
3332                            result.instance = map
3333                                .next_value::<std::option::Option<std::string::String>>()?
3334                                .unwrap_or_default();
3335                        }
3336                        __FieldTag::__project => {
3337                            if !fields.insert(__FieldTag::__project) {
3338                                return std::result::Result::Err(A::Error::duplicate_field(
3339                                    "multiple values for project",
3340                                ));
3341                            }
3342                            result.project = map
3343                                .next_value::<std::option::Option<std::string::String>>()?
3344                                .unwrap_or_default();
3345                        }
3346                        __FieldTag::__body => {
3347                            if !fields.insert(__FieldTag::__body) {
3348                                return std::result::Result::Err(A::Error::duplicate_field(
3349                                    "multiple values for body",
3350                                ));
3351                            }
3352                            result.body =
3353                                map.next_value::<std::option::Option<crate::model::Database>>()?;
3354                        }
3355                        __FieldTag::Unknown(key) => {
3356                            let value = map.next_value::<serde_json::Value>()?;
3357                            result._unknown_fields.insert(key, value);
3358                        }
3359                    }
3360                }
3361                std::result::Result::Ok(result)
3362            }
3363        }
3364        deserializer.deserialize_any(Visitor)
3365    }
3366}
3367
3368#[doc(hidden)]
3369impl serde::ser::Serialize for SqlDatabasesInsertRequest {
3370    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3371    where
3372        S: serde::ser::Serializer,
3373    {
3374        use serde::ser::SerializeMap;
3375        #[allow(unused_imports)]
3376        use std::option::Option::Some;
3377        let mut state = serializer.serialize_map(std::option::Option::None)?;
3378        if !self.instance.is_empty() {
3379            state.serialize_entry("instance", &self.instance)?;
3380        }
3381        if !self.project.is_empty() {
3382            state.serialize_entry("project", &self.project)?;
3383        }
3384        if self.body.is_some() {
3385            state.serialize_entry("body", &self.body)?;
3386        }
3387        if !self._unknown_fields.is_empty() {
3388            for (key, value) in self._unknown_fields.iter() {
3389                state.serialize_entry(key, &value)?;
3390            }
3391        }
3392        state.end()
3393    }
3394}
3395
3396/// Database list request.
3397#[derive(Clone, Debug, Default, PartialEq)]
3398#[non_exhaustive]
3399pub struct SqlDatabasesListRequest {
3400    /// Cloud SQL instance ID. This does not include the project ID.
3401    pub instance: std::string::String,
3402
3403    /// Project ID of the project that contains the instance.
3404    pub project: std::string::String,
3405
3406    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3407}
3408
3409impl SqlDatabasesListRequest {
3410    pub fn new() -> Self {
3411        std::default::Default::default()
3412    }
3413
3414    /// Sets the value of [instance][crate::model::SqlDatabasesListRequest::instance].
3415    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3416        self.instance = v.into();
3417        self
3418    }
3419
3420    /// Sets the value of [project][crate::model::SqlDatabasesListRequest::project].
3421    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3422        self.project = v.into();
3423        self
3424    }
3425}
3426
3427impl wkt::message::Message for SqlDatabasesListRequest {
3428    fn typename() -> &'static str {
3429        "type.googleapis.com/google.cloud.sql.v1.SqlDatabasesListRequest"
3430    }
3431}
3432
3433#[doc(hidden)]
3434impl<'de> serde::de::Deserialize<'de> for SqlDatabasesListRequest {
3435    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3436    where
3437        D: serde::Deserializer<'de>,
3438    {
3439        #[allow(non_camel_case_types)]
3440        #[doc(hidden)]
3441        #[derive(PartialEq, Eq, Hash)]
3442        enum __FieldTag {
3443            __instance,
3444            __project,
3445            Unknown(std::string::String),
3446        }
3447        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3448            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3449            where
3450                D: serde::Deserializer<'de>,
3451            {
3452                struct Visitor;
3453                impl<'de> serde::de::Visitor<'de> for Visitor {
3454                    type Value = __FieldTag;
3455                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3456                        formatter.write_str("a field name for SqlDatabasesListRequest")
3457                    }
3458                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3459                    where
3460                        E: serde::de::Error,
3461                    {
3462                        use std::result::Result::Ok;
3463                        use std::string::ToString;
3464                        match value {
3465                            "instance" => Ok(__FieldTag::__instance),
3466                            "project" => Ok(__FieldTag::__project),
3467                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3468                        }
3469                    }
3470                }
3471                deserializer.deserialize_identifier(Visitor)
3472            }
3473        }
3474        struct Visitor;
3475        impl<'de> serde::de::Visitor<'de> for Visitor {
3476            type Value = SqlDatabasesListRequest;
3477            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3478                formatter.write_str("struct SqlDatabasesListRequest")
3479            }
3480            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3481            where
3482                A: serde::de::MapAccess<'de>,
3483            {
3484                #[allow(unused_imports)]
3485                use serde::de::Error;
3486                use std::option::Option::Some;
3487                let mut fields = std::collections::HashSet::new();
3488                let mut result = Self::Value::new();
3489                while let Some(tag) = map.next_key::<__FieldTag>()? {
3490                    #[allow(clippy::match_single_binding)]
3491                    match tag {
3492                        __FieldTag::__instance => {
3493                            if !fields.insert(__FieldTag::__instance) {
3494                                return std::result::Result::Err(A::Error::duplicate_field(
3495                                    "multiple values for instance",
3496                                ));
3497                            }
3498                            result.instance = map
3499                                .next_value::<std::option::Option<std::string::String>>()?
3500                                .unwrap_or_default();
3501                        }
3502                        __FieldTag::__project => {
3503                            if !fields.insert(__FieldTag::__project) {
3504                                return std::result::Result::Err(A::Error::duplicate_field(
3505                                    "multiple values for project",
3506                                ));
3507                            }
3508                            result.project = map
3509                                .next_value::<std::option::Option<std::string::String>>()?
3510                                .unwrap_or_default();
3511                        }
3512                        __FieldTag::Unknown(key) => {
3513                            let value = map.next_value::<serde_json::Value>()?;
3514                            result._unknown_fields.insert(key, value);
3515                        }
3516                    }
3517                }
3518                std::result::Result::Ok(result)
3519            }
3520        }
3521        deserializer.deserialize_any(Visitor)
3522    }
3523}
3524
3525#[doc(hidden)]
3526impl serde::ser::Serialize for SqlDatabasesListRequest {
3527    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3528    where
3529        S: serde::ser::Serializer,
3530    {
3531        use serde::ser::SerializeMap;
3532        #[allow(unused_imports)]
3533        use std::option::Option::Some;
3534        let mut state = serializer.serialize_map(std::option::Option::None)?;
3535        if !self.instance.is_empty() {
3536            state.serialize_entry("instance", &self.instance)?;
3537        }
3538        if !self.project.is_empty() {
3539            state.serialize_entry("project", &self.project)?;
3540        }
3541        if !self._unknown_fields.is_empty() {
3542            for (key, value) in self._unknown_fields.iter() {
3543                state.serialize_entry(key, &value)?;
3544            }
3545        }
3546        state.end()
3547    }
3548}
3549
3550/// Database update request.
3551#[derive(Clone, Debug, Default, PartialEq)]
3552#[non_exhaustive]
3553pub struct SqlDatabasesUpdateRequest {
3554    /// Name of the database to be updated in the instance.
3555    pub database: std::string::String,
3556
3557    /// Database instance ID. This does not include the project ID.
3558    pub instance: std::string::String,
3559
3560    /// Project ID of the project that contains the instance.
3561    pub project: std::string::String,
3562
3563    pub body: std::option::Option<crate::model::Database>,
3564
3565    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3566}
3567
3568impl SqlDatabasesUpdateRequest {
3569    pub fn new() -> Self {
3570        std::default::Default::default()
3571    }
3572
3573    /// Sets the value of [database][crate::model::SqlDatabasesUpdateRequest::database].
3574    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3575        self.database = v.into();
3576        self
3577    }
3578
3579    /// Sets the value of [instance][crate::model::SqlDatabasesUpdateRequest::instance].
3580    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3581        self.instance = v.into();
3582        self
3583    }
3584
3585    /// Sets the value of [project][crate::model::SqlDatabasesUpdateRequest::project].
3586    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3587        self.project = v.into();
3588        self
3589    }
3590
3591    /// Sets the value of [body][crate::model::SqlDatabasesUpdateRequest::body].
3592    pub fn set_body<T>(mut self, v: T) -> Self
3593    where
3594        T: std::convert::Into<crate::model::Database>,
3595    {
3596        self.body = std::option::Option::Some(v.into());
3597        self
3598    }
3599
3600    /// Sets or clears the value of [body][crate::model::SqlDatabasesUpdateRequest::body].
3601    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
3602    where
3603        T: std::convert::Into<crate::model::Database>,
3604    {
3605        self.body = v.map(|x| x.into());
3606        self
3607    }
3608}
3609
3610impl wkt::message::Message for SqlDatabasesUpdateRequest {
3611    fn typename() -> &'static str {
3612        "type.googleapis.com/google.cloud.sql.v1.SqlDatabasesUpdateRequest"
3613    }
3614}
3615
3616#[doc(hidden)]
3617impl<'de> serde::de::Deserialize<'de> for SqlDatabasesUpdateRequest {
3618    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3619    where
3620        D: serde::Deserializer<'de>,
3621    {
3622        #[allow(non_camel_case_types)]
3623        #[doc(hidden)]
3624        #[derive(PartialEq, Eq, Hash)]
3625        enum __FieldTag {
3626            __database,
3627            __instance,
3628            __project,
3629            __body,
3630            Unknown(std::string::String),
3631        }
3632        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3633            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3634            where
3635                D: serde::Deserializer<'de>,
3636            {
3637                struct Visitor;
3638                impl<'de> serde::de::Visitor<'de> for Visitor {
3639                    type Value = __FieldTag;
3640                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3641                        formatter.write_str("a field name for SqlDatabasesUpdateRequest")
3642                    }
3643                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3644                    where
3645                        E: serde::de::Error,
3646                    {
3647                        use std::result::Result::Ok;
3648                        use std::string::ToString;
3649                        match value {
3650                            "database" => Ok(__FieldTag::__database),
3651                            "instance" => Ok(__FieldTag::__instance),
3652                            "project" => Ok(__FieldTag::__project),
3653                            "body" => Ok(__FieldTag::__body),
3654                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3655                        }
3656                    }
3657                }
3658                deserializer.deserialize_identifier(Visitor)
3659            }
3660        }
3661        struct Visitor;
3662        impl<'de> serde::de::Visitor<'de> for Visitor {
3663            type Value = SqlDatabasesUpdateRequest;
3664            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3665                formatter.write_str("struct SqlDatabasesUpdateRequest")
3666            }
3667            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3668            where
3669                A: serde::de::MapAccess<'de>,
3670            {
3671                #[allow(unused_imports)]
3672                use serde::de::Error;
3673                use std::option::Option::Some;
3674                let mut fields = std::collections::HashSet::new();
3675                let mut result = Self::Value::new();
3676                while let Some(tag) = map.next_key::<__FieldTag>()? {
3677                    #[allow(clippy::match_single_binding)]
3678                    match tag {
3679                        __FieldTag::__database => {
3680                            if !fields.insert(__FieldTag::__database) {
3681                                return std::result::Result::Err(A::Error::duplicate_field(
3682                                    "multiple values for database",
3683                                ));
3684                            }
3685                            result.database = map
3686                                .next_value::<std::option::Option<std::string::String>>()?
3687                                .unwrap_or_default();
3688                        }
3689                        __FieldTag::__instance => {
3690                            if !fields.insert(__FieldTag::__instance) {
3691                                return std::result::Result::Err(A::Error::duplicate_field(
3692                                    "multiple values for instance",
3693                                ));
3694                            }
3695                            result.instance = map
3696                                .next_value::<std::option::Option<std::string::String>>()?
3697                                .unwrap_or_default();
3698                        }
3699                        __FieldTag::__project => {
3700                            if !fields.insert(__FieldTag::__project) {
3701                                return std::result::Result::Err(A::Error::duplicate_field(
3702                                    "multiple values for project",
3703                                ));
3704                            }
3705                            result.project = map
3706                                .next_value::<std::option::Option<std::string::String>>()?
3707                                .unwrap_or_default();
3708                        }
3709                        __FieldTag::__body => {
3710                            if !fields.insert(__FieldTag::__body) {
3711                                return std::result::Result::Err(A::Error::duplicate_field(
3712                                    "multiple values for body",
3713                                ));
3714                            }
3715                            result.body =
3716                                map.next_value::<std::option::Option<crate::model::Database>>()?;
3717                        }
3718                        __FieldTag::Unknown(key) => {
3719                            let value = map.next_value::<serde_json::Value>()?;
3720                            result._unknown_fields.insert(key, value);
3721                        }
3722                    }
3723                }
3724                std::result::Result::Ok(result)
3725            }
3726        }
3727        deserializer.deserialize_any(Visitor)
3728    }
3729}
3730
3731#[doc(hidden)]
3732impl serde::ser::Serialize for SqlDatabasesUpdateRequest {
3733    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3734    where
3735        S: serde::ser::Serializer,
3736    {
3737        use serde::ser::SerializeMap;
3738        #[allow(unused_imports)]
3739        use std::option::Option::Some;
3740        let mut state = serializer.serialize_map(std::option::Option::None)?;
3741        if !self.database.is_empty() {
3742            state.serialize_entry("database", &self.database)?;
3743        }
3744        if !self.instance.is_empty() {
3745            state.serialize_entry("instance", &self.instance)?;
3746        }
3747        if !self.project.is_empty() {
3748            state.serialize_entry("project", &self.project)?;
3749        }
3750        if self.body.is_some() {
3751            state.serialize_entry("body", &self.body)?;
3752        }
3753        if !self._unknown_fields.is_empty() {
3754            for (key, value) in self._unknown_fields.iter() {
3755                state.serialize_entry(key, &value)?;
3756            }
3757        }
3758        state.end()
3759    }
3760}
3761
3762/// Database list response.
3763#[derive(Clone, Debug, Default, PartialEq)]
3764#[non_exhaustive]
3765pub struct DatabasesListResponse {
3766    /// This is always `sql#databasesList`.
3767    pub kind: std::string::String,
3768
3769    /// List of database resources in the instance.
3770    pub items: std::vec::Vec<crate::model::Database>,
3771
3772    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3773}
3774
3775impl DatabasesListResponse {
3776    pub fn new() -> Self {
3777        std::default::Default::default()
3778    }
3779
3780    /// Sets the value of [kind][crate::model::DatabasesListResponse::kind].
3781    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3782        self.kind = v.into();
3783        self
3784    }
3785
3786    /// Sets the value of [items][crate::model::DatabasesListResponse::items].
3787    pub fn set_items<T, V>(mut self, v: T) -> Self
3788    where
3789        T: std::iter::IntoIterator<Item = V>,
3790        V: std::convert::Into<crate::model::Database>,
3791    {
3792        use std::iter::Iterator;
3793        self.items = v.into_iter().map(|i| i.into()).collect();
3794        self
3795    }
3796}
3797
3798impl wkt::message::Message for DatabasesListResponse {
3799    fn typename() -> &'static str {
3800        "type.googleapis.com/google.cloud.sql.v1.DatabasesListResponse"
3801    }
3802}
3803
3804#[doc(hidden)]
3805impl<'de> serde::de::Deserialize<'de> for DatabasesListResponse {
3806    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3807    where
3808        D: serde::Deserializer<'de>,
3809    {
3810        #[allow(non_camel_case_types)]
3811        #[doc(hidden)]
3812        #[derive(PartialEq, Eq, Hash)]
3813        enum __FieldTag {
3814            __kind,
3815            __items,
3816            Unknown(std::string::String),
3817        }
3818        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3819            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3820            where
3821                D: serde::Deserializer<'de>,
3822            {
3823                struct Visitor;
3824                impl<'de> serde::de::Visitor<'de> for Visitor {
3825                    type Value = __FieldTag;
3826                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3827                        formatter.write_str("a field name for DatabasesListResponse")
3828                    }
3829                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3830                    where
3831                        E: serde::de::Error,
3832                    {
3833                        use std::result::Result::Ok;
3834                        use std::string::ToString;
3835                        match value {
3836                            "kind" => Ok(__FieldTag::__kind),
3837                            "items" => Ok(__FieldTag::__items),
3838                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3839                        }
3840                    }
3841                }
3842                deserializer.deserialize_identifier(Visitor)
3843            }
3844        }
3845        struct Visitor;
3846        impl<'de> serde::de::Visitor<'de> for Visitor {
3847            type Value = DatabasesListResponse;
3848            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3849                formatter.write_str("struct DatabasesListResponse")
3850            }
3851            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3852            where
3853                A: serde::de::MapAccess<'de>,
3854            {
3855                #[allow(unused_imports)]
3856                use serde::de::Error;
3857                use std::option::Option::Some;
3858                let mut fields = std::collections::HashSet::new();
3859                let mut result = Self::Value::new();
3860                while let Some(tag) = map.next_key::<__FieldTag>()? {
3861                    #[allow(clippy::match_single_binding)]
3862                    match tag {
3863                        __FieldTag::__kind => {
3864                            if !fields.insert(__FieldTag::__kind) {
3865                                return std::result::Result::Err(A::Error::duplicate_field(
3866                                    "multiple values for kind",
3867                                ));
3868                            }
3869                            result.kind = map
3870                                .next_value::<std::option::Option<std::string::String>>()?
3871                                .unwrap_or_default();
3872                        }
3873                        __FieldTag::__items => {
3874                            if !fields.insert(__FieldTag::__items) {
3875                                return std::result::Result::Err(A::Error::duplicate_field(
3876                                    "multiple values for items",
3877                                ));
3878                            }
3879                            result.items = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Database>>>()?.unwrap_or_default();
3880                        }
3881                        __FieldTag::Unknown(key) => {
3882                            let value = map.next_value::<serde_json::Value>()?;
3883                            result._unknown_fields.insert(key, value);
3884                        }
3885                    }
3886                }
3887                std::result::Result::Ok(result)
3888            }
3889        }
3890        deserializer.deserialize_any(Visitor)
3891    }
3892}
3893
3894#[doc(hidden)]
3895impl serde::ser::Serialize for DatabasesListResponse {
3896    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3897    where
3898        S: serde::ser::Serializer,
3899    {
3900        use serde::ser::SerializeMap;
3901        #[allow(unused_imports)]
3902        use std::option::Option::Some;
3903        let mut state = serializer.serialize_map(std::option::Option::None)?;
3904        if !self.kind.is_empty() {
3905            state.serialize_entry("kind", &self.kind)?;
3906        }
3907        if !self.items.is_empty() {
3908            state.serialize_entry("items", &self.items)?;
3909        }
3910        if !self._unknown_fields.is_empty() {
3911            for (key, value) in self._unknown_fields.iter() {
3912                state.serialize_entry(key, &value)?;
3913            }
3914        }
3915        state.end()
3916    }
3917}
3918
3919/// Flags list request.
3920#[derive(Clone, Debug, Default, PartialEq)]
3921#[non_exhaustive]
3922pub struct SqlFlagsListRequest {
3923    /// Database type and version you want to retrieve flags for. By default, this
3924    /// method returns flags for all database types and versions.
3925    pub database_version: std::string::String,
3926
3927    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3928}
3929
3930impl SqlFlagsListRequest {
3931    pub fn new() -> Self {
3932        std::default::Default::default()
3933    }
3934
3935    /// Sets the value of [database_version][crate::model::SqlFlagsListRequest::database_version].
3936    pub fn set_database_version<T: std::convert::Into<std::string::String>>(
3937        mut self,
3938        v: T,
3939    ) -> Self {
3940        self.database_version = v.into();
3941        self
3942    }
3943}
3944
3945impl wkt::message::Message for SqlFlagsListRequest {
3946    fn typename() -> &'static str {
3947        "type.googleapis.com/google.cloud.sql.v1.SqlFlagsListRequest"
3948    }
3949}
3950
3951#[doc(hidden)]
3952impl<'de> serde::de::Deserialize<'de> for SqlFlagsListRequest {
3953    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3954    where
3955        D: serde::Deserializer<'de>,
3956    {
3957        #[allow(non_camel_case_types)]
3958        #[doc(hidden)]
3959        #[derive(PartialEq, Eq, Hash)]
3960        enum __FieldTag {
3961            __database_version,
3962            Unknown(std::string::String),
3963        }
3964        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3965            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3966            where
3967                D: serde::Deserializer<'de>,
3968            {
3969                struct Visitor;
3970                impl<'de> serde::de::Visitor<'de> for Visitor {
3971                    type Value = __FieldTag;
3972                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3973                        formatter.write_str("a field name for SqlFlagsListRequest")
3974                    }
3975                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3976                    where
3977                        E: serde::de::Error,
3978                    {
3979                        use std::result::Result::Ok;
3980                        use std::string::ToString;
3981                        match value {
3982                            "databaseVersion" => Ok(__FieldTag::__database_version),
3983                            "database_version" => Ok(__FieldTag::__database_version),
3984                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3985                        }
3986                    }
3987                }
3988                deserializer.deserialize_identifier(Visitor)
3989            }
3990        }
3991        struct Visitor;
3992        impl<'de> serde::de::Visitor<'de> for Visitor {
3993            type Value = SqlFlagsListRequest;
3994            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3995                formatter.write_str("struct SqlFlagsListRequest")
3996            }
3997            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3998            where
3999                A: serde::de::MapAccess<'de>,
4000            {
4001                #[allow(unused_imports)]
4002                use serde::de::Error;
4003                use std::option::Option::Some;
4004                let mut fields = std::collections::HashSet::new();
4005                let mut result = Self::Value::new();
4006                while let Some(tag) = map.next_key::<__FieldTag>()? {
4007                    #[allow(clippy::match_single_binding)]
4008                    match tag {
4009                        __FieldTag::__database_version => {
4010                            if !fields.insert(__FieldTag::__database_version) {
4011                                return std::result::Result::Err(A::Error::duplicate_field(
4012                                    "multiple values for database_version",
4013                                ));
4014                            }
4015                            result.database_version = map
4016                                .next_value::<std::option::Option<std::string::String>>()?
4017                                .unwrap_or_default();
4018                        }
4019                        __FieldTag::Unknown(key) => {
4020                            let value = map.next_value::<serde_json::Value>()?;
4021                            result._unknown_fields.insert(key, value);
4022                        }
4023                    }
4024                }
4025                std::result::Result::Ok(result)
4026            }
4027        }
4028        deserializer.deserialize_any(Visitor)
4029    }
4030}
4031
4032#[doc(hidden)]
4033impl serde::ser::Serialize for SqlFlagsListRequest {
4034    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4035    where
4036        S: serde::ser::Serializer,
4037    {
4038        use serde::ser::SerializeMap;
4039        #[allow(unused_imports)]
4040        use std::option::Option::Some;
4041        let mut state = serializer.serialize_map(std::option::Option::None)?;
4042        if !self.database_version.is_empty() {
4043            state.serialize_entry("databaseVersion", &self.database_version)?;
4044        }
4045        if !self._unknown_fields.is_empty() {
4046            for (key, value) in self._unknown_fields.iter() {
4047                state.serialize_entry(key, &value)?;
4048            }
4049        }
4050        state.end()
4051    }
4052}
4053
4054/// Flags list response.
4055#[derive(Clone, Debug, Default, PartialEq)]
4056#[non_exhaustive]
4057pub struct FlagsListResponse {
4058    /// This is always `sql#flagsList`.
4059    pub kind: std::string::String,
4060
4061    /// List of flags.
4062    pub items: std::vec::Vec<crate::model::Flag>,
4063
4064    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4065}
4066
4067impl FlagsListResponse {
4068    pub fn new() -> Self {
4069        std::default::Default::default()
4070    }
4071
4072    /// Sets the value of [kind][crate::model::FlagsListResponse::kind].
4073    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4074        self.kind = v.into();
4075        self
4076    }
4077
4078    /// Sets the value of [items][crate::model::FlagsListResponse::items].
4079    pub fn set_items<T, V>(mut self, v: T) -> Self
4080    where
4081        T: std::iter::IntoIterator<Item = V>,
4082        V: std::convert::Into<crate::model::Flag>,
4083    {
4084        use std::iter::Iterator;
4085        self.items = v.into_iter().map(|i| i.into()).collect();
4086        self
4087    }
4088}
4089
4090impl wkt::message::Message for FlagsListResponse {
4091    fn typename() -> &'static str {
4092        "type.googleapis.com/google.cloud.sql.v1.FlagsListResponse"
4093    }
4094}
4095
4096#[doc(hidden)]
4097impl<'de> serde::de::Deserialize<'de> for FlagsListResponse {
4098    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4099    where
4100        D: serde::Deserializer<'de>,
4101    {
4102        #[allow(non_camel_case_types)]
4103        #[doc(hidden)]
4104        #[derive(PartialEq, Eq, Hash)]
4105        enum __FieldTag {
4106            __kind,
4107            __items,
4108            Unknown(std::string::String),
4109        }
4110        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4111            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4112            where
4113                D: serde::Deserializer<'de>,
4114            {
4115                struct Visitor;
4116                impl<'de> serde::de::Visitor<'de> for Visitor {
4117                    type Value = __FieldTag;
4118                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4119                        formatter.write_str("a field name for FlagsListResponse")
4120                    }
4121                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4122                    where
4123                        E: serde::de::Error,
4124                    {
4125                        use std::result::Result::Ok;
4126                        use std::string::ToString;
4127                        match value {
4128                            "kind" => Ok(__FieldTag::__kind),
4129                            "items" => Ok(__FieldTag::__items),
4130                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4131                        }
4132                    }
4133                }
4134                deserializer.deserialize_identifier(Visitor)
4135            }
4136        }
4137        struct Visitor;
4138        impl<'de> serde::de::Visitor<'de> for Visitor {
4139            type Value = FlagsListResponse;
4140            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4141                formatter.write_str("struct FlagsListResponse")
4142            }
4143            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4144            where
4145                A: serde::de::MapAccess<'de>,
4146            {
4147                #[allow(unused_imports)]
4148                use serde::de::Error;
4149                use std::option::Option::Some;
4150                let mut fields = std::collections::HashSet::new();
4151                let mut result = Self::Value::new();
4152                while let Some(tag) = map.next_key::<__FieldTag>()? {
4153                    #[allow(clippy::match_single_binding)]
4154                    match tag {
4155                        __FieldTag::__kind => {
4156                            if !fields.insert(__FieldTag::__kind) {
4157                                return std::result::Result::Err(A::Error::duplicate_field(
4158                                    "multiple values for kind",
4159                                ));
4160                            }
4161                            result.kind = map
4162                                .next_value::<std::option::Option<std::string::String>>()?
4163                                .unwrap_or_default();
4164                        }
4165                        __FieldTag::__items => {
4166                            if !fields.insert(__FieldTag::__items) {
4167                                return std::result::Result::Err(A::Error::duplicate_field(
4168                                    "multiple values for items",
4169                                ));
4170                            }
4171                            result.items = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Flag>>>()?.unwrap_or_default();
4172                        }
4173                        __FieldTag::Unknown(key) => {
4174                            let value = map.next_value::<serde_json::Value>()?;
4175                            result._unknown_fields.insert(key, value);
4176                        }
4177                    }
4178                }
4179                std::result::Result::Ok(result)
4180            }
4181        }
4182        deserializer.deserialize_any(Visitor)
4183    }
4184}
4185
4186#[doc(hidden)]
4187impl serde::ser::Serialize for FlagsListResponse {
4188    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4189    where
4190        S: serde::ser::Serializer,
4191    {
4192        use serde::ser::SerializeMap;
4193        #[allow(unused_imports)]
4194        use std::option::Option::Some;
4195        let mut state = serializer.serialize_map(std::option::Option::None)?;
4196        if !self.kind.is_empty() {
4197            state.serialize_entry("kind", &self.kind)?;
4198        }
4199        if !self.items.is_empty() {
4200            state.serialize_entry("items", &self.items)?;
4201        }
4202        if !self._unknown_fields.is_empty() {
4203            for (key, value) in self._unknown_fields.iter() {
4204                state.serialize_entry(key, &value)?;
4205            }
4206        }
4207        state.end()
4208    }
4209}
4210
4211/// A flag resource.
4212#[derive(Clone, Debug, Default, PartialEq)]
4213#[non_exhaustive]
4214pub struct Flag {
4215    /// This is the name of the flag. Flag names always use underscores, not
4216    /// hyphens, for example: `max_allowed_packet`
4217    pub name: std::string::String,
4218
4219    /// The type of the flag. Flags are typed to being `BOOLEAN`, `STRING`,
4220    /// `INTEGER` or `NONE`. `NONE` is used for flags that do not take a
4221    /// value, such as `skip_grant_tables`.
4222    pub r#type: crate::model::SqlFlagType,
4223
4224    /// The database version this flag applies to. Can be
4225    /// MySQL instances: `MYSQL_8_0`, `MYSQL_8_0_18`, `MYSQL_8_0_26`, `MYSQL_5_7`,
4226    /// or `MYSQL_5_6`. PostgreSQL instances: `POSTGRES_9_6`, `POSTGRES_10`,
4227    /// `POSTGRES_11` or `POSTGRES_12`. SQL Server instances:
4228    /// `SQLSERVER_2017_STANDARD`, `SQLSERVER_2017_ENTERPRISE`,
4229    /// `SQLSERVER_2017_EXPRESS`, `SQLSERVER_2017_WEB`, `SQLSERVER_2019_STANDARD`,
4230    /// `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`, or
4231    /// `SQLSERVER_2019_WEB`.
4232    /// See [the complete
4233    /// list](/sql/docs/mysql/admin-api/rest/v1/SqlDatabaseVersion).
4234    pub applies_to: std::vec::Vec<crate::model::SqlDatabaseVersion>,
4235
4236    /// For `STRING` flags, a list of strings that the value can be set to.
4237    pub allowed_string_values: std::vec::Vec<std::string::String>,
4238
4239    /// For `INTEGER` flags, the minimum allowed value.
4240    pub min_value: std::option::Option<wkt::Int64Value>,
4241
4242    /// For `INTEGER` flags, the maximum allowed value.
4243    pub max_value: std::option::Option<wkt::Int64Value>,
4244
4245    /// Indicates whether changing this flag will trigger a database restart. Only
4246    /// applicable to Second Generation instances.
4247    pub requires_restart: std::option::Option<wkt::BoolValue>,
4248
4249    /// This is always `sql#flag`.
4250    pub kind: std::string::String,
4251
4252    /// Whether or not the flag is considered in beta.
4253    pub in_beta: std::option::Option<wkt::BoolValue>,
4254
4255    /// Use this field if only certain integers are accepted. Can be combined
4256    /// with min_value and max_value to add additional values.
4257    pub allowed_int_values: std::vec::Vec<i64>,
4258
4259    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4260}
4261
4262impl Flag {
4263    pub fn new() -> Self {
4264        std::default::Default::default()
4265    }
4266
4267    /// Sets the value of [name][crate::model::Flag::name].
4268    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4269        self.name = v.into();
4270        self
4271    }
4272
4273    /// Sets the value of [r#type][crate::model::Flag::type].
4274    pub fn set_type<T: std::convert::Into<crate::model::SqlFlagType>>(mut self, v: T) -> Self {
4275        self.r#type = v.into();
4276        self
4277    }
4278
4279    /// Sets the value of [applies_to][crate::model::Flag::applies_to].
4280    pub fn set_applies_to<T, V>(mut self, v: T) -> Self
4281    where
4282        T: std::iter::IntoIterator<Item = V>,
4283        V: std::convert::Into<crate::model::SqlDatabaseVersion>,
4284    {
4285        use std::iter::Iterator;
4286        self.applies_to = v.into_iter().map(|i| i.into()).collect();
4287        self
4288    }
4289
4290    /// Sets the value of [allowed_string_values][crate::model::Flag::allowed_string_values].
4291    pub fn set_allowed_string_values<T, V>(mut self, v: T) -> Self
4292    where
4293        T: std::iter::IntoIterator<Item = V>,
4294        V: std::convert::Into<std::string::String>,
4295    {
4296        use std::iter::Iterator;
4297        self.allowed_string_values = v.into_iter().map(|i| i.into()).collect();
4298        self
4299    }
4300
4301    /// Sets the value of [min_value][crate::model::Flag::min_value].
4302    pub fn set_min_value<T>(mut self, v: T) -> Self
4303    where
4304        T: std::convert::Into<wkt::Int64Value>,
4305    {
4306        self.min_value = std::option::Option::Some(v.into());
4307        self
4308    }
4309
4310    /// Sets or clears the value of [min_value][crate::model::Flag::min_value].
4311    pub fn set_or_clear_min_value<T>(mut self, v: std::option::Option<T>) -> Self
4312    where
4313        T: std::convert::Into<wkt::Int64Value>,
4314    {
4315        self.min_value = v.map(|x| x.into());
4316        self
4317    }
4318
4319    /// Sets the value of [max_value][crate::model::Flag::max_value].
4320    pub fn set_max_value<T>(mut self, v: T) -> Self
4321    where
4322        T: std::convert::Into<wkt::Int64Value>,
4323    {
4324        self.max_value = std::option::Option::Some(v.into());
4325        self
4326    }
4327
4328    /// Sets or clears the value of [max_value][crate::model::Flag::max_value].
4329    pub fn set_or_clear_max_value<T>(mut self, v: std::option::Option<T>) -> Self
4330    where
4331        T: std::convert::Into<wkt::Int64Value>,
4332    {
4333        self.max_value = v.map(|x| x.into());
4334        self
4335    }
4336
4337    /// Sets the value of [requires_restart][crate::model::Flag::requires_restart].
4338    pub fn set_requires_restart<T>(mut self, v: T) -> Self
4339    where
4340        T: std::convert::Into<wkt::BoolValue>,
4341    {
4342        self.requires_restart = std::option::Option::Some(v.into());
4343        self
4344    }
4345
4346    /// Sets or clears the value of [requires_restart][crate::model::Flag::requires_restart].
4347    pub fn set_or_clear_requires_restart<T>(mut self, v: std::option::Option<T>) -> Self
4348    where
4349        T: std::convert::Into<wkt::BoolValue>,
4350    {
4351        self.requires_restart = v.map(|x| x.into());
4352        self
4353    }
4354
4355    /// Sets the value of [kind][crate::model::Flag::kind].
4356    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4357        self.kind = v.into();
4358        self
4359    }
4360
4361    /// Sets the value of [in_beta][crate::model::Flag::in_beta].
4362    pub fn set_in_beta<T>(mut self, v: T) -> Self
4363    where
4364        T: std::convert::Into<wkt::BoolValue>,
4365    {
4366        self.in_beta = std::option::Option::Some(v.into());
4367        self
4368    }
4369
4370    /// Sets or clears the value of [in_beta][crate::model::Flag::in_beta].
4371    pub fn set_or_clear_in_beta<T>(mut self, v: std::option::Option<T>) -> Self
4372    where
4373        T: std::convert::Into<wkt::BoolValue>,
4374    {
4375        self.in_beta = v.map(|x| x.into());
4376        self
4377    }
4378
4379    /// Sets the value of [allowed_int_values][crate::model::Flag::allowed_int_values].
4380    pub fn set_allowed_int_values<T, V>(mut self, v: T) -> Self
4381    where
4382        T: std::iter::IntoIterator<Item = V>,
4383        V: std::convert::Into<i64>,
4384    {
4385        use std::iter::Iterator;
4386        self.allowed_int_values = v.into_iter().map(|i| i.into()).collect();
4387        self
4388    }
4389}
4390
4391impl wkt::message::Message for Flag {
4392    fn typename() -> &'static str {
4393        "type.googleapis.com/google.cloud.sql.v1.Flag"
4394    }
4395}
4396
4397#[doc(hidden)]
4398impl<'de> serde::de::Deserialize<'de> for Flag {
4399    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4400    where
4401        D: serde::Deserializer<'de>,
4402    {
4403        #[allow(non_camel_case_types)]
4404        #[doc(hidden)]
4405        #[derive(PartialEq, Eq, Hash)]
4406        enum __FieldTag {
4407            __name,
4408            __type,
4409            __applies_to,
4410            __allowed_string_values,
4411            __min_value,
4412            __max_value,
4413            __requires_restart,
4414            __kind,
4415            __in_beta,
4416            __allowed_int_values,
4417            Unknown(std::string::String),
4418        }
4419        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4420            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4421            where
4422                D: serde::Deserializer<'de>,
4423            {
4424                struct Visitor;
4425                impl<'de> serde::de::Visitor<'de> for Visitor {
4426                    type Value = __FieldTag;
4427                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4428                        formatter.write_str("a field name for Flag")
4429                    }
4430                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4431                    where
4432                        E: serde::de::Error,
4433                    {
4434                        use std::result::Result::Ok;
4435                        use std::string::ToString;
4436                        match value {
4437                            "name" => Ok(__FieldTag::__name),
4438                            "type" => Ok(__FieldTag::__type),
4439                            "appliesTo" => Ok(__FieldTag::__applies_to),
4440                            "applies_to" => Ok(__FieldTag::__applies_to),
4441                            "allowedStringValues" => Ok(__FieldTag::__allowed_string_values),
4442                            "allowed_string_values" => Ok(__FieldTag::__allowed_string_values),
4443                            "minValue" => Ok(__FieldTag::__min_value),
4444                            "min_value" => Ok(__FieldTag::__min_value),
4445                            "maxValue" => Ok(__FieldTag::__max_value),
4446                            "max_value" => Ok(__FieldTag::__max_value),
4447                            "requiresRestart" => Ok(__FieldTag::__requires_restart),
4448                            "requires_restart" => Ok(__FieldTag::__requires_restart),
4449                            "kind" => Ok(__FieldTag::__kind),
4450                            "inBeta" => Ok(__FieldTag::__in_beta),
4451                            "in_beta" => Ok(__FieldTag::__in_beta),
4452                            "allowedIntValues" => Ok(__FieldTag::__allowed_int_values),
4453                            "allowed_int_values" => Ok(__FieldTag::__allowed_int_values),
4454                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4455                        }
4456                    }
4457                }
4458                deserializer.deserialize_identifier(Visitor)
4459            }
4460        }
4461        struct Visitor;
4462        impl<'de> serde::de::Visitor<'de> for Visitor {
4463            type Value = Flag;
4464            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4465                formatter.write_str("struct Flag")
4466            }
4467            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4468            where
4469                A: serde::de::MapAccess<'de>,
4470            {
4471                #[allow(unused_imports)]
4472                use serde::de::Error;
4473                use std::option::Option::Some;
4474                let mut fields = std::collections::HashSet::new();
4475                let mut result = Self::Value::new();
4476                while let Some(tag) = map.next_key::<__FieldTag>()? {
4477                    #[allow(clippy::match_single_binding)]
4478                    match tag {
4479                        __FieldTag::__name => {
4480                            if !fields.insert(__FieldTag::__name) {
4481                                return std::result::Result::Err(A::Error::duplicate_field(
4482                                    "multiple values for name",
4483                                ));
4484                            }
4485                            result.name = map
4486                                .next_value::<std::option::Option<std::string::String>>()?
4487                                .unwrap_or_default();
4488                        }
4489                        __FieldTag::__type => {
4490                            if !fields.insert(__FieldTag::__type) {
4491                                return std::result::Result::Err(A::Error::duplicate_field(
4492                                    "multiple values for type",
4493                                ));
4494                            }
4495                            result.r#type = map
4496                                .next_value::<std::option::Option<crate::model::SqlFlagType>>()?
4497                                .unwrap_or_default();
4498                        }
4499                        __FieldTag::__applies_to => {
4500                            if !fields.insert(__FieldTag::__applies_to) {
4501                                return std::result::Result::Err(A::Error::duplicate_field(
4502                                    "multiple values for applies_to",
4503                                ));
4504                            }
4505                            result.applies_to = map
4506                                .next_value::<std::option::Option<
4507                                    std::vec::Vec<crate::model::SqlDatabaseVersion>,
4508                                >>()?
4509                                .unwrap_or_default();
4510                        }
4511                        __FieldTag::__allowed_string_values => {
4512                            if !fields.insert(__FieldTag::__allowed_string_values) {
4513                                return std::result::Result::Err(A::Error::duplicate_field(
4514                                    "multiple values for allowed_string_values",
4515                                ));
4516                            }
4517                            result.allowed_string_values = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
4518                        }
4519                        __FieldTag::__min_value => {
4520                            if !fields.insert(__FieldTag::__min_value) {
4521                                return std::result::Result::Err(A::Error::duplicate_field(
4522                                    "multiple values for min_value",
4523                                ));
4524                            }
4525                            struct __With(std::option::Option<wkt::Int64Value>);
4526                            impl<'de> serde::de::Deserialize<'de> for __With {
4527                                fn deserialize<D>(
4528                                    deserializer: D,
4529                                ) -> std::result::Result<Self, D::Error>
4530                                where
4531                                    D: serde::de::Deserializer<'de>,
4532                                {
4533                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4534                                }
4535                            }
4536                            result.min_value = map.next_value::<__With>()?.0;
4537                        }
4538                        __FieldTag::__max_value => {
4539                            if !fields.insert(__FieldTag::__max_value) {
4540                                return std::result::Result::Err(A::Error::duplicate_field(
4541                                    "multiple values for max_value",
4542                                ));
4543                            }
4544                            struct __With(std::option::Option<wkt::Int64Value>);
4545                            impl<'de> serde::de::Deserialize<'de> for __With {
4546                                fn deserialize<D>(
4547                                    deserializer: D,
4548                                ) -> std::result::Result<Self, D::Error>
4549                                where
4550                                    D: serde::de::Deserializer<'de>,
4551                                {
4552                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4553                                }
4554                            }
4555                            result.max_value = map.next_value::<__With>()?.0;
4556                        }
4557                        __FieldTag::__requires_restart => {
4558                            if !fields.insert(__FieldTag::__requires_restart) {
4559                                return std::result::Result::Err(A::Error::duplicate_field(
4560                                    "multiple values for requires_restart",
4561                                ));
4562                            }
4563                            result.requires_restart =
4564                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
4565                        }
4566                        __FieldTag::__kind => {
4567                            if !fields.insert(__FieldTag::__kind) {
4568                                return std::result::Result::Err(A::Error::duplicate_field(
4569                                    "multiple values for kind",
4570                                ));
4571                            }
4572                            result.kind = map
4573                                .next_value::<std::option::Option<std::string::String>>()?
4574                                .unwrap_or_default();
4575                        }
4576                        __FieldTag::__in_beta => {
4577                            if !fields.insert(__FieldTag::__in_beta) {
4578                                return std::result::Result::Err(A::Error::duplicate_field(
4579                                    "multiple values for in_beta",
4580                                ));
4581                            }
4582                            result.in_beta =
4583                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
4584                        }
4585                        __FieldTag::__allowed_int_values => {
4586                            if !fields.insert(__FieldTag::__allowed_int_values) {
4587                                return std::result::Result::Err(A::Error::duplicate_field(
4588                                    "multiple values for allowed_int_values",
4589                                ));
4590                            }
4591                            struct __With(std::option::Option<std::vec::Vec<i64>>);
4592                            impl<'de> serde::de::Deserialize<'de> for __With {
4593                                fn deserialize<D>(
4594                                    deserializer: D,
4595                                ) -> std::result::Result<Self, D::Error>
4596                                where
4597                                    D: serde::de::Deserializer<'de>,
4598                                {
4599                                    serde_with::As::<
4600                                        std::option::Option<std::vec::Vec<wkt::internal::I64>>,
4601                                    >::deserialize(deserializer)
4602                                    .map(__With)
4603                                }
4604                            }
4605                            result.allowed_int_values =
4606                                map.next_value::<__With>()?.0.unwrap_or_default();
4607                        }
4608                        __FieldTag::Unknown(key) => {
4609                            let value = map.next_value::<serde_json::Value>()?;
4610                            result._unknown_fields.insert(key, value);
4611                        }
4612                    }
4613                }
4614                std::result::Result::Ok(result)
4615            }
4616        }
4617        deserializer.deserialize_any(Visitor)
4618    }
4619}
4620
4621#[doc(hidden)]
4622impl serde::ser::Serialize for Flag {
4623    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4624    where
4625        S: serde::ser::Serializer,
4626    {
4627        use serde::ser::SerializeMap;
4628        #[allow(unused_imports)]
4629        use std::option::Option::Some;
4630        let mut state = serializer.serialize_map(std::option::Option::None)?;
4631        if !self.name.is_empty() {
4632            state.serialize_entry("name", &self.name)?;
4633        }
4634        if !wkt::internal::is_default(&self.r#type) {
4635            state.serialize_entry("type", &self.r#type)?;
4636        }
4637        if !self.applies_to.is_empty() {
4638            state.serialize_entry("appliesTo", &self.applies_to)?;
4639        }
4640        if !self.allowed_string_values.is_empty() {
4641            state.serialize_entry("allowedStringValues", &self.allowed_string_values)?;
4642        }
4643        if self.min_value.is_some() {
4644            struct __With<'a>(&'a std::option::Option<wkt::Int64Value>);
4645            impl<'a> serde::ser::Serialize for __With<'a> {
4646                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4647                where
4648                    S: serde::ser::Serializer,
4649                {
4650                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
4651                        self.0, serializer,
4652                    )
4653                }
4654            }
4655            state.serialize_entry("minValue", &__With(&self.min_value))?;
4656        }
4657        if self.max_value.is_some() {
4658            struct __With<'a>(&'a std::option::Option<wkt::Int64Value>);
4659            impl<'a> serde::ser::Serialize for __With<'a> {
4660                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4661                where
4662                    S: serde::ser::Serializer,
4663                {
4664                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
4665                        self.0, serializer,
4666                    )
4667                }
4668            }
4669            state.serialize_entry("maxValue", &__With(&self.max_value))?;
4670        }
4671        if self.requires_restart.is_some() {
4672            state.serialize_entry("requiresRestart", &self.requires_restart)?;
4673        }
4674        if !self.kind.is_empty() {
4675            state.serialize_entry("kind", &self.kind)?;
4676        }
4677        if self.in_beta.is_some() {
4678            state.serialize_entry("inBeta", &self.in_beta)?;
4679        }
4680        if !self.allowed_int_values.is_empty() {
4681            struct __With<'a>(&'a std::vec::Vec<i64>);
4682            impl<'a> serde::ser::Serialize for __With<'a> {
4683                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4684                where
4685                    S: serde::ser::Serializer,
4686                {
4687                    serde_with::As::<std::vec::Vec<wkt::internal::I64>>::serialize(
4688                        self.0, serializer,
4689                    )
4690                }
4691            }
4692            state.serialize_entry("allowedIntValues", &__With(&self.allowed_int_values))?;
4693        }
4694        if !self._unknown_fields.is_empty() {
4695            for (key, value) in self._unknown_fields.iter() {
4696                state.serialize_entry(key, &value)?;
4697            }
4698        }
4699        state.end()
4700    }
4701}
4702
4703/// Instance add server CA request.
4704#[derive(Clone, Debug, Default, PartialEq)]
4705#[non_exhaustive]
4706pub struct SqlInstancesAddServerCaRequest {
4707    /// Cloud SQL instance ID. This does not include the project ID.
4708    pub instance: std::string::String,
4709
4710    /// Project ID of the project that contains the instance.
4711    pub project: std::string::String,
4712
4713    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4714}
4715
4716impl SqlInstancesAddServerCaRequest {
4717    pub fn new() -> Self {
4718        std::default::Default::default()
4719    }
4720
4721    /// Sets the value of [instance][crate::model::SqlInstancesAddServerCaRequest::instance].
4722    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4723        self.instance = v.into();
4724        self
4725    }
4726
4727    /// Sets the value of [project][crate::model::SqlInstancesAddServerCaRequest::project].
4728    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4729        self.project = v.into();
4730        self
4731    }
4732}
4733
4734impl wkt::message::Message for SqlInstancesAddServerCaRequest {
4735    fn typename() -> &'static str {
4736        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesAddServerCaRequest"
4737    }
4738}
4739
4740#[doc(hidden)]
4741impl<'de> serde::de::Deserialize<'de> for SqlInstancesAddServerCaRequest {
4742    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4743    where
4744        D: serde::Deserializer<'de>,
4745    {
4746        #[allow(non_camel_case_types)]
4747        #[doc(hidden)]
4748        #[derive(PartialEq, Eq, Hash)]
4749        enum __FieldTag {
4750            __instance,
4751            __project,
4752            Unknown(std::string::String),
4753        }
4754        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4755            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4756            where
4757                D: serde::Deserializer<'de>,
4758            {
4759                struct Visitor;
4760                impl<'de> serde::de::Visitor<'de> for Visitor {
4761                    type Value = __FieldTag;
4762                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4763                        formatter.write_str("a field name for SqlInstancesAddServerCaRequest")
4764                    }
4765                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4766                    where
4767                        E: serde::de::Error,
4768                    {
4769                        use std::result::Result::Ok;
4770                        use std::string::ToString;
4771                        match value {
4772                            "instance" => Ok(__FieldTag::__instance),
4773                            "project" => Ok(__FieldTag::__project),
4774                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4775                        }
4776                    }
4777                }
4778                deserializer.deserialize_identifier(Visitor)
4779            }
4780        }
4781        struct Visitor;
4782        impl<'de> serde::de::Visitor<'de> for Visitor {
4783            type Value = SqlInstancesAddServerCaRequest;
4784            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4785                formatter.write_str("struct SqlInstancesAddServerCaRequest")
4786            }
4787            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4788            where
4789                A: serde::de::MapAccess<'de>,
4790            {
4791                #[allow(unused_imports)]
4792                use serde::de::Error;
4793                use std::option::Option::Some;
4794                let mut fields = std::collections::HashSet::new();
4795                let mut result = Self::Value::new();
4796                while let Some(tag) = map.next_key::<__FieldTag>()? {
4797                    #[allow(clippy::match_single_binding)]
4798                    match tag {
4799                        __FieldTag::__instance => {
4800                            if !fields.insert(__FieldTag::__instance) {
4801                                return std::result::Result::Err(A::Error::duplicate_field(
4802                                    "multiple values for instance",
4803                                ));
4804                            }
4805                            result.instance = map
4806                                .next_value::<std::option::Option<std::string::String>>()?
4807                                .unwrap_or_default();
4808                        }
4809                        __FieldTag::__project => {
4810                            if !fields.insert(__FieldTag::__project) {
4811                                return std::result::Result::Err(A::Error::duplicate_field(
4812                                    "multiple values for project",
4813                                ));
4814                            }
4815                            result.project = map
4816                                .next_value::<std::option::Option<std::string::String>>()?
4817                                .unwrap_or_default();
4818                        }
4819                        __FieldTag::Unknown(key) => {
4820                            let value = map.next_value::<serde_json::Value>()?;
4821                            result._unknown_fields.insert(key, value);
4822                        }
4823                    }
4824                }
4825                std::result::Result::Ok(result)
4826            }
4827        }
4828        deserializer.deserialize_any(Visitor)
4829    }
4830}
4831
4832#[doc(hidden)]
4833impl serde::ser::Serialize for SqlInstancesAddServerCaRequest {
4834    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4835    where
4836        S: serde::ser::Serializer,
4837    {
4838        use serde::ser::SerializeMap;
4839        #[allow(unused_imports)]
4840        use std::option::Option::Some;
4841        let mut state = serializer.serialize_map(std::option::Option::None)?;
4842        if !self.instance.is_empty() {
4843            state.serialize_entry("instance", &self.instance)?;
4844        }
4845        if !self.project.is_empty() {
4846            state.serialize_entry("project", &self.project)?;
4847        }
4848        if !self._unknown_fields.is_empty() {
4849            for (key, value) in self._unknown_fields.iter() {
4850                state.serialize_entry(key, &value)?;
4851            }
4852        }
4853        state.end()
4854    }
4855}
4856
4857/// Instance clone request.
4858#[derive(Clone, Debug, Default, PartialEq)]
4859#[non_exhaustive]
4860pub struct SqlInstancesCloneRequest {
4861    /// The ID of the Cloud SQL instance to be cloned (source). This does not
4862    /// include the project ID.
4863    pub instance: std::string::String,
4864
4865    /// Project ID of the source as well as the clone Cloud SQL instance.
4866    pub project: std::string::String,
4867
4868    pub body: std::option::Option<crate::model::InstancesCloneRequest>,
4869
4870    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4871}
4872
4873impl SqlInstancesCloneRequest {
4874    pub fn new() -> Self {
4875        std::default::Default::default()
4876    }
4877
4878    /// Sets the value of [instance][crate::model::SqlInstancesCloneRequest::instance].
4879    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4880        self.instance = v.into();
4881        self
4882    }
4883
4884    /// Sets the value of [project][crate::model::SqlInstancesCloneRequest::project].
4885    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4886        self.project = v.into();
4887        self
4888    }
4889
4890    /// Sets the value of [body][crate::model::SqlInstancesCloneRequest::body].
4891    pub fn set_body<T>(mut self, v: T) -> Self
4892    where
4893        T: std::convert::Into<crate::model::InstancesCloneRequest>,
4894    {
4895        self.body = std::option::Option::Some(v.into());
4896        self
4897    }
4898
4899    /// Sets or clears the value of [body][crate::model::SqlInstancesCloneRequest::body].
4900    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
4901    where
4902        T: std::convert::Into<crate::model::InstancesCloneRequest>,
4903    {
4904        self.body = v.map(|x| x.into());
4905        self
4906    }
4907}
4908
4909impl wkt::message::Message for SqlInstancesCloneRequest {
4910    fn typename() -> &'static str {
4911        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesCloneRequest"
4912    }
4913}
4914
4915#[doc(hidden)]
4916impl<'de> serde::de::Deserialize<'de> for SqlInstancesCloneRequest {
4917    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4918    where
4919        D: serde::Deserializer<'de>,
4920    {
4921        #[allow(non_camel_case_types)]
4922        #[doc(hidden)]
4923        #[derive(PartialEq, Eq, Hash)]
4924        enum __FieldTag {
4925            __instance,
4926            __project,
4927            __body,
4928            Unknown(std::string::String),
4929        }
4930        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4931            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4932            where
4933                D: serde::Deserializer<'de>,
4934            {
4935                struct Visitor;
4936                impl<'de> serde::de::Visitor<'de> for Visitor {
4937                    type Value = __FieldTag;
4938                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4939                        formatter.write_str("a field name for SqlInstancesCloneRequest")
4940                    }
4941                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4942                    where
4943                        E: serde::de::Error,
4944                    {
4945                        use std::result::Result::Ok;
4946                        use std::string::ToString;
4947                        match value {
4948                            "instance" => Ok(__FieldTag::__instance),
4949                            "project" => Ok(__FieldTag::__project),
4950                            "body" => Ok(__FieldTag::__body),
4951                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4952                        }
4953                    }
4954                }
4955                deserializer.deserialize_identifier(Visitor)
4956            }
4957        }
4958        struct Visitor;
4959        impl<'de> serde::de::Visitor<'de> for Visitor {
4960            type Value = SqlInstancesCloneRequest;
4961            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4962                formatter.write_str("struct SqlInstancesCloneRequest")
4963            }
4964            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4965            where
4966                A: serde::de::MapAccess<'de>,
4967            {
4968                #[allow(unused_imports)]
4969                use serde::de::Error;
4970                use std::option::Option::Some;
4971                let mut fields = std::collections::HashSet::new();
4972                let mut result = Self::Value::new();
4973                while let Some(tag) = map.next_key::<__FieldTag>()? {
4974                    #[allow(clippy::match_single_binding)]
4975                    match tag {
4976                        __FieldTag::__instance => {
4977                            if !fields.insert(__FieldTag::__instance) {
4978                                return std::result::Result::Err(A::Error::duplicate_field(
4979                                    "multiple values for instance",
4980                                ));
4981                            }
4982                            result.instance = map
4983                                .next_value::<std::option::Option<std::string::String>>()?
4984                                .unwrap_or_default();
4985                        }
4986                        __FieldTag::__project => {
4987                            if !fields.insert(__FieldTag::__project) {
4988                                return std::result::Result::Err(A::Error::duplicate_field(
4989                                    "multiple values for project",
4990                                ));
4991                            }
4992                            result.project = map
4993                                .next_value::<std::option::Option<std::string::String>>()?
4994                                .unwrap_or_default();
4995                        }
4996                        __FieldTag::__body => {
4997                            if !fields.insert(__FieldTag::__body) {
4998                                return std::result::Result::Err(A::Error::duplicate_field(
4999                                    "multiple values for body",
5000                                ));
5001                            }
5002                            result.body = map.next_value::<std::option::Option<crate::model::InstancesCloneRequest>>()?
5003                                ;
5004                        }
5005                        __FieldTag::Unknown(key) => {
5006                            let value = map.next_value::<serde_json::Value>()?;
5007                            result._unknown_fields.insert(key, value);
5008                        }
5009                    }
5010                }
5011                std::result::Result::Ok(result)
5012            }
5013        }
5014        deserializer.deserialize_any(Visitor)
5015    }
5016}
5017
5018#[doc(hidden)]
5019impl serde::ser::Serialize for SqlInstancesCloneRequest {
5020    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5021    where
5022        S: serde::ser::Serializer,
5023    {
5024        use serde::ser::SerializeMap;
5025        #[allow(unused_imports)]
5026        use std::option::Option::Some;
5027        let mut state = serializer.serialize_map(std::option::Option::None)?;
5028        if !self.instance.is_empty() {
5029            state.serialize_entry("instance", &self.instance)?;
5030        }
5031        if !self.project.is_empty() {
5032            state.serialize_entry("project", &self.project)?;
5033        }
5034        if self.body.is_some() {
5035            state.serialize_entry("body", &self.body)?;
5036        }
5037        if !self._unknown_fields.is_empty() {
5038            for (key, value) in self._unknown_fields.iter() {
5039                state.serialize_entry(key, &value)?;
5040            }
5041        }
5042        state.end()
5043    }
5044}
5045
5046/// Instance delete request.
5047#[derive(Clone, Debug, Default, PartialEq)]
5048#[non_exhaustive]
5049pub struct SqlInstancesDeleteRequest {
5050    /// Cloud SQL instance ID. This does not include the project ID.
5051    pub instance: std::string::String,
5052
5053    /// Project ID of the project that contains the instance to be deleted.
5054    pub project: std::string::String,
5055
5056    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5057}
5058
5059impl SqlInstancesDeleteRequest {
5060    pub fn new() -> Self {
5061        std::default::Default::default()
5062    }
5063
5064    /// Sets the value of [instance][crate::model::SqlInstancesDeleteRequest::instance].
5065    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5066        self.instance = v.into();
5067        self
5068    }
5069
5070    /// Sets the value of [project][crate::model::SqlInstancesDeleteRequest::project].
5071    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5072        self.project = v.into();
5073        self
5074    }
5075}
5076
5077impl wkt::message::Message for SqlInstancesDeleteRequest {
5078    fn typename() -> &'static str {
5079        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesDeleteRequest"
5080    }
5081}
5082
5083#[doc(hidden)]
5084impl<'de> serde::de::Deserialize<'de> for SqlInstancesDeleteRequest {
5085    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5086    where
5087        D: serde::Deserializer<'de>,
5088    {
5089        #[allow(non_camel_case_types)]
5090        #[doc(hidden)]
5091        #[derive(PartialEq, Eq, Hash)]
5092        enum __FieldTag {
5093            __instance,
5094            __project,
5095            Unknown(std::string::String),
5096        }
5097        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5098            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5099            where
5100                D: serde::Deserializer<'de>,
5101            {
5102                struct Visitor;
5103                impl<'de> serde::de::Visitor<'de> for Visitor {
5104                    type Value = __FieldTag;
5105                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5106                        formatter.write_str("a field name for SqlInstancesDeleteRequest")
5107                    }
5108                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5109                    where
5110                        E: serde::de::Error,
5111                    {
5112                        use std::result::Result::Ok;
5113                        use std::string::ToString;
5114                        match value {
5115                            "instance" => Ok(__FieldTag::__instance),
5116                            "project" => Ok(__FieldTag::__project),
5117                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5118                        }
5119                    }
5120                }
5121                deserializer.deserialize_identifier(Visitor)
5122            }
5123        }
5124        struct Visitor;
5125        impl<'de> serde::de::Visitor<'de> for Visitor {
5126            type Value = SqlInstancesDeleteRequest;
5127            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5128                formatter.write_str("struct SqlInstancesDeleteRequest")
5129            }
5130            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5131            where
5132                A: serde::de::MapAccess<'de>,
5133            {
5134                #[allow(unused_imports)]
5135                use serde::de::Error;
5136                use std::option::Option::Some;
5137                let mut fields = std::collections::HashSet::new();
5138                let mut result = Self::Value::new();
5139                while let Some(tag) = map.next_key::<__FieldTag>()? {
5140                    #[allow(clippy::match_single_binding)]
5141                    match tag {
5142                        __FieldTag::__instance => {
5143                            if !fields.insert(__FieldTag::__instance) {
5144                                return std::result::Result::Err(A::Error::duplicate_field(
5145                                    "multiple values for instance",
5146                                ));
5147                            }
5148                            result.instance = map
5149                                .next_value::<std::option::Option<std::string::String>>()?
5150                                .unwrap_or_default();
5151                        }
5152                        __FieldTag::__project => {
5153                            if !fields.insert(__FieldTag::__project) {
5154                                return std::result::Result::Err(A::Error::duplicate_field(
5155                                    "multiple values for project",
5156                                ));
5157                            }
5158                            result.project = map
5159                                .next_value::<std::option::Option<std::string::String>>()?
5160                                .unwrap_or_default();
5161                        }
5162                        __FieldTag::Unknown(key) => {
5163                            let value = map.next_value::<serde_json::Value>()?;
5164                            result._unknown_fields.insert(key, value);
5165                        }
5166                    }
5167                }
5168                std::result::Result::Ok(result)
5169            }
5170        }
5171        deserializer.deserialize_any(Visitor)
5172    }
5173}
5174
5175#[doc(hidden)]
5176impl serde::ser::Serialize for SqlInstancesDeleteRequest {
5177    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5178    where
5179        S: serde::ser::Serializer,
5180    {
5181        use serde::ser::SerializeMap;
5182        #[allow(unused_imports)]
5183        use std::option::Option::Some;
5184        let mut state = serializer.serialize_map(std::option::Option::None)?;
5185        if !self.instance.is_empty() {
5186            state.serialize_entry("instance", &self.instance)?;
5187        }
5188        if !self.project.is_empty() {
5189            state.serialize_entry("project", &self.project)?;
5190        }
5191        if !self._unknown_fields.is_empty() {
5192            for (key, value) in self._unknown_fields.iter() {
5193                state.serialize_entry(key, &value)?;
5194            }
5195        }
5196        state.end()
5197    }
5198}
5199
5200/// Instance demote master request.
5201#[derive(Clone, Debug, Default, PartialEq)]
5202#[non_exhaustive]
5203pub struct SqlInstancesDemoteMasterRequest {
5204    /// Cloud SQL instance name.
5205    pub instance: std::string::String,
5206
5207    /// ID of the project that contains the instance.
5208    pub project: std::string::String,
5209
5210    pub body: std::option::Option<crate::model::InstancesDemoteMasterRequest>,
5211
5212    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5213}
5214
5215impl SqlInstancesDemoteMasterRequest {
5216    pub fn new() -> Self {
5217        std::default::Default::default()
5218    }
5219
5220    /// Sets the value of [instance][crate::model::SqlInstancesDemoteMasterRequest::instance].
5221    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5222        self.instance = v.into();
5223        self
5224    }
5225
5226    /// Sets the value of [project][crate::model::SqlInstancesDemoteMasterRequest::project].
5227    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5228        self.project = v.into();
5229        self
5230    }
5231
5232    /// Sets the value of [body][crate::model::SqlInstancesDemoteMasterRequest::body].
5233    pub fn set_body<T>(mut self, v: T) -> Self
5234    where
5235        T: std::convert::Into<crate::model::InstancesDemoteMasterRequest>,
5236    {
5237        self.body = std::option::Option::Some(v.into());
5238        self
5239    }
5240
5241    /// Sets or clears the value of [body][crate::model::SqlInstancesDemoteMasterRequest::body].
5242    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
5243    where
5244        T: std::convert::Into<crate::model::InstancesDemoteMasterRequest>,
5245    {
5246        self.body = v.map(|x| x.into());
5247        self
5248    }
5249}
5250
5251impl wkt::message::Message for SqlInstancesDemoteMasterRequest {
5252    fn typename() -> &'static str {
5253        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesDemoteMasterRequest"
5254    }
5255}
5256
5257#[doc(hidden)]
5258impl<'de> serde::de::Deserialize<'de> for SqlInstancesDemoteMasterRequest {
5259    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5260    where
5261        D: serde::Deserializer<'de>,
5262    {
5263        #[allow(non_camel_case_types)]
5264        #[doc(hidden)]
5265        #[derive(PartialEq, Eq, Hash)]
5266        enum __FieldTag {
5267            __instance,
5268            __project,
5269            __body,
5270            Unknown(std::string::String),
5271        }
5272        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5273            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5274            where
5275                D: serde::Deserializer<'de>,
5276            {
5277                struct Visitor;
5278                impl<'de> serde::de::Visitor<'de> for Visitor {
5279                    type Value = __FieldTag;
5280                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5281                        formatter.write_str("a field name for SqlInstancesDemoteMasterRequest")
5282                    }
5283                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5284                    where
5285                        E: serde::de::Error,
5286                    {
5287                        use std::result::Result::Ok;
5288                        use std::string::ToString;
5289                        match value {
5290                            "instance" => Ok(__FieldTag::__instance),
5291                            "project" => Ok(__FieldTag::__project),
5292                            "body" => Ok(__FieldTag::__body),
5293                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5294                        }
5295                    }
5296                }
5297                deserializer.deserialize_identifier(Visitor)
5298            }
5299        }
5300        struct Visitor;
5301        impl<'de> serde::de::Visitor<'de> for Visitor {
5302            type Value = SqlInstancesDemoteMasterRequest;
5303            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5304                formatter.write_str("struct SqlInstancesDemoteMasterRequest")
5305            }
5306            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5307            where
5308                A: serde::de::MapAccess<'de>,
5309            {
5310                #[allow(unused_imports)]
5311                use serde::de::Error;
5312                use std::option::Option::Some;
5313                let mut fields = std::collections::HashSet::new();
5314                let mut result = Self::Value::new();
5315                while let Some(tag) = map.next_key::<__FieldTag>()? {
5316                    #[allow(clippy::match_single_binding)]
5317                    match tag {
5318                        __FieldTag::__instance => {
5319                            if !fields.insert(__FieldTag::__instance) {
5320                                return std::result::Result::Err(A::Error::duplicate_field(
5321                                    "multiple values for instance",
5322                                ));
5323                            }
5324                            result.instance = map
5325                                .next_value::<std::option::Option<std::string::String>>()?
5326                                .unwrap_or_default();
5327                        }
5328                        __FieldTag::__project => {
5329                            if !fields.insert(__FieldTag::__project) {
5330                                return std::result::Result::Err(A::Error::duplicate_field(
5331                                    "multiple values for project",
5332                                ));
5333                            }
5334                            result.project = map
5335                                .next_value::<std::option::Option<std::string::String>>()?
5336                                .unwrap_or_default();
5337                        }
5338                        __FieldTag::__body => {
5339                            if !fields.insert(__FieldTag::__body) {
5340                                return std::result::Result::Err(A::Error::duplicate_field(
5341                                    "multiple values for body",
5342                                ));
5343                            }
5344                            result.body = map.next_value::<std::option::Option<crate::model::InstancesDemoteMasterRequest>>()?
5345                                ;
5346                        }
5347                        __FieldTag::Unknown(key) => {
5348                            let value = map.next_value::<serde_json::Value>()?;
5349                            result._unknown_fields.insert(key, value);
5350                        }
5351                    }
5352                }
5353                std::result::Result::Ok(result)
5354            }
5355        }
5356        deserializer.deserialize_any(Visitor)
5357    }
5358}
5359
5360#[doc(hidden)]
5361impl serde::ser::Serialize for SqlInstancesDemoteMasterRequest {
5362    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5363    where
5364        S: serde::ser::Serializer,
5365    {
5366        use serde::ser::SerializeMap;
5367        #[allow(unused_imports)]
5368        use std::option::Option::Some;
5369        let mut state = serializer.serialize_map(std::option::Option::None)?;
5370        if !self.instance.is_empty() {
5371            state.serialize_entry("instance", &self.instance)?;
5372        }
5373        if !self.project.is_empty() {
5374            state.serialize_entry("project", &self.project)?;
5375        }
5376        if self.body.is_some() {
5377            state.serialize_entry("body", &self.body)?;
5378        }
5379        if !self._unknown_fields.is_empty() {
5380            for (key, value) in self._unknown_fields.iter() {
5381                state.serialize_entry(key, &value)?;
5382            }
5383        }
5384        state.end()
5385    }
5386}
5387
5388/// Instance demote request.
5389#[derive(Clone, Debug, Default, PartialEq)]
5390#[non_exhaustive]
5391pub struct SqlInstancesDemoteRequest {
5392    /// Required. Cloud SQL instance name.
5393    pub instance: std::string::String,
5394
5395    /// Required. ID of the project that contains the instance.
5396    pub project: std::string::String,
5397
5398    /// Required. The request body.
5399    pub body: std::option::Option<crate::model::InstancesDemoteRequest>,
5400
5401    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5402}
5403
5404impl SqlInstancesDemoteRequest {
5405    pub fn new() -> Self {
5406        std::default::Default::default()
5407    }
5408
5409    /// Sets the value of [instance][crate::model::SqlInstancesDemoteRequest::instance].
5410    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5411        self.instance = v.into();
5412        self
5413    }
5414
5415    /// Sets the value of [project][crate::model::SqlInstancesDemoteRequest::project].
5416    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5417        self.project = v.into();
5418        self
5419    }
5420
5421    /// Sets the value of [body][crate::model::SqlInstancesDemoteRequest::body].
5422    pub fn set_body<T>(mut self, v: T) -> Self
5423    where
5424        T: std::convert::Into<crate::model::InstancesDemoteRequest>,
5425    {
5426        self.body = std::option::Option::Some(v.into());
5427        self
5428    }
5429
5430    /// Sets or clears the value of [body][crate::model::SqlInstancesDemoteRequest::body].
5431    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
5432    where
5433        T: std::convert::Into<crate::model::InstancesDemoteRequest>,
5434    {
5435        self.body = v.map(|x| x.into());
5436        self
5437    }
5438}
5439
5440impl wkt::message::Message for SqlInstancesDemoteRequest {
5441    fn typename() -> &'static str {
5442        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesDemoteRequest"
5443    }
5444}
5445
5446#[doc(hidden)]
5447impl<'de> serde::de::Deserialize<'de> for SqlInstancesDemoteRequest {
5448    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5449    where
5450        D: serde::Deserializer<'de>,
5451    {
5452        #[allow(non_camel_case_types)]
5453        #[doc(hidden)]
5454        #[derive(PartialEq, Eq, Hash)]
5455        enum __FieldTag {
5456            __instance,
5457            __project,
5458            __body,
5459            Unknown(std::string::String),
5460        }
5461        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5462            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5463            where
5464                D: serde::Deserializer<'de>,
5465            {
5466                struct Visitor;
5467                impl<'de> serde::de::Visitor<'de> for Visitor {
5468                    type Value = __FieldTag;
5469                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5470                        formatter.write_str("a field name for SqlInstancesDemoteRequest")
5471                    }
5472                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5473                    where
5474                        E: serde::de::Error,
5475                    {
5476                        use std::result::Result::Ok;
5477                        use std::string::ToString;
5478                        match value {
5479                            "instance" => Ok(__FieldTag::__instance),
5480                            "project" => Ok(__FieldTag::__project),
5481                            "body" => Ok(__FieldTag::__body),
5482                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5483                        }
5484                    }
5485                }
5486                deserializer.deserialize_identifier(Visitor)
5487            }
5488        }
5489        struct Visitor;
5490        impl<'de> serde::de::Visitor<'de> for Visitor {
5491            type Value = SqlInstancesDemoteRequest;
5492            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5493                formatter.write_str("struct SqlInstancesDemoteRequest")
5494            }
5495            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5496            where
5497                A: serde::de::MapAccess<'de>,
5498            {
5499                #[allow(unused_imports)]
5500                use serde::de::Error;
5501                use std::option::Option::Some;
5502                let mut fields = std::collections::HashSet::new();
5503                let mut result = Self::Value::new();
5504                while let Some(tag) = map.next_key::<__FieldTag>()? {
5505                    #[allow(clippy::match_single_binding)]
5506                    match tag {
5507                        __FieldTag::__instance => {
5508                            if !fields.insert(__FieldTag::__instance) {
5509                                return std::result::Result::Err(A::Error::duplicate_field(
5510                                    "multiple values for instance",
5511                                ));
5512                            }
5513                            result.instance = map
5514                                .next_value::<std::option::Option<std::string::String>>()?
5515                                .unwrap_or_default();
5516                        }
5517                        __FieldTag::__project => {
5518                            if !fields.insert(__FieldTag::__project) {
5519                                return std::result::Result::Err(A::Error::duplicate_field(
5520                                    "multiple values for project",
5521                                ));
5522                            }
5523                            result.project = map
5524                                .next_value::<std::option::Option<std::string::String>>()?
5525                                .unwrap_or_default();
5526                        }
5527                        __FieldTag::__body => {
5528                            if !fields.insert(__FieldTag::__body) {
5529                                return std::result::Result::Err(A::Error::duplicate_field(
5530                                    "multiple values for body",
5531                                ));
5532                            }
5533                            result.body = map.next_value::<std::option::Option<crate::model::InstancesDemoteRequest>>()?
5534                                ;
5535                        }
5536                        __FieldTag::Unknown(key) => {
5537                            let value = map.next_value::<serde_json::Value>()?;
5538                            result._unknown_fields.insert(key, value);
5539                        }
5540                    }
5541                }
5542                std::result::Result::Ok(result)
5543            }
5544        }
5545        deserializer.deserialize_any(Visitor)
5546    }
5547}
5548
5549#[doc(hidden)]
5550impl serde::ser::Serialize for SqlInstancesDemoteRequest {
5551    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5552    where
5553        S: serde::ser::Serializer,
5554    {
5555        use serde::ser::SerializeMap;
5556        #[allow(unused_imports)]
5557        use std::option::Option::Some;
5558        let mut state = serializer.serialize_map(std::option::Option::None)?;
5559        if !self.instance.is_empty() {
5560            state.serialize_entry("instance", &self.instance)?;
5561        }
5562        if !self.project.is_empty() {
5563            state.serialize_entry("project", &self.project)?;
5564        }
5565        if self.body.is_some() {
5566            state.serialize_entry("body", &self.body)?;
5567        }
5568        if !self._unknown_fields.is_empty() {
5569            for (key, value) in self._unknown_fields.iter() {
5570                state.serialize_entry(key, &value)?;
5571            }
5572        }
5573        state.end()
5574    }
5575}
5576
5577/// Instance export request.
5578#[derive(Clone, Debug, Default, PartialEq)]
5579#[non_exhaustive]
5580pub struct SqlInstancesExportRequest {
5581    /// Cloud SQL instance ID. This does not include the project ID.
5582    pub instance: std::string::String,
5583
5584    /// Project ID of the project that contains the instance to be exported.
5585    pub project: std::string::String,
5586
5587    pub body: std::option::Option<crate::model::InstancesExportRequest>,
5588
5589    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5590}
5591
5592impl SqlInstancesExportRequest {
5593    pub fn new() -> Self {
5594        std::default::Default::default()
5595    }
5596
5597    /// Sets the value of [instance][crate::model::SqlInstancesExportRequest::instance].
5598    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5599        self.instance = v.into();
5600        self
5601    }
5602
5603    /// Sets the value of [project][crate::model::SqlInstancesExportRequest::project].
5604    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5605        self.project = v.into();
5606        self
5607    }
5608
5609    /// Sets the value of [body][crate::model::SqlInstancesExportRequest::body].
5610    pub fn set_body<T>(mut self, v: T) -> Self
5611    where
5612        T: std::convert::Into<crate::model::InstancesExportRequest>,
5613    {
5614        self.body = std::option::Option::Some(v.into());
5615        self
5616    }
5617
5618    /// Sets or clears the value of [body][crate::model::SqlInstancesExportRequest::body].
5619    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
5620    where
5621        T: std::convert::Into<crate::model::InstancesExportRequest>,
5622    {
5623        self.body = v.map(|x| x.into());
5624        self
5625    }
5626}
5627
5628impl wkt::message::Message for SqlInstancesExportRequest {
5629    fn typename() -> &'static str {
5630        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesExportRequest"
5631    }
5632}
5633
5634#[doc(hidden)]
5635impl<'de> serde::de::Deserialize<'de> for SqlInstancesExportRequest {
5636    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5637    where
5638        D: serde::Deserializer<'de>,
5639    {
5640        #[allow(non_camel_case_types)]
5641        #[doc(hidden)]
5642        #[derive(PartialEq, Eq, Hash)]
5643        enum __FieldTag {
5644            __instance,
5645            __project,
5646            __body,
5647            Unknown(std::string::String),
5648        }
5649        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5650            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5651            where
5652                D: serde::Deserializer<'de>,
5653            {
5654                struct Visitor;
5655                impl<'de> serde::de::Visitor<'de> for Visitor {
5656                    type Value = __FieldTag;
5657                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5658                        formatter.write_str("a field name for SqlInstancesExportRequest")
5659                    }
5660                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5661                    where
5662                        E: serde::de::Error,
5663                    {
5664                        use std::result::Result::Ok;
5665                        use std::string::ToString;
5666                        match value {
5667                            "instance" => Ok(__FieldTag::__instance),
5668                            "project" => Ok(__FieldTag::__project),
5669                            "body" => Ok(__FieldTag::__body),
5670                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5671                        }
5672                    }
5673                }
5674                deserializer.deserialize_identifier(Visitor)
5675            }
5676        }
5677        struct Visitor;
5678        impl<'de> serde::de::Visitor<'de> for Visitor {
5679            type Value = SqlInstancesExportRequest;
5680            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5681                formatter.write_str("struct SqlInstancesExportRequest")
5682            }
5683            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5684            where
5685                A: serde::de::MapAccess<'de>,
5686            {
5687                #[allow(unused_imports)]
5688                use serde::de::Error;
5689                use std::option::Option::Some;
5690                let mut fields = std::collections::HashSet::new();
5691                let mut result = Self::Value::new();
5692                while let Some(tag) = map.next_key::<__FieldTag>()? {
5693                    #[allow(clippy::match_single_binding)]
5694                    match tag {
5695                        __FieldTag::__instance => {
5696                            if !fields.insert(__FieldTag::__instance) {
5697                                return std::result::Result::Err(A::Error::duplicate_field(
5698                                    "multiple values for instance",
5699                                ));
5700                            }
5701                            result.instance = map
5702                                .next_value::<std::option::Option<std::string::String>>()?
5703                                .unwrap_or_default();
5704                        }
5705                        __FieldTag::__project => {
5706                            if !fields.insert(__FieldTag::__project) {
5707                                return std::result::Result::Err(A::Error::duplicate_field(
5708                                    "multiple values for project",
5709                                ));
5710                            }
5711                            result.project = map
5712                                .next_value::<std::option::Option<std::string::String>>()?
5713                                .unwrap_or_default();
5714                        }
5715                        __FieldTag::__body => {
5716                            if !fields.insert(__FieldTag::__body) {
5717                                return std::result::Result::Err(A::Error::duplicate_field(
5718                                    "multiple values for body",
5719                                ));
5720                            }
5721                            result.body = map.next_value::<std::option::Option<crate::model::InstancesExportRequest>>()?
5722                                ;
5723                        }
5724                        __FieldTag::Unknown(key) => {
5725                            let value = map.next_value::<serde_json::Value>()?;
5726                            result._unknown_fields.insert(key, value);
5727                        }
5728                    }
5729                }
5730                std::result::Result::Ok(result)
5731            }
5732        }
5733        deserializer.deserialize_any(Visitor)
5734    }
5735}
5736
5737#[doc(hidden)]
5738impl serde::ser::Serialize for SqlInstancesExportRequest {
5739    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5740    where
5741        S: serde::ser::Serializer,
5742    {
5743        use serde::ser::SerializeMap;
5744        #[allow(unused_imports)]
5745        use std::option::Option::Some;
5746        let mut state = serializer.serialize_map(std::option::Option::None)?;
5747        if !self.instance.is_empty() {
5748            state.serialize_entry("instance", &self.instance)?;
5749        }
5750        if !self.project.is_empty() {
5751            state.serialize_entry("project", &self.project)?;
5752        }
5753        if self.body.is_some() {
5754            state.serialize_entry("body", &self.body)?;
5755        }
5756        if !self._unknown_fields.is_empty() {
5757            for (key, value) in self._unknown_fields.iter() {
5758                state.serialize_entry(key, &value)?;
5759            }
5760        }
5761        state.end()
5762    }
5763}
5764
5765/// Instance failover request.
5766#[derive(Clone, Debug, Default, PartialEq)]
5767#[non_exhaustive]
5768pub struct SqlInstancesFailoverRequest {
5769    /// Cloud SQL instance ID. This does not include the project ID.
5770    pub instance: std::string::String,
5771
5772    /// ID of the project that contains the read replica.
5773    pub project: std::string::String,
5774
5775    pub body: std::option::Option<crate::model::InstancesFailoverRequest>,
5776
5777    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5778}
5779
5780impl SqlInstancesFailoverRequest {
5781    pub fn new() -> Self {
5782        std::default::Default::default()
5783    }
5784
5785    /// Sets the value of [instance][crate::model::SqlInstancesFailoverRequest::instance].
5786    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5787        self.instance = v.into();
5788        self
5789    }
5790
5791    /// Sets the value of [project][crate::model::SqlInstancesFailoverRequest::project].
5792    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5793        self.project = v.into();
5794        self
5795    }
5796
5797    /// Sets the value of [body][crate::model::SqlInstancesFailoverRequest::body].
5798    pub fn set_body<T>(mut self, v: T) -> Self
5799    where
5800        T: std::convert::Into<crate::model::InstancesFailoverRequest>,
5801    {
5802        self.body = std::option::Option::Some(v.into());
5803        self
5804    }
5805
5806    /// Sets or clears the value of [body][crate::model::SqlInstancesFailoverRequest::body].
5807    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
5808    where
5809        T: std::convert::Into<crate::model::InstancesFailoverRequest>,
5810    {
5811        self.body = v.map(|x| x.into());
5812        self
5813    }
5814}
5815
5816impl wkt::message::Message for SqlInstancesFailoverRequest {
5817    fn typename() -> &'static str {
5818        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesFailoverRequest"
5819    }
5820}
5821
5822#[doc(hidden)]
5823impl<'de> serde::de::Deserialize<'de> for SqlInstancesFailoverRequest {
5824    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5825    where
5826        D: serde::Deserializer<'de>,
5827    {
5828        #[allow(non_camel_case_types)]
5829        #[doc(hidden)]
5830        #[derive(PartialEq, Eq, Hash)]
5831        enum __FieldTag {
5832            __instance,
5833            __project,
5834            __body,
5835            Unknown(std::string::String),
5836        }
5837        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5838            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5839            where
5840                D: serde::Deserializer<'de>,
5841            {
5842                struct Visitor;
5843                impl<'de> serde::de::Visitor<'de> for Visitor {
5844                    type Value = __FieldTag;
5845                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5846                        formatter.write_str("a field name for SqlInstancesFailoverRequest")
5847                    }
5848                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5849                    where
5850                        E: serde::de::Error,
5851                    {
5852                        use std::result::Result::Ok;
5853                        use std::string::ToString;
5854                        match value {
5855                            "instance" => Ok(__FieldTag::__instance),
5856                            "project" => Ok(__FieldTag::__project),
5857                            "body" => Ok(__FieldTag::__body),
5858                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5859                        }
5860                    }
5861                }
5862                deserializer.deserialize_identifier(Visitor)
5863            }
5864        }
5865        struct Visitor;
5866        impl<'de> serde::de::Visitor<'de> for Visitor {
5867            type Value = SqlInstancesFailoverRequest;
5868            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5869                formatter.write_str("struct SqlInstancesFailoverRequest")
5870            }
5871            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5872            where
5873                A: serde::de::MapAccess<'de>,
5874            {
5875                #[allow(unused_imports)]
5876                use serde::de::Error;
5877                use std::option::Option::Some;
5878                let mut fields = std::collections::HashSet::new();
5879                let mut result = Self::Value::new();
5880                while let Some(tag) = map.next_key::<__FieldTag>()? {
5881                    #[allow(clippy::match_single_binding)]
5882                    match tag {
5883                        __FieldTag::__instance => {
5884                            if !fields.insert(__FieldTag::__instance) {
5885                                return std::result::Result::Err(A::Error::duplicate_field(
5886                                    "multiple values for instance",
5887                                ));
5888                            }
5889                            result.instance = map
5890                                .next_value::<std::option::Option<std::string::String>>()?
5891                                .unwrap_or_default();
5892                        }
5893                        __FieldTag::__project => {
5894                            if !fields.insert(__FieldTag::__project) {
5895                                return std::result::Result::Err(A::Error::duplicate_field(
5896                                    "multiple values for project",
5897                                ));
5898                            }
5899                            result.project = map
5900                                .next_value::<std::option::Option<std::string::String>>()?
5901                                .unwrap_or_default();
5902                        }
5903                        __FieldTag::__body => {
5904                            if !fields.insert(__FieldTag::__body) {
5905                                return std::result::Result::Err(A::Error::duplicate_field(
5906                                    "multiple values for body",
5907                                ));
5908                            }
5909                            result.body = map.next_value::<std::option::Option<crate::model::InstancesFailoverRequest>>()?
5910                                ;
5911                        }
5912                        __FieldTag::Unknown(key) => {
5913                            let value = map.next_value::<serde_json::Value>()?;
5914                            result._unknown_fields.insert(key, value);
5915                        }
5916                    }
5917                }
5918                std::result::Result::Ok(result)
5919            }
5920        }
5921        deserializer.deserialize_any(Visitor)
5922    }
5923}
5924
5925#[doc(hidden)]
5926impl serde::ser::Serialize for SqlInstancesFailoverRequest {
5927    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5928    where
5929        S: serde::ser::Serializer,
5930    {
5931        use serde::ser::SerializeMap;
5932        #[allow(unused_imports)]
5933        use std::option::Option::Some;
5934        let mut state = serializer.serialize_map(std::option::Option::None)?;
5935        if !self.instance.is_empty() {
5936            state.serialize_entry("instance", &self.instance)?;
5937        }
5938        if !self.project.is_empty() {
5939            state.serialize_entry("project", &self.project)?;
5940        }
5941        if self.body.is_some() {
5942            state.serialize_entry("body", &self.body)?;
5943        }
5944        if !self._unknown_fields.is_empty() {
5945            for (key, value) in self._unknown_fields.iter() {
5946                state.serialize_entry(key, &value)?;
5947            }
5948        }
5949        state.end()
5950    }
5951}
5952
5953/// Instance get request.
5954#[derive(Clone, Debug, Default, PartialEq)]
5955#[non_exhaustive]
5956pub struct SqlInstancesGetRequest {
5957    /// Database instance ID. This does not include the project ID.
5958    pub instance: std::string::String,
5959
5960    /// Project ID of the project that contains the instance.
5961    pub project: std::string::String,
5962
5963    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5964}
5965
5966impl SqlInstancesGetRequest {
5967    pub fn new() -> Self {
5968        std::default::Default::default()
5969    }
5970
5971    /// Sets the value of [instance][crate::model::SqlInstancesGetRequest::instance].
5972    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5973        self.instance = v.into();
5974        self
5975    }
5976
5977    /// Sets the value of [project][crate::model::SqlInstancesGetRequest::project].
5978    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5979        self.project = v.into();
5980        self
5981    }
5982}
5983
5984impl wkt::message::Message for SqlInstancesGetRequest {
5985    fn typename() -> &'static str {
5986        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesGetRequest"
5987    }
5988}
5989
5990#[doc(hidden)]
5991impl<'de> serde::de::Deserialize<'de> for SqlInstancesGetRequest {
5992    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5993    where
5994        D: serde::Deserializer<'de>,
5995    {
5996        #[allow(non_camel_case_types)]
5997        #[doc(hidden)]
5998        #[derive(PartialEq, Eq, Hash)]
5999        enum __FieldTag {
6000            __instance,
6001            __project,
6002            Unknown(std::string::String),
6003        }
6004        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6005            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6006            where
6007                D: serde::Deserializer<'de>,
6008            {
6009                struct Visitor;
6010                impl<'de> serde::de::Visitor<'de> for Visitor {
6011                    type Value = __FieldTag;
6012                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6013                        formatter.write_str("a field name for SqlInstancesGetRequest")
6014                    }
6015                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6016                    where
6017                        E: serde::de::Error,
6018                    {
6019                        use std::result::Result::Ok;
6020                        use std::string::ToString;
6021                        match value {
6022                            "instance" => Ok(__FieldTag::__instance),
6023                            "project" => Ok(__FieldTag::__project),
6024                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6025                        }
6026                    }
6027                }
6028                deserializer.deserialize_identifier(Visitor)
6029            }
6030        }
6031        struct Visitor;
6032        impl<'de> serde::de::Visitor<'de> for Visitor {
6033            type Value = SqlInstancesGetRequest;
6034            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6035                formatter.write_str("struct SqlInstancesGetRequest")
6036            }
6037            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6038            where
6039                A: serde::de::MapAccess<'de>,
6040            {
6041                #[allow(unused_imports)]
6042                use serde::de::Error;
6043                use std::option::Option::Some;
6044                let mut fields = std::collections::HashSet::new();
6045                let mut result = Self::Value::new();
6046                while let Some(tag) = map.next_key::<__FieldTag>()? {
6047                    #[allow(clippy::match_single_binding)]
6048                    match tag {
6049                        __FieldTag::__instance => {
6050                            if !fields.insert(__FieldTag::__instance) {
6051                                return std::result::Result::Err(A::Error::duplicate_field(
6052                                    "multiple values for instance",
6053                                ));
6054                            }
6055                            result.instance = map
6056                                .next_value::<std::option::Option<std::string::String>>()?
6057                                .unwrap_or_default();
6058                        }
6059                        __FieldTag::__project => {
6060                            if !fields.insert(__FieldTag::__project) {
6061                                return std::result::Result::Err(A::Error::duplicate_field(
6062                                    "multiple values for project",
6063                                ));
6064                            }
6065                            result.project = map
6066                                .next_value::<std::option::Option<std::string::String>>()?
6067                                .unwrap_or_default();
6068                        }
6069                        __FieldTag::Unknown(key) => {
6070                            let value = map.next_value::<serde_json::Value>()?;
6071                            result._unknown_fields.insert(key, value);
6072                        }
6073                    }
6074                }
6075                std::result::Result::Ok(result)
6076            }
6077        }
6078        deserializer.deserialize_any(Visitor)
6079    }
6080}
6081
6082#[doc(hidden)]
6083impl serde::ser::Serialize for SqlInstancesGetRequest {
6084    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6085    where
6086        S: serde::ser::Serializer,
6087    {
6088        use serde::ser::SerializeMap;
6089        #[allow(unused_imports)]
6090        use std::option::Option::Some;
6091        let mut state = serializer.serialize_map(std::option::Option::None)?;
6092        if !self.instance.is_empty() {
6093            state.serialize_entry("instance", &self.instance)?;
6094        }
6095        if !self.project.is_empty() {
6096            state.serialize_entry("project", &self.project)?;
6097        }
6098        if !self._unknown_fields.is_empty() {
6099            for (key, value) in self._unknown_fields.iter() {
6100                state.serialize_entry(key, &value)?;
6101            }
6102        }
6103        state.end()
6104    }
6105}
6106
6107/// Instance import request.
6108#[derive(Clone, Debug, Default, PartialEq)]
6109#[non_exhaustive]
6110pub struct SqlInstancesImportRequest {
6111    /// Cloud SQL instance ID. This does not include the project ID.
6112    pub instance: std::string::String,
6113
6114    /// Project ID of the project that contains the instance.
6115    pub project: std::string::String,
6116
6117    pub body: std::option::Option<crate::model::InstancesImportRequest>,
6118
6119    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6120}
6121
6122impl SqlInstancesImportRequest {
6123    pub fn new() -> Self {
6124        std::default::Default::default()
6125    }
6126
6127    /// Sets the value of [instance][crate::model::SqlInstancesImportRequest::instance].
6128    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6129        self.instance = v.into();
6130        self
6131    }
6132
6133    /// Sets the value of [project][crate::model::SqlInstancesImportRequest::project].
6134    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6135        self.project = v.into();
6136        self
6137    }
6138
6139    /// Sets the value of [body][crate::model::SqlInstancesImportRequest::body].
6140    pub fn set_body<T>(mut self, v: T) -> Self
6141    where
6142        T: std::convert::Into<crate::model::InstancesImportRequest>,
6143    {
6144        self.body = std::option::Option::Some(v.into());
6145        self
6146    }
6147
6148    /// Sets or clears the value of [body][crate::model::SqlInstancesImportRequest::body].
6149    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
6150    where
6151        T: std::convert::Into<crate::model::InstancesImportRequest>,
6152    {
6153        self.body = v.map(|x| x.into());
6154        self
6155    }
6156}
6157
6158impl wkt::message::Message for SqlInstancesImportRequest {
6159    fn typename() -> &'static str {
6160        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesImportRequest"
6161    }
6162}
6163
6164#[doc(hidden)]
6165impl<'de> serde::de::Deserialize<'de> for SqlInstancesImportRequest {
6166    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6167    where
6168        D: serde::Deserializer<'de>,
6169    {
6170        #[allow(non_camel_case_types)]
6171        #[doc(hidden)]
6172        #[derive(PartialEq, Eq, Hash)]
6173        enum __FieldTag {
6174            __instance,
6175            __project,
6176            __body,
6177            Unknown(std::string::String),
6178        }
6179        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6180            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6181            where
6182                D: serde::Deserializer<'de>,
6183            {
6184                struct Visitor;
6185                impl<'de> serde::de::Visitor<'de> for Visitor {
6186                    type Value = __FieldTag;
6187                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6188                        formatter.write_str("a field name for SqlInstancesImportRequest")
6189                    }
6190                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6191                    where
6192                        E: serde::de::Error,
6193                    {
6194                        use std::result::Result::Ok;
6195                        use std::string::ToString;
6196                        match value {
6197                            "instance" => Ok(__FieldTag::__instance),
6198                            "project" => Ok(__FieldTag::__project),
6199                            "body" => Ok(__FieldTag::__body),
6200                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6201                        }
6202                    }
6203                }
6204                deserializer.deserialize_identifier(Visitor)
6205            }
6206        }
6207        struct Visitor;
6208        impl<'de> serde::de::Visitor<'de> for Visitor {
6209            type Value = SqlInstancesImportRequest;
6210            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6211                formatter.write_str("struct SqlInstancesImportRequest")
6212            }
6213            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6214            where
6215                A: serde::de::MapAccess<'de>,
6216            {
6217                #[allow(unused_imports)]
6218                use serde::de::Error;
6219                use std::option::Option::Some;
6220                let mut fields = std::collections::HashSet::new();
6221                let mut result = Self::Value::new();
6222                while let Some(tag) = map.next_key::<__FieldTag>()? {
6223                    #[allow(clippy::match_single_binding)]
6224                    match tag {
6225                        __FieldTag::__instance => {
6226                            if !fields.insert(__FieldTag::__instance) {
6227                                return std::result::Result::Err(A::Error::duplicate_field(
6228                                    "multiple values for instance",
6229                                ));
6230                            }
6231                            result.instance = map
6232                                .next_value::<std::option::Option<std::string::String>>()?
6233                                .unwrap_or_default();
6234                        }
6235                        __FieldTag::__project => {
6236                            if !fields.insert(__FieldTag::__project) {
6237                                return std::result::Result::Err(A::Error::duplicate_field(
6238                                    "multiple values for project",
6239                                ));
6240                            }
6241                            result.project = map
6242                                .next_value::<std::option::Option<std::string::String>>()?
6243                                .unwrap_or_default();
6244                        }
6245                        __FieldTag::__body => {
6246                            if !fields.insert(__FieldTag::__body) {
6247                                return std::result::Result::Err(A::Error::duplicate_field(
6248                                    "multiple values for body",
6249                                ));
6250                            }
6251                            result.body = map.next_value::<std::option::Option<crate::model::InstancesImportRequest>>()?
6252                                ;
6253                        }
6254                        __FieldTag::Unknown(key) => {
6255                            let value = map.next_value::<serde_json::Value>()?;
6256                            result._unknown_fields.insert(key, value);
6257                        }
6258                    }
6259                }
6260                std::result::Result::Ok(result)
6261            }
6262        }
6263        deserializer.deserialize_any(Visitor)
6264    }
6265}
6266
6267#[doc(hidden)]
6268impl serde::ser::Serialize for SqlInstancesImportRequest {
6269    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6270    where
6271        S: serde::ser::Serializer,
6272    {
6273        use serde::ser::SerializeMap;
6274        #[allow(unused_imports)]
6275        use std::option::Option::Some;
6276        let mut state = serializer.serialize_map(std::option::Option::None)?;
6277        if !self.instance.is_empty() {
6278            state.serialize_entry("instance", &self.instance)?;
6279        }
6280        if !self.project.is_empty() {
6281            state.serialize_entry("project", &self.project)?;
6282        }
6283        if self.body.is_some() {
6284            state.serialize_entry("body", &self.body)?;
6285        }
6286        if !self._unknown_fields.is_empty() {
6287            for (key, value) in self._unknown_fields.iter() {
6288                state.serialize_entry(key, &value)?;
6289            }
6290        }
6291        state.end()
6292    }
6293}
6294
6295/// Instance insert request.
6296#[derive(Clone, Debug, Default, PartialEq)]
6297#[non_exhaustive]
6298pub struct SqlInstancesInsertRequest {
6299    /// Project ID of the project to which the newly created Cloud SQL instances
6300    /// should belong.
6301    pub project: std::string::String,
6302
6303    pub body: std::option::Option<crate::model::DatabaseInstance>,
6304
6305    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6306}
6307
6308impl SqlInstancesInsertRequest {
6309    pub fn new() -> Self {
6310        std::default::Default::default()
6311    }
6312
6313    /// Sets the value of [project][crate::model::SqlInstancesInsertRequest::project].
6314    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6315        self.project = v.into();
6316        self
6317    }
6318
6319    /// Sets the value of [body][crate::model::SqlInstancesInsertRequest::body].
6320    pub fn set_body<T>(mut self, v: T) -> Self
6321    where
6322        T: std::convert::Into<crate::model::DatabaseInstance>,
6323    {
6324        self.body = std::option::Option::Some(v.into());
6325        self
6326    }
6327
6328    /// Sets or clears the value of [body][crate::model::SqlInstancesInsertRequest::body].
6329    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
6330    where
6331        T: std::convert::Into<crate::model::DatabaseInstance>,
6332    {
6333        self.body = v.map(|x| x.into());
6334        self
6335    }
6336}
6337
6338impl wkt::message::Message for SqlInstancesInsertRequest {
6339    fn typename() -> &'static str {
6340        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesInsertRequest"
6341    }
6342}
6343
6344#[doc(hidden)]
6345impl<'de> serde::de::Deserialize<'de> for SqlInstancesInsertRequest {
6346    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6347    where
6348        D: serde::Deserializer<'de>,
6349    {
6350        #[allow(non_camel_case_types)]
6351        #[doc(hidden)]
6352        #[derive(PartialEq, Eq, Hash)]
6353        enum __FieldTag {
6354            __project,
6355            __body,
6356            Unknown(std::string::String),
6357        }
6358        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6359            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6360            where
6361                D: serde::Deserializer<'de>,
6362            {
6363                struct Visitor;
6364                impl<'de> serde::de::Visitor<'de> for Visitor {
6365                    type Value = __FieldTag;
6366                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6367                        formatter.write_str("a field name for SqlInstancesInsertRequest")
6368                    }
6369                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6370                    where
6371                        E: serde::de::Error,
6372                    {
6373                        use std::result::Result::Ok;
6374                        use std::string::ToString;
6375                        match value {
6376                            "project" => Ok(__FieldTag::__project),
6377                            "body" => Ok(__FieldTag::__body),
6378                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6379                        }
6380                    }
6381                }
6382                deserializer.deserialize_identifier(Visitor)
6383            }
6384        }
6385        struct Visitor;
6386        impl<'de> serde::de::Visitor<'de> for Visitor {
6387            type Value = SqlInstancesInsertRequest;
6388            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6389                formatter.write_str("struct SqlInstancesInsertRequest")
6390            }
6391            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6392            where
6393                A: serde::de::MapAccess<'de>,
6394            {
6395                #[allow(unused_imports)]
6396                use serde::de::Error;
6397                use std::option::Option::Some;
6398                let mut fields = std::collections::HashSet::new();
6399                let mut result = Self::Value::new();
6400                while let Some(tag) = map.next_key::<__FieldTag>()? {
6401                    #[allow(clippy::match_single_binding)]
6402                    match tag {
6403                        __FieldTag::__project => {
6404                            if !fields.insert(__FieldTag::__project) {
6405                                return std::result::Result::Err(A::Error::duplicate_field(
6406                                    "multiple values for project",
6407                                ));
6408                            }
6409                            result.project = map
6410                                .next_value::<std::option::Option<std::string::String>>()?
6411                                .unwrap_or_default();
6412                        }
6413                        __FieldTag::__body => {
6414                            if !fields.insert(__FieldTag::__body) {
6415                                return std::result::Result::Err(A::Error::duplicate_field(
6416                                    "multiple values for body",
6417                                ));
6418                            }
6419                            result.body = map
6420                                .next_value::<std::option::Option<crate::model::DatabaseInstance>>(
6421                                )?;
6422                        }
6423                        __FieldTag::Unknown(key) => {
6424                            let value = map.next_value::<serde_json::Value>()?;
6425                            result._unknown_fields.insert(key, value);
6426                        }
6427                    }
6428                }
6429                std::result::Result::Ok(result)
6430            }
6431        }
6432        deserializer.deserialize_any(Visitor)
6433    }
6434}
6435
6436#[doc(hidden)]
6437impl serde::ser::Serialize for SqlInstancesInsertRequest {
6438    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6439    where
6440        S: serde::ser::Serializer,
6441    {
6442        use serde::ser::SerializeMap;
6443        #[allow(unused_imports)]
6444        use std::option::Option::Some;
6445        let mut state = serializer.serialize_map(std::option::Option::None)?;
6446        if !self.project.is_empty() {
6447            state.serialize_entry("project", &self.project)?;
6448        }
6449        if self.body.is_some() {
6450            state.serialize_entry("body", &self.body)?;
6451        }
6452        if !self._unknown_fields.is_empty() {
6453            for (key, value) in self._unknown_fields.iter() {
6454                state.serialize_entry(key, &value)?;
6455            }
6456        }
6457        state.end()
6458    }
6459}
6460
6461/// Instance list request.
6462#[derive(Clone, Debug, Default, PartialEq)]
6463#[non_exhaustive]
6464pub struct SqlInstancesListRequest {
6465    /// A filter expression that filters resources listed in the response.
6466    /// The expression is in the form of field:value. For example,
6467    /// 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per
6468    /// their JSON representation, such as 'settings.userLabels.auto_start:true'.
6469    ///
6470    /// Multiple filter queries are space-separated. For example.
6471    /// 'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each
6472    /// expression is an AND expression. However, you can include AND and OR
6473    /// expressions explicitly.
6474    pub filter: std::string::String,
6475
6476    /// The maximum number of instances to return. The service may return fewer
6477    /// than this value.
6478    /// If unspecified, at most 500 instances are returned.
6479    /// The maximum value is 1000; values above 1000 are coerced to 1000.
6480    pub max_results: u32,
6481
6482    /// A previously-returned page token representing part of the larger set of
6483    /// results to view.
6484    pub page_token: std::string::String,
6485
6486    /// Project ID of the project for which to list Cloud SQL instances.
6487    pub project: std::string::String,
6488
6489    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6490}
6491
6492impl SqlInstancesListRequest {
6493    pub fn new() -> Self {
6494        std::default::Default::default()
6495    }
6496
6497    /// Sets the value of [filter][crate::model::SqlInstancesListRequest::filter].
6498    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6499        self.filter = v.into();
6500        self
6501    }
6502
6503    /// Sets the value of [max_results][crate::model::SqlInstancesListRequest::max_results].
6504    pub fn set_max_results<T: std::convert::Into<u32>>(mut self, v: T) -> Self {
6505        self.max_results = v.into();
6506        self
6507    }
6508
6509    /// Sets the value of [page_token][crate::model::SqlInstancesListRequest::page_token].
6510    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6511        self.page_token = v.into();
6512        self
6513    }
6514
6515    /// Sets the value of [project][crate::model::SqlInstancesListRequest::project].
6516    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6517        self.project = v.into();
6518        self
6519    }
6520}
6521
6522impl wkt::message::Message for SqlInstancesListRequest {
6523    fn typename() -> &'static str {
6524        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesListRequest"
6525    }
6526}
6527
6528#[doc(hidden)]
6529impl<'de> serde::de::Deserialize<'de> for SqlInstancesListRequest {
6530    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6531    where
6532        D: serde::Deserializer<'de>,
6533    {
6534        #[allow(non_camel_case_types)]
6535        #[doc(hidden)]
6536        #[derive(PartialEq, Eq, Hash)]
6537        enum __FieldTag {
6538            __filter,
6539            __max_results,
6540            __page_token,
6541            __project,
6542            Unknown(std::string::String),
6543        }
6544        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6545            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6546            where
6547                D: serde::Deserializer<'de>,
6548            {
6549                struct Visitor;
6550                impl<'de> serde::de::Visitor<'de> for Visitor {
6551                    type Value = __FieldTag;
6552                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6553                        formatter.write_str("a field name for SqlInstancesListRequest")
6554                    }
6555                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6556                    where
6557                        E: serde::de::Error,
6558                    {
6559                        use std::result::Result::Ok;
6560                        use std::string::ToString;
6561                        match value {
6562                            "filter" => Ok(__FieldTag::__filter),
6563                            "maxResults" => Ok(__FieldTag::__max_results),
6564                            "max_results" => Ok(__FieldTag::__max_results),
6565                            "pageToken" => Ok(__FieldTag::__page_token),
6566                            "page_token" => Ok(__FieldTag::__page_token),
6567                            "project" => Ok(__FieldTag::__project),
6568                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6569                        }
6570                    }
6571                }
6572                deserializer.deserialize_identifier(Visitor)
6573            }
6574        }
6575        struct Visitor;
6576        impl<'de> serde::de::Visitor<'de> for Visitor {
6577            type Value = SqlInstancesListRequest;
6578            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6579                formatter.write_str("struct SqlInstancesListRequest")
6580            }
6581            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6582            where
6583                A: serde::de::MapAccess<'de>,
6584            {
6585                #[allow(unused_imports)]
6586                use serde::de::Error;
6587                use std::option::Option::Some;
6588                let mut fields = std::collections::HashSet::new();
6589                let mut result = Self::Value::new();
6590                while let Some(tag) = map.next_key::<__FieldTag>()? {
6591                    #[allow(clippy::match_single_binding)]
6592                    match tag {
6593                        __FieldTag::__filter => {
6594                            if !fields.insert(__FieldTag::__filter) {
6595                                return std::result::Result::Err(A::Error::duplicate_field(
6596                                    "multiple values for filter",
6597                                ));
6598                            }
6599                            result.filter = map
6600                                .next_value::<std::option::Option<std::string::String>>()?
6601                                .unwrap_or_default();
6602                        }
6603                        __FieldTag::__max_results => {
6604                            if !fields.insert(__FieldTag::__max_results) {
6605                                return std::result::Result::Err(A::Error::duplicate_field(
6606                                    "multiple values for max_results",
6607                                ));
6608                            }
6609                            struct __With(std::option::Option<u32>);
6610                            impl<'de> serde::de::Deserialize<'de> for __With {
6611                                fn deserialize<D>(
6612                                    deserializer: D,
6613                                ) -> std::result::Result<Self, D::Error>
6614                                where
6615                                    D: serde::de::Deserializer<'de>,
6616                                {
6617                                    serde_with::As::< std::option::Option<wkt::internal::U32> >::deserialize(deserializer).map(__With)
6618                                }
6619                            }
6620                            result.max_results = map.next_value::<__With>()?.0.unwrap_or_default();
6621                        }
6622                        __FieldTag::__page_token => {
6623                            if !fields.insert(__FieldTag::__page_token) {
6624                                return std::result::Result::Err(A::Error::duplicate_field(
6625                                    "multiple values for page_token",
6626                                ));
6627                            }
6628                            result.page_token = map
6629                                .next_value::<std::option::Option<std::string::String>>()?
6630                                .unwrap_or_default();
6631                        }
6632                        __FieldTag::__project => {
6633                            if !fields.insert(__FieldTag::__project) {
6634                                return std::result::Result::Err(A::Error::duplicate_field(
6635                                    "multiple values for project",
6636                                ));
6637                            }
6638                            result.project = map
6639                                .next_value::<std::option::Option<std::string::String>>()?
6640                                .unwrap_or_default();
6641                        }
6642                        __FieldTag::Unknown(key) => {
6643                            let value = map.next_value::<serde_json::Value>()?;
6644                            result._unknown_fields.insert(key, value);
6645                        }
6646                    }
6647                }
6648                std::result::Result::Ok(result)
6649            }
6650        }
6651        deserializer.deserialize_any(Visitor)
6652    }
6653}
6654
6655#[doc(hidden)]
6656impl serde::ser::Serialize for SqlInstancesListRequest {
6657    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6658    where
6659        S: serde::ser::Serializer,
6660    {
6661        use serde::ser::SerializeMap;
6662        #[allow(unused_imports)]
6663        use std::option::Option::Some;
6664        let mut state = serializer.serialize_map(std::option::Option::None)?;
6665        if !self.filter.is_empty() {
6666            state.serialize_entry("filter", &self.filter)?;
6667        }
6668        if !wkt::internal::is_default(&self.max_results) {
6669            struct __With<'a>(&'a u32);
6670            impl<'a> serde::ser::Serialize for __With<'a> {
6671                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6672                where
6673                    S: serde::ser::Serializer,
6674                {
6675                    serde_with::As::<wkt::internal::U32>::serialize(self.0, serializer)
6676                }
6677            }
6678            state.serialize_entry("maxResults", &__With(&self.max_results))?;
6679        }
6680        if !self.page_token.is_empty() {
6681            state.serialize_entry("pageToken", &self.page_token)?;
6682        }
6683        if !self.project.is_empty() {
6684            state.serialize_entry("project", &self.project)?;
6685        }
6686        if !self._unknown_fields.is_empty() {
6687            for (key, value) in self._unknown_fields.iter() {
6688                state.serialize_entry(key, &value)?;
6689            }
6690        }
6691        state.end()
6692    }
6693}
6694
6695/// Instance list server CAs request.
6696#[derive(Clone, Debug, Default, PartialEq)]
6697#[non_exhaustive]
6698pub struct SqlInstancesListServerCasRequest {
6699    /// Cloud SQL instance ID. This does not include the project ID.
6700    pub instance: std::string::String,
6701
6702    /// Project ID of the project that contains the instance.
6703    pub project: std::string::String,
6704
6705    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6706}
6707
6708impl SqlInstancesListServerCasRequest {
6709    pub fn new() -> Self {
6710        std::default::Default::default()
6711    }
6712
6713    /// Sets the value of [instance][crate::model::SqlInstancesListServerCasRequest::instance].
6714    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6715        self.instance = v.into();
6716        self
6717    }
6718
6719    /// Sets the value of [project][crate::model::SqlInstancesListServerCasRequest::project].
6720    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6721        self.project = v.into();
6722        self
6723    }
6724}
6725
6726impl wkt::message::Message for SqlInstancesListServerCasRequest {
6727    fn typename() -> &'static str {
6728        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesListServerCasRequest"
6729    }
6730}
6731
6732#[doc(hidden)]
6733impl<'de> serde::de::Deserialize<'de> for SqlInstancesListServerCasRequest {
6734    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6735    where
6736        D: serde::Deserializer<'de>,
6737    {
6738        #[allow(non_camel_case_types)]
6739        #[doc(hidden)]
6740        #[derive(PartialEq, Eq, Hash)]
6741        enum __FieldTag {
6742            __instance,
6743            __project,
6744            Unknown(std::string::String),
6745        }
6746        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6747            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6748            where
6749                D: serde::Deserializer<'de>,
6750            {
6751                struct Visitor;
6752                impl<'de> serde::de::Visitor<'de> for Visitor {
6753                    type Value = __FieldTag;
6754                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6755                        formatter.write_str("a field name for SqlInstancesListServerCasRequest")
6756                    }
6757                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6758                    where
6759                        E: serde::de::Error,
6760                    {
6761                        use std::result::Result::Ok;
6762                        use std::string::ToString;
6763                        match value {
6764                            "instance" => Ok(__FieldTag::__instance),
6765                            "project" => Ok(__FieldTag::__project),
6766                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6767                        }
6768                    }
6769                }
6770                deserializer.deserialize_identifier(Visitor)
6771            }
6772        }
6773        struct Visitor;
6774        impl<'de> serde::de::Visitor<'de> for Visitor {
6775            type Value = SqlInstancesListServerCasRequest;
6776            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6777                formatter.write_str("struct SqlInstancesListServerCasRequest")
6778            }
6779            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6780            where
6781                A: serde::de::MapAccess<'de>,
6782            {
6783                #[allow(unused_imports)]
6784                use serde::de::Error;
6785                use std::option::Option::Some;
6786                let mut fields = std::collections::HashSet::new();
6787                let mut result = Self::Value::new();
6788                while let Some(tag) = map.next_key::<__FieldTag>()? {
6789                    #[allow(clippy::match_single_binding)]
6790                    match tag {
6791                        __FieldTag::__instance => {
6792                            if !fields.insert(__FieldTag::__instance) {
6793                                return std::result::Result::Err(A::Error::duplicate_field(
6794                                    "multiple values for instance",
6795                                ));
6796                            }
6797                            result.instance = map
6798                                .next_value::<std::option::Option<std::string::String>>()?
6799                                .unwrap_or_default();
6800                        }
6801                        __FieldTag::__project => {
6802                            if !fields.insert(__FieldTag::__project) {
6803                                return std::result::Result::Err(A::Error::duplicate_field(
6804                                    "multiple values for project",
6805                                ));
6806                            }
6807                            result.project = map
6808                                .next_value::<std::option::Option<std::string::String>>()?
6809                                .unwrap_or_default();
6810                        }
6811                        __FieldTag::Unknown(key) => {
6812                            let value = map.next_value::<serde_json::Value>()?;
6813                            result._unknown_fields.insert(key, value);
6814                        }
6815                    }
6816                }
6817                std::result::Result::Ok(result)
6818            }
6819        }
6820        deserializer.deserialize_any(Visitor)
6821    }
6822}
6823
6824#[doc(hidden)]
6825impl serde::ser::Serialize for SqlInstancesListServerCasRequest {
6826    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6827    where
6828        S: serde::ser::Serializer,
6829    {
6830        use serde::ser::SerializeMap;
6831        #[allow(unused_imports)]
6832        use std::option::Option::Some;
6833        let mut state = serializer.serialize_map(std::option::Option::None)?;
6834        if !self.instance.is_empty() {
6835            state.serialize_entry("instance", &self.instance)?;
6836        }
6837        if !self.project.is_empty() {
6838            state.serialize_entry("project", &self.project)?;
6839        }
6840        if !self._unknown_fields.is_empty() {
6841            for (key, value) in self._unknown_fields.iter() {
6842                state.serialize_entry(key, &value)?;
6843            }
6844        }
6845        state.end()
6846    }
6847}
6848
6849/// Instance patch request.
6850#[derive(Clone, Debug, Default, PartialEq)]
6851#[non_exhaustive]
6852pub struct SqlInstancesPatchRequest {
6853    /// Cloud SQL instance ID. This does not include the project ID.
6854    pub instance: std::string::String,
6855
6856    /// Project ID of the project that contains the instance.
6857    pub project: std::string::String,
6858
6859    pub body: std::option::Option<crate::model::DatabaseInstance>,
6860
6861    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6862}
6863
6864impl SqlInstancesPatchRequest {
6865    pub fn new() -> Self {
6866        std::default::Default::default()
6867    }
6868
6869    /// Sets the value of [instance][crate::model::SqlInstancesPatchRequest::instance].
6870    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6871        self.instance = v.into();
6872        self
6873    }
6874
6875    /// Sets the value of [project][crate::model::SqlInstancesPatchRequest::project].
6876    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6877        self.project = v.into();
6878        self
6879    }
6880
6881    /// Sets the value of [body][crate::model::SqlInstancesPatchRequest::body].
6882    pub fn set_body<T>(mut self, v: T) -> Self
6883    where
6884        T: std::convert::Into<crate::model::DatabaseInstance>,
6885    {
6886        self.body = std::option::Option::Some(v.into());
6887        self
6888    }
6889
6890    /// Sets or clears the value of [body][crate::model::SqlInstancesPatchRequest::body].
6891    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
6892    where
6893        T: std::convert::Into<crate::model::DatabaseInstance>,
6894    {
6895        self.body = v.map(|x| x.into());
6896        self
6897    }
6898}
6899
6900impl wkt::message::Message for SqlInstancesPatchRequest {
6901    fn typename() -> &'static str {
6902        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesPatchRequest"
6903    }
6904}
6905
6906#[doc(hidden)]
6907impl<'de> serde::de::Deserialize<'de> for SqlInstancesPatchRequest {
6908    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6909    where
6910        D: serde::Deserializer<'de>,
6911    {
6912        #[allow(non_camel_case_types)]
6913        #[doc(hidden)]
6914        #[derive(PartialEq, Eq, Hash)]
6915        enum __FieldTag {
6916            __instance,
6917            __project,
6918            __body,
6919            Unknown(std::string::String),
6920        }
6921        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6922            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6923            where
6924                D: serde::Deserializer<'de>,
6925            {
6926                struct Visitor;
6927                impl<'de> serde::de::Visitor<'de> for Visitor {
6928                    type Value = __FieldTag;
6929                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6930                        formatter.write_str("a field name for SqlInstancesPatchRequest")
6931                    }
6932                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6933                    where
6934                        E: serde::de::Error,
6935                    {
6936                        use std::result::Result::Ok;
6937                        use std::string::ToString;
6938                        match value {
6939                            "instance" => Ok(__FieldTag::__instance),
6940                            "project" => Ok(__FieldTag::__project),
6941                            "body" => Ok(__FieldTag::__body),
6942                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6943                        }
6944                    }
6945                }
6946                deserializer.deserialize_identifier(Visitor)
6947            }
6948        }
6949        struct Visitor;
6950        impl<'de> serde::de::Visitor<'de> for Visitor {
6951            type Value = SqlInstancesPatchRequest;
6952            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6953                formatter.write_str("struct SqlInstancesPatchRequest")
6954            }
6955            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6956            where
6957                A: serde::de::MapAccess<'de>,
6958            {
6959                #[allow(unused_imports)]
6960                use serde::de::Error;
6961                use std::option::Option::Some;
6962                let mut fields = std::collections::HashSet::new();
6963                let mut result = Self::Value::new();
6964                while let Some(tag) = map.next_key::<__FieldTag>()? {
6965                    #[allow(clippy::match_single_binding)]
6966                    match tag {
6967                        __FieldTag::__instance => {
6968                            if !fields.insert(__FieldTag::__instance) {
6969                                return std::result::Result::Err(A::Error::duplicate_field(
6970                                    "multiple values for instance",
6971                                ));
6972                            }
6973                            result.instance = map
6974                                .next_value::<std::option::Option<std::string::String>>()?
6975                                .unwrap_or_default();
6976                        }
6977                        __FieldTag::__project => {
6978                            if !fields.insert(__FieldTag::__project) {
6979                                return std::result::Result::Err(A::Error::duplicate_field(
6980                                    "multiple values for project",
6981                                ));
6982                            }
6983                            result.project = map
6984                                .next_value::<std::option::Option<std::string::String>>()?
6985                                .unwrap_or_default();
6986                        }
6987                        __FieldTag::__body => {
6988                            if !fields.insert(__FieldTag::__body) {
6989                                return std::result::Result::Err(A::Error::duplicate_field(
6990                                    "multiple values for body",
6991                                ));
6992                            }
6993                            result.body = map
6994                                .next_value::<std::option::Option<crate::model::DatabaseInstance>>(
6995                                )?;
6996                        }
6997                        __FieldTag::Unknown(key) => {
6998                            let value = map.next_value::<serde_json::Value>()?;
6999                            result._unknown_fields.insert(key, value);
7000                        }
7001                    }
7002                }
7003                std::result::Result::Ok(result)
7004            }
7005        }
7006        deserializer.deserialize_any(Visitor)
7007    }
7008}
7009
7010#[doc(hidden)]
7011impl serde::ser::Serialize for SqlInstancesPatchRequest {
7012    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7013    where
7014        S: serde::ser::Serializer,
7015    {
7016        use serde::ser::SerializeMap;
7017        #[allow(unused_imports)]
7018        use std::option::Option::Some;
7019        let mut state = serializer.serialize_map(std::option::Option::None)?;
7020        if !self.instance.is_empty() {
7021            state.serialize_entry("instance", &self.instance)?;
7022        }
7023        if !self.project.is_empty() {
7024            state.serialize_entry("project", &self.project)?;
7025        }
7026        if self.body.is_some() {
7027            state.serialize_entry("body", &self.body)?;
7028        }
7029        if !self._unknown_fields.is_empty() {
7030            for (key, value) in self._unknown_fields.iter() {
7031                state.serialize_entry(key, &value)?;
7032            }
7033        }
7034        state.end()
7035    }
7036}
7037
7038/// Instance promote replica request.
7039#[derive(Clone, Debug, Default, PartialEq)]
7040#[non_exhaustive]
7041pub struct SqlInstancesPromoteReplicaRequest {
7042    /// Cloud SQL read replica instance name.
7043    pub instance: std::string::String,
7044
7045    /// ID of the project that contains the read replica.
7046    pub project: std::string::String,
7047
7048    /// Set to true to invoke a replica failover to the designated DR
7049    /// replica. As part of replica failover, the promote operation attempts
7050    /// to add the original primary instance as a replica of the promoted
7051    /// DR replica when the original primary instance comes back online.
7052    /// If set to false or not specified, then the original primary
7053    /// instance becomes an independent Cloud SQL primary instance.
7054    /// Only applicable to MySQL.
7055    pub failover: bool,
7056
7057    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7058}
7059
7060impl SqlInstancesPromoteReplicaRequest {
7061    pub fn new() -> Self {
7062        std::default::Default::default()
7063    }
7064
7065    /// Sets the value of [instance][crate::model::SqlInstancesPromoteReplicaRequest::instance].
7066    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7067        self.instance = v.into();
7068        self
7069    }
7070
7071    /// Sets the value of [project][crate::model::SqlInstancesPromoteReplicaRequest::project].
7072    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7073        self.project = v.into();
7074        self
7075    }
7076
7077    /// Sets the value of [failover][crate::model::SqlInstancesPromoteReplicaRequest::failover].
7078    pub fn set_failover<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7079        self.failover = v.into();
7080        self
7081    }
7082}
7083
7084impl wkt::message::Message for SqlInstancesPromoteReplicaRequest {
7085    fn typename() -> &'static str {
7086        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest"
7087    }
7088}
7089
7090#[doc(hidden)]
7091impl<'de> serde::de::Deserialize<'de> for SqlInstancesPromoteReplicaRequest {
7092    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7093    where
7094        D: serde::Deserializer<'de>,
7095    {
7096        #[allow(non_camel_case_types)]
7097        #[doc(hidden)]
7098        #[derive(PartialEq, Eq, Hash)]
7099        enum __FieldTag {
7100            __instance,
7101            __project,
7102            __failover,
7103            Unknown(std::string::String),
7104        }
7105        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7106            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7107            where
7108                D: serde::Deserializer<'de>,
7109            {
7110                struct Visitor;
7111                impl<'de> serde::de::Visitor<'de> for Visitor {
7112                    type Value = __FieldTag;
7113                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7114                        formatter.write_str("a field name for SqlInstancesPromoteReplicaRequest")
7115                    }
7116                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7117                    where
7118                        E: serde::de::Error,
7119                    {
7120                        use std::result::Result::Ok;
7121                        use std::string::ToString;
7122                        match value {
7123                            "instance" => Ok(__FieldTag::__instance),
7124                            "project" => Ok(__FieldTag::__project),
7125                            "failover" => Ok(__FieldTag::__failover),
7126                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7127                        }
7128                    }
7129                }
7130                deserializer.deserialize_identifier(Visitor)
7131            }
7132        }
7133        struct Visitor;
7134        impl<'de> serde::de::Visitor<'de> for Visitor {
7135            type Value = SqlInstancesPromoteReplicaRequest;
7136            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7137                formatter.write_str("struct SqlInstancesPromoteReplicaRequest")
7138            }
7139            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7140            where
7141                A: serde::de::MapAccess<'de>,
7142            {
7143                #[allow(unused_imports)]
7144                use serde::de::Error;
7145                use std::option::Option::Some;
7146                let mut fields = std::collections::HashSet::new();
7147                let mut result = Self::Value::new();
7148                while let Some(tag) = map.next_key::<__FieldTag>()? {
7149                    #[allow(clippy::match_single_binding)]
7150                    match tag {
7151                        __FieldTag::__instance => {
7152                            if !fields.insert(__FieldTag::__instance) {
7153                                return std::result::Result::Err(A::Error::duplicate_field(
7154                                    "multiple values for instance",
7155                                ));
7156                            }
7157                            result.instance = map
7158                                .next_value::<std::option::Option<std::string::String>>()?
7159                                .unwrap_or_default();
7160                        }
7161                        __FieldTag::__project => {
7162                            if !fields.insert(__FieldTag::__project) {
7163                                return std::result::Result::Err(A::Error::duplicate_field(
7164                                    "multiple values for project",
7165                                ));
7166                            }
7167                            result.project = map
7168                                .next_value::<std::option::Option<std::string::String>>()?
7169                                .unwrap_or_default();
7170                        }
7171                        __FieldTag::__failover => {
7172                            if !fields.insert(__FieldTag::__failover) {
7173                                return std::result::Result::Err(A::Error::duplicate_field(
7174                                    "multiple values for failover",
7175                                ));
7176                            }
7177                            result.failover = map
7178                                .next_value::<std::option::Option<bool>>()?
7179                                .unwrap_or_default();
7180                        }
7181                        __FieldTag::Unknown(key) => {
7182                            let value = map.next_value::<serde_json::Value>()?;
7183                            result._unknown_fields.insert(key, value);
7184                        }
7185                    }
7186                }
7187                std::result::Result::Ok(result)
7188            }
7189        }
7190        deserializer.deserialize_any(Visitor)
7191    }
7192}
7193
7194#[doc(hidden)]
7195impl serde::ser::Serialize for SqlInstancesPromoteReplicaRequest {
7196    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7197    where
7198        S: serde::ser::Serializer,
7199    {
7200        use serde::ser::SerializeMap;
7201        #[allow(unused_imports)]
7202        use std::option::Option::Some;
7203        let mut state = serializer.serialize_map(std::option::Option::None)?;
7204        if !self.instance.is_empty() {
7205            state.serialize_entry("instance", &self.instance)?;
7206        }
7207        if !self.project.is_empty() {
7208            state.serialize_entry("project", &self.project)?;
7209        }
7210        if !wkt::internal::is_default(&self.failover) {
7211            state.serialize_entry("failover", &self.failover)?;
7212        }
7213        if !self._unknown_fields.is_empty() {
7214            for (key, value) in self._unknown_fields.iter() {
7215                state.serialize_entry(key, &value)?;
7216            }
7217        }
7218        state.end()
7219    }
7220}
7221
7222/// Instance switchover request.
7223#[derive(Clone, Debug, Default, PartialEq)]
7224#[non_exhaustive]
7225pub struct SqlInstancesSwitchoverRequest {
7226    /// Cloud SQL read replica instance name.
7227    pub instance: std::string::String,
7228
7229    /// ID of the project that contains the replica.
7230    pub project: std::string::String,
7231
7232    /// Optional. (MySQL only) Cloud SQL instance operations timeout, which is a
7233    /// sum of all database operations. Default value is 10 minutes and can be
7234    /// modified to a maximum value of 24 hours.
7235    pub db_timeout: std::option::Option<wkt::Duration>,
7236
7237    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7238}
7239
7240impl SqlInstancesSwitchoverRequest {
7241    pub fn new() -> Self {
7242        std::default::Default::default()
7243    }
7244
7245    /// Sets the value of [instance][crate::model::SqlInstancesSwitchoverRequest::instance].
7246    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7247        self.instance = v.into();
7248        self
7249    }
7250
7251    /// Sets the value of [project][crate::model::SqlInstancesSwitchoverRequest::project].
7252    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7253        self.project = v.into();
7254        self
7255    }
7256
7257    /// Sets the value of [db_timeout][crate::model::SqlInstancesSwitchoverRequest::db_timeout].
7258    pub fn set_db_timeout<T>(mut self, v: T) -> Self
7259    where
7260        T: std::convert::Into<wkt::Duration>,
7261    {
7262        self.db_timeout = std::option::Option::Some(v.into());
7263        self
7264    }
7265
7266    /// Sets or clears the value of [db_timeout][crate::model::SqlInstancesSwitchoverRequest::db_timeout].
7267    pub fn set_or_clear_db_timeout<T>(mut self, v: std::option::Option<T>) -> Self
7268    where
7269        T: std::convert::Into<wkt::Duration>,
7270    {
7271        self.db_timeout = v.map(|x| x.into());
7272        self
7273    }
7274}
7275
7276impl wkt::message::Message for SqlInstancesSwitchoverRequest {
7277    fn typename() -> &'static str {
7278        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesSwitchoverRequest"
7279    }
7280}
7281
7282#[doc(hidden)]
7283impl<'de> serde::de::Deserialize<'de> for SqlInstancesSwitchoverRequest {
7284    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7285    where
7286        D: serde::Deserializer<'de>,
7287    {
7288        #[allow(non_camel_case_types)]
7289        #[doc(hidden)]
7290        #[derive(PartialEq, Eq, Hash)]
7291        enum __FieldTag {
7292            __instance,
7293            __project,
7294            __db_timeout,
7295            Unknown(std::string::String),
7296        }
7297        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7298            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7299            where
7300                D: serde::Deserializer<'de>,
7301            {
7302                struct Visitor;
7303                impl<'de> serde::de::Visitor<'de> for Visitor {
7304                    type Value = __FieldTag;
7305                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7306                        formatter.write_str("a field name for SqlInstancesSwitchoverRequest")
7307                    }
7308                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7309                    where
7310                        E: serde::de::Error,
7311                    {
7312                        use std::result::Result::Ok;
7313                        use std::string::ToString;
7314                        match value {
7315                            "instance" => Ok(__FieldTag::__instance),
7316                            "project" => Ok(__FieldTag::__project),
7317                            "dbTimeout" => Ok(__FieldTag::__db_timeout),
7318                            "db_timeout" => Ok(__FieldTag::__db_timeout),
7319                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7320                        }
7321                    }
7322                }
7323                deserializer.deserialize_identifier(Visitor)
7324            }
7325        }
7326        struct Visitor;
7327        impl<'de> serde::de::Visitor<'de> for Visitor {
7328            type Value = SqlInstancesSwitchoverRequest;
7329            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7330                formatter.write_str("struct SqlInstancesSwitchoverRequest")
7331            }
7332            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7333            where
7334                A: serde::de::MapAccess<'de>,
7335            {
7336                #[allow(unused_imports)]
7337                use serde::de::Error;
7338                use std::option::Option::Some;
7339                let mut fields = std::collections::HashSet::new();
7340                let mut result = Self::Value::new();
7341                while let Some(tag) = map.next_key::<__FieldTag>()? {
7342                    #[allow(clippy::match_single_binding)]
7343                    match tag {
7344                        __FieldTag::__instance => {
7345                            if !fields.insert(__FieldTag::__instance) {
7346                                return std::result::Result::Err(A::Error::duplicate_field(
7347                                    "multiple values for instance",
7348                                ));
7349                            }
7350                            result.instance = map
7351                                .next_value::<std::option::Option<std::string::String>>()?
7352                                .unwrap_or_default();
7353                        }
7354                        __FieldTag::__project => {
7355                            if !fields.insert(__FieldTag::__project) {
7356                                return std::result::Result::Err(A::Error::duplicate_field(
7357                                    "multiple values for project",
7358                                ));
7359                            }
7360                            result.project = map
7361                                .next_value::<std::option::Option<std::string::String>>()?
7362                                .unwrap_or_default();
7363                        }
7364                        __FieldTag::__db_timeout => {
7365                            if !fields.insert(__FieldTag::__db_timeout) {
7366                                return std::result::Result::Err(A::Error::duplicate_field(
7367                                    "multiple values for db_timeout",
7368                                ));
7369                            }
7370                            result.db_timeout =
7371                                map.next_value::<std::option::Option<wkt::Duration>>()?;
7372                        }
7373                        __FieldTag::Unknown(key) => {
7374                            let value = map.next_value::<serde_json::Value>()?;
7375                            result._unknown_fields.insert(key, value);
7376                        }
7377                    }
7378                }
7379                std::result::Result::Ok(result)
7380            }
7381        }
7382        deserializer.deserialize_any(Visitor)
7383    }
7384}
7385
7386#[doc(hidden)]
7387impl serde::ser::Serialize for SqlInstancesSwitchoverRequest {
7388    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7389    where
7390        S: serde::ser::Serializer,
7391    {
7392        use serde::ser::SerializeMap;
7393        #[allow(unused_imports)]
7394        use std::option::Option::Some;
7395        let mut state = serializer.serialize_map(std::option::Option::None)?;
7396        if !self.instance.is_empty() {
7397            state.serialize_entry("instance", &self.instance)?;
7398        }
7399        if !self.project.is_empty() {
7400            state.serialize_entry("project", &self.project)?;
7401        }
7402        if self.db_timeout.is_some() {
7403            state.serialize_entry("dbTimeout", &self.db_timeout)?;
7404        }
7405        if !self._unknown_fields.is_empty() {
7406            for (key, value) in self._unknown_fields.iter() {
7407                state.serialize_entry(key, &value)?;
7408            }
7409        }
7410        state.end()
7411    }
7412}
7413
7414/// Instance reset SSL config request.
7415#[derive(Clone, Debug, Default, PartialEq)]
7416#[non_exhaustive]
7417pub struct SqlInstancesResetSslConfigRequest {
7418    /// Cloud SQL instance ID. This does not include the project ID.
7419    pub instance: std::string::String,
7420
7421    /// Project ID of the project that contains the instance.
7422    pub project: std::string::String,
7423
7424    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7425}
7426
7427impl SqlInstancesResetSslConfigRequest {
7428    pub fn new() -> Self {
7429        std::default::Default::default()
7430    }
7431
7432    /// Sets the value of [instance][crate::model::SqlInstancesResetSslConfigRequest::instance].
7433    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7434        self.instance = v.into();
7435        self
7436    }
7437
7438    /// Sets the value of [project][crate::model::SqlInstancesResetSslConfigRequest::project].
7439    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7440        self.project = v.into();
7441        self
7442    }
7443}
7444
7445impl wkt::message::Message for SqlInstancesResetSslConfigRequest {
7446    fn typename() -> &'static str {
7447        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesResetSslConfigRequest"
7448    }
7449}
7450
7451#[doc(hidden)]
7452impl<'de> serde::de::Deserialize<'de> for SqlInstancesResetSslConfigRequest {
7453    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7454    where
7455        D: serde::Deserializer<'de>,
7456    {
7457        #[allow(non_camel_case_types)]
7458        #[doc(hidden)]
7459        #[derive(PartialEq, Eq, Hash)]
7460        enum __FieldTag {
7461            __instance,
7462            __project,
7463            Unknown(std::string::String),
7464        }
7465        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7466            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7467            where
7468                D: serde::Deserializer<'de>,
7469            {
7470                struct Visitor;
7471                impl<'de> serde::de::Visitor<'de> for Visitor {
7472                    type Value = __FieldTag;
7473                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7474                        formatter.write_str("a field name for SqlInstancesResetSslConfigRequest")
7475                    }
7476                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7477                    where
7478                        E: serde::de::Error,
7479                    {
7480                        use std::result::Result::Ok;
7481                        use std::string::ToString;
7482                        match value {
7483                            "instance" => Ok(__FieldTag::__instance),
7484                            "project" => Ok(__FieldTag::__project),
7485                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7486                        }
7487                    }
7488                }
7489                deserializer.deserialize_identifier(Visitor)
7490            }
7491        }
7492        struct Visitor;
7493        impl<'de> serde::de::Visitor<'de> for Visitor {
7494            type Value = SqlInstancesResetSslConfigRequest;
7495            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7496                formatter.write_str("struct SqlInstancesResetSslConfigRequest")
7497            }
7498            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7499            where
7500                A: serde::de::MapAccess<'de>,
7501            {
7502                #[allow(unused_imports)]
7503                use serde::de::Error;
7504                use std::option::Option::Some;
7505                let mut fields = std::collections::HashSet::new();
7506                let mut result = Self::Value::new();
7507                while let Some(tag) = map.next_key::<__FieldTag>()? {
7508                    #[allow(clippy::match_single_binding)]
7509                    match tag {
7510                        __FieldTag::__instance => {
7511                            if !fields.insert(__FieldTag::__instance) {
7512                                return std::result::Result::Err(A::Error::duplicate_field(
7513                                    "multiple values for instance",
7514                                ));
7515                            }
7516                            result.instance = map
7517                                .next_value::<std::option::Option<std::string::String>>()?
7518                                .unwrap_or_default();
7519                        }
7520                        __FieldTag::__project => {
7521                            if !fields.insert(__FieldTag::__project) {
7522                                return std::result::Result::Err(A::Error::duplicate_field(
7523                                    "multiple values for project",
7524                                ));
7525                            }
7526                            result.project = map
7527                                .next_value::<std::option::Option<std::string::String>>()?
7528                                .unwrap_or_default();
7529                        }
7530                        __FieldTag::Unknown(key) => {
7531                            let value = map.next_value::<serde_json::Value>()?;
7532                            result._unknown_fields.insert(key, value);
7533                        }
7534                    }
7535                }
7536                std::result::Result::Ok(result)
7537            }
7538        }
7539        deserializer.deserialize_any(Visitor)
7540    }
7541}
7542
7543#[doc(hidden)]
7544impl serde::ser::Serialize for SqlInstancesResetSslConfigRequest {
7545    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7546    where
7547        S: serde::ser::Serializer,
7548    {
7549        use serde::ser::SerializeMap;
7550        #[allow(unused_imports)]
7551        use std::option::Option::Some;
7552        let mut state = serializer.serialize_map(std::option::Option::None)?;
7553        if !self.instance.is_empty() {
7554            state.serialize_entry("instance", &self.instance)?;
7555        }
7556        if !self.project.is_empty() {
7557            state.serialize_entry("project", &self.project)?;
7558        }
7559        if !self._unknown_fields.is_empty() {
7560            for (key, value) in self._unknown_fields.iter() {
7561                state.serialize_entry(key, &value)?;
7562            }
7563        }
7564        state.end()
7565    }
7566}
7567
7568/// Instance restart request.
7569#[derive(Clone, Debug, Default, PartialEq)]
7570#[non_exhaustive]
7571pub struct SqlInstancesRestartRequest {
7572    /// Cloud SQL instance ID. This does not include the project ID.
7573    pub instance: std::string::String,
7574
7575    /// Project ID of the project that contains the instance to be restarted.
7576    pub project: std::string::String,
7577
7578    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7579}
7580
7581impl SqlInstancesRestartRequest {
7582    pub fn new() -> Self {
7583        std::default::Default::default()
7584    }
7585
7586    /// Sets the value of [instance][crate::model::SqlInstancesRestartRequest::instance].
7587    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7588        self.instance = v.into();
7589        self
7590    }
7591
7592    /// Sets the value of [project][crate::model::SqlInstancesRestartRequest::project].
7593    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7594        self.project = v.into();
7595        self
7596    }
7597}
7598
7599impl wkt::message::Message for SqlInstancesRestartRequest {
7600    fn typename() -> &'static str {
7601        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesRestartRequest"
7602    }
7603}
7604
7605#[doc(hidden)]
7606impl<'de> serde::de::Deserialize<'de> for SqlInstancesRestartRequest {
7607    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7608    where
7609        D: serde::Deserializer<'de>,
7610    {
7611        #[allow(non_camel_case_types)]
7612        #[doc(hidden)]
7613        #[derive(PartialEq, Eq, Hash)]
7614        enum __FieldTag {
7615            __instance,
7616            __project,
7617            Unknown(std::string::String),
7618        }
7619        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7620            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7621            where
7622                D: serde::Deserializer<'de>,
7623            {
7624                struct Visitor;
7625                impl<'de> serde::de::Visitor<'de> for Visitor {
7626                    type Value = __FieldTag;
7627                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7628                        formatter.write_str("a field name for SqlInstancesRestartRequest")
7629                    }
7630                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7631                    where
7632                        E: serde::de::Error,
7633                    {
7634                        use std::result::Result::Ok;
7635                        use std::string::ToString;
7636                        match value {
7637                            "instance" => Ok(__FieldTag::__instance),
7638                            "project" => Ok(__FieldTag::__project),
7639                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7640                        }
7641                    }
7642                }
7643                deserializer.deserialize_identifier(Visitor)
7644            }
7645        }
7646        struct Visitor;
7647        impl<'de> serde::de::Visitor<'de> for Visitor {
7648            type Value = SqlInstancesRestartRequest;
7649            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7650                formatter.write_str("struct SqlInstancesRestartRequest")
7651            }
7652            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7653            where
7654                A: serde::de::MapAccess<'de>,
7655            {
7656                #[allow(unused_imports)]
7657                use serde::de::Error;
7658                use std::option::Option::Some;
7659                let mut fields = std::collections::HashSet::new();
7660                let mut result = Self::Value::new();
7661                while let Some(tag) = map.next_key::<__FieldTag>()? {
7662                    #[allow(clippy::match_single_binding)]
7663                    match tag {
7664                        __FieldTag::__instance => {
7665                            if !fields.insert(__FieldTag::__instance) {
7666                                return std::result::Result::Err(A::Error::duplicate_field(
7667                                    "multiple values for instance",
7668                                ));
7669                            }
7670                            result.instance = map
7671                                .next_value::<std::option::Option<std::string::String>>()?
7672                                .unwrap_or_default();
7673                        }
7674                        __FieldTag::__project => {
7675                            if !fields.insert(__FieldTag::__project) {
7676                                return std::result::Result::Err(A::Error::duplicate_field(
7677                                    "multiple values for project",
7678                                ));
7679                            }
7680                            result.project = map
7681                                .next_value::<std::option::Option<std::string::String>>()?
7682                                .unwrap_or_default();
7683                        }
7684                        __FieldTag::Unknown(key) => {
7685                            let value = map.next_value::<serde_json::Value>()?;
7686                            result._unknown_fields.insert(key, value);
7687                        }
7688                    }
7689                }
7690                std::result::Result::Ok(result)
7691            }
7692        }
7693        deserializer.deserialize_any(Visitor)
7694    }
7695}
7696
7697#[doc(hidden)]
7698impl serde::ser::Serialize for SqlInstancesRestartRequest {
7699    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7700    where
7701        S: serde::ser::Serializer,
7702    {
7703        use serde::ser::SerializeMap;
7704        #[allow(unused_imports)]
7705        use std::option::Option::Some;
7706        let mut state = serializer.serialize_map(std::option::Option::None)?;
7707        if !self.instance.is_empty() {
7708            state.serialize_entry("instance", &self.instance)?;
7709        }
7710        if !self.project.is_empty() {
7711            state.serialize_entry("project", &self.project)?;
7712        }
7713        if !self._unknown_fields.is_empty() {
7714            for (key, value) in self._unknown_fields.iter() {
7715                state.serialize_entry(key, &value)?;
7716            }
7717        }
7718        state.end()
7719    }
7720}
7721
7722/// Instance restore backup request.
7723#[derive(Clone, Debug, Default, PartialEq)]
7724#[non_exhaustive]
7725pub struct SqlInstancesRestoreBackupRequest {
7726    /// Cloud SQL instance ID. This does not include the project ID.
7727    pub instance: std::string::String,
7728
7729    /// Project ID of the project that contains the instance.
7730    pub project: std::string::String,
7731
7732    pub body: std::option::Option<crate::model::InstancesRestoreBackupRequest>,
7733
7734    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7735}
7736
7737impl SqlInstancesRestoreBackupRequest {
7738    pub fn new() -> Self {
7739        std::default::Default::default()
7740    }
7741
7742    /// Sets the value of [instance][crate::model::SqlInstancesRestoreBackupRequest::instance].
7743    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7744        self.instance = v.into();
7745        self
7746    }
7747
7748    /// Sets the value of [project][crate::model::SqlInstancesRestoreBackupRequest::project].
7749    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7750        self.project = v.into();
7751        self
7752    }
7753
7754    /// Sets the value of [body][crate::model::SqlInstancesRestoreBackupRequest::body].
7755    pub fn set_body<T>(mut self, v: T) -> Self
7756    where
7757        T: std::convert::Into<crate::model::InstancesRestoreBackupRequest>,
7758    {
7759        self.body = std::option::Option::Some(v.into());
7760        self
7761    }
7762
7763    /// Sets or clears the value of [body][crate::model::SqlInstancesRestoreBackupRequest::body].
7764    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
7765    where
7766        T: std::convert::Into<crate::model::InstancesRestoreBackupRequest>,
7767    {
7768        self.body = v.map(|x| x.into());
7769        self
7770    }
7771}
7772
7773impl wkt::message::Message for SqlInstancesRestoreBackupRequest {
7774    fn typename() -> &'static str {
7775        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesRestoreBackupRequest"
7776    }
7777}
7778
7779#[doc(hidden)]
7780impl<'de> serde::de::Deserialize<'de> for SqlInstancesRestoreBackupRequest {
7781    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7782    where
7783        D: serde::Deserializer<'de>,
7784    {
7785        #[allow(non_camel_case_types)]
7786        #[doc(hidden)]
7787        #[derive(PartialEq, Eq, Hash)]
7788        enum __FieldTag {
7789            __instance,
7790            __project,
7791            __body,
7792            Unknown(std::string::String),
7793        }
7794        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7795            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7796            where
7797                D: serde::Deserializer<'de>,
7798            {
7799                struct Visitor;
7800                impl<'de> serde::de::Visitor<'de> for Visitor {
7801                    type Value = __FieldTag;
7802                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7803                        formatter.write_str("a field name for SqlInstancesRestoreBackupRequest")
7804                    }
7805                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7806                    where
7807                        E: serde::de::Error,
7808                    {
7809                        use std::result::Result::Ok;
7810                        use std::string::ToString;
7811                        match value {
7812                            "instance" => Ok(__FieldTag::__instance),
7813                            "project" => Ok(__FieldTag::__project),
7814                            "body" => Ok(__FieldTag::__body),
7815                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7816                        }
7817                    }
7818                }
7819                deserializer.deserialize_identifier(Visitor)
7820            }
7821        }
7822        struct Visitor;
7823        impl<'de> serde::de::Visitor<'de> for Visitor {
7824            type Value = SqlInstancesRestoreBackupRequest;
7825            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7826                formatter.write_str("struct SqlInstancesRestoreBackupRequest")
7827            }
7828            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7829            where
7830                A: serde::de::MapAccess<'de>,
7831            {
7832                #[allow(unused_imports)]
7833                use serde::de::Error;
7834                use std::option::Option::Some;
7835                let mut fields = std::collections::HashSet::new();
7836                let mut result = Self::Value::new();
7837                while let Some(tag) = map.next_key::<__FieldTag>()? {
7838                    #[allow(clippy::match_single_binding)]
7839                    match tag {
7840                        __FieldTag::__instance => {
7841                            if !fields.insert(__FieldTag::__instance) {
7842                                return std::result::Result::Err(A::Error::duplicate_field(
7843                                    "multiple values for instance",
7844                                ));
7845                            }
7846                            result.instance = map
7847                                .next_value::<std::option::Option<std::string::String>>()?
7848                                .unwrap_or_default();
7849                        }
7850                        __FieldTag::__project => {
7851                            if !fields.insert(__FieldTag::__project) {
7852                                return std::result::Result::Err(A::Error::duplicate_field(
7853                                    "multiple values for project",
7854                                ));
7855                            }
7856                            result.project = map
7857                                .next_value::<std::option::Option<std::string::String>>()?
7858                                .unwrap_or_default();
7859                        }
7860                        __FieldTag::__body => {
7861                            if !fields.insert(__FieldTag::__body) {
7862                                return std::result::Result::Err(A::Error::duplicate_field(
7863                                    "multiple values for body",
7864                                ));
7865                            }
7866                            result.body =
7867                                map.next_value::<std::option::Option<
7868                                    crate::model::InstancesRestoreBackupRequest,
7869                                >>()?;
7870                        }
7871                        __FieldTag::Unknown(key) => {
7872                            let value = map.next_value::<serde_json::Value>()?;
7873                            result._unknown_fields.insert(key, value);
7874                        }
7875                    }
7876                }
7877                std::result::Result::Ok(result)
7878            }
7879        }
7880        deserializer.deserialize_any(Visitor)
7881    }
7882}
7883
7884#[doc(hidden)]
7885impl serde::ser::Serialize for SqlInstancesRestoreBackupRequest {
7886    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7887    where
7888        S: serde::ser::Serializer,
7889    {
7890        use serde::ser::SerializeMap;
7891        #[allow(unused_imports)]
7892        use std::option::Option::Some;
7893        let mut state = serializer.serialize_map(std::option::Option::None)?;
7894        if !self.instance.is_empty() {
7895            state.serialize_entry("instance", &self.instance)?;
7896        }
7897        if !self.project.is_empty() {
7898            state.serialize_entry("project", &self.project)?;
7899        }
7900        if self.body.is_some() {
7901            state.serialize_entry("body", &self.body)?;
7902        }
7903        if !self._unknown_fields.is_empty() {
7904            for (key, value) in self._unknown_fields.iter() {
7905                state.serialize_entry(key, &value)?;
7906            }
7907        }
7908        state.end()
7909    }
7910}
7911
7912/// Instance rotate server CA request.
7913#[derive(Clone, Debug, Default, PartialEq)]
7914#[non_exhaustive]
7915pub struct SqlInstancesRotateServerCaRequest {
7916    /// Cloud SQL instance ID. This does not include the project ID.
7917    pub instance: std::string::String,
7918
7919    /// Project ID of the project that contains the instance.
7920    pub project: std::string::String,
7921
7922    pub body: std::option::Option<crate::model::InstancesRotateServerCaRequest>,
7923
7924    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7925}
7926
7927impl SqlInstancesRotateServerCaRequest {
7928    pub fn new() -> Self {
7929        std::default::Default::default()
7930    }
7931
7932    /// Sets the value of [instance][crate::model::SqlInstancesRotateServerCaRequest::instance].
7933    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7934        self.instance = v.into();
7935        self
7936    }
7937
7938    /// Sets the value of [project][crate::model::SqlInstancesRotateServerCaRequest::project].
7939    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7940        self.project = v.into();
7941        self
7942    }
7943
7944    /// Sets the value of [body][crate::model::SqlInstancesRotateServerCaRequest::body].
7945    pub fn set_body<T>(mut self, v: T) -> Self
7946    where
7947        T: std::convert::Into<crate::model::InstancesRotateServerCaRequest>,
7948    {
7949        self.body = std::option::Option::Some(v.into());
7950        self
7951    }
7952
7953    /// Sets or clears the value of [body][crate::model::SqlInstancesRotateServerCaRequest::body].
7954    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
7955    where
7956        T: std::convert::Into<crate::model::InstancesRotateServerCaRequest>,
7957    {
7958        self.body = v.map(|x| x.into());
7959        self
7960    }
7961}
7962
7963impl wkt::message::Message for SqlInstancesRotateServerCaRequest {
7964    fn typename() -> &'static str {
7965        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesRotateServerCaRequest"
7966    }
7967}
7968
7969#[doc(hidden)]
7970impl<'de> serde::de::Deserialize<'de> for SqlInstancesRotateServerCaRequest {
7971    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7972    where
7973        D: serde::Deserializer<'de>,
7974    {
7975        #[allow(non_camel_case_types)]
7976        #[doc(hidden)]
7977        #[derive(PartialEq, Eq, Hash)]
7978        enum __FieldTag {
7979            __instance,
7980            __project,
7981            __body,
7982            Unknown(std::string::String),
7983        }
7984        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7985            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7986            where
7987                D: serde::Deserializer<'de>,
7988            {
7989                struct Visitor;
7990                impl<'de> serde::de::Visitor<'de> for Visitor {
7991                    type Value = __FieldTag;
7992                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7993                        formatter.write_str("a field name for SqlInstancesRotateServerCaRequest")
7994                    }
7995                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7996                    where
7997                        E: serde::de::Error,
7998                    {
7999                        use std::result::Result::Ok;
8000                        use std::string::ToString;
8001                        match value {
8002                            "instance" => Ok(__FieldTag::__instance),
8003                            "project" => Ok(__FieldTag::__project),
8004                            "body" => Ok(__FieldTag::__body),
8005                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8006                        }
8007                    }
8008                }
8009                deserializer.deserialize_identifier(Visitor)
8010            }
8011        }
8012        struct Visitor;
8013        impl<'de> serde::de::Visitor<'de> for Visitor {
8014            type Value = SqlInstancesRotateServerCaRequest;
8015            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8016                formatter.write_str("struct SqlInstancesRotateServerCaRequest")
8017            }
8018            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8019            where
8020                A: serde::de::MapAccess<'de>,
8021            {
8022                #[allow(unused_imports)]
8023                use serde::de::Error;
8024                use std::option::Option::Some;
8025                let mut fields = std::collections::HashSet::new();
8026                let mut result = Self::Value::new();
8027                while let Some(tag) = map.next_key::<__FieldTag>()? {
8028                    #[allow(clippy::match_single_binding)]
8029                    match tag {
8030                        __FieldTag::__instance => {
8031                            if !fields.insert(__FieldTag::__instance) {
8032                                return std::result::Result::Err(A::Error::duplicate_field(
8033                                    "multiple values for instance",
8034                                ));
8035                            }
8036                            result.instance = map
8037                                .next_value::<std::option::Option<std::string::String>>()?
8038                                .unwrap_or_default();
8039                        }
8040                        __FieldTag::__project => {
8041                            if !fields.insert(__FieldTag::__project) {
8042                                return std::result::Result::Err(A::Error::duplicate_field(
8043                                    "multiple values for project",
8044                                ));
8045                            }
8046                            result.project = map
8047                                .next_value::<std::option::Option<std::string::String>>()?
8048                                .unwrap_or_default();
8049                        }
8050                        __FieldTag::__body => {
8051                            if !fields.insert(__FieldTag::__body) {
8052                                return std::result::Result::Err(A::Error::duplicate_field(
8053                                    "multiple values for body",
8054                                ));
8055                            }
8056                            result.body =
8057                                map.next_value::<std::option::Option<
8058                                    crate::model::InstancesRotateServerCaRequest,
8059                                >>()?;
8060                        }
8061                        __FieldTag::Unknown(key) => {
8062                            let value = map.next_value::<serde_json::Value>()?;
8063                            result._unknown_fields.insert(key, value);
8064                        }
8065                    }
8066                }
8067                std::result::Result::Ok(result)
8068            }
8069        }
8070        deserializer.deserialize_any(Visitor)
8071    }
8072}
8073
8074#[doc(hidden)]
8075impl serde::ser::Serialize for SqlInstancesRotateServerCaRequest {
8076    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8077    where
8078        S: serde::ser::Serializer,
8079    {
8080        use serde::ser::SerializeMap;
8081        #[allow(unused_imports)]
8082        use std::option::Option::Some;
8083        let mut state = serializer.serialize_map(std::option::Option::None)?;
8084        if !self.instance.is_empty() {
8085            state.serialize_entry("instance", &self.instance)?;
8086        }
8087        if !self.project.is_empty() {
8088            state.serialize_entry("project", &self.project)?;
8089        }
8090        if self.body.is_some() {
8091            state.serialize_entry("body", &self.body)?;
8092        }
8093        if !self._unknown_fields.is_empty() {
8094            for (key, value) in self._unknown_fields.iter() {
8095                state.serialize_entry(key, &value)?;
8096            }
8097        }
8098        state.end()
8099    }
8100}
8101
8102/// Instance start replica request.
8103#[derive(Clone, Debug, Default, PartialEq)]
8104#[non_exhaustive]
8105pub struct SqlInstancesStartReplicaRequest {
8106    /// Cloud SQL read replica instance name.
8107    pub instance: std::string::String,
8108
8109    /// ID of the project that contains the read replica.
8110    pub project: std::string::String,
8111
8112    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8113}
8114
8115impl SqlInstancesStartReplicaRequest {
8116    pub fn new() -> Self {
8117        std::default::Default::default()
8118    }
8119
8120    /// Sets the value of [instance][crate::model::SqlInstancesStartReplicaRequest::instance].
8121    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8122        self.instance = v.into();
8123        self
8124    }
8125
8126    /// Sets the value of [project][crate::model::SqlInstancesStartReplicaRequest::project].
8127    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8128        self.project = v.into();
8129        self
8130    }
8131}
8132
8133impl wkt::message::Message for SqlInstancesStartReplicaRequest {
8134    fn typename() -> &'static str {
8135        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesStartReplicaRequest"
8136    }
8137}
8138
8139#[doc(hidden)]
8140impl<'de> serde::de::Deserialize<'de> for SqlInstancesStartReplicaRequest {
8141    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8142    where
8143        D: serde::Deserializer<'de>,
8144    {
8145        #[allow(non_camel_case_types)]
8146        #[doc(hidden)]
8147        #[derive(PartialEq, Eq, Hash)]
8148        enum __FieldTag {
8149            __instance,
8150            __project,
8151            Unknown(std::string::String),
8152        }
8153        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8154            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8155            where
8156                D: serde::Deserializer<'de>,
8157            {
8158                struct Visitor;
8159                impl<'de> serde::de::Visitor<'de> for Visitor {
8160                    type Value = __FieldTag;
8161                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8162                        formatter.write_str("a field name for SqlInstancesStartReplicaRequest")
8163                    }
8164                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8165                    where
8166                        E: serde::de::Error,
8167                    {
8168                        use std::result::Result::Ok;
8169                        use std::string::ToString;
8170                        match value {
8171                            "instance" => Ok(__FieldTag::__instance),
8172                            "project" => Ok(__FieldTag::__project),
8173                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8174                        }
8175                    }
8176                }
8177                deserializer.deserialize_identifier(Visitor)
8178            }
8179        }
8180        struct Visitor;
8181        impl<'de> serde::de::Visitor<'de> for Visitor {
8182            type Value = SqlInstancesStartReplicaRequest;
8183            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8184                formatter.write_str("struct SqlInstancesStartReplicaRequest")
8185            }
8186            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8187            where
8188                A: serde::de::MapAccess<'de>,
8189            {
8190                #[allow(unused_imports)]
8191                use serde::de::Error;
8192                use std::option::Option::Some;
8193                let mut fields = std::collections::HashSet::new();
8194                let mut result = Self::Value::new();
8195                while let Some(tag) = map.next_key::<__FieldTag>()? {
8196                    #[allow(clippy::match_single_binding)]
8197                    match tag {
8198                        __FieldTag::__instance => {
8199                            if !fields.insert(__FieldTag::__instance) {
8200                                return std::result::Result::Err(A::Error::duplicate_field(
8201                                    "multiple values for instance",
8202                                ));
8203                            }
8204                            result.instance = map
8205                                .next_value::<std::option::Option<std::string::String>>()?
8206                                .unwrap_or_default();
8207                        }
8208                        __FieldTag::__project => {
8209                            if !fields.insert(__FieldTag::__project) {
8210                                return std::result::Result::Err(A::Error::duplicate_field(
8211                                    "multiple values for project",
8212                                ));
8213                            }
8214                            result.project = map
8215                                .next_value::<std::option::Option<std::string::String>>()?
8216                                .unwrap_or_default();
8217                        }
8218                        __FieldTag::Unknown(key) => {
8219                            let value = map.next_value::<serde_json::Value>()?;
8220                            result._unknown_fields.insert(key, value);
8221                        }
8222                    }
8223                }
8224                std::result::Result::Ok(result)
8225            }
8226        }
8227        deserializer.deserialize_any(Visitor)
8228    }
8229}
8230
8231#[doc(hidden)]
8232impl serde::ser::Serialize for SqlInstancesStartReplicaRequest {
8233    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8234    where
8235        S: serde::ser::Serializer,
8236    {
8237        use serde::ser::SerializeMap;
8238        #[allow(unused_imports)]
8239        use std::option::Option::Some;
8240        let mut state = serializer.serialize_map(std::option::Option::None)?;
8241        if !self.instance.is_empty() {
8242            state.serialize_entry("instance", &self.instance)?;
8243        }
8244        if !self.project.is_empty() {
8245            state.serialize_entry("project", &self.project)?;
8246        }
8247        if !self._unknown_fields.is_empty() {
8248            for (key, value) in self._unknown_fields.iter() {
8249                state.serialize_entry(key, &value)?;
8250            }
8251        }
8252        state.end()
8253    }
8254}
8255
8256/// Instance stop replica request.
8257#[derive(Clone, Debug, Default, PartialEq)]
8258#[non_exhaustive]
8259pub struct SqlInstancesStopReplicaRequest {
8260    /// Cloud SQL read replica instance name.
8261    pub instance: std::string::String,
8262
8263    /// ID of the project that contains the read replica.
8264    pub project: std::string::String,
8265
8266    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8267}
8268
8269impl SqlInstancesStopReplicaRequest {
8270    pub fn new() -> Self {
8271        std::default::Default::default()
8272    }
8273
8274    /// Sets the value of [instance][crate::model::SqlInstancesStopReplicaRequest::instance].
8275    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8276        self.instance = v.into();
8277        self
8278    }
8279
8280    /// Sets the value of [project][crate::model::SqlInstancesStopReplicaRequest::project].
8281    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8282        self.project = v.into();
8283        self
8284    }
8285}
8286
8287impl wkt::message::Message for SqlInstancesStopReplicaRequest {
8288    fn typename() -> &'static str {
8289        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesStopReplicaRequest"
8290    }
8291}
8292
8293#[doc(hidden)]
8294impl<'de> serde::de::Deserialize<'de> for SqlInstancesStopReplicaRequest {
8295    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8296    where
8297        D: serde::Deserializer<'de>,
8298    {
8299        #[allow(non_camel_case_types)]
8300        #[doc(hidden)]
8301        #[derive(PartialEq, Eq, Hash)]
8302        enum __FieldTag {
8303            __instance,
8304            __project,
8305            Unknown(std::string::String),
8306        }
8307        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8308            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8309            where
8310                D: serde::Deserializer<'de>,
8311            {
8312                struct Visitor;
8313                impl<'de> serde::de::Visitor<'de> for Visitor {
8314                    type Value = __FieldTag;
8315                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8316                        formatter.write_str("a field name for SqlInstancesStopReplicaRequest")
8317                    }
8318                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8319                    where
8320                        E: serde::de::Error,
8321                    {
8322                        use std::result::Result::Ok;
8323                        use std::string::ToString;
8324                        match value {
8325                            "instance" => Ok(__FieldTag::__instance),
8326                            "project" => Ok(__FieldTag::__project),
8327                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8328                        }
8329                    }
8330                }
8331                deserializer.deserialize_identifier(Visitor)
8332            }
8333        }
8334        struct Visitor;
8335        impl<'de> serde::de::Visitor<'de> for Visitor {
8336            type Value = SqlInstancesStopReplicaRequest;
8337            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8338                formatter.write_str("struct SqlInstancesStopReplicaRequest")
8339            }
8340            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8341            where
8342                A: serde::de::MapAccess<'de>,
8343            {
8344                #[allow(unused_imports)]
8345                use serde::de::Error;
8346                use std::option::Option::Some;
8347                let mut fields = std::collections::HashSet::new();
8348                let mut result = Self::Value::new();
8349                while let Some(tag) = map.next_key::<__FieldTag>()? {
8350                    #[allow(clippy::match_single_binding)]
8351                    match tag {
8352                        __FieldTag::__instance => {
8353                            if !fields.insert(__FieldTag::__instance) {
8354                                return std::result::Result::Err(A::Error::duplicate_field(
8355                                    "multiple values for instance",
8356                                ));
8357                            }
8358                            result.instance = map
8359                                .next_value::<std::option::Option<std::string::String>>()?
8360                                .unwrap_or_default();
8361                        }
8362                        __FieldTag::__project => {
8363                            if !fields.insert(__FieldTag::__project) {
8364                                return std::result::Result::Err(A::Error::duplicate_field(
8365                                    "multiple values for project",
8366                                ));
8367                            }
8368                            result.project = map
8369                                .next_value::<std::option::Option<std::string::String>>()?
8370                                .unwrap_or_default();
8371                        }
8372                        __FieldTag::Unknown(key) => {
8373                            let value = map.next_value::<serde_json::Value>()?;
8374                            result._unknown_fields.insert(key, value);
8375                        }
8376                    }
8377                }
8378                std::result::Result::Ok(result)
8379            }
8380        }
8381        deserializer.deserialize_any(Visitor)
8382    }
8383}
8384
8385#[doc(hidden)]
8386impl serde::ser::Serialize for SqlInstancesStopReplicaRequest {
8387    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8388    where
8389        S: serde::ser::Serializer,
8390    {
8391        use serde::ser::SerializeMap;
8392        #[allow(unused_imports)]
8393        use std::option::Option::Some;
8394        let mut state = serializer.serialize_map(std::option::Option::None)?;
8395        if !self.instance.is_empty() {
8396            state.serialize_entry("instance", &self.instance)?;
8397        }
8398        if !self.project.is_empty() {
8399            state.serialize_entry("project", &self.project)?;
8400        }
8401        if !self._unknown_fields.is_empty() {
8402            for (key, value) in self._unknown_fields.iter() {
8403                state.serialize_entry(key, &value)?;
8404            }
8405        }
8406        state.end()
8407    }
8408}
8409
8410/// Instance truncate log request.
8411#[derive(Clone, Debug, Default, PartialEq)]
8412#[non_exhaustive]
8413pub struct SqlInstancesTruncateLogRequest {
8414    /// Cloud SQL instance ID. This does not include the project ID.
8415    pub instance: std::string::String,
8416
8417    /// Project ID of the Cloud SQL project.
8418    pub project: std::string::String,
8419
8420    pub body: std::option::Option<crate::model::InstancesTruncateLogRequest>,
8421
8422    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8423}
8424
8425impl SqlInstancesTruncateLogRequest {
8426    pub fn new() -> Self {
8427        std::default::Default::default()
8428    }
8429
8430    /// Sets the value of [instance][crate::model::SqlInstancesTruncateLogRequest::instance].
8431    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8432        self.instance = v.into();
8433        self
8434    }
8435
8436    /// Sets the value of [project][crate::model::SqlInstancesTruncateLogRequest::project].
8437    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8438        self.project = v.into();
8439        self
8440    }
8441
8442    /// Sets the value of [body][crate::model::SqlInstancesTruncateLogRequest::body].
8443    pub fn set_body<T>(mut self, v: T) -> Self
8444    where
8445        T: std::convert::Into<crate::model::InstancesTruncateLogRequest>,
8446    {
8447        self.body = std::option::Option::Some(v.into());
8448        self
8449    }
8450
8451    /// Sets or clears the value of [body][crate::model::SqlInstancesTruncateLogRequest::body].
8452    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
8453    where
8454        T: std::convert::Into<crate::model::InstancesTruncateLogRequest>,
8455    {
8456        self.body = v.map(|x| x.into());
8457        self
8458    }
8459}
8460
8461impl wkt::message::Message for SqlInstancesTruncateLogRequest {
8462    fn typename() -> &'static str {
8463        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesTruncateLogRequest"
8464    }
8465}
8466
8467#[doc(hidden)]
8468impl<'de> serde::de::Deserialize<'de> for SqlInstancesTruncateLogRequest {
8469    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8470    where
8471        D: serde::Deserializer<'de>,
8472    {
8473        #[allow(non_camel_case_types)]
8474        #[doc(hidden)]
8475        #[derive(PartialEq, Eq, Hash)]
8476        enum __FieldTag {
8477            __instance,
8478            __project,
8479            __body,
8480            Unknown(std::string::String),
8481        }
8482        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8483            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8484            where
8485                D: serde::Deserializer<'de>,
8486            {
8487                struct Visitor;
8488                impl<'de> serde::de::Visitor<'de> for Visitor {
8489                    type Value = __FieldTag;
8490                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8491                        formatter.write_str("a field name for SqlInstancesTruncateLogRequest")
8492                    }
8493                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8494                    where
8495                        E: serde::de::Error,
8496                    {
8497                        use std::result::Result::Ok;
8498                        use std::string::ToString;
8499                        match value {
8500                            "instance" => Ok(__FieldTag::__instance),
8501                            "project" => Ok(__FieldTag::__project),
8502                            "body" => Ok(__FieldTag::__body),
8503                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8504                        }
8505                    }
8506                }
8507                deserializer.deserialize_identifier(Visitor)
8508            }
8509        }
8510        struct Visitor;
8511        impl<'de> serde::de::Visitor<'de> for Visitor {
8512            type Value = SqlInstancesTruncateLogRequest;
8513            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8514                formatter.write_str("struct SqlInstancesTruncateLogRequest")
8515            }
8516            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8517            where
8518                A: serde::de::MapAccess<'de>,
8519            {
8520                #[allow(unused_imports)]
8521                use serde::de::Error;
8522                use std::option::Option::Some;
8523                let mut fields = std::collections::HashSet::new();
8524                let mut result = Self::Value::new();
8525                while let Some(tag) = map.next_key::<__FieldTag>()? {
8526                    #[allow(clippy::match_single_binding)]
8527                    match tag {
8528                        __FieldTag::__instance => {
8529                            if !fields.insert(__FieldTag::__instance) {
8530                                return std::result::Result::Err(A::Error::duplicate_field(
8531                                    "multiple values for instance",
8532                                ));
8533                            }
8534                            result.instance = map
8535                                .next_value::<std::option::Option<std::string::String>>()?
8536                                .unwrap_or_default();
8537                        }
8538                        __FieldTag::__project => {
8539                            if !fields.insert(__FieldTag::__project) {
8540                                return std::result::Result::Err(A::Error::duplicate_field(
8541                                    "multiple values for project",
8542                                ));
8543                            }
8544                            result.project = map
8545                                .next_value::<std::option::Option<std::string::String>>()?
8546                                .unwrap_or_default();
8547                        }
8548                        __FieldTag::__body => {
8549                            if !fields.insert(__FieldTag::__body) {
8550                                return std::result::Result::Err(A::Error::duplicate_field(
8551                                    "multiple values for body",
8552                                ));
8553                            }
8554                            result.body = map.next_value::<std::option::Option<crate::model::InstancesTruncateLogRequest>>()?
8555                                ;
8556                        }
8557                        __FieldTag::Unknown(key) => {
8558                            let value = map.next_value::<serde_json::Value>()?;
8559                            result._unknown_fields.insert(key, value);
8560                        }
8561                    }
8562                }
8563                std::result::Result::Ok(result)
8564            }
8565        }
8566        deserializer.deserialize_any(Visitor)
8567    }
8568}
8569
8570#[doc(hidden)]
8571impl serde::ser::Serialize for SqlInstancesTruncateLogRequest {
8572    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8573    where
8574        S: serde::ser::Serializer,
8575    {
8576        use serde::ser::SerializeMap;
8577        #[allow(unused_imports)]
8578        use std::option::Option::Some;
8579        let mut state = serializer.serialize_map(std::option::Option::None)?;
8580        if !self.instance.is_empty() {
8581            state.serialize_entry("instance", &self.instance)?;
8582        }
8583        if !self.project.is_empty() {
8584            state.serialize_entry("project", &self.project)?;
8585        }
8586        if self.body.is_some() {
8587            state.serialize_entry("body", &self.body)?;
8588        }
8589        if !self._unknown_fields.is_empty() {
8590            for (key, value) in self._unknown_fields.iter() {
8591                state.serialize_entry(key, &value)?;
8592            }
8593        }
8594        state.end()
8595    }
8596}
8597
8598/// Instance perform disk shrink request.
8599#[derive(Clone, Debug, Default, PartialEq)]
8600#[non_exhaustive]
8601pub struct SqlInstancesPerformDiskShrinkRequest {
8602    /// Cloud SQL instance ID. This does not include the project ID.
8603    pub instance: std::string::String,
8604
8605    /// Project ID of the project that contains the instance.
8606    pub project: std::string::String,
8607
8608    /// Perform disk shrink context.
8609    pub body: std::option::Option<crate::model::PerformDiskShrinkContext>,
8610
8611    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8612}
8613
8614impl SqlInstancesPerformDiskShrinkRequest {
8615    pub fn new() -> Self {
8616        std::default::Default::default()
8617    }
8618
8619    /// Sets the value of [instance][crate::model::SqlInstancesPerformDiskShrinkRequest::instance].
8620    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8621        self.instance = v.into();
8622        self
8623    }
8624
8625    /// Sets the value of [project][crate::model::SqlInstancesPerformDiskShrinkRequest::project].
8626    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8627        self.project = v.into();
8628        self
8629    }
8630
8631    /// Sets the value of [body][crate::model::SqlInstancesPerformDiskShrinkRequest::body].
8632    pub fn set_body<T>(mut self, v: T) -> Self
8633    where
8634        T: std::convert::Into<crate::model::PerformDiskShrinkContext>,
8635    {
8636        self.body = std::option::Option::Some(v.into());
8637        self
8638    }
8639
8640    /// Sets or clears the value of [body][crate::model::SqlInstancesPerformDiskShrinkRequest::body].
8641    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
8642    where
8643        T: std::convert::Into<crate::model::PerformDiskShrinkContext>,
8644    {
8645        self.body = v.map(|x| x.into());
8646        self
8647    }
8648}
8649
8650impl wkt::message::Message for SqlInstancesPerformDiskShrinkRequest {
8651    fn typename() -> &'static str {
8652        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest"
8653    }
8654}
8655
8656#[doc(hidden)]
8657impl<'de> serde::de::Deserialize<'de> for SqlInstancesPerformDiskShrinkRequest {
8658    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8659    where
8660        D: serde::Deserializer<'de>,
8661    {
8662        #[allow(non_camel_case_types)]
8663        #[doc(hidden)]
8664        #[derive(PartialEq, Eq, Hash)]
8665        enum __FieldTag {
8666            __instance,
8667            __project,
8668            __body,
8669            Unknown(std::string::String),
8670        }
8671        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8672            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8673            where
8674                D: serde::Deserializer<'de>,
8675            {
8676                struct Visitor;
8677                impl<'de> serde::de::Visitor<'de> for Visitor {
8678                    type Value = __FieldTag;
8679                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8680                        formatter.write_str("a field name for SqlInstancesPerformDiskShrinkRequest")
8681                    }
8682                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8683                    where
8684                        E: serde::de::Error,
8685                    {
8686                        use std::result::Result::Ok;
8687                        use std::string::ToString;
8688                        match value {
8689                            "instance" => Ok(__FieldTag::__instance),
8690                            "project" => Ok(__FieldTag::__project),
8691                            "body" => Ok(__FieldTag::__body),
8692                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8693                        }
8694                    }
8695                }
8696                deserializer.deserialize_identifier(Visitor)
8697            }
8698        }
8699        struct Visitor;
8700        impl<'de> serde::de::Visitor<'de> for Visitor {
8701            type Value = SqlInstancesPerformDiskShrinkRequest;
8702            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8703                formatter.write_str("struct SqlInstancesPerformDiskShrinkRequest")
8704            }
8705            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8706            where
8707                A: serde::de::MapAccess<'de>,
8708            {
8709                #[allow(unused_imports)]
8710                use serde::de::Error;
8711                use std::option::Option::Some;
8712                let mut fields = std::collections::HashSet::new();
8713                let mut result = Self::Value::new();
8714                while let Some(tag) = map.next_key::<__FieldTag>()? {
8715                    #[allow(clippy::match_single_binding)]
8716                    match tag {
8717                        __FieldTag::__instance => {
8718                            if !fields.insert(__FieldTag::__instance) {
8719                                return std::result::Result::Err(A::Error::duplicate_field(
8720                                    "multiple values for instance",
8721                                ));
8722                            }
8723                            result.instance = map
8724                                .next_value::<std::option::Option<std::string::String>>()?
8725                                .unwrap_or_default();
8726                        }
8727                        __FieldTag::__project => {
8728                            if !fields.insert(__FieldTag::__project) {
8729                                return std::result::Result::Err(A::Error::duplicate_field(
8730                                    "multiple values for project",
8731                                ));
8732                            }
8733                            result.project = map
8734                                .next_value::<std::option::Option<std::string::String>>()?
8735                                .unwrap_or_default();
8736                        }
8737                        __FieldTag::__body => {
8738                            if !fields.insert(__FieldTag::__body) {
8739                                return std::result::Result::Err(A::Error::duplicate_field(
8740                                    "multiple values for body",
8741                                ));
8742                            }
8743                            result.body = map.next_value::<std::option::Option<crate::model::PerformDiskShrinkContext>>()?
8744                                ;
8745                        }
8746                        __FieldTag::Unknown(key) => {
8747                            let value = map.next_value::<serde_json::Value>()?;
8748                            result._unknown_fields.insert(key, value);
8749                        }
8750                    }
8751                }
8752                std::result::Result::Ok(result)
8753            }
8754        }
8755        deserializer.deserialize_any(Visitor)
8756    }
8757}
8758
8759#[doc(hidden)]
8760impl serde::ser::Serialize for SqlInstancesPerformDiskShrinkRequest {
8761    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8762    where
8763        S: serde::ser::Serializer,
8764    {
8765        use serde::ser::SerializeMap;
8766        #[allow(unused_imports)]
8767        use std::option::Option::Some;
8768        let mut state = serializer.serialize_map(std::option::Option::None)?;
8769        if !self.instance.is_empty() {
8770            state.serialize_entry("instance", &self.instance)?;
8771        }
8772        if !self.project.is_empty() {
8773            state.serialize_entry("project", &self.project)?;
8774        }
8775        if self.body.is_some() {
8776            state.serialize_entry("body", &self.body)?;
8777        }
8778        if !self._unknown_fields.is_empty() {
8779            for (key, value) in self._unknown_fields.iter() {
8780                state.serialize_entry(key, &value)?;
8781            }
8782        }
8783        state.end()
8784    }
8785}
8786
8787/// Instance update request.
8788#[derive(Clone, Debug, Default, PartialEq)]
8789#[non_exhaustive]
8790pub struct SqlInstancesUpdateRequest {
8791    /// Cloud SQL instance ID. This does not include the project ID.
8792    pub instance: std::string::String,
8793
8794    /// Project ID of the project that contains the instance.
8795    pub project: std::string::String,
8796
8797    pub body: std::option::Option<crate::model::DatabaseInstance>,
8798
8799    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8800}
8801
8802impl SqlInstancesUpdateRequest {
8803    pub fn new() -> Self {
8804        std::default::Default::default()
8805    }
8806
8807    /// Sets the value of [instance][crate::model::SqlInstancesUpdateRequest::instance].
8808    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8809        self.instance = v.into();
8810        self
8811    }
8812
8813    /// Sets the value of [project][crate::model::SqlInstancesUpdateRequest::project].
8814    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8815        self.project = v.into();
8816        self
8817    }
8818
8819    /// Sets the value of [body][crate::model::SqlInstancesUpdateRequest::body].
8820    pub fn set_body<T>(mut self, v: T) -> Self
8821    where
8822        T: std::convert::Into<crate::model::DatabaseInstance>,
8823    {
8824        self.body = std::option::Option::Some(v.into());
8825        self
8826    }
8827
8828    /// Sets or clears the value of [body][crate::model::SqlInstancesUpdateRequest::body].
8829    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
8830    where
8831        T: std::convert::Into<crate::model::DatabaseInstance>,
8832    {
8833        self.body = v.map(|x| x.into());
8834        self
8835    }
8836}
8837
8838impl wkt::message::Message for SqlInstancesUpdateRequest {
8839    fn typename() -> &'static str {
8840        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesUpdateRequest"
8841    }
8842}
8843
8844#[doc(hidden)]
8845impl<'de> serde::de::Deserialize<'de> for SqlInstancesUpdateRequest {
8846    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8847    where
8848        D: serde::Deserializer<'de>,
8849    {
8850        #[allow(non_camel_case_types)]
8851        #[doc(hidden)]
8852        #[derive(PartialEq, Eq, Hash)]
8853        enum __FieldTag {
8854            __instance,
8855            __project,
8856            __body,
8857            Unknown(std::string::String),
8858        }
8859        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8860            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8861            where
8862                D: serde::Deserializer<'de>,
8863            {
8864                struct Visitor;
8865                impl<'de> serde::de::Visitor<'de> for Visitor {
8866                    type Value = __FieldTag;
8867                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8868                        formatter.write_str("a field name for SqlInstancesUpdateRequest")
8869                    }
8870                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8871                    where
8872                        E: serde::de::Error,
8873                    {
8874                        use std::result::Result::Ok;
8875                        use std::string::ToString;
8876                        match value {
8877                            "instance" => Ok(__FieldTag::__instance),
8878                            "project" => Ok(__FieldTag::__project),
8879                            "body" => Ok(__FieldTag::__body),
8880                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8881                        }
8882                    }
8883                }
8884                deserializer.deserialize_identifier(Visitor)
8885            }
8886        }
8887        struct Visitor;
8888        impl<'de> serde::de::Visitor<'de> for Visitor {
8889            type Value = SqlInstancesUpdateRequest;
8890            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8891                formatter.write_str("struct SqlInstancesUpdateRequest")
8892            }
8893            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8894            where
8895                A: serde::de::MapAccess<'de>,
8896            {
8897                #[allow(unused_imports)]
8898                use serde::de::Error;
8899                use std::option::Option::Some;
8900                let mut fields = std::collections::HashSet::new();
8901                let mut result = Self::Value::new();
8902                while let Some(tag) = map.next_key::<__FieldTag>()? {
8903                    #[allow(clippy::match_single_binding)]
8904                    match tag {
8905                        __FieldTag::__instance => {
8906                            if !fields.insert(__FieldTag::__instance) {
8907                                return std::result::Result::Err(A::Error::duplicate_field(
8908                                    "multiple values for instance",
8909                                ));
8910                            }
8911                            result.instance = map
8912                                .next_value::<std::option::Option<std::string::String>>()?
8913                                .unwrap_or_default();
8914                        }
8915                        __FieldTag::__project => {
8916                            if !fields.insert(__FieldTag::__project) {
8917                                return std::result::Result::Err(A::Error::duplicate_field(
8918                                    "multiple values for project",
8919                                ));
8920                            }
8921                            result.project = map
8922                                .next_value::<std::option::Option<std::string::String>>()?
8923                                .unwrap_or_default();
8924                        }
8925                        __FieldTag::__body => {
8926                            if !fields.insert(__FieldTag::__body) {
8927                                return std::result::Result::Err(A::Error::duplicate_field(
8928                                    "multiple values for body",
8929                                ));
8930                            }
8931                            result.body = map
8932                                .next_value::<std::option::Option<crate::model::DatabaseInstance>>(
8933                                )?;
8934                        }
8935                        __FieldTag::Unknown(key) => {
8936                            let value = map.next_value::<serde_json::Value>()?;
8937                            result._unknown_fields.insert(key, value);
8938                        }
8939                    }
8940                }
8941                std::result::Result::Ok(result)
8942            }
8943        }
8944        deserializer.deserialize_any(Visitor)
8945    }
8946}
8947
8948#[doc(hidden)]
8949impl serde::ser::Serialize for SqlInstancesUpdateRequest {
8950    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8951    where
8952        S: serde::ser::Serializer,
8953    {
8954        use serde::ser::SerializeMap;
8955        #[allow(unused_imports)]
8956        use std::option::Option::Some;
8957        let mut state = serializer.serialize_map(std::option::Option::None)?;
8958        if !self.instance.is_empty() {
8959            state.serialize_entry("instance", &self.instance)?;
8960        }
8961        if !self.project.is_empty() {
8962            state.serialize_entry("project", &self.project)?;
8963        }
8964        if self.body.is_some() {
8965            state.serialize_entry("body", &self.body)?;
8966        }
8967        if !self._unknown_fields.is_empty() {
8968            for (key, value) in self._unknown_fields.iter() {
8969                state.serialize_entry(key, &value)?;
8970            }
8971        }
8972        state.end()
8973    }
8974}
8975
8976/// Instance reschedule maintenance request.
8977#[derive(Clone, Debug, Default, PartialEq)]
8978#[non_exhaustive]
8979pub struct SqlInstancesRescheduleMaintenanceRequest {
8980    /// Cloud SQL instance ID. This does not include the project ID.
8981    pub instance: std::string::String,
8982
8983    /// ID of the project that contains the instance.
8984    pub project: std::string::String,
8985
8986    pub body: std::option::Option<crate::model::SqlInstancesRescheduleMaintenanceRequestBody>,
8987
8988    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8989}
8990
8991impl SqlInstancesRescheduleMaintenanceRequest {
8992    pub fn new() -> Self {
8993        std::default::Default::default()
8994    }
8995
8996    /// Sets the value of [instance][crate::model::SqlInstancesRescheduleMaintenanceRequest::instance].
8997    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8998        self.instance = v.into();
8999        self
9000    }
9001
9002    /// Sets the value of [project][crate::model::SqlInstancesRescheduleMaintenanceRequest::project].
9003    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9004        self.project = v.into();
9005        self
9006    }
9007
9008    /// Sets the value of [body][crate::model::SqlInstancesRescheduleMaintenanceRequest::body].
9009    pub fn set_body<T>(mut self, v: T) -> Self
9010    where
9011        T: std::convert::Into<crate::model::SqlInstancesRescheduleMaintenanceRequestBody>,
9012    {
9013        self.body = std::option::Option::Some(v.into());
9014        self
9015    }
9016
9017    /// Sets or clears the value of [body][crate::model::SqlInstancesRescheduleMaintenanceRequest::body].
9018    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
9019    where
9020        T: std::convert::Into<crate::model::SqlInstancesRescheduleMaintenanceRequestBody>,
9021    {
9022        self.body = v.map(|x| x.into());
9023        self
9024    }
9025}
9026
9027impl wkt::message::Message for SqlInstancesRescheduleMaintenanceRequest {
9028    fn typename() -> &'static str {
9029        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest"
9030    }
9031}
9032
9033#[doc(hidden)]
9034impl<'de> serde::de::Deserialize<'de> for SqlInstancesRescheduleMaintenanceRequest {
9035    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9036    where
9037        D: serde::Deserializer<'de>,
9038    {
9039        #[allow(non_camel_case_types)]
9040        #[doc(hidden)]
9041        #[derive(PartialEq, Eq, Hash)]
9042        enum __FieldTag {
9043            __instance,
9044            __project,
9045            __body,
9046            Unknown(std::string::String),
9047        }
9048        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9049            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9050            where
9051                D: serde::Deserializer<'de>,
9052            {
9053                struct Visitor;
9054                impl<'de> serde::de::Visitor<'de> for Visitor {
9055                    type Value = __FieldTag;
9056                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9057                        formatter
9058                            .write_str("a field name for SqlInstancesRescheduleMaintenanceRequest")
9059                    }
9060                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9061                    where
9062                        E: serde::de::Error,
9063                    {
9064                        use std::result::Result::Ok;
9065                        use std::string::ToString;
9066                        match value {
9067                            "instance" => Ok(__FieldTag::__instance),
9068                            "project" => Ok(__FieldTag::__project),
9069                            "body" => Ok(__FieldTag::__body),
9070                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9071                        }
9072                    }
9073                }
9074                deserializer.deserialize_identifier(Visitor)
9075            }
9076        }
9077        struct Visitor;
9078        impl<'de> serde::de::Visitor<'de> for Visitor {
9079            type Value = SqlInstancesRescheduleMaintenanceRequest;
9080            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9081                formatter.write_str("struct SqlInstancesRescheduleMaintenanceRequest")
9082            }
9083            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9084            where
9085                A: serde::de::MapAccess<'de>,
9086            {
9087                #[allow(unused_imports)]
9088                use serde::de::Error;
9089                use std::option::Option::Some;
9090                let mut fields = std::collections::HashSet::new();
9091                let mut result = Self::Value::new();
9092                while let Some(tag) = map.next_key::<__FieldTag>()? {
9093                    #[allow(clippy::match_single_binding)]
9094                    match tag {
9095                        __FieldTag::__instance => {
9096                            if !fields.insert(__FieldTag::__instance) {
9097                                return std::result::Result::Err(A::Error::duplicate_field(
9098                                    "multiple values for instance",
9099                                ));
9100                            }
9101                            result.instance = map
9102                                .next_value::<std::option::Option<std::string::String>>()?
9103                                .unwrap_or_default();
9104                        }
9105                        __FieldTag::__project => {
9106                            if !fields.insert(__FieldTag::__project) {
9107                                return std::result::Result::Err(A::Error::duplicate_field(
9108                                    "multiple values for project",
9109                                ));
9110                            }
9111                            result.project = map
9112                                .next_value::<std::option::Option<std::string::String>>()?
9113                                .unwrap_or_default();
9114                        }
9115                        __FieldTag::__body => {
9116                            if !fields.insert(__FieldTag::__body) {
9117                                return std::result::Result::Err(A::Error::duplicate_field(
9118                                    "multiple values for body",
9119                                ));
9120                            }
9121                            result.body = map.next_value::<std::option::Option<
9122                                crate::model::SqlInstancesRescheduleMaintenanceRequestBody,
9123                            >>()?;
9124                        }
9125                        __FieldTag::Unknown(key) => {
9126                            let value = map.next_value::<serde_json::Value>()?;
9127                            result._unknown_fields.insert(key, value);
9128                        }
9129                    }
9130                }
9131                std::result::Result::Ok(result)
9132            }
9133        }
9134        deserializer.deserialize_any(Visitor)
9135    }
9136}
9137
9138#[doc(hidden)]
9139impl serde::ser::Serialize for SqlInstancesRescheduleMaintenanceRequest {
9140    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9141    where
9142        S: serde::ser::Serializer,
9143    {
9144        use serde::ser::SerializeMap;
9145        #[allow(unused_imports)]
9146        use std::option::Option::Some;
9147        let mut state = serializer.serialize_map(std::option::Option::None)?;
9148        if !self.instance.is_empty() {
9149            state.serialize_entry("instance", &self.instance)?;
9150        }
9151        if !self.project.is_empty() {
9152            state.serialize_entry("project", &self.project)?;
9153        }
9154        if self.body.is_some() {
9155            state.serialize_entry("body", &self.body)?;
9156        }
9157        if !self._unknown_fields.is_empty() {
9158            for (key, value) in self._unknown_fields.iter() {
9159                state.serialize_entry(key, &value)?;
9160            }
9161        }
9162        state.end()
9163    }
9164}
9165
9166/// Instance reencrypt request.
9167#[derive(Clone, Debug, Default, PartialEq)]
9168#[non_exhaustive]
9169pub struct SqlInstancesReencryptRequest {
9170    /// Cloud SQL instance ID. This does not include the project ID.
9171    pub instance: std::string::String,
9172
9173    /// ID of the project that contains the instance.
9174    pub project: std::string::String,
9175
9176    /// Reencrypt body that users request
9177    pub body: std::option::Option<crate::model::InstancesReencryptRequest>,
9178
9179    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9180}
9181
9182impl SqlInstancesReencryptRequest {
9183    pub fn new() -> Self {
9184        std::default::Default::default()
9185    }
9186
9187    /// Sets the value of [instance][crate::model::SqlInstancesReencryptRequest::instance].
9188    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9189        self.instance = v.into();
9190        self
9191    }
9192
9193    /// Sets the value of [project][crate::model::SqlInstancesReencryptRequest::project].
9194    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9195        self.project = v.into();
9196        self
9197    }
9198
9199    /// Sets the value of [body][crate::model::SqlInstancesReencryptRequest::body].
9200    pub fn set_body<T>(mut self, v: T) -> Self
9201    where
9202        T: std::convert::Into<crate::model::InstancesReencryptRequest>,
9203    {
9204        self.body = std::option::Option::Some(v.into());
9205        self
9206    }
9207
9208    /// Sets or clears the value of [body][crate::model::SqlInstancesReencryptRequest::body].
9209    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
9210    where
9211        T: std::convert::Into<crate::model::InstancesReencryptRequest>,
9212    {
9213        self.body = v.map(|x| x.into());
9214        self
9215    }
9216}
9217
9218impl wkt::message::Message for SqlInstancesReencryptRequest {
9219    fn typename() -> &'static str {
9220        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesReencryptRequest"
9221    }
9222}
9223
9224#[doc(hidden)]
9225impl<'de> serde::de::Deserialize<'de> for SqlInstancesReencryptRequest {
9226    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9227    where
9228        D: serde::Deserializer<'de>,
9229    {
9230        #[allow(non_camel_case_types)]
9231        #[doc(hidden)]
9232        #[derive(PartialEq, Eq, Hash)]
9233        enum __FieldTag {
9234            __instance,
9235            __project,
9236            __body,
9237            Unknown(std::string::String),
9238        }
9239        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9240            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9241            where
9242                D: serde::Deserializer<'de>,
9243            {
9244                struct Visitor;
9245                impl<'de> serde::de::Visitor<'de> for Visitor {
9246                    type Value = __FieldTag;
9247                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9248                        formatter.write_str("a field name for SqlInstancesReencryptRequest")
9249                    }
9250                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9251                    where
9252                        E: serde::de::Error,
9253                    {
9254                        use std::result::Result::Ok;
9255                        use std::string::ToString;
9256                        match value {
9257                            "instance" => Ok(__FieldTag::__instance),
9258                            "project" => Ok(__FieldTag::__project),
9259                            "body" => Ok(__FieldTag::__body),
9260                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9261                        }
9262                    }
9263                }
9264                deserializer.deserialize_identifier(Visitor)
9265            }
9266        }
9267        struct Visitor;
9268        impl<'de> serde::de::Visitor<'de> for Visitor {
9269            type Value = SqlInstancesReencryptRequest;
9270            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9271                formatter.write_str("struct SqlInstancesReencryptRequest")
9272            }
9273            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9274            where
9275                A: serde::de::MapAccess<'de>,
9276            {
9277                #[allow(unused_imports)]
9278                use serde::de::Error;
9279                use std::option::Option::Some;
9280                let mut fields = std::collections::HashSet::new();
9281                let mut result = Self::Value::new();
9282                while let Some(tag) = map.next_key::<__FieldTag>()? {
9283                    #[allow(clippy::match_single_binding)]
9284                    match tag {
9285                        __FieldTag::__instance => {
9286                            if !fields.insert(__FieldTag::__instance) {
9287                                return std::result::Result::Err(A::Error::duplicate_field(
9288                                    "multiple values for instance",
9289                                ));
9290                            }
9291                            result.instance = map
9292                                .next_value::<std::option::Option<std::string::String>>()?
9293                                .unwrap_or_default();
9294                        }
9295                        __FieldTag::__project => {
9296                            if !fields.insert(__FieldTag::__project) {
9297                                return std::result::Result::Err(A::Error::duplicate_field(
9298                                    "multiple values for project",
9299                                ));
9300                            }
9301                            result.project = map
9302                                .next_value::<std::option::Option<std::string::String>>()?
9303                                .unwrap_or_default();
9304                        }
9305                        __FieldTag::__body => {
9306                            if !fields.insert(__FieldTag::__body) {
9307                                return std::result::Result::Err(A::Error::duplicate_field(
9308                                    "multiple values for body",
9309                                ));
9310                            }
9311                            result.body = map.next_value::<std::option::Option<crate::model::InstancesReencryptRequest>>()?
9312                                ;
9313                        }
9314                        __FieldTag::Unknown(key) => {
9315                            let value = map.next_value::<serde_json::Value>()?;
9316                            result._unknown_fields.insert(key, value);
9317                        }
9318                    }
9319                }
9320                std::result::Result::Ok(result)
9321            }
9322        }
9323        deserializer.deserialize_any(Visitor)
9324    }
9325}
9326
9327#[doc(hidden)]
9328impl serde::ser::Serialize for SqlInstancesReencryptRequest {
9329    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9330    where
9331        S: serde::ser::Serializer,
9332    {
9333        use serde::ser::SerializeMap;
9334        #[allow(unused_imports)]
9335        use std::option::Option::Some;
9336        let mut state = serializer.serialize_map(std::option::Option::None)?;
9337        if !self.instance.is_empty() {
9338            state.serialize_entry("instance", &self.instance)?;
9339        }
9340        if !self.project.is_empty() {
9341            state.serialize_entry("project", &self.project)?;
9342        }
9343        if self.body.is_some() {
9344            state.serialize_entry("body", &self.body)?;
9345        }
9346        if !self._unknown_fields.is_empty() {
9347            for (key, value) in self._unknown_fields.iter() {
9348                state.serialize_entry(key, &value)?;
9349            }
9350        }
9351        state.end()
9352    }
9353}
9354
9355/// Database Instance reencrypt request.
9356#[derive(Clone, Debug, Default, PartialEq)]
9357#[non_exhaustive]
9358pub struct InstancesReencryptRequest {
9359    /// Configuration specific to backup re-encryption
9360    pub backup_reencryption_config: std::option::Option<crate::model::BackupReencryptionConfig>,
9361
9362    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9363}
9364
9365impl InstancesReencryptRequest {
9366    pub fn new() -> Self {
9367        std::default::Default::default()
9368    }
9369
9370    /// Sets the value of [backup_reencryption_config][crate::model::InstancesReencryptRequest::backup_reencryption_config].
9371    pub fn set_backup_reencryption_config<T>(mut self, v: T) -> Self
9372    where
9373        T: std::convert::Into<crate::model::BackupReencryptionConfig>,
9374    {
9375        self.backup_reencryption_config = std::option::Option::Some(v.into());
9376        self
9377    }
9378
9379    /// Sets or clears the value of [backup_reencryption_config][crate::model::InstancesReencryptRequest::backup_reencryption_config].
9380    pub fn set_or_clear_backup_reencryption_config<T>(mut self, v: std::option::Option<T>) -> Self
9381    where
9382        T: std::convert::Into<crate::model::BackupReencryptionConfig>,
9383    {
9384        self.backup_reencryption_config = v.map(|x| x.into());
9385        self
9386    }
9387}
9388
9389impl wkt::message::Message for InstancesReencryptRequest {
9390    fn typename() -> &'static str {
9391        "type.googleapis.com/google.cloud.sql.v1.InstancesReencryptRequest"
9392    }
9393}
9394
9395#[doc(hidden)]
9396impl<'de> serde::de::Deserialize<'de> for InstancesReencryptRequest {
9397    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9398    where
9399        D: serde::Deserializer<'de>,
9400    {
9401        #[allow(non_camel_case_types)]
9402        #[doc(hidden)]
9403        #[derive(PartialEq, Eq, Hash)]
9404        enum __FieldTag {
9405            __backup_reencryption_config,
9406            Unknown(std::string::String),
9407        }
9408        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9409            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9410            where
9411                D: serde::Deserializer<'de>,
9412            {
9413                struct Visitor;
9414                impl<'de> serde::de::Visitor<'de> for Visitor {
9415                    type Value = __FieldTag;
9416                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9417                        formatter.write_str("a field name for InstancesReencryptRequest")
9418                    }
9419                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9420                    where
9421                        E: serde::de::Error,
9422                    {
9423                        use std::result::Result::Ok;
9424                        use std::string::ToString;
9425                        match value {
9426                            "backupReencryptionConfig" => {
9427                                Ok(__FieldTag::__backup_reencryption_config)
9428                            }
9429                            "backup_reencryption_config" => {
9430                                Ok(__FieldTag::__backup_reencryption_config)
9431                            }
9432                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9433                        }
9434                    }
9435                }
9436                deserializer.deserialize_identifier(Visitor)
9437            }
9438        }
9439        struct Visitor;
9440        impl<'de> serde::de::Visitor<'de> for Visitor {
9441            type Value = InstancesReencryptRequest;
9442            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9443                formatter.write_str("struct InstancesReencryptRequest")
9444            }
9445            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9446            where
9447                A: serde::de::MapAccess<'de>,
9448            {
9449                #[allow(unused_imports)]
9450                use serde::de::Error;
9451                use std::option::Option::Some;
9452                let mut fields = std::collections::HashSet::new();
9453                let mut result = Self::Value::new();
9454                while let Some(tag) = map.next_key::<__FieldTag>()? {
9455                    #[allow(clippy::match_single_binding)]
9456                    match tag {
9457                        __FieldTag::__backup_reencryption_config => {
9458                            if !fields.insert(__FieldTag::__backup_reencryption_config) {
9459                                return std::result::Result::Err(A::Error::duplicate_field(
9460                                    "multiple values for backup_reencryption_config",
9461                                ));
9462                            }
9463                            result.backup_reencryption_config = map.next_value::<std::option::Option<crate::model::BackupReencryptionConfig>>()?
9464                                ;
9465                        }
9466                        __FieldTag::Unknown(key) => {
9467                            let value = map.next_value::<serde_json::Value>()?;
9468                            result._unknown_fields.insert(key, value);
9469                        }
9470                    }
9471                }
9472                std::result::Result::Ok(result)
9473            }
9474        }
9475        deserializer.deserialize_any(Visitor)
9476    }
9477}
9478
9479#[doc(hidden)]
9480impl serde::ser::Serialize for InstancesReencryptRequest {
9481    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9482    where
9483        S: serde::ser::Serializer,
9484    {
9485        use serde::ser::SerializeMap;
9486        #[allow(unused_imports)]
9487        use std::option::Option::Some;
9488        let mut state = serializer.serialize_map(std::option::Option::None)?;
9489        if self.backup_reencryption_config.is_some() {
9490            state.serialize_entry("backupReencryptionConfig", &self.backup_reencryption_config)?;
9491        }
9492        if !self._unknown_fields.is_empty() {
9493            for (key, value) in self._unknown_fields.iter() {
9494                state.serialize_entry(key, &value)?;
9495            }
9496        }
9497        state.end()
9498    }
9499}
9500
9501/// Backup Reencryption Config
9502#[derive(Clone, Debug, Default, PartialEq)]
9503#[non_exhaustive]
9504pub struct BackupReencryptionConfig {
9505    /// Backup re-encryption limit
9506    pub backup_limit: std::option::Option<i32>,
9507
9508    /// Type of backups users want to re-encrypt.
9509    pub backup_type: std::option::Option<crate::model::backup_reencryption_config::BackupType>,
9510
9511    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9512}
9513
9514impl BackupReencryptionConfig {
9515    pub fn new() -> Self {
9516        std::default::Default::default()
9517    }
9518
9519    /// Sets the value of [backup_limit][crate::model::BackupReencryptionConfig::backup_limit].
9520    pub fn set_backup_limit<T>(mut self, v: T) -> Self
9521    where
9522        T: std::convert::Into<i32>,
9523    {
9524        self.backup_limit = std::option::Option::Some(v.into());
9525        self
9526    }
9527
9528    /// Sets or clears the value of [backup_limit][crate::model::BackupReencryptionConfig::backup_limit].
9529    pub fn set_or_clear_backup_limit<T>(mut self, v: std::option::Option<T>) -> Self
9530    where
9531        T: std::convert::Into<i32>,
9532    {
9533        self.backup_limit = v.map(|x| x.into());
9534        self
9535    }
9536
9537    /// Sets the value of [backup_type][crate::model::BackupReencryptionConfig::backup_type].
9538    pub fn set_backup_type<T>(mut self, v: T) -> Self
9539    where
9540        T: std::convert::Into<crate::model::backup_reencryption_config::BackupType>,
9541    {
9542        self.backup_type = std::option::Option::Some(v.into());
9543        self
9544    }
9545
9546    /// Sets or clears the value of [backup_type][crate::model::BackupReencryptionConfig::backup_type].
9547    pub fn set_or_clear_backup_type<T>(mut self, v: std::option::Option<T>) -> Self
9548    where
9549        T: std::convert::Into<crate::model::backup_reencryption_config::BackupType>,
9550    {
9551        self.backup_type = v.map(|x| x.into());
9552        self
9553    }
9554}
9555
9556impl wkt::message::Message for BackupReencryptionConfig {
9557    fn typename() -> &'static str {
9558        "type.googleapis.com/google.cloud.sql.v1.BackupReencryptionConfig"
9559    }
9560}
9561
9562#[doc(hidden)]
9563impl<'de> serde::de::Deserialize<'de> for BackupReencryptionConfig {
9564    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9565    where
9566        D: serde::Deserializer<'de>,
9567    {
9568        #[allow(non_camel_case_types)]
9569        #[doc(hidden)]
9570        #[derive(PartialEq, Eq, Hash)]
9571        enum __FieldTag {
9572            __backup_limit,
9573            __backup_type,
9574            Unknown(std::string::String),
9575        }
9576        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9577            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9578            where
9579                D: serde::Deserializer<'de>,
9580            {
9581                struct Visitor;
9582                impl<'de> serde::de::Visitor<'de> for Visitor {
9583                    type Value = __FieldTag;
9584                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9585                        formatter.write_str("a field name for BackupReencryptionConfig")
9586                    }
9587                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9588                    where
9589                        E: serde::de::Error,
9590                    {
9591                        use std::result::Result::Ok;
9592                        use std::string::ToString;
9593                        match value {
9594                            "backupLimit" => Ok(__FieldTag::__backup_limit),
9595                            "backup_limit" => Ok(__FieldTag::__backup_limit),
9596                            "backupType" => Ok(__FieldTag::__backup_type),
9597                            "backup_type" => Ok(__FieldTag::__backup_type),
9598                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9599                        }
9600                    }
9601                }
9602                deserializer.deserialize_identifier(Visitor)
9603            }
9604        }
9605        struct Visitor;
9606        impl<'de> serde::de::Visitor<'de> for Visitor {
9607            type Value = BackupReencryptionConfig;
9608            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9609                formatter.write_str("struct BackupReencryptionConfig")
9610            }
9611            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9612            where
9613                A: serde::de::MapAccess<'de>,
9614            {
9615                #[allow(unused_imports)]
9616                use serde::de::Error;
9617                use std::option::Option::Some;
9618                let mut fields = std::collections::HashSet::new();
9619                let mut result = Self::Value::new();
9620                while let Some(tag) = map.next_key::<__FieldTag>()? {
9621                    #[allow(clippy::match_single_binding)]
9622                    match tag {
9623                        __FieldTag::__backup_limit => {
9624                            if !fields.insert(__FieldTag::__backup_limit) {
9625                                return std::result::Result::Err(A::Error::duplicate_field(
9626                                    "multiple values for backup_limit",
9627                                ));
9628                            }
9629                            struct __With(std::option::Option<i32>);
9630                            impl<'de> serde::de::Deserialize<'de> for __With {
9631                                fn deserialize<D>(
9632                                    deserializer: D,
9633                                ) -> std::result::Result<Self, D::Error>
9634                                where
9635                                    D: serde::de::Deserializer<'de>,
9636                                {
9637                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
9638                                }
9639                            }
9640                            result.backup_limit = map.next_value::<__With>()?.0;
9641                        }
9642                        __FieldTag::__backup_type => {
9643                            if !fields.insert(__FieldTag::__backup_type) {
9644                                return std::result::Result::Err(A::Error::duplicate_field(
9645                                    "multiple values for backup_type",
9646                                ));
9647                            }
9648                            result.backup_type = map.next_value::<std::option::Option<
9649                                crate::model::backup_reencryption_config::BackupType,
9650                            >>()?;
9651                        }
9652                        __FieldTag::Unknown(key) => {
9653                            let value = map.next_value::<serde_json::Value>()?;
9654                            result._unknown_fields.insert(key, value);
9655                        }
9656                    }
9657                }
9658                std::result::Result::Ok(result)
9659            }
9660        }
9661        deserializer.deserialize_any(Visitor)
9662    }
9663}
9664
9665#[doc(hidden)]
9666impl serde::ser::Serialize for BackupReencryptionConfig {
9667    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9668    where
9669        S: serde::ser::Serializer,
9670    {
9671        use serde::ser::SerializeMap;
9672        #[allow(unused_imports)]
9673        use std::option::Option::Some;
9674        let mut state = serializer.serialize_map(std::option::Option::None)?;
9675        if self.backup_limit.is_some() {
9676            struct __With<'a>(&'a std::option::Option<i32>);
9677            impl<'a> serde::ser::Serialize for __With<'a> {
9678                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9679                where
9680                    S: serde::ser::Serializer,
9681                {
9682                    serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
9683                        self.0, serializer,
9684                    )
9685                }
9686            }
9687            state.serialize_entry("backupLimit", &__With(&self.backup_limit))?;
9688        }
9689        if self.backup_type.is_some() {
9690            state.serialize_entry("backupType", &self.backup_type)?;
9691        }
9692        if !self._unknown_fields.is_empty() {
9693            for (key, value) in self._unknown_fields.iter() {
9694                state.serialize_entry(key, &value)?;
9695            }
9696        }
9697        state.end()
9698    }
9699}
9700
9701/// Defines additional types related to [BackupReencryptionConfig].
9702pub mod backup_reencryption_config {
9703    #[allow(unused_imports)]
9704    use super::*;
9705
9706    /// Backup type for re-encryption
9707    ///
9708    /// # Working with unknown values
9709    ///
9710    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9711    /// additional enum variants at any time. Adding new variants is not considered
9712    /// a breaking change. Applications should write their code in anticipation of:
9713    ///
9714    /// - New values appearing in future releases of the client library, **and**
9715    /// - New values received dynamically, without application changes.
9716    ///
9717    /// Please consult the [Working with enums] section in the user guide for some
9718    /// guidelines.
9719    ///
9720    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9721    #[derive(Clone, Debug, PartialEq)]
9722    #[non_exhaustive]
9723    pub enum BackupType {
9724        /// Unknown backup type, will be defaulted to AUTOMATIC backup type
9725        Unspecified,
9726        /// Reencrypt automatic backups
9727        Automated,
9728        /// Reencrypt on-demand backups
9729        OnDemand,
9730        /// If set, the enum was initialized with an unknown value.
9731        ///
9732        /// Applications can examine the value using [BackupType::value] or
9733        /// [BackupType::name].
9734        UnknownValue(backup_type::UnknownValue),
9735    }
9736
9737    #[doc(hidden)]
9738    pub mod backup_type {
9739        #[allow(unused_imports)]
9740        use super::*;
9741        #[derive(Clone, Debug, PartialEq)]
9742        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9743    }
9744
9745    impl BackupType {
9746        /// Gets the enum value.
9747        ///
9748        /// Returns `None` if the enum contains an unknown value deserialized from
9749        /// the string representation of enums.
9750        pub fn value(&self) -> std::option::Option<i32> {
9751            match self {
9752                Self::Unspecified => std::option::Option::Some(0),
9753                Self::Automated => std::option::Option::Some(1),
9754                Self::OnDemand => std::option::Option::Some(2),
9755                Self::UnknownValue(u) => u.0.value(),
9756            }
9757        }
9758
9759        /// Gets the enum value as a string.
9760        ///
9761        /// Returns `None` if the enum contains an unknown value deserialized from
9762        /// the integer representation of enums.
9763        pub fn name(&self) -> std::option::Option<&str> {
9764            match self {
9765                Self::Unspecified => std::option::Option::Some("BACKUP_TYPE_UNSPECIFIED"),
9766                Self::Automated => std::option::Option::Some("AUTOMATED"),
9767                Self::OnDemand => std::option::Option::Some("ON_DEMAND"),
9768                Self::UnknownValue(u) => u.0.name(),
9769            }
9770        }
9771    }
9772
9773    impl std::default::Default for BackupType {
9774        fn default() -> Self {
9775            use std::convert::From;
9776            Self::from(0)
9777        }
9778    }
9779
9780    impl std::fmt::Display for BackupType {
9781        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9782            wkt::internal::display_enum(f, self.name(), self.value())
9783        }
9784    }
9785
9786    impl std::convert::From<i32> for BackupType {
9787        fn from(value: i32) -> Self {
9788            match value {
9789                0 => Self::Unspecified,
9790                1 => Self::Automated,
9791                2 => Self::OnDemand,
9792                _ => Self::UnknownValue(backup_type::UnknownValue(
9793                    wkt::internal::UnknownEnumValue::Integer(value),
9794                )),
9795            }
9796        }
9797    }
9798
9799    impl std::convert::From<&str> for BackupType {
9800        fn from(value: &str) -> Self {
9801            use std::string::ToString;
9802            match value {
9803                "BACKUP_TYPE_UNSPECIFIED" => Self::Unspecified,
9804                "AUTOMATED" => Self::Automated,
9805                "ON_DEMAND" => Self::OnDemand,
9806                _ => Self::UnknownValue(backup_type::UnknownValue(
9807                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9808                )),
9809            }
9810        }
9811    }
9812
9813    impl serde::ser::Serialize for BackupType {
9814        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9815        where
9816            S: serde::Serializer,
9817        {
9818            match self {
9819                Self::Unspecified => serializer.serialize_i32(0),
9820                Self::Automated => serializer.serialize_i32(1),
9821                Self::OnDemand => serializer.serialize_i32(2),
9822                Self::UnknownValue(u) => u.0.serialize(serializer),
9823            }
9824        }
9825    }
9826
9827    impl<'de> serde::de::Deserialize<'de> for BackupType {
9828        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9829        where
9830            D: serde::Deserializer<'de>,
9831        {
9832            deserializer.deserialize_any(wkt::internal::EnumVisitor::<BackupType>::new(
9833                ".google.cloud.sql.v1.BackupReencryptionConfig.BackupType",
9834            ))
9835        }
9836    }
9837}
9838
9839/// Instance get disk shrink config request.
9840#[derive(Clone, Debug, Default, PartialEq)]
9841#[non_exhaustive]
9842pub struct SqlInstancesGetDiskShrinkConfigRequest {
9843    /// Cloud SQL instance ID. This does not include the project ID.
9844    pub instance: std::string::String,
9845
9846    /// Project ID of the project that contains the instance.
9847    pub project: std::string::String,
9848
9849    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9850}
9851
9852impl SqlInstancesGetDiskShrinkConfigRequest {
9853    pub fn new() -> Self {
9854        std::default::Default::default()
9855    }
9856
9857    /// Sets the value of [instance][crate::model::SqlInstancesGetDiskShrinkConfigRequest::instance].
9858    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9859        self.instance = v.into();
9860        self
9861    }
9862
9863    /// Sets the value of [project][crate::model::SqlInstancesGetDiskShrinkConfigRequest::project].
9864    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9865        self.project = v.into();
9866        self
9867    }
9868}
9869
9870impl wkt::message::Message for SqlInstancesGetDiskShrinkConfigRequest {
9871    fn typename() -> &'static str {
9872        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest"
9873    }
9874}
9875
9876#[doc(hidden)]
9877impl<'de> serde::de::Deserialize<'de> for SqlInstancesGetDiskShrinkConfigRequest {
9878    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9879    where
9880        D: serde::Deserializer<'de>,
9881    {
9882        #[allow(non_camel_case_types)]
9883        #[doc(hidden)]
9884        #[derive(PartialEq, Eq, Hash)]
9885        enum __FieldTag {
9886            __instance,
9887            __project,
9888            Unknown(std::string::String),
9889        }
9890        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9891            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9892            where
9893                D: serde::Deserializer<'de>,
9894            {
9895                struct Visitor;
9896                impl<'de> serde::de::Visitor<'de> for Visitor {
9897                    type Value = __FieldTag;
9898                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9899                        formatter
9900                            .write_str("a field name for SqlInstancesGetDiskShrinkConfigRequest")
9901                    }
9902                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9903                    where
9904                        E: serde::de::Error,
9905                    {
9906                        use std::result::Result::Ok;
9907                        use std::string::ToString;
9908                        match value {
9909                            "instance" => Ok(__FieldTag::__instance),
9910                            "project" => Ok(__FieldTag::__project),
9911                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9912                        }
9913                    }
9914                }
9915                deserializer.deserialize_identifier(Visitor)
9916            }
9917        }
9918        struct Visitor;
9919        impl<'de> serde::de::Visitor<'de> for Visitor {
9920            type Value = SqlInstancesGetDiskShrinkConfigRequest;
9921            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9922                formatter.write_str("struct SqlInstancesGetDiskShrinkConfigRequest")
9923            }
9924            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9925            where
9926                A: serde::de::MapAccess<'de>,
9927            {
9928                #[allow(unused_imports)]
9929                use serde::de::Error;
9930                use std::option::Option::Some;
9931                let mut fields = std::collections::HashSet::new();
9932                let mut result = Self::Value::new();
9933                while let Some(tag) = map.next_key::<__FieldTag>()? {
9934                    #[allow(clippy::match_single_binding)]
9935                    match tag {
9936                        __FieldTag::__instance => {
9937                            if !fields.insert(__FieldTag::__instance) {
9938                                return std::result::Result::Err(A::Error::duplicate_field(
9939                                    "multiple values for instance",
9940                                ));
9941                            }
9942                            result.instance = map
9943                                .next_value::<std::option::Option<std::string::String>>()?
9944                                .unwrap_or_default();
9945                        }
9946                        __FieldTag::__project => {
9947                            if !fields.insert(__FieldTag::__project) {
9948                                return std::result::Result::Err(A::Error::duplicate_field(
9949                                    "multiple values for project",
9950                                ));
9951                            }
9952                            result.project = map
9953                                .next_value::<std::option::Option<std::string::String>>()?
9954                                .unwrap_or_default();
9955                        }
9956                        __FieldTag::Unknown(key) => {
9957                            let value = map.next_value::<serde_json::Value>()?;
9958                            result._unknown_fields.insert(key, value);
9959                        }
9960                    }
9961                }
9962                std::result::Result::Ok(result)
9963            }
9964        }
9965        deserializer.deserialize_any(Visitor)
9966    }
9967}
9968
9969#[doc(hidden)]
9970impl serde::ser::Serialize for SqlInstancesGetDiskShrinkConfigRequest {
9971    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9972    where
9973        S: serde::ser::Serializer,
9974    {
9975        use serde::ser::SerializeMap;
9976        #[allow(unused_imports)]
9977        use std::option::Option::Some;
9978        let mut state = serializer.serialize_map(std::option::Option::None)?;
9979        if !self.instance.is_empty() {
9980            state.serialize_entry("instance", &self.instance)?;
9981        }
9982        if !self.project.is_empty() {
9983            state.serialize_entry("project", &self.project)?;
9984        }
9985        if !self._unknown_fields.is_empty() {
9986            for (key, value) in self._unknown_fields.iter() {
9987                state.serialize_entry(key, &value)?;
9988            }
9989        }
9990        state.end()
9991    }
9992}
9993
9994/// Instance verify external sync settings request.
9995#[derive(Clone, Debug, Default, PartialEq)]
9996#[non_exhaustive]
9997pub struct SqlInstancesVerifyExternalSyncSettingsRequest {
9998    /// Cloud SQL instance ID. This does not include the project ID.
9999    pub instance: std::string::String,
10000
10001    /// Project ID of the project that contains the instance.
10002    pub project: std::string::String,
10003
10004    /// Flag to enable verifying connection only
10005    pub verify_connection_only: bool,
10006
10007    /// External sync mode
10008    pub sync_mode:
10009        crate::model::sql_instances_verify_external_sync_settings_request::ExternalSyncMode,
10010
10011    /// Optional. Flag to verify settings required by replication setup only
10012    pub verify_replication_only: bool,
10013
10014    /// Optional. MigrationType configures the migration to use physical files or
10015    /// logical dump files. If not set, then the logical dump file configuration is
10016    /// used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL.
10017    pub migration_type:
10018        crate::model::sql_instances_verify_external_sync_settings_request::MigrationType,
10019
10020    /// Optional. Parallel level for initial data sync. Only applicable for
10021    /// PostgreSQL.
10022    pub sync_parallel_level: crate::model::ExternalSyncParallelLevel,
10023
10024    pub sync_config: std::option::Option<
10025        crate::model::sql_instances_verify_external_sync_settings_request::SyncConfig,
10026    >,
10027
10028    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10029}
10030
10031impl SqlInstancesVerifyExternalSyncSettingsRequest {
10032    pub fn new() -> Self {
10033        std::default::Default::default()
10034    }
10035
10036    /// Sets the value of [instance][crate::model::SqlInstancesVerifyExternalSyncSettingsRequest::instance].
10037    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10038        self.instance = v.into();
10039        self
10040    }
10041
10042    /// Sets the value of [project][crate::model::SqlInstancesVerifyExternalSyncSettingsRequest::project].
10043    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10044        self.project = v.into();
10045        self
10046    }
10047
10048    /// Sets the value of [verify_connection_only][crate::model::SqlInstancesVerifyExternalSyncSettingsRequest::verify_connection_only].
10049    pub fn set_verify_connection_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10050        self.verify_connection_only = v.into();
10051        self
10052    }
10053
10054    /// Sets the value of [sync_mode][crate::model::SqlInstancesVerifyExternalSyncSettingsRequest::sync_mode].
10055    pub fn set_sync_mode<
10056        T: std::convert::Into<
10057                crate::model::sql_instances_verify_external_sync_settings_request::ExternalSyncMode,
10058            >,
10059    >(
10060        mut self,
10061        v: T,
10062    ) -> Self {
10063        self.sync_mode = v.into();
10064        self
10065    }
10066
10067    /// Sets the value of [verify_replication_only][crate::model::SqlInstancesVerifyExternalSyncSettingsRequest::verify_replication_only].
10068    pub fn set_verify_replication_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10069        self.verify_replication_only = v.into();
10070        self
10071    }
10072
10073    /// Sets the value of [migration_type][crate::model::SqlInstancesVerifyExternalSyncSettingsRequest::migration_type].
10074    pub fn set_migration_type<
10075        T: std::convert::Into<
10076                crate::model::sql_instances_verify_external_sync_settings_request::MigrationType,
10077            >,
10078    >(
10079        mut self,
10080        v: T,
10081    ) -> Self {
10082        self.migration_type = v.into();
10083        self
10084    }
10085
10086    /// Sets the value of [sync_parallel_level][crate::model::SqlInstancesVerifyExternalSyncSettingsRequest::sync_parallel_level].
10087    pub fn set_sync_parallel_level<
10088        T: std::convert::Into<crate::model::ExternalSyncParallelLevel>,
10089    >(
10090        mut self,
10091        v: T,
10092    ) -> Self {
10093        self.sync_parallel_level = v.into();
10094        self
10095    }
10096
10097    /// Sets the value of [sync_config][crate::model::SqlInstancesVerifyExternalSyncSettingsRequest::sync_config].
10098    ///
10099    /// Note that all the setters affecting `sync_config` are mutually
10100    /// exclusive.
10101    pub fn set_sync_config<
10102        T: std::convert::Into<
10103                std::option::Option<
10104                    crate::model::sql_instances_verify_external_sync_settings_request::SyncConfig,
10105                >,
10106            >,
10107    >(
10108        mut self,
10109        v: T,
10110    ) -> Self {
10111        self.sync_config = v.into();
10112        self
10113    }
10114
10115    /// The value of [sync_config][crate::model::SqlInstancesVerifyExternalSyncSettingsRequest::sync_config]
10116    /// if it holds a `MysqlSyncConfig`, `None` if the field is not set or
10117    /// holds a different branch.
10118    pub fn mysql_sync_config(
10119        &self,
10120    ) -> std::option::Option<&std::boxed::Box<crate::model::MySqlSyncConfig>> {
10121        #[allow(unreachable_patterns)]
10122        self.sync_config.as_ref().and_then(|v| match v {
10123            crate::model::sql_instances_verify_external_sync_settings_request::SyncConfig::MysqlSyncConfig(v) => std::option::Option::Some(v),
10124            _ => std::option::Option::None,
10125        })
10126    }
10127
10128    /// Sets the value of [sync_config][crate::model::SqlInstancesVerifyExternalSyncSettingsRequest::sync_config]
10129    /// to hold a `MysqlSyncConfig`.
10130    ///
10131    /// Note that all the setters affecting `sync_config` are
10132    /// mutually exclusive.
10133    pub fn set_mysql_sync_config<
10134        T: std::convert::Into<std::boxed::Box<crate::model::MySqlSyncConfig>>,
10135    >(
10136        mut self,
10137        v: T,
10138    ) -> Self {
10139        self.sync_config = std::option::Option::Some(
10140            crate::model::sql_instances_verify_external_sync_settings_request::SyncConfig::MysqlSyncConfig(
10141                v.into()
10142            )
10143        );
10144        self
10145    }
10146}
10147
10148impl wkt::message::Message for SqlInstancesVerifyExternalSyncSettingsRequest {
10149    fn typename() -> &'static str {
10150        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest"
10151    }
10152}
10153
10154#[doc(hidden)]
10155impl<'de> serde::de::Deserialize<'de> for SqlInstancesVerifyExternalSyncSettingsRequest {
10156    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10157    where
10158        D: serde::Deserializer<'de>,
10159    {
10160        #[allow(non_camel_case_types)]
10161        #[doc(hidden)]
10162        #[derive(PartialEq, Eq, Hash)]
10163        enum __FieldTag {
10164            __instance,
10165            __project,
10166            __verify_connection_only,
10167            __sync_mode,
10168            __verify_replication_only,
10169            __mysql_sync_config,
10170            __migration_type,
10171            __sync_parallel_level,
10172            Unknown(std::string::String),
10173        }
10174        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10175            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10176            where
10177                D: serde::Deserializer<'de>,
10178            {
10179                struct Visitor;
10180                impl<'de> serde::de::Visitor<'de> for Visitor {
10181                    type Value = __FieldTag;
10182                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10183                        formatter.write_str(
10184                            "a field name for SqlInstancesVerifyExternalSyncSettingsRequest",
10185                        )
10186                    }
10187                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10188                    where
10189                        E: serde::de::Error,
10190                    {
10191                        use std::result::Result::Ok;
10192                        use std::string::ToString;
10193                        match value {
10194                            "instance" => Ok(__FieldTag::__instance),
10195                            "project" => Ok(__FieldTag::__project),
10196                            "verifyConnectionOnly" => Ok(__FieldTag::__verify_connection_only),
10197                            "verify_connection_only" => Ok(__FieldTag::__verify_connection_only),
10198                            "syncMode" => Ok(__FieldTag::__sync_mode),
10199                            "sync_mode" => Ok(__FieldTag::__sync_mode),
10200                            "verifyReplicationOnly" => Ok(__FieldTag::__verify_replication_only),
10201                            "verify_replication_only" => Ok(__FieldTag::__verify_replication_only),
10202                            "mysqlSyncConfig" => Ok(__FieldTag::__mysql_sync_config),
10203                            "mysql_sync_config" => Ok(__FieldTag::__mysql_sync_config),
10204                            "migrationType" => Ok(__FieldTag::__migration_type),
10205                            "migration_type" => Ok(__FieldTag::__migration_type),
10206                            "syncParallelLevel" => Ok(__FieldTag::__sync_parallel_level),
10207                            "sync_parallel_level" => Ok(__FieldTag::__sync_parallel_level),
10208                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10209                        }
10210                    }
10211                }
10212                deserializer.deserialize_identifier(Visitor)
10213            }
10214        }
10215        struct Visitor;
10216        impl<'de> serde::de::Visitor<'de> for Visitor {
10217            type Value = SqlInstancesVerifyExternalSyncSettingsRequest;
10218            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10219                formatter.write_str("struct SqlInstancesVerifyExternalSyncSettingsRequest")
10220            }
10221            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10222            where
10223                A: serde::de::MapAccess<'de>,
10224            {
10225                #[allow(unused_imports)]
10226                use serde::de::Error;
10227                use std::option::Option::Some;
10228                let mut fields = std::collections::HashSet::new();
10229                let mut result = Self::Value::new();
10230                while let Some(tag) = map.next_key::<__FieldTag>()? {
10231                    #[allow(clippy::match_single_binding)]
10232                    match tag {
10233                        __FieldTag::__instance => {
10234                            if !fields.insert(__FieldTag::__instance) {
10235                                return std::result::Result::Err(A::Error::duplicate_field(
10236                                    "multiple values for instance",
10237                                ));
10238                            }
10239                            result.instance = map
10240                                .next_value::<std::option::Option<std::string::String>>()?
10241                                .unwrap_or_default();
10242                        }
10243                        __FieldTag::__project => {
10244                            if !fields.insert(__FieldTag::__project) {
10245                                return std::result::Result::Err(A::Error::duplicate_field(
10246                                    "multiple values for project",
10247                                ));
10248                            }
10249                            result.project = map
10250                                .next_value::<std::option::Option<std::string::String>>()?
10251                                .unwrap_or_default();
10252                        }
10253                        __FieldTag::__verify_connection_only => {
10254                            if !fields.insert(__FieldTag::__verify_connection_only) {
10255                                return std::result::Result::Err(A::Error::duplicate_field(
10256                                    "multiple values for verify_connection_only",
10257                                ));
10258                            }
10259                            result.verify_connection_only = map
10260                                .next_value::<std::option::Option<bool>>()?
10261                                .unwrap_or_default();
10262                        }
10263                        __FieldTag::__sync_mode => {
10264                            if !fields.insert(__FieldTag::__sync_mode) {
10265                                return std::result::Result::Err(A::Error::duplicate_field(
10266                                    "multiple values for sync_mode",
10267                                ));
10268                            }
10269                            result.sync_mode = map.next_value::<std::option::Option<crate::model::sql_instances_verify_external_sync_settings_request::ExternalSyncMode>>()?.unwrap_or_default();
10270                        }
10271                        __FieldTag::__verify_replication_only => {
10272                            if !fields.insert(__FieldTag::__verify_replication_only) {
10273                                return std::result::Result::Err(A::Error::duplicate_field(
10274                                    "multiple values for verify_replication_only",
10275                                ));
10276                            }
10277                            result.verify_replication_only = map
10278                                .next_value::<std::option::Option<bool>>()?
10279                                .unwrap_or_default();
10280                        }
10281                        __FieldTag::__mysql_sync_config => {
10282                            if !fields.insert(__FieldTag::__mysql_sync_config) {
10283                                return std::result::Result::Err(A::Error::duplicate_field(
10284                                    "multiple values for mysql_sync_config",
10285                                ));
10286                            }
10287                            if result.sync_config.is_some() {
10288                                return std::result::Result::Err(A::Error::duplicate_field(
10289                                    "multiple values for `sync_config`, a oneof with full ID .google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.mysql_sync_config, latest field was mysqlSyncConfig",
10290                                ));
10291                            }
10292                            result.sync_config = std::option::Option::Some(
10293                                crate::model::sql_instances_verify_external_sync_settings_request::SyncConfig::MysqlSyncConfig(
10294                                    map.next_value::<std::option::Option<std::boxed::Box<crate::model::MySqlSyncConfig>>>()?.unwrap_or_default()
10295                                ),
10296                            );
10297                        }
10298                        __FieldTag::__migration_type => {
10299                            if !fields.insert(__FieldTag::__migration_type) {
10300                                return std::result::Result::Err(A::Error::duplicate_field(
10301                                    "multiple values for migration_type",
10302                                ));
10303                            }
10304                            result.migration_type = map.next_value::<std::option::Option<crate::model::sql_instances_verify_external_sync_settings_request::MigrationType>>()?.unwrap_or_default();
10305                        }
10306                        __FieldTag::__sync_parallel_level => {
10307                            if !fields.insert(__FieldTag::__sync_parallel_level) {
10308                                return std::result::Result::Err(A::Error::duplicate_field(
10309                                    "multiple values for sync_parallel_level",
10310                                ));
10311                            }
10312                            result.sync_parallel_level = map.next_value::<std::option::Option<crate::model::ExternalSyncParallelLevel>>()?.unwrap_or_default();
10313                        }
10314                        __FieldTag::Unknown(key) => {
10315                            let value = map.next_value::<serde_json::Value>()?;
10316                            result._unknown_fields.insert(key, value);
10317                        }
10318                    }
10319                }
10320                std::result::Result::Ok(result)
10321            }
10322        }
10323        deserializer.deserialize_any(Visitor)
10324    }
10325}
10326
10327#[doc(hidden)]
10328impl serde::ser::Serialize for SqlInstancesVerifyExternalSyncSettingsRequest {
10329    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10330    where
10331        S: serde::ser::Serializer,
10332    {
10333        use serde::ser::SerializeMap;
10334        #[allow(unused_imports)]
10335        use std::option::Option::Some;
10336        let mut state = serializer.serialize_map(std::option::Option::None)?;
10337        if !self.instance.is_empty() {
10338            state.serialize_entry("instance", &self.instance)?;
10339        }
10340        if !self.project.is_empty() {
10341            state.serialize_entry("project", &self.project)?;
10342        }
10343        if !wkt::internal::is_default(&self.verify_connection_only) {
10344            state.serialize_entry("verifyConnectionOnly", &self.verify_connection_only)?;
10345        }
10346        if !wkt::internal::is_default(&self.sync_mode) {
10347            state.serialize_entry("syncMode", &self.sync_mode)?;
10348        }
10349        if !wkt::internal::is_default(&self.verify_replication_only) {
10350            state.serialize_entry("verifyReplicationOnly", &self.verify_replication_only)?;
10351        }
10352        if let Some(value) = self.mysql_sync_config() {
10353            state.serialize_entry("mysqlSyncConfig", value)?;
10354        }
10355        if !wkt::internal::is_default(&self.migration_type) {
10356            state.serialize_entry("migrationType", &self.migration_type)?;
10357        }
10358        if !wkt::internal::is_default(&self.sync_parallel_level) {
10359            state.serialize_entry("syncParallelLevel", &self.sync_parallel_level)?;
10360        }
10361        if !self._unknown_fields.is_empty() {
10362            for (key, value) in self._unknown_fields.iter() {
10363                state.serialize_entry(key, &value)?;
10364            }
10365        }
10366        state.end()
10367    }
10368}
10369
10370/// Defines additional types related to [SqlInstancesVerifyExternalSyncSettingsRequest].
10371pub mod sql_instances_verify_external_sync_settings_request {
10372    #[allow(unused_imports)]
10373    use super::*;
10374
10375    ///
10376    /// # Working with unknown values
10377    ///
10378    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10379    /// additional enum variants at any time. Adding new variants is not considered
10380    /// a breaking change. Applications should write their code in anticipation of:
10381    ///
10382    /// - New values appearing in future releases of the client library, **and**
10383    /// - New values received dynamically, without application changes.
10384    ///
10385    /// Please consult the [Working with enums] section in the user guide for some
10386    /// guidelines.
10387    ///
10388    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10389    #[derive(Clone, Debug, PartialEq)]
10390    #[non_exhaustive]
10391    pub enum ExternalSyncMode {
10392        /// Unknown external sync mode, will be defaulted to ONLINE mode
10393        Unspecified,
10394        /// Online external sync will set up replication after initial data external
10395        /// sync
10396        Online,
10397        /// Offline external sync only dumps and loads a one-time snapshot of
10398        /// the primary instance's data
10399        Offline,
10400        /// If set, the enum was initialized with an unknown value.
10401        ///
10402        /// Applications can examine the value using [ExternalSyncMode::value] or
10403        /// [ExternalSyncMode::name].
10404        UnknownValue(external_sync_mode::UnknownValue),
10405    }
10406
10407    #[doc(hidden)]
10408    pub mod external_sync_mode {
10409        #[allow(unused_imports)]
10410        use super::*;
10411        #[derive(Clone, Debug, PartialEq)]
10412        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10413    }
10414
10415    impl ExternalSyncMode {
10416        /// Gets the enum value.
10417        ///
10418        /// Returns `None` if the enum contains an unknown value deserialized from
10419        /// the string representation of enums.
10420        pub fn value(&self) -> std::option::Option<i32> {
10421            match self {
10422                Self::Unspecified => std::option::Option::Some(0),
10423                Self::Online => std::option::Option::Some(1),
10424                Self::Offline => std::option::Option::Some(2),
10425                Self::UnknownValue(u) => u.0.value(),
10426            }
10427        }
10428
10429        /// Gets the enum value as a string.
10430        ///
10431        /// Returns `None` if the enum contains an unknown value deserialized from
10432        /// the integer representation of enums.
10433        pub fn name(&self) -> std::option::Option<&str> {
10434            match self {
10435                Self::Unspecified => std::option::Option::Some("EXTERNAL_SYNC_MODE_UNSPECIFIED"),
10436                Self::Online => std::option::Option::Some("ONLINE"),
10437                Self::Offline => std::option::Option::Some("OFFLINE"),
10438                Self::UnknownValue(u) => u.0.name(),
10439            }
10440        }
10441    }
10442
10443    impl std::default::Default for ExternalSyncMode {
10444        fn default() -> Self {
10445            use std::convert::From;
10446            Self::from(0)
10447        }
10448    }
10449
10450    impl std::fmt::Display for ExternalSyncMode {
10451        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10452            wkt::internal::display_enum(f, self.name(), self.value())
10453        }
10454    }
10455
10456    impl std::convert::From<i32> for ExternalSyncMode {
10457        fn from(value: i32) -> Self {
10458            match value {
10459                0 => Self::Unspecified,
10460                1 => Self::Online,
10461                2 => Self::Offline,
10462                _ => Self::UnknownValue(external_sync_mode::UnknownValue(
10463                    wkt::internal::UnknownEnumValue::Integer(value),
10464                )),
10465            }
10466        }
10467    }
10468
10469    impl std::convert::From<&str> for ExternalSyncMode {
10470        fn from(value: &str) -> Self {
10471            use std::string::ToString;
10472            match value {
10473                "EXTERNAL_SYNC_MODE_UNSPECIFIED" => Self::Unspecified,
10474                "ONLINE" => Self::Online,
10475                "OFFLINE" => Self::Offline,
10476                _ => Self::UnknownValue(external_sync_mode::UnknownValue(
10477                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10478                )),
10479            }
10480        }
10481    }
10482
10483    impl serde::ser::Serialize for ExternalSyncMode {
10484        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10485        where
10486            S: serde::Serializer,
10487        {
10488            match self {
10489                Self::Unspecified => serializer.serialize_i32(0),
10490                Self::Online => serializer.serialize_i32(1),
10491                Self::Offline => serializer.serialize_i32(2),
10492                Self::UnknownValue(u) => u.0.serialize(serializer),
10493            }
10494        }
10495    }
10496
10497    impl<'de> serde::de::Deserialize<'de> for ExternalSyncMode {
10498        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10499        where
10500            D: serde::Deserializer<'de>,
10501        {
10502            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExternalSyncMode>::new(
10503                ".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode"))
10504        }
10505    }
10506
10507    /// MigrationType determines whether the migration is a physical file-based
10508    /// migration or a logical dump file-based migration.
10509    ///
10510    /// # Working with unknown values
10511    ///
10512    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10513    /// additional enum variants at any time. Adding new variants is not considered
10514    /// a breaking change. Applications should write their code in anticipation of:
10515    ///
10516    /// - New values appearing in future releases of the client library, **and**
10517    /// - New values received dynamically, without application changes.
10518    ///
10519    /// Please consult the [Working with enums] section in the user guide for some
10520    /// guidelines.
10521    ///
10522    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10523    #[derive(Clone, Debug, PartialEq)]
10524    #[non_exhaustive]
10525    pub enum MigrationType {
10526        /// Default value is a logical dump file-based migration
10527        Unspecified,
10528        /// Logical dump file-based migration
10529        Logical,
10530        /// Physical file-based migration
10531        Physical,
10532        /// If set, the enum was initialized with an unknown value.
10533        ///
10534        /// Applications can examine the value using [MigrationType::value] or
10535        /// [MigrationType::name].
10536        UnknownValue(migration_type::UnknownValue),
10537    }
10538
10539    #[doc(hidden)]
10540    pub mod migration_type {
10541        #[allow(unused_imports)]
10542        use super::*;
10543        #[derive(Clone, Debug, PartialEq)]
10544        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10545    }
10546
10547    impl MigrationType {
10548        /// Gets the enum value.
10549        ///
10550        /// Returns `None` if the enum contains an unknown value deserialized from
10551        /// the string representation of enums.
10552        pub fn value(&self) -> std::option::Option<i32> {
10553            match self {
10554                Self::Unspecified => std::option::Option::Some(0),
10555                Self::Logical => std::option::Option::Some(1),
10556                Self::Physical => std::option::Option::Some(2),
10557                Self::UnknownValue(u) => u.0.value(),
10558            }
10559        }
10560
10561        /// Gets the enum value as a string.
10562        ///
10563        /// Returns `None` if the enum contains an unknown value deserialized from
10564        /// the integer representation of enums.
10565        pub fn name(&self) -> std::option::Option<&str> {
10566            match self {
10567                Self::Unspecified => std::option::Option::Some("MIGRATION_TYPE_UNSPECIFIED"),
10568                Self::Logical => std::option::Option::Some("LOGICAL"),
10569                Self::Physical => std::option::Option::Some("PHYSICAL"),
10570                Self::UnknownValue(u) => u.0.name(),
10571            }
10572        }
10573    }
10574
10575    impl std::default::Default for MigrationType {
10576        fn default() -> Self {
10577            use std::convert::From;
10578            Self::from(0)
10579        }
10580    }
10581
10582    impl std::fmt::Display for MigrationType {
10583        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10584            wkt::internal::display_enum(f, self.name(), self.value())
10585        }
10586    }
10587
10588    impl std::convert::From<i32> for MigrationType {
10589        fn from(value: i32) -> Self {
10590            match value {
10591                0 => Self::Unspecified,
10592                1 => Self::Logical,
10593                2 => Self::Physical,
10594                _ => Self::UnknownValue(migration_type::UnknownValue(
10595                    wkt::internal::UnknownEnumValue::Integer(value),
10596                )),
10597            }
10598        }
10599    }
10600
10601    impl std::convert::From<&str> for MigrationType {
10602        fn from(value: &str) -> Self {
10603            use std::string::ToString;
10604            match value {
10605                "MIGRATION_TYPE_UNSPECIFIED" => Self::Unspecified,
10606                "LOGICAL" => Self::Logical,
10607                "PHYSICAL" => Self::Physical,
10608                _ => Self::UnknownValue(migration_type::UnknownValue(
10609                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10610                )),
10611            }
10612        }
10613    }
10614
10615    impl serde::ser::Serialize for MigrationType {
10616        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10617        where
10618            S: serde::Serializer,
10619        {
10620            match self {
10621                Self::Unspecified => serializer.serialize_i32(0),
10622                Self::Logical => serializer.serialize_i32(1),
10623                Self::Physical => serializer.serialize_i32(2),
10624                Self::UnknownValue(u) => u.0.serialize(serializer),
10625            }
10626        }
10627    }
10628
10629    impl<'de> serde::de::Deserialize<'de> for MigrationType {
10630        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10631        where
10632            D: serde::Deserializer<'de>,
10633        {
10634            deserializer.deserialize_any(wkt::internal::EnumVisitor::<MigrationType>::new(
10635                ".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType",
10636            ))
10637        }
10638    }
10639
10640    #[derive(Clone, Debug, PartialEq)]
10641    #[non_exhaustive]
10642    pub enum SyncConfig {
10643        /// Optional. MySQL-specific settings for start external sync.
10644        MysqlSyncConfig(std::boxed::Box<crate::model::MySqlSyncConfig>),
10645    }
10646}
10647
10648/// Instance start external sync request.
10649#[derive(Clone, Debug, Default, PartialEq)]
10650#[non_exhaustive]
10651pub struct SqlInstancesStartExternalSyncRequest {
10652    /// Cloud SQL instance ID. This does not include the project ID.
10653    pub instance: std::string::String,
10654
10655    /// ID of the project that contains the instance.
10656    pub project: std::string::String,
10657
10658    /// External sync mode.
10659    pub sync_mode:
10660        crate::model::sql_instances_verify_external_sync_settings_request::ExternalSyncMode,
10661
10662    /// Whether to skip the verification step (VESS).
10663    pub skip_verification: bool,
10664
10665    /// Optional. Parallel level for initial data sync. Currently only applicable
10666    /// for MySQL.
10667    pub sync_parallel_level: crate::model::ExternalSyncParallelLevel,
10668
10669    /// Optional. MigrationType configures the migration to use physical files or
10670    /// logical dump files. If not set, then the logical dump file configuration is
10671    /// used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL.
10672    pub migration_type:
10673        crate::model::sql_instances_verify_external_sync_settings_request::MigrationType,
10674
10675    pub sync_config:
10676        std::option::Option<crate::model::sql_instances_start_external_sync_request::SyncConfig>,
10677
10678    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10679}
10680
10681impl SqlInstancesStartExternalSyncRequest {
10682    pub fn new() -> Self {
10683        std::default::Default::default()
10684    }
10685
10686    /// Sets the value of [instance][crate::model::SqlInstancesStartExternalSyncRequest::instance].
10687    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10688        self.instance = v.into();
10689        self
10690    }
10691
10692    /// Sets the value of [project][crate::model::SqlInstancesStartExternalSyncRequest::project].
10693    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10694        self.project = v.into();
10695        self
10696    }
10697
10698    /// Sets the value of [sync_mode][crate::model::SqlInstancesStartExternalSyncRequest::sync_mode].
10699    pub fn set_sync_mode<
10700        T: std::convert::Into<
10701                crate::model::sql_instances_verify_external_sync_settings_request::ExternalSyncMode,
10702            >,
10703    >(
10704        mut self,
10705        v: T,
10706    ) -> Self {
10707        self.sync_mode = v.into();
10708        self
10709    }
10710
10711    /// Sets the value of [skip_verification][crate::model::SqlInstancesStartExternalSyncRequest::skip_verification].
10712    pub fn set_skip_verification<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10713        self.skip_verification = v.into();
10714        self
10715    }
10716
10717    /// Sets the value of [sync_parallel_level][crate::model::SqlInstancesStartExternalSyncRequest::sync_parallel_level].
10718    pub fn set_sync_parallel_level<
10719        T: std::convert::Into<crate::model::ExternalSyncParallelLevel>,
10720    >(
10721        mut self,
10722        v: T,
10723    ) -> Self {
10724        self.sync_parallel_level = v.into();
10725        self
10726    }
10727
10728    /// Sets the value of [migration_type][crate::model::SqlInstancesStartExternalSyncRequest::migration_type].
10729    pub fn set_migration_type<
10730        T: std::convert::Into<
10731                crate::model::sql_instances_verify_external_sync_settings_request::MigrationType,
10732            >,
10733    >(
10734        mut self,
10735        v: T,
10736    ) -> Self {
10737        self.migration_type = v.into();
10738        self
10739    }
10740
10741    /// Sets the value of [sync_config][crate::model::SqlInstancesStartExternalSyncRequest::sync_config].
10742    ///
10743    /// Note that all the setters affecting `sync_config` are mutually
10744    /// exclusive.
10745    pub fn set_sync_config<
10746        T: std::convert::Into<
10747                std::option::Option<
10748                    crate::model::sql_instances_start_external_sync_request::SyncConfig,
10749                >,
10750            >,
10751    >(
10752        mut self,
10753        v: T,
10754    ) -> Self {
10755        self.sync_config = v.into();
10756        self
10757    }
10758
10759    /// The value of [sync_config][crate::model::SqlInstancesStartExternalSyncRequest::sync_config]
10760    /// if it holds a `MysqlSyncConfig`, `None` if the field is not set or
10761    /// holds a different branch.
10762    pub fn mysql_sync_config(
10763        &self,
10764    ) -> std::option::Option<&std::boxed::Box<crate::model::MySqlSyncConfig>> {
10765        #[allow(unreachable_patterns)]
10766        self.sync_config.as_ref().and_then(|v| match v {
10767            crate::model::sql_instances_start_external_sync_request::SyncConfig::MysqlSyncConfig(v) => std::option::Option::Some(v),
10768            _ => std::option::Option::None,
10769        })
10770    }
10771
10772    /// Sets the value of [sync_config][crate::model::SqlInstancesStartExternalSyncRequest::sync_config]
10773    /// to hold a `MysqlSyncConfig`.
10774    ///
10775    /// Note that all the setters affecting `sync_config` are
10776    /// mutually exclusive.
10777    pub fn set_mysql_sync_config<
10778        T: std::convert::Into<std::boxed::Box<crate::model::MySqlSyncConfig>>,
10779    >(
10780        mut self,
10781        v: T,
10782    ) -> Self {
10783        self.sync_config = std::option::Option::Some(
10784            crate::model::sql_instances_start_external_sync_request::SyncConfig::MysqlSyncConfig(
10785                v.into(),
10786            ),
10787        );
10788        self
10789    }
10790}
10791
10792impl wkt::message::Message for SqlInstancesStartExternalSyncRequest {
10793    fn typename() -> &'static str {
10794        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest"
10795    }
10796}
10797
10798#[doc(hidden)]
10799impl<'de> serde::de::Deserialize<'de> for SqlInstancesStartExternalSyncRequest {
10800    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10801    where
10802        D: serde::Deserializer<'de>,
10803    {
10804        #[allow(non_camel_case_types)]
10805        #[doc(hidden)]
10806        #[derive(PartialEq, Eq, Hash)]
10807        enum __FieldTag {
10808            __instance,
10809            __project,
10810            __sync_mode,
10811            __skip_verification,
10812            __mysql_sync_config,
10813            __sync_parallel_level,
10814            __migration_type,
10815            Unknown(std::string::String),
10816        }
10817        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10818            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10819            where
10820                D: serde::Deserializer<'de>,
10821            {
10822                struct Visitor;
10823                impl<'de> serde::de::Visitor<'de> for Visitor {
10824                    type Value = __FieldTag;
10825                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10826                        formatter.write_str("a field name for SqlInstancesStartExternalSyncRequest")
10827                    }
10828                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10829                    where
10830                        E: serde::de::Error,
10831                    {
10832                        use std::result::Result::Ok;
10833                        use std::string::ToString;
10834                        match value {
10835                            "instance" => Ok(__FieldTag::__instance),
10836                            "project" => Ok(__FieldTag::__project),
10837                            "syncMode" => Ok(__FieldTag::__sync_mode),
10838                            "sync_mode" => Ok(__FieldTag::__sync_mode),
10839                            "skipVerification" => Ok(__FieldTag::__skip_verification),
10840                            "skip_verification" => Ok(__FieldTag::__skip_verification),
10841                            "mysqlSyncConfig" => Ok(__FieldTag::__mysql_sync_config),
10842                            "mysql_sync_config" => Ok(__FieldTag::__mysql_sync_config),
10843                            "syncParallelLevel" => Ok(__FieldTag::__sync_parallel_level),
10844                            "sync_parallel_level" => Ok(__FieldTag::__sync_parallel_level),
10845                            "migrationType" => Ok(__FieldTag::__migration_type),
10846                            "migration_type" => Ok(__FieldTag::__migration_type),
10847                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10848                        }
10849                    }
10850                }
10851                deserializer.deserialize_identifier(Visitor)
10852            }
10853        }
10854        struct Visitor;
10855        impl<'de> serde::de::Visitor<'de> for Visitor {
10856            type Value = SqlInstancesStartExternalSyncRequest;
10857            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10858                formatter.write_str("struct SqlInstancesStartExternalSyncRequest")
10859            }
10860            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10861            where
10862                A: serde::de::MapAccess<'de>,
10863            {
10864                #[allow(unused_imports)]
10865                use serde::de::Error;
10866                use std::option::Option::Some;
10867                let mut fields = std::collections::HashSet::new();
10868                let mut result = Self::Value::new();
10869                while let Some(tag) = map.next_key::<__FieldTag>()? {
10870                    #[allow(clippy::match_single_binding)]
10871                    match tag {
10872                        __FieldTag::__instance => {
10873                            if !fields.insert(__FieldTag::__instance) {
10874                                return std::result::Result::Err(A::Error::duplicate_field(
10875                                    "multiple values for instance",
10876                                ));
10877                            }
10878                            result.instance = map
10879                                .next_value::<std::option::Option<std::string::String>>()?
10880                                .unwrap_or_default();
10881                        }
10882                        __FieldTag::__project => {
10883                            if !fields.insert(__FieldTag::__project) {
10884                                return std::result::Result::Err(A::Error::duplicate_field(
10885                                    "multiple values for project",
10886                                ));
10887                            }
10888                            result.project = map
10889                                .next_value::<std::option::Option<std::string::String>>()?
10890                                .unwrap_or_default();
10891                        }
10892                        __FieldTag::__sync_mode => {
10893                            if !fields.insert(__FieldTag::__sync_mode) {
10894                                return std::result::Result::Err(A::Error::duplicate_field(
10895                                    "multiple values for sync_mode",
10896                                ));
10897                            }
10898                            result.sync_mode = map.next_value::<std::option::Option<crate::model::sql_instances_verify_external_sync_settings_request::ExternalSyncMode>>()?.unwrap_or_default();
10899                        }
10900                        __FieldTag::__skip_verification => {
10901                            if !fields.insert(__FieldTag::__skip_verification) {
10902                                return std::result::Result::Err(A::Error::duplicate_field(
10903                                    "multiple values for skip_verification",
10904                                ));
10905                            }
10906                            result.skip_verification = map
10907                                .next_value::<std::option::Option<bool>>()?
10908                                .unwrap_or_default();
10909                        }
10910                        __FieldTag::__mysql_sync_config => {
10911                            if !fields.insert(__FieldTag::__mysql_sync_config) {
10912                                return std::result::Result::Err(A::Error::duplicate_field(
10913                                    "multiple values for mysql_sync_config",
10914                                ));
10915                            }
10916                            if result.sync_config.is_some() {
10917                                return std::result::Result::Err(A::Error::duplicate_field(
10918                                    "multiple values for `sync_config`, a oneof with full ID .google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest.mysql_sync_config, latest field was mysqlSyncConfig",
10919                                ));
10920                            }
10921                            result.sync_config = std::option::Option::Some(
10922                                crate::model::sql_instances_start_external_sync_request::SyncConfig::MysqlSyncConfig(
10923                                    map.next_value::<std::option::Option<std::boxed::Box<crate::model::MySqlSyncConfig>>>()?.unwrap_or_default()
10924                                ),
10925                            );
10926                        }
10927                        __FieldTag::__sync_parallel_level => {
10928                            if !fields.insert(__FieldTag::__sync_parallel_level) {
10929                                return std::result::Result::Err(A::Error::duplicate_field(
10930                                    "multiple values for sync_parallel_level",
10931                                ));
10932                            }
10933                            result.sync_parallel_level = map.next_value::<std::option::Option<crate::model::ExternalSyncParallelLevel>>()?.unwrap_or_default();
10934                        }
10935                        __FieldTag::__migration_type => {
10936                            if !fields.insert(__FieldTag::__migration_type) {
10937                                return std::result::Result::Err(A::Error::duplicate_field(
10938                                    "multiple values for migration_type",
10939                                ));
10940                            }
10941                            result.migration_type = map.next_value::<std::option::Option<crate::model::sql_instances_verify_external_sync_settings_request::MigrationType>>()?.unwrap_or_default();
10942                        }
10943                        __FieldTag::Unknown(key) => {
10944                            let value = map.next_value::<serde_json::Value>()?;
10945                            result._unknown_fields.insert(key, value);
10946                        }
10947                    }
10948                }
10949                std::result::Result::Ok(result)
10950            }
10951        }
10952        deserializer.deserialize_any(Visitor)
10953    }
10954}
10955
10956#[doc(hidden)]
10957impl serde::ser::Serialize for SqlInstancesStartExternalSyncRequest {
10958    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10959    where
10960        S: serde::ser::Serializer,
10961    {
10962        use serde::ser::SerializeMap;
10963        #[allow(unused_imports)]
10964        use std::option::Option::Some;
10965        let mut state = serializer.serialize_map(std::option::Option::None)?;
10966        if !self.instance.is_empty() {
10967            state.serialize_entry("instance", &self.instance)?;
10968        }
10969        if !self.project.is_empty() {
10970            state.serialize_entry("project", &self.project)?;
10971        }
10972        if !wkt::internal::is_default(&self.sync_mode) {
10973            state.serialize_entry("syncMode", &self.sync_mode)?;
10974        }
10975        if !wkt::internal::is_default(&self.skip_verification) {
10976            state.serialize_entry("skipVerification", &self.skip_verification)?;
10977        }
10978        if let Some(value) = self.mysql_sync_config() {
10979            state.serialize_entry("mysqlSyncConfig", value)?;
10980        }
10981        if !wkt::internal::is_default(&self.sync_parallel_level) {
10982            state.serialize_entry("syncParallelLevel", &self.sync_parallel_level)?;
10983        }
10984        if !wkt::internal::is_default(&self.migration_type) {
10985            state.serialize_entry("migrationType", &self.migration_type)?;
10986        }
10987        if !self._unknown_fields.is_empty() {
10988            for (key, value) in self._unknown_fields.iter() {
10989                state.serialize_entry(key, &value)?;
10990            }
10991        }
10992        state.end()
10993    }
10994}
10995
10996/// Defines additional types related to [SqlInstancesStartExternalSyncRequest].
10997pub mod sql_instances_start_external_sync_request {
10998    #[allow(unused_imports)]
10999    use super::*;
11000
11001    #[derive(Clone, Debug, PartialEq)]
11002    #[non_exhaustive]
11003    pub enum SyncConfig {
11004        /// MySQL-specific settings for start external sync.
11005        MysqlSyncConfig(std::boxed::Box<crate::model::MySqlSyncConfig>),
11006    }
11007}
11008
11009/// Instance reset replica size request.
11010#[derive(Clone, Debug, Default, PartialEq)]
11011#[non_exhaustive]
11012pub struct SqlInstancesResetReplicaSizeRequest {
11013    /// Cloud SQL read replica instance name.
11014    pub instance: std::string::String,
11015
11016    /// ID of the project that contains the read replica.
11017    pub project: std::string::String,
11018
11019    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11020}
11021
11022impl SqlInstancesResetReplicaSizeRequest {
11023    pub fn new() -> Self {
11024        std::default::Default::default()
11025    }
11026
11027    /// Sets the value of [instance][crate::model::SqlInstancesResetReplicaSizeRequest::instance].
11028    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11029        self.instance = v.into();
11030        self
11031    }
11032
11033    /// Sets the value of [project][crate::model::SqlInstancesResetReplicaSizeRequest::project].
11034    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11035        self.project = v.into();
11036        self
11037    }
11038}
11039
11040impl wkt::message::Message for SqlInstancesResetReplicaSizeRequest {
11041    fn typename() -> &'static str {
11042        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest"
11043    }
11044}
11045
11046#[doc(hidden)]
11047impl<'de> serde::de::Deserialize<'de> for SqlInstancesResetReplicaSizeRequest {
11048    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11049    where
11050        D: serde::Deserializer<'de>,
11051    {
11052        #[allow(non_camel_case_types)]
11053        #[doc(hidden)]
11054        #[derive(PartialEq, Eq, Hash)]
11055        enum __FieldTag {
11056            __instance,
11057            __project,
11058            Unknown(std::string::String),
11059        }
11060        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11061            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11062            where
11063                D: serde::Deserializer<'de>,
11064            {
11065                struct Visitor;
11066                impl<'de> serde::de::Visitor<'de> for Visitor {
11067                    type Value = __FieldTag;
11068                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11069                        formatter.write_str("a field name for SqlInstancesResetReplicaSizeRequest")
11070                    }
11071                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11072                    where
11073                        E: serde::de::Error,
11074                    {
11075                        use std::result::Result::Ok;
11076                        use std::string::ToString;
11077                        match value {
11078                            "instance" => Ok(__FieldTag::__instance),
11079                            "project" => Ok(__FieldTag::__project),
11080                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11081                        }
11082                    }
11083                }
11084                deserializer.deserialize_identifier(Visitor)
11085            }
11086        }
11087        struct Visitor;
11088        impl<'de> serde::de::Visitor<'de> for Visitor {
11089            type Value = SqlInstancesResetReplicaSizeRequest;
11090            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11091                formatter.write_str("struct SqlInstancesResetReplicaSizeRequest")
11092            }
11093            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11094            where
11095                A: serde::de::MapAccess<'de>,
11096            {
11097                #[allow(unused_imports)]
11098                use serde::de::Error;
11099                use std::option::Option::Some;
11100                let mut fields = std::collections::HashSet::new();
11101                let mut result = Self::Value::new();
11102                while let Some(tag) = map.next_key::<__FieldTag>()? {
11103                    #[allow(clippy::match_single_binding)]
11104                    match tag {
11105                        __FieldTag::__instance => {
11106                            if !fields.insert(__FieldTag::__instance) {
11107                                return std::result::Result::Err(A::Error::duplicate_field(
11108                                    "multiple values for instance",
11109                                ));
11110                            }
11111                            result.instance = map
11112                                .next_value::<std::option::Option<std::string::String>>()?
11113                                .unwrap_or_default();
11114                        }
11115                        __FieldTag::__project => {
11116                            if !fields.insert(__FieldTag::__project) {
11117                                return std::result::Result::Err(A::Error::duplicate_field(
11118                                    "multiple values for project",
11119                                ));
11120                            }
11121                            result.project = map
11122                                .next_value::<std::option::Option<std::string::String>>()?
11123                                .unwrap_or_default();
11124                        }
11125                        __FieldTag::Unknown(key) => {
11126                            let value = map.next_value::<serde_json::Value>()?;
11127                            result._unknown_fields.insert(key, value);
11128                        }
11129                    }
11130                }
11131                std::result::Result::Ok(result)
11132            }
11133        }
11134        deserializer.deserialize_any(Visitor)
11135    }
11136}
11137
11138#[doc(hidden)]
11139impl serde::ser::Serialize for SqlInstancesResetReplicaSizeRequest {
11140    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11141    where
11142        S: serde::ser::Serializer,
11143    {
11144        use serde::ser::SerializeMap;
11145        #[allow(unused_imports)]
11146        use std::option::Option::Some;
11147        let mut state = serializer.serialize_map(std::option::Option::None)?;
11148        if !self.instance.is_empty() {
11149            state.serialize_entry("instance", &self.instance)?;
11150        }
11151        if !self.project.is_empty() {
11152            state.serialize_entry("project", &self.project)?;
11153        }
11154        if !self._unknown_fields.is_empty() {
11155            for (key, value) in self._unknown_fields.iter() {
11156                state.serialize_entry(key, &value)?;
11157            }
11158        }
11159        state.end()
11160    }
11161}
11162
11163/// Instance create ephemeral certificate request.
11164#[derive(Clone, Debug, Default, PartialEq)]
11165#[non_exhaustive]
11166pub struct SqlInstancesCreateEphemeralCertRequest {
11167    /// Cloud SQL instance ID. This does not include the project ID.
11168    pub instance: std::string::String,
11169
11170    /// Project ID of the Cloud SQL project.
11171    pub project: std::string::String,
11172
11173    pub body: std::option::Option<crate::model::SslCertsCreateEphemeralRequest>,
11174
11175    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11176}
11177
11178impl SqlInstancesCreateEphemeralCertRequest {
11179    pub fn new() -> Self {
11180        std::default::Default::default()
11181    }
11182
11183    /// Sets the value of [instance][crate::model::SqlInstancesCreateEphemeralCertRequest::instance].
11184    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11185        self.instance = v.into();
11186        self
11187    }
11188
11189    /// Sets the value of [project][crate::model::SqlInstancesCreateEphemeralCertRequest::project].
11190    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11191        self.project = v.into();
11192        self
11193    }
11194
11195    /// Sets the value of [body][crate::model::SqlInstancesCreateEphemeralCertRequest::body].
11196    pub fn set_body<T>(mut self, v: T) -> Self
11197    where
11198        T: std::convert::Into<crate::model::SslCertsCreateEphemeralRequest>,
11199    {
11200        self.body = std::option::Option::Some(v.into());
11201        self
11202    }
11203
11204    /// Sets or clears the value of [body][crate::model::SqlInstancesCreateEphemeralCertRequest::body].
11205    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
11206    where
11207        T: std::convert::Into<crate::model::SslCertsCreateEphemeralRequest>,
11208    {
11209        self.body = v.map(|x| x.into());
11210        self
11211    }
11212}
11213
11214impl wkt::message::Message for SqlInstancesCreateEphemeralCertRequest {
11215    fn typename() -> &'static str {
11216        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest"
11217    }
11218}
11219
11220#[doc(hidden)]
11221impl<'de> serde::de::Deserialize<'de> for SqlInstancesCreateEphemeralCertRequest {
11222    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11223    where
11224        D: serde::Deserializer<'de>,
11225    {
11226        #[allow(non_camel_case_types)]
11227        #[doc(hidden)]
11228        #[derive(PartialEq, Eq, Hash)]
11229        enum __FieldTag {
11230            __instance,
11231            __project,
11232            __body,
11233            Unknown(std::string::String),
11234        }
11235        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11236            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11237            where
11238                D: serde::Deserializer<'de>,
11239            {
11240                struct Visitor;
11241                impl<'de> serde::de::Visitor<'de> for Visitor {
11242                    type Value = __FieldTag;
11243                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11244                        formatter
11245                            .write_str("a field name for SqlInstancesCreateEphemeralCertRequest")
11246                    }
11247                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11248                    where
11249                        E: serde::de::Error,
11250                    {
11251                        use std::result::Result::Ok;
11252                        use std::string::ToString;
11253                        match value {
11254                            "instance" => Ok(__FieldTag::__instance),
11255                            "project" => Ok(__FieldTag::__project),
11256                            "body" => Ok(__FieldTag::__body),
11257                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11258                        }
11259                    }
11260                }
11261                deserializer.deserialize_identifier(Visitor)
11262            }
11263        }
11264        struct Visitor;
11265        impl<'de> serde::de::Visitor<'de> for Visitor {
11266            type Value = SqlInstancesCreateEphemeralCertRequest;
11267            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11268                formatter.write_str("struct SqlInstancesCreateEphemeralCertRequest")
11269            }
11270            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11271            where
11272                A: serde::de::MapAccess<'de>,
11273            {
11274                #[allow(unused_imports)]
11275                use serde::de::Error;
11276                use std::option::Option::Some;
11277                let mut fields = std::collections::HashSet::new();
11278                let mut result = Self::Value::new();
11279                while let Some(tag) = map.next_key::<__FieldTag>()? {
11280                    #[allow(clippy::match_single_binding)]
11281                    match tag {
11282                        __FieldTag::__instance => {
11283                            if !fields.insert(__FieldTag::__instance) {
11284                                return std::result::Result::Err(A::Error::duplicate_field(
11285                                    "multiple values for instance",
11286                                ));
11287                            }
11288                            result.instance = map
11289                                .next_value::<std::option::Option<std::string::String>>()?
11290                                .unwrap_or_default();
11291                        }
11292                        __FieldTag::__project => {
11293                            if !fields.insert(__FieldTag::__project) {
11294                                return std::result::Result::Err(A::Error::duplicate_field(
11295                                    "multiple values for project",
11296                                ));
11297                            }
11298                            result.project = map
11299                                .next_value::<std::option::Option<std::string::String>>()?
11300                                .unwrap_or_default();
11301                        }
11302                        __FieldTag::__body => {
11303                            if !fields.insert(__FieldTag::__body) {
11304                                return std::result::Result::Err(A::Error::duplicate_field(
11305                                    "multiple values for body",
11306                                ));
11307                            }
11308                            result.body =
11309                                map.next_value::<std::option::Option<
11310                                    crate::model::SslCertsCreateEphemeralRequest,
11311                                >>()?;
11312                        }
11313                        __FieldTag::Unknown(key) => {
11314                            let value = map.next_value::<serde_json::Value>()?;
11315                            result._unknown_fields.insert(key, value);
11316                        }
11317                    }
11318                }
11319                std::result::Result::Ok(result)
11320            }
11321        }
11322        deserializer.deserialize_any(Visitor)
11323    }
11324}
11325
11326#[doc(hidden)]
11327impl serde::ser::Serialize for SqlInstancesCreateEphemeralCertRequest {
11328    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11329    where
11330        S: serde::ser::Serializer,
11331    {
11332        use serde::ser::SerializeMap;
11333        #[allow(unused_imports)]
11334        use std::option::Option::Some;
11335        let mut state = serializer.serialize_map(std::option::Option::None)?;
11336        if !self.instance.is_empty() {
11337            state.serialize_entry("instance", &self.instance)?;
11338        }
11339        if !self.project.is_empty() {
11340            state.serialize_entry("project", &self.project)?;
11341        }
11342        if self.body.is_some() {
11343            state.serialize_entry("body", &self.body)?;
11344        }
11345        if !self._unknown_fields.is_empty() {
11346            for (key, value) in self._unknown_fields.iter() {
11347                state.serialize_entry(key, &value)?;
11348            }
11349        }
11350        state.end()
11351    }
11352}
11353
11354/// Database instance clone request.
11355#[derive(Clone, Debug, Default, PartialEq)]
11356#[non_exhaustive]
11357pub struct InstancesCloneRequest {
11358    /// Contains details about the clone operation.
11359    pub clone_context: std::option::Option<crate::model::CloneContext>,
11360
11361    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11362}
11363
11364impl InstancesCloneRequest {
11365    pub fn new() -> Self {
11366        std::default::Default::default()
11367    }
11368
11369    /// Sets the value of [clone_context][crate::model::InstancesCloneRequest::clone_context].
11370    pub fn set_clone_context<T>(mut self, v: T) -> Self
11371    where
11372        T: std::convert::Into<crate::model::CloneContext>,
11373    {
11374        self.clone_context = std::option::Option::Some(v.into());
11375        self
11376    }
11377
11378    /// Sets or clears the value of [clone_context][crate::model::InstancesCloneRequest::clone_context].
11379    pub fn set_or_clear_clone_context<T>(mut self, v: std::option::Option<T>) -> Self
11380    where
11381        T: std::convert::Into<crate::model::CloneContext>,
11382    {
11383        self.clone_context = v.map(|x| x.into());
11384        self
11385    }
11386}
11387
11388impl wkt::message::Message for InstancesCloneRequest {
11389    fn typename() -> &'static str {
11390        "type.googleapis.com/google.cloud.sql.v1.InstancesCloneRequest"
11391    }
11392}
11393
11394#[doc(hidden)]
11395impl<'de> serde::de::Deserialize<'de> for InstancesCloneRequest {
11396    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11397    where
11398        D: serde::Deserializer<'de>,
11399    {
11400        #[allow(non_camel_case_types)]
11401        #[doc(hidden)]
11402        #[derive(PartialEq, Eq, Hash)]
11403        enum __FieldTag {
11404            __clone_context,
11405            Unknown(std::string::String),
11406        }
11407        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11408            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11409            where
11410                D: serde::Deserializer<'de>,
11411            {
11412                struct Visitor;
11413                impl<'de> serde::de::Visitor<'de> for Visitor {
11414                    type Value = __FieldTag;
11415                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11416                        formatter.write_str("a field name for InstancesCloneRequest")
11417                    }
11418                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11419                    where
11420                        E: serde::de::Error,
11421                    {
11422                        use std::result::Result::Ok;
11423                        use std::string::ToString;
11424                        match value {
11425                            "cloneContext" => Ok(__FieldTag::__clone_context),
11426                            "clone_context" => Ok(__FieldTag::__clone_context),
11427                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11428                        }
11429                    }
11430                }
11431                deserializer.deserialize_identifier(Visitor)
11432            }
11433        }
11434        struct Visitor;
11435        impl<'de> serde::de::Visitor<'de> for Visitor {
11436            type Value = InstancesCloneRequest;
11437            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11438                formatter.write_str("struct InstancesCloneRequest")
11439            }
11440            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11441            where
11442                A: serde::de::MapAccess<'de>,
11443            {
11444                #[allow(unused_imports)]
11445                use serde::de::Error;
11446                use std::option::Option::Some;
11447                let mut fields = std::collections::HashSet::new();
11448                let mut result = Self::Value::new();
11449                while let Some(tag) = map.next_key::<__FieldTag>()? {
11450                    #[allow(clippy::match_single_binding)]
11451                    match tag {
11452                        __FieldTag::__clone_context => {
11453                            if !fields.insert(__FieldTag::__clone_context) {
11454                                return std::result::Result::Err(A::Error::duplicate_field(
11455                                    "multiple values for clone_context",
11456                                ));
11457                            }
11458                            result.clone_context = map
11459                                .next_value::<std::option::Option<crate::model::CloneContext>>()?;
11460                        }
11461                        __FieldTag::Unknown(key) => {
11462                            let value = map.next_value::<serde_json::Value>()?;
11463                            result._unknown_fields.insert(key, value);
11464                        }
11465                    }
11466                }
11467                std::result::Result::Ok(result)
11468            }
11469        }
11470        deserializer.deserialize_any(Visitor)
11471    }
11472}
11473
11474#[doc(hidden)]
11475impl serde::ser::Serialize for InstancesCloneRequest {
11476    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11477    where
11478        S: serde::ser::Serializer,
11479    {
11480        use serde::ser::SerializeMap;
11481        #[allow(unused_imports)]
11482        use std::option::Option::Some;
11483        let mut state = serializer.serialize_map(std::option::Option::None)?;
11484        if self.clone_context.is_some() {
11485            state.serialize_entry("cloneContext", &self.clone_context)?;
11486        }
11487        if !self._unknown_fields.is_empty() {
11488            for (key, value) in self._unknown_fields.iter() {
11489                state.serialize_entry(key, &value)?;
11490            }
11491        }
11492        state.end()
11493    }
11494}
11495
11496/// Database demote primary instance request.
11497#[derive(Clone, Debug, Default, PartialEq)]
11498#[non_exhaustive]
11499pub struct InstancesDemoteMasterRequest {
11500    /// Contains details about the demoteMaster operation.
11501    pub demote_master_context: std::option::Option<crate::model::DemoteMasterContext>,
11502
11503    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11504}
11505
11506impl InstancesDemoteMasterRequest {
11507    pub fn new() -> Self {
11508        std::default::Default::default()
11509    }
11510
11511    /// Sets the value of [demote_master_context][crate::model::InstancesDemoteMasterRequest::demote_master_context].
11512    pub fn set_demote_master_context<T>(mut self, v: T) -> Self
11513    where
11514        T: std::convert::Into<crate::model::DemoteMasterContext>,
11515    {
11516        self.demote_master_context = std::option::Option::Some(v.into());
11517        self
11518    }
11519
11520    /// Sets or clears the value of [demote_master_context][crate::model::InstancesDemoteMasterRequest::demote_master_context].
11521    pub fn set_or_clear_demote_master_context<T>(mut self, v: std::option::Option<T>) -> Self
11522    where
11523        T: std::convert::Into<crate::model::DemoteMasterContext>,
11524    {
11525        self.demote_master_context = v.map(|x| x.into());
11526        self
11527    }
11528}
11529
11530impl wkt::message::Message for InstancesDemoteMasterRequest {
11531    fn typename() -> &'static str {
11532        "type.googleapis.com/google.cloud.sql.v1.InstancesDemoteMasterRequest"
11533    }
11534}
11535
11536#[doc(hidden)]
11537impl<'de> serde::de::Deserialize<'de> for InstancesDemoteMasterRequest {
11538    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11539    where
11540        D: serde::Deserializer<'de>,
11541    {
11542        #[allow(non_camel_case_types)]
11543        #[doc(hidden)]
11544        #[derive(PartialEq, Eq, Hash)]
11545        enum __FieldTag {
11546            __demote_master_context,
11547            Unknown(std::string::String),
11548        }
11549        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11550            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11551            where
11552                D: serde::Deserializer<'de>,
11553            {
11554                struct Visitor;
11555                impl<'de> serde::de::Visitor<'de> for Visitor {
11556                    type Value = __FieldTag;
11557                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11558                        formatter.write_str("a field name for InstancesDemoteMasterRequest")
11559                    }
11560                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11561                    where
11562                        E: serde::de::Error,
11563                    {
11564                        use std::result::Result::Ok;
11565                        use std::string::ToString;
11566                        match value {
11567                            "demoteMasterContext" => Ok(__FieldTag::__demote_master_context),
11568                            "demote_master_context" => Ok(__FieldTag::__demote_master_context),
11569                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11570                        }
11571                    }
11572                }
11573                deserializer.deserialize_identifier(Visitor)
11574            }
11575        }
11576        struct Visitor;
11577        impl<'de> serde::de::Visitor<'de> for Visitor {
11578            type Value = InstancesDemoteMasterRequest;
11579            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11580                formatter.write_str("struct InstancesDemoteMasterRequest")
11581            }
11582            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11583            where
11584                A: serde::de::MapAccess<'de>,
11585            {
11586                #[allow(unused_imports)]
11587                use serde::de::Error;
11588                use std::option::Option::Some;
11589                let mut fields = std::collections::HashSet::new();
11590                let mut result = Self::Value::new();
11591                while let Some(tag) = map.next_key::<__FieldTag>()? {
11592                    #[allow(clippy::match_single_binding)]
11593                    match tag {
11594                        __FieldTag::__demote_master_context => {
11595                            if !fields.insert(__FieldTag::__demote_master_context) {
11596                                return std::result::Result::Err(A::Error::duplicate_field(
11597                                    "multiple values for demote_master_context",
11598                                ));
11599                            }
11600                            result.demote_master_context = map.next_value::<std::option::Option<crate::model::DemoteMasterContext>>()?
11601                                ;
11602                        }
11603                        __FieldTag::Unknown(key) => {
11604                            let value = map.next_value::<serde_json::Value>()?;
11605                            result._unknown_fields.insert(key, value);
11606                        }
11607                    }
11608                }
11609                std::result::Result::Ok(result)
11610            }
11611        }
11612        deserializer.deserialize_any(Visitor)
11613    }
11614}
11615
11616#[doc(hidden)]
11617impl serde::ser::Serialize for InstancesDemoteMasterRequest {
11618    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11619    where
11620        S: serde::ser::Serializer,
11621    {
11622        use serde::ser::SerializeMap;
11623        #[allow(unused_imports)]
11624        use std::option::Option::Some;
11625        let mut state = serializer.serialize_map(std::option::Option::None)?;
11626        if self.demote_master_context.is_some() {
11627            state.serialize_entry("demoteMasterContext", &self.demote_master_context)?;
11628        }
11629        if !self._unknown_fields.is_empty() {
11630            for (key, value) in self._unknown_fields.iter() {
11631                state.serialize_entry(key, &value)?;
11632            }
11633        }
11634        state.end()
11635    }
11636}
11637
11638/// This request is used to demote an existing standalone instance to be a
11639/// Cloud SQL read replica for an external database server.
11640#[derive(Clone, Debug, Default, PartialEq)]
11641#[non_exhaustive]
11642pub struct InstancesDemoteRequest {
11643    /// Required. Contains details about the demote operation.
11644    pub demote_context: std::option::Option<crate::model::DemoteContext>,
11645
11646    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11647}
11648
11649impl InstancesDemoteRequest {
11650    pub fn new() -> Self {
11651        std::default::Default::default()
11652    }
11653
11654    /// Sets the value of [demote_context][crate::model::InstancesDemoteRequest::demote_context].
11655    pub fn set_demote_context<T>(mut self, v: T) -> Self
11656    where
11657        T: std::convert::Into<crate::model::DemoteContext>,
11658    {
11659        self.demote_context = std::option::Option::Some(v.into());
11660        self
11661    }
11662
11663    /// Sets or clears the value of [demote_context][crate::model::InstancesDemoteRequest::demote_context].
11664    pub fn set_or_clear_demote_context<T>(mut self, v: std::option::Option<T>) -> Self
11665    where
11666        T: std::convert::Into<crate::model::DemoteContext>,
11667    {
11668        self.demote_context = v.map(|x| x.into());
11669        self
11670    }
11671}
11672
11673impl wkt::message::Message for InstancesDemoteRequest {
11674    fn typename() -> &'static str {
11675        "type.googleapis.com/google.cloud.sql.v1.InstancesDemoteRequest"
11676    }
11677}
11678
11679#[doc(hidden)]
11680impl<'de> serde::de::Deserialize<'de> for InstancesDemoteRequest {
11681    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11682    where
11683        D: serde::Deserializer<'de>,
11684    {
11685        #[allow(non_camel_case_types)]
11686        #[doc(hidden)]
11687        #[derive(PartialEq, Eq, Hash)]
11688        enum __FieldTag {
11689            __demote_context,
11690            Unknown(std::string::String),
11691        }
11692        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11693            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11694            where
11695                D: serde::Deserializer<'de>,
11696            {
11697                struct Visitor;
11698                impl<'de> serde::de::Visitor<'de> for Visitor {
11699                    type Value = __FieldTag;
11700                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11701                        formatter.write_str("a field name for InstancesDemoteRequest")
11702                    }
11703                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11704                    where
11705                        E: serde::de::Error,
11706                    {
11707                        use std::result::Result::Ok;
11708                        use std::string::ToString;
11709                        match value {
11710                            "demoteContext" => Ok(__FieldTag::__demote_context),
11711                            "demote_context" => Ok(__FieldTag::__demote_context),
11712                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11713                        }
11714                    }
11715                }
11716                deserializer.deserialize_identifier(Visitor)
11717            }
11718        }
11719        struct Visitor;
11720        impl<'de> serde::de::Visitor<'de> for Visitor {
11721            type Value = InstancesDemoteRequest;
11722            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11723                formatter.write_str("struct InstancesDemoteRequest")
11724            }
11725            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11726            where
11727                A: serde::de::MapAccess<'de>,
11728            {
11729                #[allow(unused_imports)]
11730                use serde::de::Error;
11731                use std::option::Option::Some;
11732                let mut fields = std::collections::HashSet::new();
11733                let mut result = Self::Value::new();
11734                while let Some(tag) = map.next_key::<__FieldTag>()? {
11735                    #[allow(clippy::match_single_binding)]
11736                    match tag {
11737                        __FieldTag::__demote_context => {
11738                            if !fields.insert(__FieldTag::__demote_context) {
11739                                return std::result::Result::Err(A::Error::duplicate_field(
11740                                    "multiple values for demote_context",
11741                                ));
11742                            }
11743                            result.demote_context = map
11744                                .next_value::<std::option::Option<crate::model::DemoteContext>>()?;
11745                        }
11746                        __FieldTag::Unknown(key) => {
11747                            let value = map.next_value::<serde_json::Value>()?;
11748                            result._unknown_fields.insert(key, value);
11749                        }
11750                    }
11751                }
11752                std::result::Result::Ok(result)
11753            }
11754        }
11755        deserializer.deserialize_any(Visitor)
11756    }
11757}
11758
11759#[doc(hidden)]
11760impl serde::ser::Serialize for InstancesDemoteRequest {
11761    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11762    where
11763        S: serde::ser::Serializer,
11764    {
11765        use serde::ser::SerializeMap;
11766        #[allow(unused_imports)]
11767        use std::option::Option::Some;
11768        let mut state = serializer.serialize_map(std::option::Option::None)?;
11769        if self.demote_context.is_some() {
11770            state.serialize_entry("demoteContext", &self.demote_context)?;
11771        }
11772        if !self._unknown_fields.is_empty() {
11773            for (key, value) in self._unknown_fields.iter() {
11774                state.serialize_entry(key, &value)?;
11775            }
11776        }
11777        state.end()
11778    }
11779}
11780
11781/// Database instance export request.
11782#[derive(Clone, Debug, Default, PartialEq)]
11783#[non_exhaustive]
11784pub struct InstancesExportRequest {
11785    /// Contains details about the export operation.
11786    pub export_context: std::option::Option<crate::model::ExportContext>,
11787
11788    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11789}
11790
11791impl InstancesExportRequest {
11792    pub fn new() -> Self {
11793        std::default::Default::default()
11794    }
11795
11796    /// Sets the value of [export_context][crate::model::InstancesExportRequest::export_context].
11797    pub fn set_export_context<T>(mut self, v: T) -> Self
11798    where
11799        T: std::convert::Into<crate::model::ExportContext>,
11800    {
11801        self.export_context = std::option::Option::Some(v.into());
11802        self
11803    }
11804
11805    /// Sets or clears the value of [export_context][crate::model::InstancesExportRequest::export_context].
11806    pub fn set_or_clear_export_context<T>(mut self, v: std::option::Option<T>) -> Self
11807    where
11808        T: std::convert::Into<crate::model::ExportContext>,
11809    {
11810        self.export_context = v.map(|x| x.into());
11811        self
11812    }
11813}
11814
11815impl wkt::message::Message for InstancesExportRequest {
11816    fn typename() -> &'static str {
11817        "type.googleapis.com/google.cloud.sql.v1.InstancesExportRequest"
11818    }
11819}
11820
11821#[doc(hidden)]
11822impl<'de> serde::de::Deserialize<'de> for InstancesExportRequest {
11823    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11824    where
11825        D: serde::Deserializer<'de>,
11826    {
11827        #[allow(non_camel_case_types)]
11828        #[doc(hidden)]
11829        #[derive(PartialEq, Eq, Hash)]
11830        enum __FieldTag {
11831            __export_context,
11832            Unknown(std::string::String),
11833        }
11834        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11835            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11836            where
11837                D: serde::Deserializer<'de>,
11838            {
11839                struct Visitor;
11840                impl<'de> serde::de::Visitor<'de> for Visitor {
11841                    type Value = __FieldTag;
11842                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11843                        formatter.write_str("a field name for InstancesExportRequest")
11844                    }
11845                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11846                    where
11847                        E: serde::de::Error,
11848                    {
11849                        use std::result::Result::Ok;
11850                        use std::string::ToString;
11851                        match value {
11852                            "exportContext" => Ok(__FieldTag::__export_context),
11853                            "export_context" => Ok(__FieldTag::__export_context),
11854                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11855                        }
11856                    }
11857                }
11858                deserializer.deserialize_identifier(Visitor)
11859            }
11860        }
11861        struct Visitor;
11862        impl<'de> serde::de::Visitor<'de> for Visitor {
11863            type Value = InstancesExportRequest;
11864            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11865                formatter.write_str("struct InstancesExportRequest")
11866            }
11867            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11868            where
11869                A: serde::de::MapAccess<'de>,
11870            {
11871                #[allow(unused_imports)]
11872                use serde::de::Error;
11873                use std::option::Option::Some;
11874                let mut fields = std::collections::HashSet::new();
11875                let mut result = Self::Value::new();
11876                while let Some(tag) = map.next_key::<__FieldTag>()? {
11877                    #[allow(clippy::match_single_binding)]
11878                    match tag {
11879                        __FieldTag::__export_context => {
11880                            if !fields.insert(__FieldTag::__export_context) {
11881                                return std::result::Result::Err(A::Error::duplicate_field(
11882                                    "multiple values for export_context",
11883                                ));
11884                            }
11885                            result.export_context = map
11886                                .next_value::<std::option::Option<crate::model::ExportContext>>()?;
11887                        }
11888                        __FieldTag::Unknown(key) => {
11889                            let value = map.next_value::<serde_json::Value>()?;
11890                            result._unknown_fields.insert(key, value);
11891                        }
11892                    }
11893                }
11894                std::result::Result::Ok(result)
11895            }
11896        }
11897        deserializer.deserialize_any(Visitor)
11898    }
11899}
11900
11901#[doc(hidden)]
11902impl serde::ser::Serialize for InstancesExportRequest {
11903    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11904    where
11905        S: serde::ser::Serializer,
11906    {
11907        use serde::ser::SerializeMap;
11908        #[allow(unused_imports)]
11909        use std::option::Option::Some;
11910        let mut state = serializer.serialize_map(std::option::Option::None)?;
11911        if self.export_context.is_some() {
11912            state.serialize_entry("exportContext", &self.export_context)?;
11913        }
11914        if !self._unknown_fields.is_empty() {
11915            for (key, value) in self._unknown_fields.iter() {
11916                state.serialize_entry(key, &value)?;
11917            }
11918        }
11919        state.end()
11920    }
11921}
11922
11923/// Instance failover request.
11924#[derive(Clone, Debug, Default, PartialEq)]
11925#[non_exhaustive]
11926pub struct InstancesFailoverRequest {
11927    /// Failover Context.
11928    pub failover_context: std::option::Option<crate::model::FailoverContext>,
11929
11930    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11931}
11932
11933impl InstancesFailoverRequest {
11934    pub fn new() -> Self {
11935        std::default::Default::default()
11936    }
11937
11938    /// Sets the value of [failover_context][crate::model::InstancesFailoverRequest::failover_context].
11939    pub fn set_failover_context<T>(mut self, v: T) -> Self
11940    where
11941        T: std::convert::Into<crate::model::FailoverContext>,
11942    {
11943        self.failover_context = std::option::Option::Some(v.into());
11944        self
11945    }
11946
11947    /// Sets or clears the value of [failover_context][crate::model::InstancesFailoverRequest::failover_context].
11948    pub fn set_or_clear_failover_context<T>(mut self, v: std::option::Option<T>) -> Self
11949    where
11950        T: std::convert::Into<crate::model::FailoverContext>,
11951    {
11952        self.failover_context = v.map(|x| x.into());
11953        self
11954    }
11955}
11956
11957impl wkt::message::Message for InstancesFailoverRequest {
11958    fn typename() -> &'static str {
11959        "type.googleapis.com/google.cloud.sql.v1.InstancesFailoverRequest"
11960    }
11961}
11962
11963#[doc(hidden)]
11964impl<'de> serde::de::Deserialize<'de> for InstancesFailoverRequest {
11965    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11966    where
11967        D: serde::Deserializer<'de>,
11968    {
11969        #[allow(non_camel_case_types)]
11970        #[doc(hidden)]
11971        #[derive(PartialEq, Eq, Hash)]
11972        enum __FieldTag {
11973            __failover_context,
11974            Unknown(std::string::String),
11975        }
11976        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11977            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11978            where
11979                D: serde::Deserializer<'de>,
11980            {
11981                struct Visitor;
11982                impl<'de> serde::de::Visitor<'de> for Visitor {
11983                    type Value = __FieldTag;
11984                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11985                        formatter.write_str("a field name for InstancesFailoverRequest")
11986                    }
11987                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11988                    where
11989                        E: serde::de::Error,
11990                    {
11991                        use std::result::Result::Ok;
11992                        use std::string::ToString;
11993                        match value {
11994                            "failoverContext" => Ok(__FieldTag::__failover_context),
11995                            "failover_context" => Ok(__FieldTag::__failover_context),
11996                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11997                        }
11998                    }
11999                }
12000                deserializer.deserialize_identifier(Visitor)
12001            }
12002        }
12003        struct Visitor;
12004        impl<'de> serde::de::Visitor<'de> for Visitor {
12005            type Value = InstancesFailoverRequest;
12006            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12007                formatter.write_str("struct InstancesFailoverRequest")
12008            }
12009            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12010            where
12011                A: serde::de::MapAccess<'de>,
12012            {
12013                #[allow(unused_imports)]
12014                use serde::de::Error;
12015                use std::option::Option::Some;
12016                let mut fields = std::collections::HashSet::new();
12017                let mut result = Self::Value::new();
12018                while let Some(tag) = map.next_key::<__FieldTag>()? {
12019                    #[allow(clippy::match_single_binding)]
12020                    match tag {
12021                        __FieldTag::__failover_context => {
12022                            if !fields.insert(__FieldTag::__failover_context) {
12023                                return std::result::Result::Err(A::Error::duplicate_field(
12024                                    "multiple values for failover_context",
12025                                ));
12026                            }
12027                            result.failover_context = map
12028                                .next_value::<std::option::Option<crate::model::FailoverContext>>(
12029                                )?;
12030                        }
12031                        __FieldTag::Unknown(key) => {
12032                            let value = map.next_value::<serde_json::Value>()?;
12033                            result._unknown_fields.insert(key, value);
12034                        }
12035                    }
12036                }
12037                std::result::Result::Ok(result)
12038            }
12039        }
12040        deserializer.deserialize_any(Visitor)
12041    }
12042}
12043
12044#[doc(hidden)]
12045impl serde::ser::Serialize for InstancesFailoverRequest {
12046    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12047    where
12048        S: serde::ser::Serializer,
12049    {
12050        use serde::ser::SerializeMap;
12051        #[allow(unused_imports)]
12052        use std::option::Option::Some;
12053        let mut state = serializer.serialize_map(std::option::Option::None)?;
12054        if self.failover_context.is_some() {
12055            state.serialize_entry("failoverContext", &self.failover_context)?;
12056        }
12057        if !self._unknown_fields.is_empty() {
12058            for (key, value) in self._unknown_fields.iter() {
12059                state.serialize_entry(key, &value)?;
12060            }
12061        }
12062        state.end()
12063    }
12064}
12065
12066/// SslCerts create ephemeral certificate request.
12067#[derive(Clone, Debug, Default, PartialEq)]
12068#[non_exhaustive]
12069pub struct SslCertsCreateEphemeralRequest {
12070    /// PEM encoded public key to include in the signed certificate.
12071    pub public_key: std::string::String,
12072
12073    /// Access token to include in the signed certificate.
12074    pub access_token: std::string::String,
12075
12076    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12077}
12078
12079impl SslCertsCreateEphemeralRequest {
12080    pub fn new() -> Self {
12081        std::default::Default::default()
12082    }
12083
12084    /// Sets the value of [public_key][crate::model::SslCertsCreateEphemeralRequest::public_key].
12085    pub fn set_public_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12086        self.public_key = v.into();
12087        self
12088    }
12089
12090    /// Sets the value of [access_token][crate::model::SslCertsCreateEphemeralRequest::access_token].
12091    pub fn set_access_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12092        self.access_token = v.into();
12093        self
12094    }
12095}
12096
12097impl wkt::message::Message for SslCertsCreateEphemeralRequest {
12098    fn typename() -> &'static str {
12099        "type.googleapis.com/google.cloud.sql.v1.SslCertsCreateEphemeralRequest"
12100    }
12101}
12102
12103#[doc(hidden)]
12104impl<'de> serde::de::Deserialize<'de> for SslCertsCreateEphemeralRequest {
12105    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12106    where
12107        D: serde::Deserializer<'de>,
12108    {
12109        #[allow(non_camel_case_types)]
12110        #[doc(hidden)]
12111        #[derive(PartialEq, Eq, Hash)]
12112        enum __FieldTag {
12113            __public_key,
12114            __access_token,
12115            Unknown(std::string::String),
12116        }
12117        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12118            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12119            where
12120                D: serde::Deserializer<'de>,
12121            {
12122                struct Visitor;
12123                impl<'de> serde::de::Visitor<'de> for Visitor {
12124                    type Value = __FieldTag;
12125                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12126                        formatter.write_str("a field name for SslCertsCreateEphemeralRequest")
12127                    }
12128                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12129                    where
12130                        E: serde::de::Error,
12131                    {
12132                        use std::result::Result::Ok;
12133                        use std::string::ToString;
12134                        match value {
12135                            "public_key" => Ok(__FieldTag::__public_key),
12136                            "access_token" => Ok(__FieldTag::__access_token),
12137                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12138                        }
12139                    }
12140                }
12141                deserializer.deserialize_identifier(Visitor)
12142            }
12143        }
12144        struct Visitor;
12145        impl<'de> serde::de::Visitor<'de> for Visitor {
12146            type Value = SslCertsCreateEphemeralRequest;
12147            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12148                formatter.write_str("struct SslCertsCreateEphemeralRequest")
12149            }
12150            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12151            where
12152                A: serde::de::MapAccess<'de>,
12153            {
12154                #[allow(unused_imports)]
12155                use serde::de::Error;
12156                use std::option::Option::Some;
12157                let mut fields = std::collections::HashSet::new();
12158                let mut result = Self::Value::new();
12159                while let Some(tag) = map.next_key::<__FieldTag>()? {
12160                    #[allow(clippy::match_single_binding)]
12161                    match tag {
12162                        __FieldTag::__public_key => {
12163                            if !fields.insert(__FieldTag::__public_key) {
12164                                return std::result::Result::Err(A::Error::duplicate_field(
12165                                    "multiple values for public_key",
12166                                ));
12167                            }
12168                            result.public_key = map
12169                                .next_value::<std::option::Option<std::string::String>>()?
12170                                .unwrap_or_default();
12171                        }
12172                        __FieldTag::__access_token => {
12173                            if !fields.insert(__FieldTag::__access_token) {
12174                                return std::result::Result::Err(A::Error::duplicate_field(
12175                                    "multiple values for access_token",
12176                                ));
12177                            }
12178                            result.access_token = map
12179                                .next_value::<std::option::Option<std::string::String>>()?
12180                                .unwrap_or_default();
12181                        }
12182                        __FieldTag::Unknown(key) => {
12183                            let value = map.next_value::<serde_json::Value>()?;
12184                            result._unknown_fields.insert(key, value);
12185                        }
12186                    }
12187                }
12188                std::result::Result::Ok(result)
12189            }
12190        }
12191        deserializer.deserialize_any(Visitor)
12192    }
12193}
12194
12195#[doc(hidden)]
12196impl serde::ser::Serialize for SslCertsCreateEphemeralRequest {
12197    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12198    where
12199        S: serde::ser::Serializer,
12200    {
12201        use serde::ser::SerializeMap;
12202        #[allow(unused_imports)]
12203        use std::option::Option::Some;
12204        let mut state = serializer.serialize_map(std::option::Option::None)?;
12205        if !self.public_key.is_empty() {
12206            state.serialize_entry("public_key", &self.public_key)?;
12207        }
12208        if !self.access_token.is_empty() {
12209            state.serialize_entry("access_token", &self.access_token)?;
12210        }
12211        if !self._unknown_fields.is_empty() {
12212            for (key, value) in self._unknown_fields.iter() {
12213                state.serialize_entry(key, &value)?;
12214            }
12215        }
12216        state.end()
12217    }
12218}
12219
12220/// Database instance import request.
12221#[derive(Clone, Debug, Default, PartialEq)]
12222#[non_exhaustive]
12223pub struct InstancesImportRequest {
12224    /// Contains details about the import operation.
12225    pub import_context: std::option::Option<crate::model::ImportContext>,
12226
12227    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12228}
12229
12230impl InstancesImportRequest {
12231    pub fn new() -> Self {
12232        std::default::Default::default()
12233    }
12234
12235    /// Sets the value of [import_context][crate::model::InstancesImportRequest::import_context].
12236    pub fn set_import_context<T>(mut self, v: T) -> Self
12237    where
12238        T: std::convert::Into<crate::model::ImportContext>,
12239    {
12240        self.import_context = std::option::Option::Some(v.into());
12241        self
12242    }
12243
12244    /// Sets or clears the value of [import_context][crate::model::InstancesImportRequest::import_context].
12245    pub fn set_or_clear_import_context<T>(mut self, v: std::option::Option<T>) -> Self
12246    where
12247        T: std::convert::Into<crate::model::ImportContext>,
12248    {
12249        self.import_context = v.map(|x| x.into());
12250        self
12251    }
12252}
12253
12254impl wkt::message::Message for InstancesImportRequest {
12255    fn typename() -> &'static str {
12256        "type.googleapis.com/google.cloud.sql.v1.InstancesImportRequest"
12257    }
12258}
12259
12260#[doc(hidden)]
12261impl<'de> serde::de::Deserialize<'de> for InstancesImportRequest {
12262    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12263    where
12264        D: serde::Deserializer<'de>,
12265    {
12266        #[allow(non_camel_case_types)]
12267        #[doc(hidden)]
12268        #[derive(PartialEq, Eq, Hash)]
12269        enum __FieldTag {
12270            __import_context,
12271            Unknown(std::string::String),
12272        }
12273        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12274            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12275            where
12276                D: serde::Deserializer<'de>,
12277            {
12278                struct Visitor;
12279                impl<'de> serde::de::Visitor<'de> for Visitor {
12280                    type Value = __FieldTag;
12281                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12282                        formatter.write_str("a field name for InstancesImportRequest")
12283                    }
12284                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12285                    where
12286                        E: serde::de::Error,
12287                    {
12288                        use std::result::Result::Ok;
12289                        use std::string::ToString;
12290                        match value {
12291                            "importContext" => Ok(__FieldTag::__import_context),
12292                            "import_context" => Ok(__FieldTag::__import_context),
12293                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12294                        }
12295                    }
12296                }
12297                deserializer.deserialize_identifier(Visitor)
12298            }
12299        }
12300        struct Visitor;
12301        impl<'de> serde::de::Visitor<'de> for Visitor {
12302            type Value = InstancesImportRequest;
12303            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12304                formatter.write_str("struct InstancesImportRequest")
12305            }
12306            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12307            where
12308                A: serde::de::MapAccess<'de>,
12309            {
12310                #[allow(unused_imports)]
12311                use serde::de::Error;
12312                use std::option::Option::Some;
12313                let mut fields = std::collections::HashSet::new();
12314                let mut result = Self::Value::new();
12315                while let Some(tag) = map.next_key::<__FieldTag>()? {
12316                    #[allow(clippy::match_single_binding)]
12317                    match tag {
12318                        __FieldTag::__import_context => {
12319                            if !fields.insert(__FieldTag::__import_context) {
12320                                return std::result::Result::Err(A::Error::duplicate_field(
12321                                    "multiple values for import_context",
12322                                ));
12323                            }
12324                            result.import_context = map
12325                                .next_value::<std::option::Option<crate::model::ImportContext>>()?;
12326                        }
12327                        __FieldTag::Unknown(key) => {
12328                            let value = map.next_value::<serde_json::Value>()?;
12329                            result._unknown_fields.insert(key, value);
12330                        }
12331                    }
12332                }
12333                std::result::Result::Ok(result)
12334            }
12335        }
12336        deserializer.deserialize_any(Visitor)
12337    }
12338}
12339
12340#[doc(hidden)]
12341impl serde::ser::Serialize for InstancesImportRequest {
12342    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12343    where
12344        S: serde::ser::Serializer,
12345    {
12346        use serde::ser::SerializeMap;
12347        #[allow(unused_imports)]
12348        use std::option::Option::Some;
12349        let mut state = serializer.serialize_map(std::option::Option::None)?;
12350        if self.import_context.is_some() {
12351            state.serialize_entry("importContext", &self.import_context)?;
12352        }
12353        if !self._unknown_fields.is_empty() {
12354            for (key, value) in self._unknown_fields.iter() {
12355                state.serialize_entry(key, &value)?;
12356            }
12357        }
12358        state.end()
12359    }
12360}
12361
12362/// Database instances list response.
12363#[derive(Clone, Debug, Default, PartialEq)]
12364#[non_exhaustive]
12365pub struct InstancesListResponse {
12366    /// This is always `sql#instancesList`.
12367    pub kind: std::string::String,
12368
12369    /// List of warnings that occurred while handling the request.
12370    pub warnings: std::vec::Vec<crate::model::ApiWarning>,
12371
12372    /// List of database instance resources.
12373    pub items: std::vec::Vec<crate::model::DatabaseInstance>,
12374
12375    /// The continuation token, used to page through large result sets. Provide
12376    /// this value in a subsequent request to return the next page of results.
12377    pub next_page_token: std::string::String,
12378
12379    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12380}
12381
12382impl InstancesListResponse {
12383    pub fn new() -> Self {
12384        std::default::Default::default()
12385    }
12386
12387    /// Sets the value of [kind][crate::model::InstancesListResponse::kind].
12388    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12389        self.kind = v.into();
12390        self
12391    }
12392
12393    /// Sets the value of [warnings][crate::model::InstancesListResponse::warnings].
12394    pub fn set_warnings<T, V>(mut self, v: T) -> Self
12395    where
12396        T: std::iter::IntoIterator<Item = V>,
12397        V: std::convert::Into<crate::model::ApiWarning>,
12398    {
12399        use std::iter::Iterator;
12400        self.warnings = v.into_iter().map(|i| i.into()).collect();
12401        self
12402    }
12403
12404    /// Sets the value of [items][crate::model::InstancesListResponse::items].
12405    pub fn set_items<T, V>(mut self, v: T) -> Self
12406    where
12407        T: std::iter::IntoIterator<Item = V>,
12408        V: std::convert::Into<crate::model::DatabaseInstance>,
12409    {
12410        use std::iter::Iterator;
12411        self.items = v.into_iter().map(|i| i.into()).collect();
12412        self
12413    }
12414
12415    /// Sets the value of [next_page_token][crate::model::InstancesListResponse::next_page_token].
12416    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12417        self.next_page_token = v.into();
12418        self
12419    }
12420}
12421
12422impl wkt::message::Message for InstancesListResponse {
12423    fn typename() -> &'static str {
12424        "type.googleapis.com/google.cloud.sql.v1.InstancesListResponse"
12425    }
12426}
12427
12428#[doc(hidden)]
12429impl gax::paginator::internal::PageableResponse for InstancesListResponse {
12430    type PageItem = crate::model::DatabaseInstance;
12431
12432    fn items(self) -> std::vec::Vec<Self::PageItem> {
12433        self.items
12434    }
12435
12436    fn next_page_token(&self) -> std::string::String {
12437        use std::clone::Clone;
12438        self.next_page_token.clone()
12439    }
12440}
12441
12442#[doc(hidden)]
12443impl<'de> serde::de::Deserialize<'de> for InstancesListResponse {
12444    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12445    where
12446        D: serde::Deserializer<'de>,
12447    {
12448        #[allow(non_camel_case_types)]
12449        #[doc(hidden)]
12450        #[derive(PartialEq, Eq, Hash)]
12451        enum __FieldTag {
12452            __kind,
12453            __warnings,
12454            __items,
12455            __next_page_token,
12456            Unknown(std::string::String),
12457        }
12458        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12459            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12460            where
12461                D: serde::Deserializer<'de>,
12462            {
12463                struct Visitor;
12464                impl<'de> serde::de::Visitor<'de> for Visitor {
12465                    type Value = __FieldTag;
12466                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12467                        formatter.write_str("a field name for InstancesListResponse")
12468                    }
12469                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12470                    where
12471                        E: serde::de::Error,
12472                    {
12473                        use std::result::Result::Ok;
12474                        use std::string::ToString;
12475                        match value {
12476                            "kind" => Ok(__FieldTag::__kind),
12477                            "warnings" => Ok(__FieldTag::__warnings),
12478                            "items" => Ok(__FieldTag::__items),
12479                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
12480                            "next_page_token" => Ok(__FieldTag::__next_page_token),
12481                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12482                        }
12483                    }
12484                }
12485                deserializer.deserialize_identifier(Visitor)
12486            }
12487        }
12488        struct Visitor;
12489        impl<'de> serde::de::Visitor<'de> for Visitor {
12490            type Value = InstancesListResponse;
12491            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12492                formatter.write_str("struct InstancesListResponse")
12493            }
12494            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12495            where
12496                A: serde::de::MapAccess<'de>,
12497            {
12498                #[allow(unused_imports)]
12499                use serde::de::Error;
12500                use std::option::Option::Some;
12501                let mut fields = std::collections::HashSet::new();
12502                let mut result = Self::Value::new();
12503                while let Some(tag) = map.next_key::<__FieldTag>()? {
12504                    #[allow(clippy::match_single_binding)]
12505                    match tag {
12506                        __FieldTag::__kind => {
12507                            if !fields.insert(__FieldTag::__kind) {
12508                                return std::result::Result::Err(A::Error::duplicate_field(
12509                                    "multiple values for kind",
12510                                ));
12511                            }
12512                            result.kind = map
12513                                .next_value::<std::option::Option<std::string::String>>()?
12514                                .unwrap_or_default();
12515                        }
12516                        __FieldTag::__warnings => {
12517                            if !fields.insert(__FieldTag::__warnings) {
12518                                return std::result::Result::Err(A::Error::duplicate_field(
12519                                    "multiple values for warnings",
12520                                ));
12521                            }
12522                            result.warnings = map.next_value::<std::option::Option<std::vec::Vec<crate::model::ApiWarning>>>()?.unwrap_or_default();
12523                        }
12524                        __FieldTag::__items => {
12525                            if !fields.insert(__FieldTag::__items) {
12526                                return std::result::Result::Err(A::Error::duplicate_field(
12527                                    "multiple values for items",
12528                                ));
12529                            }
12530                            result.items =
12531                                map.next_value::<std::option::Option<
12532                                    std::vec::Vec<crate::model::DatabaseInstance>,
12533                                >>()?
12534                                .unwrap_or_default();
12535                        }
12536                        __FieldTag::__next_page_token => {
12537                            if !fields.insert(__FieldTag::__next_page_token) {
12538                                return std::result::Result::Err(A::Error::duplicate_field(
12539                                    "multiple values for next_page_token",
12540                                ));
12541                            }
12542                            result.next_page_token = map
12543                                .next_value::<std::option::Option<std::string::String>>()?
12544                                .unwrap_or_default();
12545                        }
12546                        __FieldTag::Unknown(key) => {
12547                            let value = map.next_value::<serde_json::Value>()?;
12548                            result._unknown_fields.insert(key, value);
12549                        }
12550                    }
12551                }
12552                std::result::Result::Ok(result)
12553            }
12554        }
12555        deserializer.deserialize_any(Visitor)
12556    }
12557}
12558
12559#[doc(hidden)]
12560impl serde::ser::Serialize for InstancesListResponse {
12561    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12562    where
12563        S: serde::ser::Serializer,
12564    {
12565        use serde::ser::SerializeMap;
12566        #[allow(unused_imports)]
12567        use std::option::Option::Some;
12568        let mut state = serializer.serialize_map(std::option::Option::None)?;
12569        if !self.kind.is_empty() {
12570            state.serialize_entry("kind", &self.kind)?;
12571        }
12572        if !self.warnings.is_empty() {
12573            state.serialize_entry("warnings", &self.warnings)?;
12574        }
12575        if !self.items.is_empty() {
12576            state.serialize_entry("items", &self.items)?;
12577        }
12578        if !self.next_page_token.is_empty() {
12579            state.serialize_entry("nextPageToken", &self.next_page_token)?;
12580        }
12581        if !self._unknown_fields.is_empty() {
12582            for (key, value) in self._unknown_fields.iter() {
12583                state.serialize_entry(key, &value)?;
12584            }
12585        }
12586        state.end()
12587    }
12588}
12589
12590/// Instances ListServerCas response.
12591#[derive(Clone, Debug, Default, PartialEq)]
12592#[non_exhaustive]
12593pub struct InstancesListServerCasResponse {
12594    /// List of server CA certificates for the instance.
12595    pub certs: std::vec::Vec<crate::model::SslCert>,
12596
12597    pub active_version: std::string::String,
12598
12599    /// This is always `sql#instancesListServerCas`.
12600    pub kind: std::string::String,
12601
12602    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12603}
12604
12605impl InstancesListServerCasResponse {
12606    pub fn new() -> Self {
12607        std::default::Default::default()
12608    }
12609
12610    /// Sets the value of [certs][crate::model::InstancesListServerCasResponse::certs].
12611    pub fn set_certs<T, V>(mut self, v: T) -> Self
12612    where
12613        T: std::iter::IntoIterator<Item = V>,
12614        V: std::convert::Into<crate::model::SslCert>,
12615    {
12616        use std::iter::Iterator;
12617        self.certs = v.into_iter().map(|i| i.into()).collect();
12618        self
12619    }
12620
12621    /// Sets the value of [active_version][crate::model::InstancesListServerCasResponse::active_version].
12622    pub fn set_active_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12623        self.active_version = v.into();
12624        self
12625    }
12626
12627    /// Sets the value of [kind][crate::model::InstancesListServerCasResponse::kind].
12628    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12629        self.kind = v.into();
12630        self
12631    }
12632}
12633
12634impl wkt::message::Message for InstancesListServerCasResponse {
12635    fn typename() -> &'static str {
12636        "type.googleapis.com/google.cloud.sql.v1.InstancesListServerCasResponse"
12637    }
12638}
12639
12640#[doc(hidden)]
12641impl<'de> serde::de::Deserialize<'de> for InstancesListServerCasResponse {
12642    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12643    where
12644        D: serde::Deserializer<'de>,
12645    {
12646        #[allow(non_camel_case_types)]
12647        #[doc(hidden)]
12648        #[derive(PartialEq, Eq, Hash)]
12649        enum __FieldTag {
12650            __certs,
12651            __active_version,
12652            __kind,
12653            Unknown(std::string::String),
12654        }
12655        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12656            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12657            where
12658                D: serde::Deserializer<'de>,
12659            {
12660                struct Visitor;
12661                impl<'de> serde::de::Visitor<'de> for Visitor {
12662                    type Value = __FieldTag;
12663                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12664                        formatter.write_str("a field name for InstancesListServerCasResponse")
12665                    }
12666                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12667                    where
12668                        E: serde::de::Error,
12669                    {
12670                        use std::result::Result::Ok;
12671                        use std::string::ToString;
12672                        match value {
12673                            "certs" => Ok(__FieldTag::__certs),
12674                            "activeVersion" => Ok(__FieldTag::__active_version),
12675                            "active_version" => Ok(__FieldTag::__active_version),
12676                            "kind" => Ok(__FieldTag::__kind),
12677                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12678                        }
12679                    }
12680                }
12681                deserializer.deserialize_identifier(Visitor)
12682            }
12683        }
12684        struct Visitor;
12685        impl<'de> serde::de::Visitor<'de> for Visitor {
12686            type Value = InstancesListServerCasResponse;
12687            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12688                formatter.write_str("struct InstancesListServerCasResponse")
12689            }
12690            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12691            where
12692                A: serde::de::MapAccess<'de>,
12693            {
12694                #[allow(unused_imports)]
12695                use serde::de::Error;
12696                use std::option::Option::Some;
12697                let mut fields = std::collections::HashSet::new();
12698                let mut result = Self::Value::new();
12699                while let Some(tag) = map.next_key::<__FieldTag>()? {
12700                    #[allow(clippy::match_single_binding)]
12701                    match tag {
12702                        __FieldTag::__certs => {
12703                            if !fields.insert(__FieldTag::__certs) {
12704                                return std::result::Result::Err(A::Error::duplicate_field(
12705                                    "multiple values for certs",
12706                                ));
12707                            }
12708                            result.certs = map.next_value::<std::option::Option<std::vec::Vec<crate::model::SslCert>>>()?.unwrap_or_default();
12709                        }
12710                        __FieldTag::__active_version => {
12711                            if !fields.insert(__FieldTag::__active_version) {
12712                                return std::result::Result::Err(A::Error::duplicate_field(
12713                                    "multiple values for active_version",
12714                                ));
12715                            }
12716                            result.active_version = map
12717                                .next_value::<std::option::Option<std::string::String>>()?
12718                                .unwrap_or_default();
12719                        }
12720                        __FieldTag::__kind => {
12721                            if !fields.insert(__FieldTag::__kind) {
12722                                return std::result::Result::Err(A::Error::duplicate_field(
12723                                    "multiple values for kind",
12724                                ));
12725                            }
12726                            result.kind = map
12727                                .next_value::<std::option::Option<std::string::String>>()?
12728                                .unwrap_or_default();
12729                        }
12730                        __FieldTag::Unknown(key) => {
12731                            let value = map.next_value::<serde_json::Value>()?;
12732                            result._unknown_fields.insert(key, value);
12733                        }
12734                    }
12735                }
12736                std::result::Result::Ok(result)
12737            }
12738        }
12739        deserializer.deserialize_any(Visitor)
12740    }
12741}
12742
12743#[doc(hidden)]
12744impl serde::ser::Serialize for InstancesListServerCasResponse {
12745    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12746    where
12747        S: serde::ser::Serializer,
12748    {
12749        use serde::ser::SerializeMap;
12750        #[allow(unused_imports)]
12751        use std::option::Option::Some;
12752        let mut state = serializer.serialize_map(std::option::Option::None)?;
12753        if !self.certs.is_empty() {
12754            state.serialize_entry("certs", &self.certs)?;
12755        }
12756        if !self.active_version.is_empty() {
12757            state.serialize_entry("activeVersion", &self.active_version)?;
12758        }
12759        if !self.kind.is_empty() {
12760            state.serialize_entry("kind", &self.kind)?;
12761        }
12762        if !self._unknown_fields.is_empty() {
12763            for (key, value) in self._unknown_fields.iter() {
12764                state.serialize_entry(key, &value)?;
12765            }
12766        }
12767        state.end()
12768    }
12769}
12770
12771/// Database instance restore backup request.
12772#[derive(Clone, Debug, Default, PartialEq)]
12773#[non_exhaustive]
12774pub struct InstancesRestoreBackupRequest {
12775    /// Parameters required to perform the restore backup operation.
12776    pub restore_backup_context: std::option::Option<crate::model::RestoreBackupContext>,
12777
12778    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12779}
12780
12781impl InstancesRestoreBackupRequest {
12782    pub fn new() -> Self {
12783        std::default::Default::default()
12784    }
12785
12786    /// Sets the value of [restore_backup_context][crate::model::InstancesRestoreBackupRequest::restore_backup_context].
12787    pub fn set_restore_backup_context<T>(mut self, v: T) -> Self
12788    where
12789        T: std::convert::Into<crate::model::RestoreBackupContext>,
12790    {
12791        self.restore_backup_context = std::option::Option::Some(v.into());
12792        self
12793    }
12794
12795    /// Sets or clears the value of [restore_backup_context][crate::model::InstancesRestoreBackupRequest::restore_backup_context].
12796    pub fn set_or_clear_restore_backup_context<T>(mut self, v: std::option::Option<T>) -> Self
12797    where
12798        T: std::convert::Into<crate::model::RestoreBackupContext>,
12799    {
12800        self.restore_backup_context = v.map(|x| x.into());
12801        self
12802    }
12803}
12804
12805impl wkt::message::Message for InstancesRestoreBackupRequest {
12806    fn typename() -> &'static str {
12807        "type.googleapis.com/google.cloud.sql.v1.InstancesRestoreBackupRequest"
12808    }
12809}
12810
12811#[doc(hidden)]
12812impl<'de> serde::de::Deserialize<'de> for InstancesRestoreBackupRequest {
12813    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12814    where
12815        D: serde::Deserializer<'de>,
12816    {
12817        #[allow(non_camel_case_types)]
12818        #[doc(hidden)]
12819        #[derive(PartialEq, Eq, Hash)]
12820        enum __FieldTag {
12821            __restore_backup_context,
12822            Unknown(std::string::String),
12823        }
12824        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12825            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12826            where
12827                D: serde::Deserializer<'de>,
12828            {
12829                struct Visitor;
12830                impl<'de> serde::de::Visitor<'de> for Visitor {
12831                    type Value = __FieldTag;
12832                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12833                        formatter.write_str("a field name for InstancesRestoreBackupRequest")
12834                    }
12835                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12836                    where
12837                        E: serde::de::Error,
12838                    {
12839                        use std::result::Result::Ok;
12840                        use std::string::ToString;
12841                        match value {
12842                            "restoreBackupContext" => Ok(__FieldTag::__restore_backup_context),
12843                            "restore_backup_context" => Ok(__FieldTag::__restore_backup_context),
12844                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12845                        }
12846                    }
12847                }
12848                deserializer.deserialize_identifier(Visitor)
12849            }
12850        }
12851        struct Visitor;
12852        impl<'de> serde::de::Visitor<'de> for Visitor {
12853            type Value = InstancesRestoreBackupRequest;
12854            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12855                formatter.write_str("struct InstancesRestoreBackupRequest")
12856            }
12857            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12858            where
12859                A: serde::de::MapAccess<'de>,
12860            {
12861                #[allow(unused_imports)]
12862                use serde::de::Error;
12863                use std::option::Option::Some;
12864                let mut fields = std::collections::HashSet::new();
12865                let mut result = Self::Value::new();
12866                while let Some(tag) = map.next_key::<__FieldTag>()? {
12867                    #[allow(clippy::match_single_binding)]
12868                    match tag {
12869                        __FieldTag::__restore_backup_context => {
12870                            if !fields.insert(__FieldTag::__restore_backup_context) {
12871                                return std::result::Result::Err(A::Error::duplicate_field(
12872                                    "multiple values for restore_backup_context",
12873                                ));
12874                            }
12875                            result.restore_backup_context = map.next_value::<std::option::Option<crate::model::RestoreBackupContext>>()?
12876                                ;
12877                        }
12878                        __FieldTag::Unknown(key) => {
12879                            let value = map.next_value::<serde_json::Value>()?;
12880                            result._unknown_fields.insert(key, value);
12881                        }
12882                    }
12883                }
12884                std::result::Result::Ok(result)
12885            }
12886        }
12887        deserializer.deserialize_any(Visitor)
12888    }
12889}
12890
12891#[doc(hidden)]
12892impl serde::ser::Serialize for InstancesRestoreBackupRequest {
12893    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12894    where
12895        S: serde::ser::Serializer,
12896    {
12897        use serde::ser::SerializeMap;
12898        #[allow(unused_imports)]
12899        use std::option::Option::Some;
12900        let mut state = serializer.serialize_map(std::option::Option::None)?;
12901        if self.restore_backup_context.is_some() {
12902            state.serialize_entry("restoreBackupContext", &self.restore_backup_context)?;
12903        }
12904        if !self._unknown_fields.is_empty() {
12905            for (key, value) in self._unknown_fields.iter() {
12906                state.serialize_entry(key, &value)?;
12907            }
12908        }
12909        state.end()
12910    }
12911}
12912
12913/// Rotate server CA request.
12914#[derive(Clone, Debug, Default, PartialEq)]
12915#[non_exhaustive]
12916pub struct InstancesRotateServerCaRequest {
12917    /// Contains details about the rotate server CA operation.
12918    pub rotate_server_ca_context: std::option::Option<crate::model::RotateServerCaContext>,
12919
12920    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12921}
12922
12923impl InstancesRotateServerCaRequest {
12924    pub fn new() -> Self {
12925        std::default::Default::default()
12926    }
12927
12928    /// Sets the value of [rotate_server_ca_context][crate::model::InstancesRotateServerCaRequest::rotate_server_ca_context].
12929    pub fn set_rotate_server_ca_context<T>(mut self, v: T) -> Self
12930    where
12931        T: std::convert::Into<crate::model::RotateServerCaContext>,
12932    {
12933        self.rotate_server_ca_context = std::option::Option::Some(v.into());
12934        self
12935    }
12936
12937    /// Sets or clears the value of [rotate_server_ca_context][crate::model::InstancesRotateServerCaRequest::rotate_server_ca_context].
12938    pub fn set_or_clear_rotate_server_ca_context<T>(mut self, v: std::option::Option<T>) -> Self
12939    where
12940        T: std::convert::Into<crate::model::RotateServerCaContext>,
12941    {
12942        self.rotate_server_ca_context = v.map(|x| x.into());
12943        self
12944    }
12945}
12946
12947impl wkt::message::Message for InstancesRotateServerCaRequest {
12948    fn typename() -> &'static str {
12949        "type.googleapis.com/google.cloud.sql.v1.InstancesRotateServerCaRequest"
12950    }
12951}
12952
12953#[doc(hidden)]
12954impl<'de> serde::de::Deserialize<'de> for InstancesRotateServerCaRequest {
12955    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12956    where
12957        D: serde::Deserializer<'de>,
12958    {
12959        #[allow(non_camel_case_types)]
12960        #[doc(hidden)]
12961        #[derive(PartialEq, Eq, Hash)]
12962        enum __FieldTag {
12963            __rotate_server_ca_context,
12964            Unknown(std::string::String),
12965        }
12966        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12967            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12968            where
12969                D: serde::Deserializer<'de>,
12970            {
12971                struct Visitor;
12972                impl<'de> serde::de::Visitor<'de> for Visitor {
12973                    type Value = __FieldTag;
12974                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12975                        formatter.write_str("a field name for InstancesRotateServerCaRequest")
12976                    }
12977                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12978                    where
12979                        E: serde::de::Error,
12980                    {
12981                        use std::result::Result::Ok;
12982                        use std::string::ToString;
12983                        match value {
12984                            "rotateServerCaContext" => Ok(__FieldTag::__rotate_server_ca_context),
12985                            "rotate_server_ca_context" => {
12986                                Ok(__FieldTag::__rotate_server_ca_context)
12987                            }
12988                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12989                        }
12990                    }
12991                }
12992                deserializer.deserialize_identifier(Visitor)
12993            }
12994        }
12995        struct Visitor;
12996        impl<'de> serde::de::Visitor<'de> for Visitor {
12997            type Value = InstancesRotateServerCaRequest;
12998            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12999                formatter.write_str("struct InstancesRotateServerCaRequest")
13000            }
13001            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13002            where
13003                A: serde::de::MapAccess<'de>,
13004            {
13005                #[allow(unused_imports)]
13006                use serde::de::Error;
13007                use std::option::Option::Some;
13008                let mut fields = std::collections::HashSet::new();
13009                let mut result = Self::Value::new();
13010                while let Some(tag) = map.next_key::<__FieldTag>()? {
13011                    #[allow(clippy::match_single_binding)]
13012                    match tag {
13013                        __FieldTag::__rotate_server_ca_context => {
13014                            if !fields.insert(__FieldTag::__rotate_server_ca_context) {
13015                                return std::result::Result::Err(A::Error::duplicate_field(
13016                                    "multiple values for rotate_server_ca_context",
13017                                ));
13018                            }
13019                            result.rotate_server_ca_context = map.next_value::<std::option::Option<crate::model::RotateServerCaContext>>()?
13020                                ;
13021                        }
13022                        __FieldTag::Unknown(key) => {
13023                            let value = map.next_value::<serde_json::Value>()?;
13024                            result._unknown_fields.insert(key, value);
13025                        }
13026                    }
13027                }
13028                std::result::Result::Ok(result)
13029            }
13030        }
13031        deserializer.deserialize_any(Visitor)
13032    }
13033}
13034
13035#[doc(hidden)]
13036impl serde::ser::Serialize for InstancesRotateServerCaRequest {
13037    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13038    where
13039        S: serde::ser::Serializer,
13040    {
13041        use serde::ser::SerializeMap;
13042        #[allow(unused_imports)]
13043        use std::option::Option::Some;
13044        let mut state = serializer.serialize_map(std::option::Option::None)?;
13045        if self.rotate_server_ca_context.is_some() {
13046            state.serialize_entry("rotateServerCaContext", &self.rotate_server_ca_context)?;
13047        }
13048        if !self._unknown_fields.is_empty() {
13049            for (key, value) in self._unknown_fields.iter() {
13050                state.serialize_entry(key, &value)?;
13051            }
13052        }
13053        state.end()
13054    }
13055}
13056
13057/// Instance truncate log request.
13058#[derive(Clone, Debug, Default, PartialEq)]
13059#[non_exhaustive]
13060pub struct InstancesTruncateLogRequest {
13061    /// Contains details about the truncate log operation.
13062    pub truncate_log_context: std::option::Option<crate::model::TruncateLogContext>,
13063
13064    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13065}
13066
13067impl InstancesTruncateLogRequest {
13068    pub fn new() -> Self {
13069        std::default::Default::default()
13070    }
13071
13072    /// Sets the value of [truncate_log_context][crate::model::InstancesTruncateLogRequest::truncate_log_context].
13073    pub fn set_truncate_log_context<T>(mut self, v: T) -> Self
13074    where
13075        T: std::convert::Into<crate::model::TruncateLogContext>,
13076    {
13077        self.truncate_log_context = std::option::Option::Some(v.into());
13078        self
13079    }
13080
13081    /// Sets or clears the value of [truncate_log_context][crate::model::InstancesTruncateLogRequest::truncate_log_context].
13082    pub fn set_or_clear_truncate_log_context<T>(mut self, v: std::option::Option<T>) -> Self
13083    where
13084        T: std::convert::Into<crate::model::TruncateLogContext>,
13085    {
13086        self.truncate_log_context = v.map(|x| x.into());
13087        self
13088    }
13089}
13090
13091impl wkt::message::Message for InstancesTruncateLogRequest {
13092    fn typename() -> &'static str {
13093        "type.googleapis.com/google.cloud.sql.v1.InstancesTruncateLogRequest"
13094    }
13095}
13096
13097#[doc(hidden)]
13098impl<'de> serde::de::Deserialize<'de> for InstancesTruncateLogRequest {
13099    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13100    where
13101        D: serde::Deserializer<'de>,
13102    {
13103        #[allow(non_camel_case_types)]
13104        #[doc(hidden)]
13105        #[derive(PartialEq, Eq, Hash)]
13106        enum __FieldTag {
13107            __truncate_log_context,
13108            Unknown(std::string::String),
13109        }
13110        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13111            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13112            where
13113                D: serde::Deserializer<'de>,
13114            {
13115                struct Visitor;
13116                impl<'de> serde::de::Visitor<'de> for Visitor {
13117                    type Value = __FieldTag;
13118                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13119                        formatter.write_str("a field name for InstancesTruncateLogRequest")
13120                    }
13121                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13122                    where
13123                        E: serde::de::Error,
13124                    {
13125                        use std::result::Result::Ok;
13126                        use std::string::ToString;
13127                        match value {
13128                            "truncateLogContext" => Ok(__FieldTag::__truncate_log_context),
13129                            "truncate_log_context" => Ok(__FieldTag::__truncate_log_context),
13130                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13131                        }
13132                    }
13133                }
13134                deserializer.deserialize_identifier(Visitor)
13135            }
13136        }
13137        struct Visitor;
13138        impl<'de> serde::de::Visitor<'de> for Visitor {
13139            type Value = InstancesTruncateLogRequest;
13140            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13141                formatter.write_str("struct InstancesTruncateLogRequest")
13142            }
13143            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13144            where
13145                A: serde::de::MapAccess<'de>,
13146            {
13147                #[allow(unused_imports)]
13148                use serde::de::Error;
13149                use std::option::Option::Some;
13150                let mut fields = std::collections::HashSet::new();
13151                let mut result = Self::Value::new();
13152                while let Some(tag) = map.next_key::<__FieldTag>()? {
13153                    #[allow(clippy::match_single_binding)]
13154                    match tag {
13155                        __FieldTag::__truncate_log_context => {
13156                            if !fields.insert(__FieldTag::__truncate_log_context) {
13157                                return std::result::Result::Err(A::Error::duplicate_field(
13158                                    "multiple values for truncate_log_context",
13159                                ));
13160                            }
13161                            result.truncate_log_context = map.next_value::<std::option::Option<crate::model::TruncateLogContext>>()?
13162                                ;
13163                        }
13164                        __FieldTag::Unknown(key) => {
13165                            let value = map.next_value::<serde_json::Value>()?;
13166                            result._unknown_fields.insert(key, value);
13167                        }
13168                    }
13169                }
13170                std::result::Result::Ok(result)
13171            }
13172        }
13173        deserializer.deserialize_any(Visitor)
13174    }
13175}
13176
13177#[doc(hidden)]
13178impl serde::ser::Serialize for InstancesTruncateLogRequest {
13179    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13180    where
13181        S: serde::ser::Serializer,
13182    {
13183        use serde::ser::SerializeMap;
13184        #[allow(unused_imports)]
13185        use std::option::Option::Some;
13186        let mut state = serializer.serialize_map(std::option::Option::None)?;
13187        if self.truncate_log_context.is_some() {
13188            state.serialize_entry("truncateLogContext", &self.truncate_log_context)?;
13189        }
13190        if !self._unknown_fields.is_empty() {
13191            for (key, value) in self._unknown_fields.iter() {
13192                state.serialize_entry(key, &value)?;
13193            }
13194        }
13195        state.end()
13196    }
13197}
13198
13199/// Request to acquire a lease for SSRS.
13200#[derive(Clone, Debug, Default, PartialEq)]
13201#[non_exhaustive]
13202pub struct InstancesAcquireSsrsLeaseRequest {
13203    /// Contains details about the acquire SSRS lease operation.
13204    pub acquire_ssrs_lease_context: std::option::Option<crate::model::AcquireSsrsLeaseContext>,
13205
13206    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13207}
13208
13209impl InstancesAcquireSsrsLeaseRequest {
13210    pub fn new() -> Self {
13211        std::default::Default::default()
13212    }
13213
13214    /// Sets the value of [acquire_ssrs_lease_context][crate::model::InstancesAcquireSsrsLeaseRequest::acquire_ssrs_lease_context].
13215    pub fn set_acquire_ssrs_lease_context<T>(mut self, v: T) -> Self
13216    where
13217        T: std::convert::Into<crate::model::AcquireSsrsLeaseContext>,
13218    {
13219        self.acquire_ssrs_lease_context = std::option::Option::Some(v.into());
13220        self
13221    }
13222
13223    /// Sets or clears the value of [acquire_ssrs_lease_context][crate::model::InstancesAcquireSsrsLeaseRequest::acquire_ssrs_lease_context].
13224    pub fn set_or_clear_acquire_ssrs_lease_context<T>(mut self, v: std::option::Option<T>) -> Self
13225    where
13226        T: std::convert::Into<crate::model::AcquireSsrsLeaseContext>,
13227    {
13228        self.acquire_ssrs_lease_context = v.map(|x| x.into());
13229        self
13230    }
13231}
13232
13233impl wkt::message::Message for InstancesAcquireSsrsLeaseRequest {
13234    fn typename() -> &'static str {
13235        "type.googleapis.com/google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest"
13236    }
13237}
13238
13239#[doc(hidden)]
13240impl<'de> serde::de::Deserialize<'de> for InstancesAcquireSsrsLeaseRequest {
13241    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13242    where
13243        D: serde::Deserializer<'de>,
13244    {
13245        #[allow(non_camel_case_types)]
13246        #[doc(hidden)]
13247        #[derive(PartialEq, Eq, Hash)]
13248        enum __FieldTag {
13249            __acquire_ssrs_lease_context,
13250            Unknown(std::string::String),
13251        }
13252        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13253            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13254            where
13255                D: serde::Deserializer<'de>,
13256            {
13257                struct Visitor;
13258                impl<'de> serde::de::Visitor<'de> for Visitor {
13259                    type Value = __FieldTag;
13260                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13261                        formatter.write_str("a field name for InstancesAcquireSsrsLeaseRequest")
13262                    }
13263                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13264                    where
13265                        E: serde::de::Error,
13266                    {
13267                        use std::result::Result::Ok;
13268                        use std::string::ToString;
13269                        match value {
13270                            "acquireSsrsLeaseContext" => {
13271                                Ok(__FieldTag::__acquire_ssrs_lease_context)
13272                            }
13273                            "acquire_ssrs_lease_context" => {
13274                                Ok(__FieldTag::__acquire_ssrs_lease_context)
13275                            }
13276                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13277                        }
13278                    }
13279                }
13280                deserializer.deserialize_identifier(Visitor)
13281            }
13282        }
13283        struct Visitor;
13284        impl<'de> serde::de::Visitor<'de> for Visitor {
13285            type Value = InstancesAcquireSsrsLeaseRequest;
13286            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13287                formatter.write_str("struct InstancesAcquireSsrsLeaseRequest")
13288            }
13289            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13290            where
13291                A: serde::de::MapAccess<'de>,
13292            {
13293                #[allow(unused_imports)]
13294                use serde::de::Error;
13295                use std::option::Option::Some;
13296                let mut fields = std::collections::HashSet::new();
13297                let mut result = Self::Value::new();
13298                while let Some(tag) = map.next_key::<__FieldTag>()? {
13299                    #[allow(clippy::match_single_binding)]
13300                    match tag {
13301                        __FieldTag::__acquire_ssrs_lease_context => {
13302                            if !fields.insert(__FieldTag::__acquire_ssrs_lease_context) {
13303                                return std::result::Result::Err(A::Error::duplicate_field(
13304                                    "multiple values for acquire_ssrs_lease_context",
13305                                ));
13306                            }
13307                            result.acquire_ssrs_lease_context = map.next_value::<std::option::Option<crate::model::AcquireSsrsLeaseContext>>()?
13308                                ;
13309                        }
13310                        __FieldTag::Unknown(key) => {
13311                            let value = map.next_value::<serde_json::Value>()?;
13312                            result._unknown_fields.insert(key, value);
13313                        }
13314                    }
13315                }
13316                std::result::Result::Ok(result)
13317            }
13318        }
13319        deserializer.deserialize_any(Visitor)
13320    }
13321}
13322
13323#[doc(hidden)]
13324impl serde::ser::Serialize for InstancesAcquireSsrsLeaseRequest {
13325    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13326    where
13327        S: serde::ser::Serializer,
13328    {
13329        use serde::ser::SerializeMap;
13330        #[allow(unused_imports)]
13331        use std::option::Option::Some;
13332        let mut state = serializer.serialize_map(std::option::Option::None)?;
13333        if self.acquire_ssrs_lease_context.is_some() {
13334            state.serialize_entry("acquireSsrsLeaseContext", &self.acquire_ssrs_lease_context)?;
13335        }
13336        if !self._unknown_fields.is_empty() {
13337            for (key, value) in self._unknown_fields.iter() {
13338                state.serialize_entry(key, &value)?;
13339            }
13340        }
13341        state.end()
13342    }
13343}
13344
13345/// Instance verify external sync settings response.
13346#[derive(Clone, Debug, Default, PartialEq)]
13347#[non_exhaustive]
13348pub struct SqlInstancesVerifyExternalSyncSettingsResponse {
13349    /// This is always `sql#migrationSettingErrorList`.
13350    pub kind: std::string::String,
13351
13352    /// List of migration violations.
13353    pub errors: std::vec::Vec<crate::model::SqlExternalSyncSettingError>,
13354
13355    /// List of migration warnings.
13356    pub warnings: std::vec::Vec<crate::model::SqlExternalSyncSettingError>,
13357
13358    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13359}
13360
13361impl SqlInstancesVerifyExternalSyncSettingsResponse {
13362    pub fn new() -> Self {
13363        std::default::Default::default()
13364    }
13365
13366    /// Sets the value of [kind][crate::model::SqlInstancesVerifyExternalSyncSettingsResponse::kind].
13367    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13368        self.kind = v.into();
13369        self
13370    }
13371
13372    /// Sets the value of [errors][crate::model::SqlInstancesVerifyExternalSyncSettingsResponse::errors].
13373    pub fn set_errors<T, V>(mut self, v: T) -> Self
13374    where
13375        T: std::iter::IntoIterator<Item = V>,
13376        V: std::convert::Into<crate::model::SqlExternalSyncSettingError>,
13377    {
13378        use std::iter::Iterator;
13379        self.errors = v.into_iter().map(|i| i.into()).collect();
13380        self
13381    }
13382
13383    /// Sets the value of [warnings][crate::model::SqlInstancesVerifyExternalSyncSettingsResponse::warnings].
13384    pub fn set_warnings<T, V>(mut self, v: T) -> Self
13385    where
13386        T: std::iter::IntoIterator<Item = V>,
13387        V: std::convert::Into<crate::model::SqlExternalSyncSettingError>,
13388    {
13389        use std::iter::Iterator;
13390        self.warnings = v.into_iter().map(|i| i.into()).collect();
13391        self
13392    }
13393}
13394
13395impl wkt::message::Message for SqlInstancesVerifyExternalSyncSettingsResponse {
13396    fn typename() -> &'static str {
13397        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse"
13398    }
13399}
13400
13401#[doc(hidden)]
13402impl<'de> serde::de::Deserialize<'de> for SqlInstancesVerifyExternalSyncSettingsResponse {
13403    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13404    where
13405        D: serde::Deserializer<'de>,
13406    {
13407        #[allow(non_camel_case_types)]
13408        #[doc(hidden)]
13409        #[derive(PartialEq, Eq, Hash)]
13410        enum __FieldTag {
13411            __kind,
13412            __errors,
13413            __warnings,
13414            Unknown(std::string::String),
13415        }
13416        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13417            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13418            where
13419                D: serde::Deserializer<'de>,
13420            {
13421                struct Visitor;
13422                impl<'de> serde::de::Visitor<'de> for Visitor {
13423                    type Value = __FieldTag;
13424                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13425                        formatter.write_str(
13426                            "a field name for SqlInstancesVerifyExternalSyncSettingsResponse",
13427                        )
13428                    }
13429                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13430                    where
13431                        E: serde::de::Error,
13432                    {
13433                        use std::result::Result::Ok;
13434                        use std::string::ToString;
13435                        match value {
13436                            "kind" => Ok(__FieldTag::__kind),
13437                            "errors" => Ok(__FieldTag::__errors),
13438                            "warnings" => Ok(__FieldTag::__warnings),
13439                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13440                        }
13441                    }
13442                }
13443                deserializer.deserialize_identifier(Visitor)
13444            }
13445        }
13446        struct Visitor;
13447        impl<'de> serde::de::Visitor<'de> for Visitor {
13448            type Value = SqlInstancesVerifyExternalSyncSettingsResponse;
13449            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13450                formatter.write_str("struct SqlInstancesVerifyExternalSyncSettingsResponse")
13451            }
13452            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13453            where
13454                A: serde::de::MapAccess<'de>,
13455            {
13456                #[allow(unused_imports)]
13457                use serde::de::Error;
13458                use std::option::Option::Some;
13459                let mut fields = std::collections::HashSet::new();
13460                let mut result = Self::Value::new();
13461                while let Some(tag) = map.next_key::<__FieldTag>()? {
13462                    #[allow(clippy::match_single_binding)]
13463                    match tag {
13464                        __FieldTag::__kind => {
13465                            if !fields.insert(__FieldTag::__kind) {
13466                                return std::result::Result::Err(A::Error::duplicate_field(
13467                                    "multiple values for kind",
13468                                ));
13469                            }
13470                            result.kind = map
13471                                .next_value::<std::option::Option<std::string::String>>()?
13472                                .unwrap_or_default();
13473                        }
13474                        __FieldTag::__errors => {
13475                            if !fields.insert(__FieldTag::__errors) {
13476                                return std::result::Result::Err(A::Error::duplicate_field(
13477                                    "multiple values for errors",
13478                                ));
13479                            }
13480                            result.errors = map
13481                                .next_value::<std::option::Option<
13482                                    std::vec::Vec<crate::model::SqlExternalSyncSettingError>,
13483                                >>()?
13484                                .unwrap_or_default();
13485                        }
13486                        __FieldTag::__warnings => {
13487                            if !fields.insert(__FieldTag::__warnings) {
13488                                return std::result::Result::Err(A::Error::duplicate_field(
13489                                    "multiple values for warnings",
13490                                ));
13491                            }
13492                            result.warnings = map
13493                                .next_value::<std::option::Option<
13494                                    std::vec::Vec<crate::model::SqlExternalSyncSettingError>,
13495                                >>()?
13496                                .unwrap_or_default();
13497                        }
13498                        __FieldTag::Unknown(key) => {
13499                            let value = map.next_value::<serde_json::Value>()?;
13500                            result._unknown_fields.insert(key, value);
13501                        }
13502                    }
13503                }
13504                std::result::Result::Ok(result)
13505            }
13506        }
13507        deserializer.deserialize_any(Visitor)
13508    }
13509}
13510
13511#[doc(hidden)]
13512impl serde::ser::Serialize for SqlInstancesVerifyExternalSyncSettingsResponse {
13513    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13514    where
13515        S: serde::ser::Serializer,
13516    {
13517        use serde::ser::SerializeMap;
13518        #[allow(unused_imports)]
13519        use std::option::Option::Some;
13520        let mut state = serializer.serialize_map(std::option::Option::None)?;
13521        if !self.kind.is_empty() {
13522            state.serialize_entry("kind", &self.kind)?;
13523        }
13524        if !self.errors.is_empty() {
13525            state.serialize_entry("errors", &self.errors)?;
13526        }
13527        if !self.warnings.is_empty() {
13528            state.serialize_entry("warnings", &self.warnings)?;
13529        }
13530        if !self._unknown_fields.is_empty() {
13531            for (key, value) in self._unknown_fields.iter() {
13532                state.serialize_entry(key, &value)?;
13533            }
13534        }
13535        state.end()
13536    }
13537}
13538
13539/// Instance get disk shrink config response.
13540#[derive(Clone, Debug, Default, PartialEq)]
13541#[non_exhaustive]
13542pub struct SqlInstancesGetDiskShrinkConfigResponse {
13543    /// This is always `sql#getDiskShrinkConfig`.
13544    pub kind: std::string::String,
13545
13546    /// The minimum size to which a disk can be shrunk in GigaBytes.
13547    pub minimal_target_size_gb: i64,
13548
13549    /// Additional message to customers.
13550    pub message: std::string::String,
13551
13552    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13553}
13554
13555impl SqlInstancesGetDiskShrinkConfigResponse {
13556    pub fn new() -> Self {
13557        std::default::Default::default()
13558    }
13559
13560    /// Sets the value of [kind][crate::model::SqlInstancesGetDiskShrinkConfigResponse::kind].
13561    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13562        self.kind = v.into();
13563        self
13564    }
13565
13566    /// Sets the value of [minimal_target_size_gb][crate::model::SqlInstancesGetDiskShrinkConfigResponse::minimal_target_size_gb].
13567    pub fn set_minimal_target_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
13568        self.minimal_target_size_gb = v.into();
13569        self
13570    }
13571
13572    /// Sets the value of [message][crate::model::SqlInstancesGetDiskShrinkConfigResponse::message].
13573    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13574        self.message = v.into();
13575        self
13576    }
13577}
13578
13579impl wkt::message::Message for SqlInstancesGetDiskShrinkConfigResponse {
13580    fn typename() -> &'static str {
13581        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse"
13582    }
13583}
13584
13585#[doc(hidden)]
13586impl<'de> serde::de::Deserialize<'de> for SqlInstancesGetDiskShrinkConfigResponse {
13587    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13588    where
13589        D: serde::Deserializer<'de>,
13590    {
13591        #[allow(non_camel_case_types)]
13592        #[doc(hidden)]
13593        #[derive(PartialEq, Eq, Hash)]
13594        enum __FieldTag {
13595            __kind,
13596            __minimal_target_size_gb,
13597            __message,
13598            Unknown(std::string::String),
13599        }
13600        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13601            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13602            where
13603                D: serde::Deserializer<'de>,
13604            {
13605                struct Visitor;
13606                impl<'de> serde::de::Visitor<'de> for Visitor {
13607                    type Value = __FieldTag;
13608                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13609                        formatter
13610                            .write_str("a field name for SqlInstancesGetDiskShrinkConfigResponse")
13611                    }
13612                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13613                    where
13614                        E: serde::de::Error,
13615                    {
13616                        use std::result::Result::Ok;
13617                        use std::string::ToString;
13618                        match value {
13619                            "kind" => Ok(__FieldTag::__kind),
13620                            "minimalTargetSizeGb" => Ok(__FieldTag::__minimal_target_size_gb),
13621                            "minimal_target_size_gb" => Ok(__FieldTag::__minimal_target_size_gb),
13622                            "message" => Ok(__FieldTag::__message),
13623                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13624                        }
13625                    }
13626                }
13627                deserializer.deserialize_identifier(Visitor)
13628            }
13629        }
13630        struct Visitor;
13631        impl<'de> serde::de::Visitor<'de> for Visitor {
13632            type Value = SqlInstancesGetDiskShrinkConfigResponse;
13633            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13634                formatter.write_str("struct SqlInstancesGetDiskShrinkConfigResponse")
13635            }
13636            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13637            where
13638                A: serde::de::MapAccess<'de>,
13639            {
13640                #[allow(unused_imports)]
13641                use serde::de::Error;
13642                use std::option::Option::Some;
13643                let mut fields = std::collections::HashSet::new();
13644                let mut result = Self::Value::new();
13645                while let Some(tag) = map.next_key::<__FieldTag>()? {
13646                    #[allow(clippy::match_single_binding)]
13647                    match tag {
13648                        __FieldTag::__kind => {
13649                            if !fields.insert(__FieldTag::__kind) {
13650                                return std::result::Result::Err(A::Error::duplicate_field(
13651                                    "multiple values for kind",
13652                                ));
13653                            }
13654                            result.kind = map
13655                                .next_value::<std::option::Option<std::string::String>>()?
13656                                .unwrap_or_default();
13657                        }
13658                        __FieldTag::__minimal_target_size_gb => {
13659                            if !fields.insert(__FieldTag::__minimal_target_size_gb) {
13660                                return std::result::Result::Err(A::Error::duplicate_field(
13661                                    "multiple values for minimal_target_size_gb",
13662                                ));
13663                            }
13664                            struct __With(std::option::Option<i64>);
13665                            impl<'de> serde::de::Deserialize<'de> for __With {
13666                                fn deserialize<D>(
13667                                    deserializer: D,
13668                                ) -> std::result::Result<Self, D::Error>
13669                                where
13670                                    D: serde::de::Deserializer<'de>,
13671                                {
13672                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
13673                                }
13674                            }
13675                            result.minimal_target_size_gb =
13676                                map.next_value::<__With>()?.0.unwrap_or_default();
13677                        }
13678                        __FieldTag::__message => {
13679                            if !fields.insert(__FieldTag::__message) {
13680                                return std::result::Result::Err(A::Error::duplicate_field(
13681                                    "multiple values for message",
13682                                ));
13683                            }
13684                            result.message = map
13685                                .next_value::<std::option::Option<std::string::String>>()?
13686                                .unwrap_or_default();
13687                        }
13688                        __FieldTag::Unknown(key) => {
13689                            let value = map.next_value::<serde_json::Value>()?;
13690                            result._unknown_fields.insert(key, value);
13691                        }
13692                    }
13693                }
13694                std::result::Result::Ok(result)
13695            }
13696        }
13697        deserializer.deserialize_any(Visitor)
13698    }
13699}
13700
13701#[doc(hidden)]
13702impl serde::ser::Serialize for SqlInstancesGetDiskShrinkConfigResponse {
13703    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13704    where
13705        S: serde::ser::Serializer,
13706    {
13707        use serde::ser::SerializeMap;
13708        #[allow(unused_imports)]
13709        use std::option::Option::Some;
13710        let mut state = serializer.serialize_map(std::option::Option::None)?;
13711        if !self.kind.is_empty() {
13712            state.serialize_entry("kind", &self.kind)?;
13713        }
13714        if !wkt::internal::is_default(&self.minimal_target_size_gb) {
13715            struct __With<'a>(&'a i64);
13716            impl<'a> serde::ser::Serialize for __With<'a> {
13717                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13718                where
13719                    S: serde::ser::Serializer,
13720                {
13721                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
13722                }
13723            }
13724            state.serialize_entry("minimalTargetSizeGb", &__With(&self.minimal_target_size_gb))?;
13725        }
13726        if !self.message.is_empty() {
13727            state.serialize_entry("message", &self.message)?;
13728        }
13729        if !self._unknown_fields.is_empty() {
13730            for (key, value) in self._unknown_fields.iter() {
13731                state.serialize_entry(key, &value)?;
13732            }
13733        }
13734        state.end()
13735    }
13736}
13737
13738/// Instance get latest recovery time request.
13739#[derive(Clone, Debug, Default, PartialEq)]
13740#[non_exhaustive]
13741pub struct SqlInstancesGetLatestRecoveryTimeRequest {
13742    /// Cloud SQL instance ID. This does not include the project ID.
13743    pub instance: std::string::String,
13744
13745    /// Project ID of the project that contains the instance.
13746    pub project: std::string::String,
13747
13748    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13749}
13750
13751impl SqlInstancesGetLatestRecoveryTimeRequest {
13752    pub fn new() -> Self {
13753        std::default::Default::default()
13754    }
13755
13756    /// Sets the value of [instance][crate::model::SqlInstancesGetLatestRecoveryTimeRequest::instance].
13757    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13758        self.instance = v.into();
13759        self
13760    }
13761
13762    /// Sets the value of [project][crate::model::SqlInstancesGetLatestRecoveryTimeRequest::project].
13763    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13764        self.project = v.into();
13765        self
13766    }
13767}
13768
13769impl wkt::message::Message for SqlInstancesGetLatestRecoveryTimeRequest {
13770    fn typename() -> &'static str {
13771        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest"
13772    }
13773}
13774
13775#[doc(hidden)]
13776impl<'de> serde::de::Deserialize<'de> for SqlInstancesGetLatestRecoveryTimeRequest {
13777    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13778    where
13779        D: serde::Deserializer<'de>,
13780    {
13781        #[allow(non_camel_case_types)]
13782        #[doc(hidden)]
13783        #[derive(PartialEq, Eq, Hash)]
13784        enum __FieldTag {
13785            __instance,
13786            __project,
13787            Unknown(std::string::String),
13788        }
13789        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13790            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13791            where
13792                D: serde::Deserializer<'de>,
13793            {
13794                struct Visitor;
13795                impl<'de> serde::de::Visitor<'de> for Visitor {
13796                    type Value = __FieldTag;
13797                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13798                        formatter
13799                            .write_str("a field name for SqlInstancesGetLatestRecoveryTimeRequest")
13800                    }
13801                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13802                    where
13803                        E: serde::de::Error,
13804                    {
13805                        use std::result::Result::Ok;
13806                        use std::string::ToString;
13807                        match value {
13808                            "instance" => Ok(__FieldTag::__instance),
13809                            "project" => Ok(__FieldTag::__project),
13810                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13811                        }
13812                    }
13813                }
13814                deserializer.deserialize_identifier(Visitor)
13815            }
13816        }
13817        struct Visitor;
13818        impl<'de> serde::de::Visitor<'de> for Visitor {
13819            type Value = SqlInstancesGetLatestRecoveryTimeRequest;
13820            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13821                formatter.write_str("struct SqlInstancesGetLatestRecoveryTimeRequest")
13822            }
13823            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13824            where
13825                A: serde::de::MapAccess<'de>,
13826            {
13827                #[allow(unused_imports)]
13828                use serde::de::Error;
13829                use std::option::Option::Some;
13830                let mut fields = std::collections::HashSet::new();
13831                let mut result = Self::Value::new();
13832                while let Some(tag) = map.next_key::<__FieldTag>()? {
13833                    #[allow(clippy::match_single_binding)]
13834                    match tag {
13835                        __FieldTag::__instance => {
13836                            if !fields.insert(__FieldTag::__instance) {
13837                                return std::result::Result::Err(A::Error::duplicate_field(
13838                                    "multiple values for instance",
13839                                ));
13840                            }
13841                            result.instance = map
13842                                .next_value::<std::option::Option<std::string::String>>()?
13843                                .unwrap_or_default();
13844                        }
13845                        __FieldTag::__project => {
13846                            if !fields.insert(__FieldTag::__project) {
13847                                return std::result::Result::Err(A::Error::duplicate_field(
13848                                    "multiple values for project",
13849                                ));
13850                            }
13851                            result.project = map
13852                                .next_value::<std::option::Option<std::string::String>>()?
13853                                .unwrap_or_default();
13854                        }
13855                        __FieldTag::Unknown(key) => {
13856                            let value = map.next_value::<serde_json::Value>()?;
13857                            result._unknown_fields.insert(key, value);
13858                        }
13859                    }
13860                }
13861                std::result::Result::Ok(result)
13862            }
13863        }
13864        deserializer.deserialize_any(Visitor)
13865    }
13866}
13867
13868#[doc(hidden)]
13869impl serde::ser::Serialize for SqlInstancesGetLatestRecoveryTimeRequest {
13870    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13871    where
13872        S: serde::ser::Serializer,
13873    {
13874        use serde::ser::SerializeMap;
13875        #[allow(unused_imports)]
13876        use std::option::Option::Some;
13877        let mut state = serializer.serialize_map(std::option::Option::None)?;
13878        if !self.instance.is_empty() {
13879            state.serialize_entry("instance", &self.instance)?;
13880        }
13881        if !self.project.is_empty() {
13882            state.serialize_entry("project", &self.project)?;
13883        }
13884        if !self._unknown_fields.is_empty() {
13885            for (key, value) in self._unknown_fields.iter() {
13886                state.serialize_entry(key, &value)?;
13887            }
13888        }
13889        state.end()
13890    }
13891}
13892
13893/// Instance get latest recovery time response.
13894#[derive(Clone, Debug, Default, PartialEq)]
13895#[non_exhaustive]
13896pub struct SqlInstancesGetLatestRecoveryTimeResponse {
13897    /// This is always `sql#getLatestRecoveryTime`.
13898    pub kind: std::string::String,
13899
13900    /// Timestamp, identifies the latest recovery time of the source instance.
13901    pub latest_recovery_time: std::option::Option<wkt::Timestamp>,
13902
13903    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13904}
13905
13906impl SqlInstancesGetLatestRecoveryTimeResponse {
13907    pub fn new() -> Self {
13908        std::default::Default::default()
13909    }
13910
13911    /// Sets the value of [kind][crate::model::SqlInstancesGetLatestRecoveryTimeResponse::kind].
13912    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13913        self.kind = v.into();
13914        self
13915    }
13916
13917    /// Sets the value of [latest_recovery_time][crate::model::SqlInstancesGetLatestRecoveryTimeResponse::latest_recovery_time].
13918    pub fn set_latest_recovery_time<T>(mut self, v: T) -> Self
13919    where
13920        T: std::convert::Into<wkt::Timestamp>,
13921    {
13922        self.latest_recovery_time = std::option::Option::Some(v.into());
13923        self
13924    }
13925
13926    /// Sets or clears the value of [latest_recovery_time][crate::model::SqlInstancesGetLatestRecoveryTimeResponse::latest_recovery_time].
13927    pub fn set_or_clear_latest_recovery_time<T>(mut self, v: std::option::Option<T>) -> Self
13928    where
13929        T: std::convert::Into<wkt::Timestamp>,
13930    {
13931        self.latest_recovery_time = v.map(|x| x.into());
13932        self
13933    }
13934}
13935
13936impl wkt::message::Message for SqlInstancesGetLatestRecoveryTimeResponse {
13937    fn typename() -> &'static str {
13938        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse"
13939    }
13940}
13941
13942#[doc(hidden)]
13943impl<'de> serde::de::Deserialize<'de> for SqlInstancesGetLatestRecoveryTimeResponse {
13944    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13945    where
13946        D: serde::Deserializer<'de>,
13947    {
13948        #[allow(non_camel_case_types)]
13949        #[doc(hidden)]
13950        #[derive(PartialEq, Eq, Hash)]
13951        enum __FieldTag {
13952            __kind,
13953            __latest_recovery_time,
13954            Unknown(std::string::String),
13955        }
13956        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13957            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13958            where
13959                D: serde::Deserializer<'de>,
13960            {
13961                struct Visitor;
13962                impl<'de> serde::de::Visitor<'de> for Visitor {
13963                    type Value = __FieldTag;
13964                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13965                        formatter
13966                            .write_str("a field name for SqlInstancesGetLatestRecoveryTimeResponse")
13967                    }
13968                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13969                    where
13970                        E: serde::de::Error,
13971                    {
13972                        use std::result::Result::Ok;
13973                        use std::string::ToString;
13974                        match value {
13975                            "kind" => Ok(__FieldTag::__kind),
13976                            "latestRecoveryTime" => Ok(__FieldTag::__latest_recovery_time),
13977                            "latest_recovery_time" => Ok(__FieldTag::__latest_recovery_time),
13978                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13979                        }
13980                    }
13981                }
13982                deserializer.deserialize_identifier(Visitor)
13983            }
13984        }
13985        struct Visitor;
13986        impl<'de> serde::de::Visitor<'de> for Visitor {
13987            type Value = SqlInstancesGetLatestRecoveryTimeResponse;
13988            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13989                formatter.write_str("struct SqlInstancesGetLatestRecoveryTimeResponse")
13990            }
13991            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13992            where
13993                A: serde::de::MapAccess<'de>,
13994            {
13995                #[allow(unused_imports)]
13996                use serde::de::Error;
13997                use std::option::Option::Some;
13998                let mut fields = std::collections::HashSet::new();
13999                let mut result = Self::Value::new();
14000                while let Some(tag) = map.next_key::<__FieldTag>()? {
14001                    #[allow(clippy::match_single_binding)]
14002                    match tag {
14003                        __FieldTag::__kind => {
14004                            if !fields.insert(__FieldTag::__kind) {
14005                                return std::result::Result::Err(A::Error::duplicate_field(
14006                                    "multiple values for kind",
14007                                ));
14008                            }
14009                            result.kind = map
14010                                .next_value::<std::option::Option<std::string::String>>()?
14011                                .unwrap_or_default();
14012                        }
14013                        __FieldTag::__latest_recovery_time => {
14014                            if !fields.insert(__FieldTag::__latest_recovery_time) {
14015                                return std::result::Result::Err(A::Error::duplicate_field(
14016                                    "multiple values for latest_recovery_time",
14017                                ));
14018                            }
14019                            result.latest_recovery_time =
14020                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
14021                        }
14022                        __FieldTag::Unknown(key) => {
14023                            let value = map.next_value::<serde_json::Value>()?;
14024                            result._unknown_fields.insert(key, value);
14025                        }
14026                    }
14027                }
14028                std::result::Result::Ok(result)
14029            }
14030        }
14031        deserializer.deserialize_any(Visitor)
14032    }
14033}
14034
14035#[doc(hidden)]
14036impl serde::ser::Serialize for SqlInstancesGetLatestRecoveryTimeResponse {
14037    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14038    where
14039        S: serde::ser::Serializer,
14040    {
14041        use serde::ser::SerializeMap;
14042        #[allow(unused_imports)]
14043        use std::option::Option::Some;
14044        let mut state = serializer.serialize_map(std::option::Option::None)?;
14045        if !self.kind.is_empty() {
14046            state.serialize_entry("kind", &self.kind)?;
14047        }
14048        if self.latest_recovery_time.is_some() {
14049            state.serialize_entry("latestRecoveryTime", &self.latest_recovery_time)?;
14050        }
14051        if !self._unknown_fields.is_empty() {
14052            for (key, value) in self._unknown_fields.iter() {
14053                state.serialize_entry(key, &value)?;
14054            }
14055        }
14056        state.end()
14057    }
14058}
14059
14060/// Database instance clone context.
14061#[derive(Clone, Debug, Default, PartialEq)]
14062#[non_exhaustive]
14063pub struct CloneContext {
14064    /// This is always `sql#cloneContext`.
14065    pub kind: std::string::String,
14066
14067    /// Reserved for future use.
14068    pub pitr_timestamp_ms: i64,
14069
14070    /// Name of the Cloud SQL instance to be created as a clone.
14071    pub destination_instance_name: std::string::String,
14072
14073    /// Binary log coordinates, if specified, identify the position up to which the
14074    /// source instance is cloned. If not specified, the source instance is
14075    /// cloned up to the most recent binary log coordinates.
14076    pub bin_log_coordinates: std::option::Option<crate::model::BinLogCoordinates>,
14077
14078    /// Timestamp, if specified, identifies the time to which the source instance
14079    /// is cloned.
14080    pub point_in_time: std::option::Option<wkt::Timestamp>,
14081
14082    /// The name of the allocated ip range for the private ip Cloud SQL instance.
14083    /// For example: "google-managed-services-default". If set, the cloned instance
14084    /// ip will be created in the allocated range. The range name must comply with
14085    /// [RFC 1035](https://tools.ietf.org/html/rfc1035). Specifically, the name
14086    /// must be 1-63 characters long and match the regular expression
14087    /// [a-z]([-a-z0-9]*[a-z0-9])?.
14088    /// Reserved for future use.
14089    pub allocated_ip_range: std::string::String,
14090
14091    /// (SQL Server only) Clone only the specified databases from the source
14092    /// instance. Clone all databases if empty.
14093    pub database_names: std::vec::Vec<std::string::String>,
14094
14095    /// Optional. Copy clone and point-in-time recovery clone of an instance to the
14096    /// specified zone. If no zone is specified, clone to the same primary zone as
14097    /// the source instance. This field applies to all DB types.
14098    pub preferred_zone: std::option::Option<std::string::String>,
14099
14100    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14101}
14102
14103impl CloneContext {
14104    pub fn new() -> Self {
14105        std::default::Default::default()
14106    }
14107
14108    /// Sets the value of [kind][crate::model::CloneContext::kind].
14109    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14110        self.kind = v.into();
14111        self
14112    }
14113
14114    /// Sets the value of [pitr_timestamp_ms][crate::model::CloneContext::pitr_timestamp_ms].
14115    pub fn set_pitr_timestamp_ms<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
14116        self.pitr_timestamp_ms = v.into();
14117        self
14118    }
14119
14120    /// Sets the value of [destination_instance_name][crate::model::CloneContext::destination_instance_name].
14121    pub fn set_destination_instance_name<T: std::convert::Into<std::string::String>>(
14122        mut self,
14123        v: T,
14124    ) -> Self {
14125        self.destination_instance_name = v.into();
14126        self
14127    }
14128
14129    /// Sets the value of [bin_log_coordinates][crate::model::CloneContext::bin_log_coordinates].
14130    pub fn set_bin_log_coordinates<T>(mut self, v: T) -> Self
14131    where
14132        T: std::convert::Into<crate::model::BinLogCoordinates>,
14133    {
14134        self.bin_log_coordinates = std::option::Option::Some(v.into());
14135        self
14136    }
14137
14138    /// Sets or clears the value of [bin_log_coordinates][crate::model::CloneContext::bin_log_coordinates].
14139    pub fn set_or_clear_bin_log_coordinates<T>(mut self, v: std::option::Option<T>) -> Self
14140    where
14141        T: std::convert::Into<crate::model::BinLogCoordinates>,
14142    {
14143        self.bin_log_coordinates = v.map(|x| x.into());
14144        self
14145    }
14146
14147    /// Sets the value of [point_in_time][crate::model::CloneContext::point_in_time].
14148    pub fn set_point_in_time<T>(mut self, v: T) -> Self
14149    where
14150        T: std::convert::Into<wkt::Timestamp>,
14151    {
14152        self.point_in_time = std::option::Option::Some(v.into());
14153        self
14154    }
14155
14156    /// Sets or clears the value of [point_in_time][crate::model::CloneContext::point_in_time].
14157    pub fn set_or_clear_point_in_time<T>(mut self, v: std::option::Option<T>) -> Self
14158    where
14159        T: std::convert::Into<wkt::Timestamp>,
14160    {
14161        self.point_in_time = v.map(|x| x.into());
14162        self
14163    }
14164
14165    /// Sets the value of [allocated_ip_range][crate::model::CloneContext::allocated_ip_range].
14166    pub fn set_allocated_ip_range<T: std::convert::Into<std::string::String>>(
14167        mut self,
14168        v: T,
14169    ) -> Self {
14170        self.allocated_ip_range = v.into();
14171        self
14172    }
14173
14174    /// Sets the value of [database_names][crate::model::CloneContext::database_names].
14175    pub fn set_database_names<T, V>(mut self, v: T) -> Self
14176    where
14177        T: std::iter::IntoIterator<Item = V>,
14178        V: std::convert::Into<std::string::String>,
14179    {
14180        use std::iter::Iterator;
14181        self.database_names = v.into_iter().map(|i| i.into()).collect();
14182        self
14183    }
14184
14185    /// Sets the value of [preferred_zone][crate::model::CloneContext::preferred_zone].
14186    pub fn set_preferred_zone<T>(mut self, v: T) -> Self
14187    where
14188        T: std::convert::Into<std::string::String>,
14189    {
14190        self.preferred_zone = std::option::Option::Some(v.into());
14191        self
14192    }
14193
14194    /// Sets or clears the value of [preferred_zone][crate::model::CloneContext::preferred_zone].
14195    pub fn set_or_clear_preferred_zone<T>(mut self, v: std::option::Option<T>) -> Self
14196    where
14197        T: std::convert::Into<std::string::String>,
14198    {
14199        self.preferred_zone = v.map(|x| x.into());
14200        self
14201    }
14202}
14203
14204impl wkt::message::Message for CloneContext {
14205    fn typename() -> &'static str {
14206        "type.googleapis.com/google.cloud.sql.v1.CloneContext"
14207    }
14208}
14209
14210#[doc(hidden)]
14211impl<'de> serde::de::Deserialize<'de> for CloneContext {
14212    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14213    where
14214        D: serde::Deserializer<'de>,
14215    {
14216        #[allow(non_camel_case_types)]
14217        #[doc(hidden)]
14218        #[derive(PartialEq, Eq, Hash)]
14219        enum __FieldTag {
14220            __kind,
14221            __pitr_timestamp_ms,
14222            __destination_instance_name,
14223            __bin_log_coordinates,
14224            __point_in_time,
14225            __allocated_ip_range,
14226            __database_names,
14227            __preferred_zone,
14228            Unknown(std::string::String),
14229        }
14230        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14231            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14232            where
14233                D: serde::Deserializer<'de>,
14234            {
14235                struct Visitor;
14236                impl<'de> serde::de::Visitor<'de> for Visitor {
14237                    type Value = __FieldTag;
14238                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14239                        formatter.write_str("a field name for CloneContext")
14240                    }
14241                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14242                    where
14243                        E: serde::de::Error,
14244                    {
14245                        use std::result::Result::Ok;
14246                        use std::string::ToString;
14247                        match value {
14248                            "kind" => Ok(__FieldTag::__kind),
14249                            "pitrTimestampMs" => Ok(__FieldTag::__pitr_timestamp_ms),
14250                            "pitr_timestamp_ms" => Ok(__FieldTag::__pitr_timestamp_ms),
14251                            "destinationInstanceName" => {
14252                                Ok(__FieldTag::__destination_instance_name)
14253                            }
14254                            "destination_instance_name" => {
14255                                Ok(__FieldTag::__destination_instance_name)
14256                            }
14257                            "binLogCoordinates" => Ok(__FieldTag::__bin_log_coordinates),
14258                            "bin_log_coordinates" => Ok(__FieldTag::__bin_log_coordinates),
14259                            "pointInTime" => Ok(__FieldTag::__point_in_time),
14260                            "point_in_time" => Ok(__FieldTag::__point_in_time),
14261                            "allocatedIpRange" => Ok(__FieldTag::__allocated_ip_range),
14262                            "allocated_ip_range" => Ok(__FieldTag::__allocated_ip_range),
14263                            "databaseNames" => Ok(__FieldTag::__database_names),
14264                            "database_names" => Ok(__FieldTag::__database_names),
14265                            "preferredZone" => Ok(__FieldTag::__preferred_zone),
14266                            "preferred_zone" => Ok(__FieldTag::__preferred_zone),
14267                            _ => Ok(__FieldTag::Unknown(value.to_string())),
14268                        }
14269                    }
14270                }
14271                deserializer.deserialize_identifier(Visitor)
14272            }
14273        }
14274        struct Visitor;
14275        impl<'de> serde::de::Visitor<'de> for Visitor {
14276            type Value = CloneContext;
14277            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14278                formatter.write_str("struct CloneContext")
14279            }
14280            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14281            where
14282                A: serde::de::MapAccess<'de>,
14283            {
14284                #[allow(unused_imports)]
14285                use serde::de::Error;
14286                use std::option::Option::Some;
14287                let mut fields = std::collections::HashSet::new();
14288                let mut result = Self::Value::new();
14289                while let Some(tag) = map.next_key::<__FieldTag>()? {
14290                    #[allow(clippy::match_single_binding)]
14291                    match tag {
14292                        __FieldTag::__kind => {
14293                            if !fields.insert(__FieldTag::__kind) {
14294                                return std::result::Result::Err(A::Error::duplicate_field(
14295                                    "multiple values for kind",
14296                                ));
14297                            }
14298                            result.kind = map
14299                                .next_value::<std::option::Option<std::string::String>>()?
14300                                .unwrap_or_default();
14301                        }
14302                        __FieldTag::__pitr_timestamp_ms => {
14303                            if !fields.insert(__FieldTag::__pitr_timestamp_ms) {
14304                                return std::result::Result::Err(A::Error::duplicate_field(
14305                                    "multiple values for pitr_timestamp_ms",
14306                                ));
14307                            }
14308                            struct __With(std::option::Option<i64>);
14309                            impl<'de> serde::de::Deserialize<'de> for __With {
14310                                fn deserialize<D>(
14311                                    deserializer: D,
14312                                ) -> std::result::Result<Self, D::Error>
14313                                where
14314                                    D: serde::de::Deserializer<'de>,
14315                                {
14316                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
14317                                }
14318                            }
14319                            result.pitr_timestamp_ms =
14320                                map.next_value::<__With>()?.0.unwrap_or_default();
14321                        }
14322                        __FieldTag::__destination_instance_name => {
14323                            if !fields.insert(__FieldTag::__destination_instance_name) {
14324                                return std::result::Result::Err(A::Error::duplicate_field(
14325                                    "multiple values for destination_instance_name",
14326                                ));
14327                            }
14328                            result.destination_instance_name = map
14329                                .next_value::<std::option::Option<std::string::String>>()?
14330                                .unwrap_or_default();
14331                        }
14332                        __FieldTag::__bin_log_coordinates => {
14333                            if !fields.insert(__FieldTag::__bin_log_coordinates) {
14334                                return std::result::Result::Err(A::Error::duplicate_field(
14335                                    "multiple values for bin_log_coordinates",
14336                                ));
14337                            }
14338                            result.bin_log_coordinates = map
14339                                .next_value::<std::option::Option<crate::model::BinLogCoordinates>>(
14340                                )?;
14341                        }
14342                        __FieldTag::__point_in_time => {
14343                            if !fields.insert(__FieldTag::__point_in_time) {
14344                                return std::result::Result::Err(A::Error::duplicate_field(
14345                                    "multiple values for point_in_time",
14346                                ));
14347                            }
14348                            result.point_in_time =
14349                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
14350                        }
14351                        __FieldTag::__allocated_ip_range => {
14352                            if !fields.insert(__FieldTag::__allocated_ip_range) {
14353                                return std::result::Result::Err(A::Error::duplicate_field(
14354                                    "multiple values for allocated_ip_range",
14355                                ));
14356                            }
14357                            result.allocated_ip_range = map
14358                                .next_value::<std::option::Option<std::string::String>>()?
14359                                .unwrap_or_default();
14360                        }
14361                        __FieldTag::__database_names => {
14362                            if !fields.insert(__FieldTag::__database_names) {
14363                                return std::result::Result::Err(A::Error::duplicate_field(
14364                                    "multiple values for database_names",
14365                                ));
14366                            }
14367                            result.database_names = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
14368                        }
14369                        __FieldTag::__preferred_zone => {
14370                            if !fields.insert(__FieldTag::__preferred_zone) {
14371                                return std::result::Result::Err(A::Error::duplicate_field(
14372                                    "multiple values for preferred_zone",
14373                                ));
14374                            }
14375                            result.preferred_zone =
14376                                map.next_value::<std::option::Option<std::string::String>>()?;
14377                        }
14378                        __FieldTag::Unknown(key) => {
14379                            let value = map.next_value::<serde_json::Value>()?;
14380                            result._unknown_fields.insert(key, value);
14381                        }
14382                    }
14383                }
14384                std::result::Result::Ok(result)
14385            }
14386        }
14387        deserializer.deserialize_any(Visitor)
14388    }
14389}
14390
14391#[doc(hidden)]
14392impl serde::ser::Serialize for CloneContext {
14393    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14394    where
14395        S: serde::ser::Serializer,
14396    {
14397        use serde::ser::SerializeMap;
14398        #[allow(unused_imports)]
14399        use std::option::Option::Some;
14400        let mut state = serializer.serialize_map(std::option::Option::None)?;
14401        if !self.kind.is_empty() {
14402            state.serialize_entry("kind", &self.kind)?;
14403        }
14404        if !wkt::internal::is_default(&self.pitr_timestamp_ms) {
14405            struct __With<'a>(&'a i64);
14406            impl<'a> serde::ser::Serialize for __With<'a> {
14407                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14408                where
14409                    S: serde::ser::Serializer,
14410                {
14411                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
14412                }
14413            }
14414            state.serialize_entry("pitrTimestampMs", &__With(&self.pitr_timestamp_ms))?;
14415        }
14416        if !self.destination_instance_name.is_empty() {
14417            state.serialize_entry("destinationInstanceName", &self.destination_instance_name)?;
14418        }
14419        if self.bin_log_coordinates.is_some() {
14420            state.serialize_entry("binLogCoordinates", &self.bin_log_coordinates)?;
14421        }
14422        if self.point_in_time.is_some() {
14423            state.serialize_entry("pointInTime", &self.point_in_time)?;
14424        }
14425        if !self.allocated_ip_range.is_empty() {
14426            state.serialize_entry("allocatedIpRange", &self.allocated_ip_range)?;
14427        }
14428        if !self.database_names.is_empty() {
14429            state.serialize_entry("databaseNames", &self.database_names)?;
14430        }
14431        if self.preferred_zone.is_some() {
14432            state.serialize_entry("preferredZone", &self.preferred_zone)?;
14433        }
14434        if !self._unknown_fields.is_empty() {
14435            for (key, value) in self._unknown_fields.iter() {
14436                state.serialize_entry(key, &value)?;
14437            }
14438        }
14439        state.end()
14440    }
14441}
14442
14443/// Binary log coordinates.
14444#[derive(Clone, Debug, Default, PartialEq)]
14445#[non_exhaustive]
14446pub struct BinLogCoordinates {
14447    /// Name of the binary log file for a Cloud SQL instance.
14448    pub bin_log_file_name: std::string::String,
14449
14450    /// Position (offset) within the binary log file.
14451    pub bin_log_position: i64,
14452
14453    /// This is always `sql#binLogCoordinates`.
14454    pub kind: std::string::String,
14455
14456    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14457}
14458
14459impl BinLogCoordinates {
14460    pub fn new() -> Self {
14461        std::default::Default::default()
14462    }
14463
14464    /// Sets the value of [bin_log_file_name][crate::model::BinLogCoordinates::bin_log_file_name].
14465    pub fn set_bin_log_file_name<T: std::convert::Into<std::string::String>>(
14466        mut self,
14467        v: T,
14468    ) -> Self {
14469        self.bin_log_file_name = v.into();
14470        self
14471    }
14472
14473    /// Sets the value of [bin_log_position][crate::model::BinLogCoordinates::bin_log_position].
14474    pub fn set_bin_log_position<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
14475        self.bin_log_position = v.into();
14476        self
14477    }
14478
14479    /// Sets the value of [kind][crate::model::BinLogCoordinates::kind].
14480    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14481        self.kind = v.into();
14482        self
14483    }
14484}
14485
14486impl wkt::message::Message for BinLogCoordinates {
14487    fn typename() -> &'static str {
14488        "type.googleapis.com/google.cloud.sql.v1.BinLogCoordinates"
14489    }
14490}
14491
14492#[doc(hidden)]
14493impl<'de> serde::de::Deserialize<'de> for BinLogCoordinates {
14494    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14495    where
14496        D: serde::Deserializer<'de>,
14497    {
14498        #[allow(non_camel_case_types)]
14499        #[doc(hidden)]
14500        #[derive(PartialEq, Eq, Hash)]
14501        enum __FieldTag {
14502            __bin_log_file_name,
14503            __bin_log_position,
14504            __kind,
14505            Unknown(std::string::String),
14506        }
14507        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14508            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14509            where
14510                D: serde::Deserializer<'de>,
14511            {
14512                struct Visitor;
14513                impl<'de> serde::de::Visitor<'de> for Visitor {
14514                    type Value = __FieldTag;
14515                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14516                        formatter.write_str("a field name for BinLogCoordinates")
14517                    }
14518                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14519                    where
14520                        E: serde::de::Error,
14521                    {
14522                        use std::result::Result::Ok;
14523                        use std::string::ToString;
14524                        match value {
14525                            "binLogFileName" => Ok(__FieldTag::__bin_log_file_name),
14526                            "bin_log_file_name" => Ok(__FieldTag::__bin_log_file_name),
14527                            "binLogPosition" => Ok(__FieldTag::__bin_log_position),
14528                            "bin_log_position" => Ok(__FieldTag::__bin_log_position),
14529                            "kind" => Ok(__FieldTag::__kind),
14530                            _ => Ok(__FieldTag::Unknown(value.to_string())),
14531                        }
14532                    }
14533                }
14534                deserializer.deserialize_identifier(Visitor)
14535            }
14536        }
14537        struct Visitor;
14538        impl<'de> serde::de::Visitor<'de> for Visitor {
14539            type Value = BinLogCoordinates;
14540            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14541                formatter.write_str("struct BinLogCoordinates")
14542            }
14543            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14544            where
14545                A: serde::de::MapAccess<'de>,
14546            {
14547                #[allow(unused_imports)]
14548                use serde::de::Error;
14549                use std::option::Option::Some;
14550                let mut fields = std::collections::HashSet::new();
14551                let mut result = Self::Value::new();
14552                while let Some(tag) = map.next_key::<__FieldTag>()? {
14553                    #[allow(clippy::match_single_binding)]
14554                    match tag {
14555                        __FieldTag::__bin_log_file_name => {
14556                            if !fields.insert(__FieldTag::__bin_log_file_name) {
14557                                return std::result::Result::Err(A::Error::duplicate_field(
14558                                    "multiple values for bin_log_file_name",
14559                                ));
14560                            }
14561                            result.bin_log_file_name = map
14562                                .next_value::<std::option::Option<std::string::String>>()?
14563                                .unwrap_or_default();
14564                        }
14565                        __FieldTag::__bin_log_position => {
14566                            if !fields.insert(__FieldTag::__bin_log_position) {
14567                                return std::result::Result::Err(A::Error::duplicate_field(
14568                                    "multiple values for bin_log_position",
14569                                ));
14570                            }
14571                            struct __With(std::option::Option<i64>);
14572                            impl<'de> serde::de::Deserialize<'de> for __With {
14573                                fn deserialize<D>(
14574                                    deserializer: D,
14575                                ) -> std::result::Result<Self, D::Error>
14576                                where
14577                                    D: serde::de::Deserializer<'de>,
14578                                {
14579                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
14580                                }
14581                            }
14582                            result.bin_log_position =
14583                                map.next_value::<__With>()?.0.unwrap_or_default();
14584                        }
14585                        __FieldTag::__kind => {
14586                            if !fields.insert(__FieldTag::__kind) {
14587                                return std::result::Result::Err(A::Error::duplicate_field(
14588                                    "multiple values for kind",
14589                                ));
14590                            }
14591                            result.kind = map
14592                                .next_value::<std::option::Option<std::string::String>>()?
14593                                .unwrap_or_default();
14594                        }
14595                        __FieldTag::Unknown(key) => {
14596                            let value = map.next_value::<serde_json::Value>()?;
14597                            result._unknown_fields.insert(key, value);
14598                        }
14599                    }
14600                }
14601                std::result::Result::Ok(result)
14602            }
14603        }
14604        deserializer.deserialize_any(Visitor)
14605    }
14606}
14607
14608#[doc(hidden)]
14609impl serde::ser::Serialize for BinLogCoordinates {
14610    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14611    where
14612        S: serde::ser::Serializer,
14613    {
14614        use serde::ser::SerializeMap;
14615        #[allow(unused_imports)]
14616        use std::option::Option::Some;
14617        let mut state = serializer.serialize_map(std::option::Option::None)?;
14618        if !self.bin_log_file_name.is_empty() {
14619            state.serialize_entry("binLogFileName", &self.bin_log_file_name)?;
14620        }
14621        if !wkt::internal::is_default(&self.bin_log_position) {
14622            struct __With<'a>(&'a i64);
14623            impl<'a> serde::ser::Serialize for __With<'a> {
14624                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14625                where
14626                    S: serde::ser::Serializer,
14627                {
14628                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
14629                }
14630            }
14631            state.serialize_entry("binLogPosition", &__With(&self.bin_log_position))?;
14632        }
14633        if !self.kind.is_empty() {
14634            state.serialize_entry("kind", &self.kind)?;
14635        }
14636        if !self._unknown_fields.is_empty() {
14637            for (key, value) in self._unknown_fields.iter() {
14638                state.serialize_entry(key, &value)?;
14639            }
14640        }
14641        state.end()
14642    }
14643}
14644
14645/// A Cloud SQL instance resource.
14646#[derive(Clone, Debug, Default, PartialEq)]
14647#[non_exhaustive]
14648pub struct DatabaseInstance {
14649    /// This is always `sql#instance`.
14650    pub kind: std::string::String,
14651
14652    /// The current serving state of the Cloud SQL instance.
14653    pub state: crate::model::database_instance::SqlInstanceState,
14654
14655    /// The database engine type and version. The `databaseVersion` field cannot
14656    /// be changed after instance creation.
14657    pub database_version: crate::model::SqlDatabaseVersion,
14658
14659    /// The user settings.
14660    pub settings: std::option::Option<crate::model::Settings>,
14661
14662    /// This field is deprecated and will be removed from a future version of the
14663    /// API. Use the `settings.settingsVersion` field instead.
14664    pub etag: std::string::String,
14665
14666    /// The name and status of the failover replica.
14667    pub failover_replica: std::option::Option<crate::model::database_instance::SqlFailoverReplica>,
14668
14669    /// The name of the instance which will act as primary in the replication
14670    /// setup.
14671    pub master_instance_name: std::string::String,
14672
14673    /// The replicas of the instance.
14674    pub replica_names: std::vec::Vec<std::string::String>,
14675
14676    /// The maximum disk size of the instance in bytes.
14677    #[deprecated]
14678    pub max_disk_size: std::option::Option<wkt::Int64Value>,
14679
14680    /// The current disk usage of the instance in bytes. This property has been
14681    /// deprecated. Use the
14682    /// "cloudsql.googleapis.com/database/disk/bytes_used" metric in Cloud
14683    /// Monitoring API instead. Please see [this
14684    /// announcement](https://groups.google.com/d/msg/google-cloud-sql-announce/I_7-F9EBhT0/BtvFtdFeAgAJ)
14685    /// for details.
14686    #[deprecated]
14687    pub current_disk_size: std::option::Option<wkt::Int64Value>,
14688
14689    /// The assigned IP addresses for the instance.
14690    pub ip_addresses: std::vec::Vec<crate::model::IpMapping>,
14691
14692    /// SSL configuration.
14693    pub server_ca_cert: std::option::Option<crate::model::SslCert>,
14694
14695    /// The instance type.
14696    pub instance_type: crate::model::SqlInstanceType,
14697
14698    /// The project ID of the project containing the Cloud SQL instance. The Google
14699    /// apps domain is prefixed if applicable.
14700    pub project: std::string::String,
14701
14702    /// The IPv6 address assigned to the instance.
14703    /// (Deprecated) This property was applicable only
14704    /// to First Generation instances.
14705    #[deprecated]
14706    pub ipv6_address: std::string::String,
14707
14708    /// The service account email address assigned to the instance.\This
14709    /// property is read-only.
14710    pub service_account_email_address: std::string::String,
14711
14712    /// Configuration specific to on-premises instances.
14713    pub on_premises_configuration: std::option::Option<crate::model::OnPremisesConfiguration>,
14714
14715    /// Configuration specific to failover replicas and read replicas.
14716    pub replica_configuration: std::option::Option<crate::model::ReplicaConfiguration>,
14717
14718    /// The backend type.
14719    /// `SECOND_GEN`: Cloud SQL database instance.
14720    /// `EXTERNAL`: A database server that is not managed by Google.
14721    ///
14722    /// This property is read-only; use the `tier` property in the `settings`
14723    /// object to determine the database type.
14724    pub backend_type: crate::model::SqlBackendType,
14725
14726    /// The URI of this resource.
14727    pub self_link: std::string::String,
14728
14729    /// If the instance state is SUSPENDED, the reason for the suspension.
14730    pub suspension_reason: std::vec::Vec<crate::model::SqlSuspensionReason>,
14731
14732    /// Connection name of the Cloud SQL instance used in connection strings.
14733    pub connection_name: std::string::String,
14734
14735    /// Name of the Cloud SQL instance. This does not include the project ID.
14736    pub name: std::string::String,
14737
14738    /// The geographical region of the Cloud SQL instance.
14739    ///
14740    /// It can be one of the
14741    /// [regions](https://cloud.google.com/sql/docs/mysql/locations#location-r)
14742    /// where Cloud SQL operates:
14743    ///
14744    /// For example,  `asia-east1`, `europe-west1`, and  `us-central1`.
14745    /// The default value is `us-central1`.
14746    pub region: std::string::String,
14747
14748    /// The Compute Engine zone that the instance is currently serving from. This
14749    /// value could be different from the zone that was specified when the instance
14750    /// was created if the instance has failed over to its secondary zone. WARNING:
14751    /// Changing this might restart the instance.
14752    pub gce_zone: std::string::String,
14753
14754    /// The Compute Engine zone that the failover instance is currently serving
14755    /// from for a regional instance. This value could be different
14756    /// from the zone that was specified when the instance
14757    /// was created if the instance has failed over to its secondary/failover zone.
14758    pub secondary_gce_zone: std::string::String,
14759
14760    /// Disk encryption configuration specific to an instance.
14761    pub disk_encryption_configuration:
14762        std::option::Option<crate::model::DiskEncryptionConfiguration>,
14763
14764    /// Disk encryption status specific to an instance.
14765    pub disk_encryption_status: std::option::Option<crate::model::DiskEncryptionStatus>,
14766
14767    /// Initial root password. Use only on creation. You must set root passwords
14768    /// before you can connect to PostgreSQL instances.
14769    pub root_password: std::string::String,
14770
14771    /// The start time of any upcoming scheduled maintenance for this instance.
14772    pub scheduled_maintenance:
14773        std::option::Option<crate::model::database_instance::SqlScheduledMaintenance>,
14774
14775    /// This status indicates whether the instance satisfies PZS.
14776    ///
14777    /// The status is reserved for future use.
14778    pub satisfies_pzs: std::option::Option<wkt::BoolValue>,
14779
14780    /// Output only. Stores the current database version running on the instance
14781    /// including minor version such as `MYSQL_8_0_18`.
14782    pub database_installed_version: std::string::String,
14783
14784    /// This field represents the report generated by the proactive database
14785    /// wellness job for OutOfDisk issues.
14786    ///
14787    /// * Writers:
14788    /// * the proactive database wellness job for OOD.
14789    /// * Readers:
14790    /// * the proactive database wellness job
14791    pub out_of_disk_report:
14792        std::option::Option<crate::model::database_instance::SqlOutOfDiskReport>,
14793
14794    /// Output only. The time when the instance was created in
14795    /// [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example
14796    /// `2012-11-15T16:19:00.094Z`.
14797    pub create_time: std::option::Option<wkt::Timestamp>,
14798
14799    /// Output only. List all maintenance versions applicable on the instance
14800    pub available_maintenance_versions: std::vec::Vec<std::string::String>,
14801
14802    /// The current software version on the instance.
14803    pub maintenance_version: std::string::String,
14804
14805    /// Output only. All database versions that are available for upgrade.
14806    pub upgradable_database_versions: std::vec::Vec<crate::model::AvailableDatabaseVersion>,
14807
14808    pub sql_network_architecture:
14809        std::option::Option<crate::model::database_instance::SqlNetworkArchitecture>,
14810
14811    /// Output only. The link to service attachment of PSC instance.
14812    pub psc_service_attachment_link: std::option::Option<std::string::String>,
14813
14814    /// Output only. The dns name of the instance.
14815    pub dns_name: std::option::Option<std::string::String>,
14816
14817    /// Output only. DEPRECATED: please use write_endpoint instead.
14818    #[deprecated]
14819    pub primary_dns_name: std::option::Option<std::string::String>,
14820
14821    /// Output only. The dns name of the primary instance in a replication group.
14822    pub write_endpoint: std::option::Option<std::string::String>,
14823
14824    /// Optional. A primary instance and disaster recovery (DR) replica pair.
14825    /// A DR replica is a cross-region replica that you designate
14826    /// for failover in the event that the primary instance
14827    /// experiences regional failure. Only applicable to MySQL.
14828    pub replication_cluster: std::option::Option<crate::model::ReplicationCluster>,
14829
14830    /// Gemini instance configuration.
14831    pub gemini_config: std::option::Option<crate::model::GeminiInstanceConfig>,
14832
14833    /// Output only. This status indicates whether the instance satisfies PZI.
14834    ///
14835    /// The status is reserved for future use.
14836    pub satisfies_pzi: std::option::Option<wkt::BoolValue>,
14837
14838    /// Input only. Whether Cloud SQL is enabled to switch storing point-in-time
14839    /// recovery log files from a data disk to Cloud Storage.
14840    pub switch_transaction_logs_to_cloud_storage_enabled: std::option::Option<wkt::BoolValue>,
14841
14842    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14843}
14844
14845impl DatabaseInstance {
14846    pub fn new() -> Self {
14847        std::default::Default::default()
14848    }
14849
14850    /// Sets the value of [kind][crate::model::DatabaseInstance::kind].
14851    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14852        self.kind = v.into();
14853        self
14854    }
14855
14856    /// Sets the value of [state][crate::model::DatabaseInstance::state].
14857    pub fn set_state<T: std::convert::Into<crate::model::database_instance::SqlInstanceState>>(
14858        mut self,
14859        v: T,
14860    ) -> Self {
14861        self.state = v.into();
14862        self
14863    }
14864
14865    /// Sets the value of [database_version][crate::model::DatabaseInstance::database_version].
14866    pub fn set_database_version<T: std::convert::Into<crate::model::SqlDatabaseVersion>>(
14867        mut self,
14868        v: T,
14869    ) -> Self {
14870        self.database_version = v.into();
14871        self
14872    }
14873
14874    /// Sets the value of [settings][crate::model::DatabaseInstance::settings].
14875    pub fn set_settings<T>(mut self, v: T) -> Self
14876    where
14877        T: std::convert::Into<crate::model::Settings>,
14878    {
14879        self.settings = std::option::Option::Some(v.into());
14880        self
14881    }
14882
14883    /// Sets or clears the value of [settings][crate::model::DatabaseInstance::settings].
14884    pub fn set_or_clear_settings<T>(mut self, v: std::option::Option<T>) -> Self
14885    where
14886        T: std::convert::Into<crate::model::Settings>,
14887    {
14888        self.settings = v.map(|x| x.into());
14889        self
14890    }
14891
14892    /// Sets the value of [etag][crate::model::DatabaseInstance::etag].
14893    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14894        self.etag = v.into();
14895        self
14896    }
14897
14898    /// Sets the value of [failover_replica][crate::model::DatabaseInstance::failover_replica].
14899    pub fn set_failover_replica<T>(mut self, v: T) -> Self
14900    where
14901        T: std::convert::Into<crate::model::database_instance::SqlFailoverReplica>,
14902    {
14903        self.failover_replica = std::option::Option::Some(v.into());
14904        self
14905    }
14906
14907    /// Sets or clears the value of [failover_replica][crate::model::DatabaseInstance::failover_replica].
14908    pub fn set_or_clear_failover_replica<T>(mut self, v: std::option::Option<T>) -> Self
14909    where
14910        T: std::convert::Into<crate::model::database_instance::SqlFailoverReplica>,
14911    {
14912        self.failover_replica = v.map(|x| x.into());
14913        self
14914    }
14915
14916    /// Sets the value of [master_instance_name][crate::model::DatabaseInstance::master_instance_name].
14917    pub fn set_master_instance_name<T: std::convert::Into<std::string::String>>(
14918        mut self,
14919        v: T,
14920    ) -> Self {
14921        self.master_instance_name = v.into();
14922        self
14923    }
14924
14925    /// Sets the value of [replica_names][crate::model::DatabaseInstance::replica_names].
14926    pub fn set_replica_names<T, V>(mut self, v: T) -> Self
14927    where
14928        T: std::iter::IntoIterator<Item = V>,
14929        V: std::convert::Into<std::string::String>,
14930    {
14931        use std::iter::Iterator;
14932        self.replica_names = v.into_iter().map(|i| i.into()).collect();
14933        self
14934    }
14935
14936    /// Sets the value of [max_disk_size][crate::model::DatabaseInstance::max_disk_size].
14937    #[deprecated]
14938    pub fn set_max_disk_size<T>(mut self, v: T) -> Self
14939    where
14940        T: std::convert::Into<wkt::Int64Value>,
14941    {
14942        self.max_disk_size = std::option::Option::Some(v.into());
14943        self
14944    }
14945
14946    /// Sets or clears the value of [max_disk_size][crate::model::DatabaseInstance::max_disk_size].
14947    #[deprecated]
14948    pub fn set_or_clear_max_disk_size<T>(mut self, v: std::option::Option<T>) -> Self
14949    where
14950        T: std::convert::Into<wkt::Int64Value>,
14951    {
14952        self.max_disk_size = v.map(|x| x.into());
14953        self
14954    }
14955
14956    /// Sets the value of [current_disk_size][crate::model::DatabaseInstance::current_disk_size].
14957    #[deprecated]
14958    pub fn set_current_disk_size<T>(mut self, v: T) -> Self
14959    where
14960        T: std::convert::Into<wkt::Int64Value>,
14961    {
14962        self.current_disk_size = std::option::Option::Some(v.into());
14963        self
14964    }
14965
14966    /// Sets or clears the value of [current_disk_size][crate::model::DatabaseInstance::current_disk_size].
14967    #[deprecated]
14968    pub fn set_or_clear_current_disk_size<T>(mut self, v: std::option::Option<T>) -> Self
14969    where
14970        T: std::convert::Into<wkt::Int64Value>,
14971    {
14972        self.current_disk_size = v.map(|x| x.into());
14973        self
14974    }
14975
14976    /// Sets the value of [ip_addresses][crate::model::DatabaseInstance::ip_addresses].
14977    pub fn set_ip_addresses<T, V>(mut self, v: T) -> Self
14978    where
14979        T: std::iter::IntoIterator<Item = V>,
14980        V: std::convert::Into<crate::model::IpMapping>,
14981    {
14982        use std::iter::Iterator;
14983        self.ip_addresses = v.into_iter().map(|i| i.into()).collect();
14984        self
14985    }
14986
14987    /// Sets the value of [server_ca_cert][crate::model::DatabaseInstance::server_ca_cert].
14988    pub fn set_server_ca_cert<T>(mut self, v: T) -> Self
14989    where
14990        T: std::convert::Into<crate::model::SslCert>,
14991    {
14992        self.server_ca_cert = std::option::Option::Some(v.into());
14993        self
14994    }
14995
14996    /// Sets or clears the value of [server_ca_cert][crate::model::DatabaseInstance::server_ca_cert].
14997    pub fn set_or_clear_server_ca_cert<T>(mut self, v: std::option::Option<T>) -> Self
14998    where
14999        T: std::convert::Into<crate::model::SslCert>,
15000    {
15001        self.server_ca_cert = v.map(|x| x.into());
15002        self
15003    }
15004
15005    /// Sets the value of [instance_type][crate::model::DatabaseInstance::instance_type].
15006    pub fn set_instance_type<T: std::convert::Into<crate::model::SqlInstanceType>>(
15007        mut self,
15008        v: T,
15009    ) -> Self {
15010        self.instance_type = v.into();
15011        self
15012    }
15013
15014    /// Sets the value of [project][crate::model::DatabaseInstance::project].
15015    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15016        self.project = v.into();
15017        self
15018    }
15019
15020    /// Sets the value of [ipv6_address][crate::model::DatabaseInstance::ipv6_address].
15021    #[deprecated]
15022    pub fn set_ipv6_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15023        self.ipv6_address = v.into();
15024        self
15025    }
15026
15027    /// Sets the value of [service_account_email_address][crate::model::DatabaseInstance::service_account_email_address].
15028    pub fn set_service_account_email_address<T: std::convert::Into<std::string::String>>(
15029        mut self,
15030        v: T,
15031    ) -> Self {
15032        self.service_account_email_address = v.into();
15033        self
15034    }
15035
15036    /// Sets the value of [on_premises_configuration][crate::model::DatabaseInstance::on_premises_configuration].
15037    pub fn set_on_premises_configuration<T>(mut self, v: T) -> Self
15038    where
15039        T: std::convert::Into<crate::model::OnPremisesConfiguration>,
15040    {
15041        self.on_premises_configuration = std::option::Option::Some(v.into());
15042        self
15043    }
15044
15045    /// Sets or clears the value of [on_premises_configuration][crate::model::DatabaseInstance::on_premises_configuration].
15046    pub fn set_or_clear_on_premises_configuration<T>(mut self, v: std::option::Option<T>) -> Self
15047    where
15048        T: std::convert::Into<crate::model::OnPremisesConfiguration>,
15049    {
15050        self.on_premises_configuration = v.map(|x| x.into());
15051        self
15052    }
15053
15054    /// Sets the value of [replica_configuration][crate::model::DatabaseInstance::replica_configuration].
15055    pub fn set_replica_configuration<T>(mut self, v: T) -> Self
15056    where
15057        T: std::convert::Into<crate::model::ReplicaConfiguration>,
15058    {
15059        self.replica_configuration = std::option::Option::Some(v.into());
15060        self
15061    }
15062
15063    /// Sets or clears the value of [replica_configuration][crate::model::DatabaseInstance::replica_configuration].
15064    pub fn set_or_clear_replica_configuration<T>(mut self, v: std::option::Option<T>) -> Self
15065    where
15066        T: std::convert::Into<crate::model::ReplicaConfiguration>,
15067    {
15068        self.replica_configuration = v.map(|x| x.into());
15069        self
15070    }
15071
15072    /// Sets the value of [backend_type][crate::model::DatabaseInstance::backend_type].
15073    pub fn set_backend_type<T: std::convert::Into<crate::model::SqlBackendType>>(
15074        mut self,
15075        v: T,
15076    ) -> Self {
15077        self.backend_type = v.into();
15078        self
15079    }
15080
15081    /// Sets the value of [self_link][crate::model::DatabaseInstance::self_link].
15082    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15083        self.self_link = v.into();
15084        self
15085    }
15086
15087    /// Sets the value of [suspension_reason][crate::model::DatabaseInstance::suspension_reason].
15088    pub fn set_suspension_reason<T, V>(mut self, v: T) -> Self
15089    where
15090        T: std::iter::IntoIterator<Item = V>,
15091        V: std::convert::Into<crate::model::SqlSuspensionReason>,
15092    {
15093        use std::iter::Iterator;
15094        self.suspension_reason = v.into_iter().map(|i| i.into()).collect();
15095        self
15096    }
15097
15098    /// Sets the value of [connection_name][crate::model::DatabaseInstance::connection_name].
15099    pub fn set_connection_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15100        self.connection_name = v.into();
15101        self
15102    }
15103
15104    /// Sets the value of [name][crate::model::DatabaseInstance::name].
15105    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15106        self.name = v.into();
15107        self
15108    }
15109
15110    /// Sets the value of [region][crate::model::DatabaseInstance::region].
15111    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15112        self.region = v.into();
15113        self
15114    }
15115
15116    /// Sets the value of [gce_zone][crate::model::DatabaseInstance::gce_zone].
15117    pub fn set_gce_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15118        self.gce_zone = v.into();
15119        self
15120    }
15121
15122    /// Sets the value of [secondary_gce_zone][crate::model::DatabaseInstance::secondary_gce_zone].
15123    pub fn set_secondary_gce_zone<T: std::convert::Into<std::string::String>>(
15124        mut self,
15125        v: T,
15126    ) -> Self {
15127        self.secondary_gce_zone = v.into();
15128        self
15129    }
15130
15131    /// Sets the value of [disk_encryption_configuration][crate::model::DatabaseInstance::disk_encryption_configuration].
15132    pub fn set_disk_encryption_configuration<T>(mut self, v: T) -> Self
15133    where
15134        T: std::convert::Into<crate::model::DiskEncryptionConfiguration>,
15135    {
15136        self.disk_encryption_configuration = std::option::Option::Some(v.into());
15137        self
15138    }
15139
15140    /// Sets or clears the value of [disk_encryption_configuration][crate::model::DatabaseInstance::disk_encryption_configuration].
15141    pub fn set_or_clear_disk_encryption_configuration<T>(
15142        mut self,
15143        v: std::option::Option<T>,
15144    ) -> Self
15145    where
15146        T: std::convert::Into<crate::model::DiskEncryptionConfiguration>,
15147    {
15148        self.disk_encryption_configuration = v.map(|x| x.into());
15149        self
15150    }
15151
15152    /// Sets the value of [disk_encryption_status][crate::model::DatabaseInstance::disk_encryption_status].
15153    pub fn set_disk_encryption_status<T>(mut self, v: T) -> Self
15154    where
15155        T: std::convert::Into<crate::model::DiskEncryptionStatus>,
15156    {
15157        self.disk_encryption_status = std::option::Option::Some(v.into());
15158        self
15159    }
15160
15161    /// Sets or clears the value of [disk_encryption_status][crate::model::DatabaseInstance::disk_encryption_status].
15162    pub fn set_or_clear_disk_encryption_status<T>(mut self, v: std::option::Option<T>) -> Self
15163    where
15164        T: std::convert::Into<crate::model::DiskEncryptionStatus>,
15165    {
15166        self.disk_encryption_status = v.map(|x| x.into());
15167        self
15168    }
15169
15170    /// Sets the value of [root_password][crate::model::DatabaseInstance::root_password].
15171    pub fn set_root_password<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15172        self.root_password = v.into();
15173        self
15174    }
15175
15176    /// Sets the value of [scheduled_maintenance][crate::model::DatabaseInstance::scheduled_maintenance].
15177    pub fn set_scheduled_maintenance<T>(mut self, v: T) -> Self
15178    where
15179        T: std::convert::Into<crate::model::database_instance::SqlScheduledMaintenance>,
15180    {
15181        self.scheduled_maintenance = std::option::Option::Some(v.into());
15182        self
15183    }
15184
15185    /// Sets or clears the value of [scheduled_maintenance][crate::model::DatabaseInstance::scheduled_maintenance].
15186    pub fn set_or_clear_scheduled_maintenance<T>(mut self, v: std::option::Option<T>) -> Self
15187    where
15188        T: std::convert::Into<crate::model::database_instance::SqlScheduledMaintenance>,
15189    {
15190        self.scheduled_maintenance = v.map(|x| x.into());
15191        self
15192    }
15193
15194    /// Sets the value of [satisfies_pzs][crate::model::DatabaseInstance::satisfies_pzs].
15195    pub fn set_satisfies_pzs<T>(mut self, v: T) -> Self
15196    where
15197        T: std::convert::Into<wkt::BoolValue>,
15198    {
15199        self.satisfies_pzs = std::option::Option::Some(v.into());
15200        self
15201    }
15202
15203    /// Sets or clears the value of [satisfies_pzs][crate::model::DatabaseInstance::satisfies_pzs].
15204    pub fn set_or_clear_satisfies_pzs<T>(mut self, v: std::option::Option<T>) -> Self
15205    where
15206        T: std::convert::Into<wkt::BoolValue>,
15207    {
15208        self.satisfies_pzs = v.map(|x| x.into());
15209        self
15210    }
15211
15212    /// Sets the value of [database_installed_version][crate::model::DatabaseInstance::database_installed_version].
15213    pub fn set_database_installed_version<T: std::convert::Into<std::string::String>>(
15214        mut self,
15215        v: T,
15216    ) -> Self {
15217        self.database_installed_version = v.into();
15218        self
15219    }
15220
15221    /// Sets the value of [out_of_disk_report][crate::model::DatabaseInstance::out_of_disk_report].
15222    pub fn set_out_of_disk_report<T>(mut self, v: T) -> Self
15223    where
15224        T: std::convert::Into<crate::model::database_instance::SqlOutOfDiskReport>,
15225    {
15226        self.out_of_disk_report = std::option::Option::Some(v.into());
15227        self
15228    }
15229
15230    /// Sets or clears the value of [out_of_disk_report][crate::model::DatabaseInstance::out_of_disk_report].
15231    pub fn set_or_clear_out_of_disk_report<T>(mut self, v: std::option::Option<T>) -> Self
15232    where
15233        T: std::convert::Into<crate::model::database_instance::SqlOutOfDiskReport>,
15234    {
15235        self.out_of_disk_report = v.map(|x| x.into());
15236        self
15237    }
15238
15239    /// Sets the value of [create_time][crate::model::DatabaseInstance::create_time].
15240    pub fn set_create_time<T>(mut self, v: T) -> Self
15241    where
15242        T: std::convert::Into<wkt::Timestamp>,
15243    {
15244        self.create_time = std::option::Option::Some(v.into());
15245        self
15246    }
15247
15248    /// Sets or clears the value of [create_time][crate::model::DatabaseInstance::create_time].
15249    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
15250    where
15251        T: std::convert::Into<wkt::Timestamp>,
15252    {
15253        self.create_time = v.map(|x| x.into());
15254        self
15255    }
15256
15257    /// Sets the value of [available_maintenance_versions][crate::model::DatabaseInstance::available_maintenance_versions].
15258    pub fn set_available_maintenance_versions<T, V>(mut self, v: T) -> Self
15259    where
15260        T: std::iter::IntoIterator<Item = V>,
15261        V: std::convert::Into<std::string::String>,
15262    {
15263        use std::iter::Iterator;
15264        self.available_maintenance_versions = v.into_iter().map(|i| i.into()).collect();
15265        self
15266    }
15267
15268    /// Sets the value of [maintenance_version][crate::model::DatabaseInstance::maintenance_version].
15269    pub fn set_maintenance_version<T: std::convert::Into<std::string::String>>(
15270        mut self,
15271        v: T,
15272    ) -> Self {
15273        self.maintenance_version = v.into();
15274        self
15275    }
15276
15277    /// Sets the value of [upgradable_database_versions][crate::model::DatabaseInstance::upgradable_database_versions].
15278    pub fn set_upgradable_database_versions<T, V>(mut self, v: T) -> Self
15279    where
15280        T: std::iter::IntoIterator<Item = V>,
15281        V: std::convert::Into<crate::model::AvailableDatabaseVersion>,
15282    {
15283        use std::iter::Iterator;
15284        self.upgradable_database_versions = v.into_iter().map(|i| i.into()).collect();
15285        self
15286    }
15287
15288    /// Sets the value of [sql_network_architecture][crate::model::DatabaseInstance::sql_network_architecture].
15289    pub fn set_sql_network_architecture<T>(mut self, v: T) -> Self
15290    where
15291        T: std::convert::Into<crate::model::database_instance::SqlNetworkArchitecture>,
15292    {
15293        self.sql_network_architecture = std::option::Option::Some(v.into());
15294        self
15295    }
15296
15297    /// Sets or clears the value of [sql_network_architecture][crate::model::DatabaseInstance::sql_network_architecture].
15298    pub fn set_or_clear_sql_network_architecture<T>(mut self, v: std::option::Option<T>) -> Self
15299    where
15300        T: std::convert::Into<crate::model::database_instance::SqlNetworkArchitecture>,
15301    {
15302        self.sql_network_architecture = v.map(|x| x.into());
15303        self
15304    }
15305
15306    /// Sets the value of [psc_service_attachment_link][crate::model::DatabaseInstance::psc_service_attachment_link].
15307    pub fn set_psc_service_attachment_link<T>(mut self, v: T) -> Self
15308    where
15309        T: std::convert::Into<std::string::String>,
15310    {
15311        self.psc_service_attachment_link = std::option::Option::Some(v.into());
15312        self
15313    }
15314
15315    /// Sets or clears the value of [psc_service_attachment_link][crate::model::DatabaseInstance::psc_service_attachment_link].
15316    pub fn set_or_clear_psc_service_attachment_link<T>(mut self, v: std::option::Option<T>) -> Self
15317    where
15318        T: std::convert::Into<std::string::String>,
15319    {
15320        self.psc_service_attachment_link = v.map(|x| x.into());
15321        self
15322    }
15323
15324    /// Sets the value of [dns_name][crate::model::DatabaseInstance::dns_name].
15325    pub fn set_dns_name<T>(mut self, v: T) -> Self
15326    where
15327        T: std::convert::Into<std::string::String>,
15328    {
15329        self.dns_name = std::option::Option::Some(v.into());
15330        self
15331    }
15332
15333    /// Sets or clears the value of [dns_name][crate::model::DatabaseInstance::dns_name].
15334    pub fn set_or_clear_dns_name<T>(mut self, v: std::option::Option<T>) -> Self
15335    where
15336        T: std::convert::Into<std::string::String>,
15337    {
15338        self.dns_name = v.map(|x| x.into());
15339        self
15340    }
15341
15342    /// Sets the value of [primary_dns_name][crate::model::DatabaseInstance::primary_dns_name].
15343    #[deprecated]
15344    pub fn set_primary_dns_name<T>(mut self, v: T) -> Self
15345    where
15346        T: std::convert::Into<std::string::String>,
15347    {
15348        self.primary_dns_name = std::option::Option::Some(v.into());
15349        self
15350    }
15351
15352    /// Sets or clears the value of [primary_dns_name][crate::model::DatabaseInstance::primary_dns_name].
15353    #[deprecated]
15354    pub fn set_or_clear_primary_dns_name<T>(mut self, v: std::option::Option<T>) -> Self
15355    where
15356        T: std::convert::Into<std::string::String>,
15357    {
15358        self.primary_dns_name = v.map(|x| x.into());
15359        self
15360    }
15361
15362    /// Sets the value of [write_endpoint][crate::model::DatabaseInstance::write_endpoint].
15363    pub fn set_write_endpoint<T>(mut self, v: T) -> Self
15364    where
15365        T: std::convert::Into<std::string::String>,
15366    {
15367        self.write_endpoint = std::option::Option::Some(v.into());
15368        self
15369    }
15370
15371    /// Sets or clears the value of [write_endpoint][crate::model::DatabaseInstance::write_endpoint].
15372    pub fn set_or_clear_write_endpoint<T>(mut self, v: std::option::Option<T>) -> Self
15373    where
15374        T: std::convert::Into<std::string::String>,
15375    {
15376        self.write_endpoint = v.map(|x| x.into());
15377        self
15378    }
15379
15380    /// Sets the value of [replication_cluster][crate::model::DatabaseInstance::replication_cluster].
15381    pub fn set_replication_cluster<T>(mut self, v: T) -> Self
15382    where
15383        T: std::convert::Into<crate::model::ReplicationCluster>,
15384    {
15385        self.replication_cluster = std::option::Option::Some(v.into());
15386        self
15387    }
15388
15389    /// Sets or clears the value of [replication_cluster][crate::model::DatabaseInstance::replication_cluster].
15390    pub fn set_or_clear_replication_cluster<T>(mut self, v: std::option::Option<T>) -> Self
15391    where
15392        T: std::convert::Into<crate::model::ReplicationCluster>,
15393    {
15394        self.replication_cluster = v.map(|x| x.into());
15395        self
15396    }
15397
15398    /// Sets the value of [gemini_config][crate::model::DatabaseInstance::gemini_config].
15399    pub fn set_gemini_config<T>(mut self, v: T) -> Self
15400    where
15401        T: std::convert::Into<crate::model::GeminiInstanceConfig>,
15402    {
15403        self.gemini_config = std::option::Option::Some(v.into());
15404        self
15405    }
15406
15407    /// Sets or clears the value of [gemini_config][crate::model::DatabaseInstance::gemini_config].
15408    pub fn set_or_clear_gemini_config<T>(mut self, v: std::option::Option<T>) -> Self
15409    where
15410        T: std::convert::Into<crate::model::GeminiInstanceConfig>,
15411    {
15412        self.gemini_config = v.map(|x| x.into());
15413        self
15414    }
15415
15416    /// Sets the value of [satisfies_pzi][crate::model::DatabaseInstance::satisfies_pzi].
15417    pub fn set_satisfies_pzi<T>(mut self, v: T) -> Self
15418    where
15419        T: std::convert::Into<wkt::BoolValue>,
15420    {
15421        self.satisfies_pzi = std::option::Option::Some(v.into());
15422        self
15423    }
15424
15425    /// Sets or clears the value of [satisfies_pzi][crate::model::DatabaseInstance::satisfies_pzi].
15426    pub fn set_or_clear_satisfies_pzi<T>(mut self, v: std::option::Option<T>) -> Self
15427    where
15428        T: std::convert::Into<wkt::BoolValue>,
15429    {
15430        self.satisfies_pzi = v.map(|x| x.into());
15431        self
15432    }
15433
15434    /// Sets the value of [switch_transaction_logs_to_cloud_storage_enabled][crate::model::DatabaseInstance::switch_transaction_logs_to_cloud_storage_enabled].
15435    pub fn set_switch_transaction_logs_to_cloud_storage_enabled<T>(mut self, v: T) -> Self
15436    where
15437        T: std::convert::Into<wkt::BoolValue>,
15438    {
15439        self.switch_transaction_logs_to_cloud_storage_enabled = std::option::Option::Some(v.into());
15440        self
15441    }
15442
15443    /// Sets or clears the value of [switch_transaction_logs_to_cloud_storage_enabled][crate::model::DatabaseInstance::switch_transaction_logs_to_cloud_storage_enabled].
15444    pub fn set_or_clear_switch_transaction_logs_to_cloud_storage_enabled<T>(
15445        mut self,
15446        v: std::option::Option<T>,
15447    ) -> Self
15448    where
15449        T: std::convert::Into<wkt::BoolValue>,
15450    {
15451        self.switch_transaction_logs_to_cloud_storage_enabled = v.map(|x| x.into());
15452        self
15453    }
15454}
15455
15456impl wkt::message::Message for DatabaseInstance {
15457    fn typename() -> &'static str {
15458        "type.googleapis.com/google.cloud.sql.v1.DatabaseInstance"
15459    }
15460}
15461
15462#[doc(hidden)]
15463impl<'de> serde::de::Deserialize<'de> for DatabaseInstance {
15464    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15465    where
15466        D: serde::Deserializer<'de>,
15467    {
15468        #[allow(non_camel_case_types)]
15469        #[doc(hidden)]
15470        #[derive(PartialEq, Eq, Hash)]
15471        enum __FieldTag {
15472            __kind,
15473            __state,
15474            __database_version,
15475            __settings,
15476            __etag,
15477            __failover_replica,
15478            __master_instance_name,
15479            __replica_names,
15480            __max_disk_size,
15481            __current_disk_size,
15482            __ip_addresses,
15483            __server_ca_cert,
15484            __instance_type,
15485            __project,
15486            __ipv6_address,
15487            __service_account_email_address,
15488            __on_premises_configuration,
15489            __replica_configuration,
15490            __backend_type,
15491            __self_link,
15492            __suspension_reason,
15493            __connection_name,
15494            __name,
15495            __region,
15496            __gce_zone,
15497            __secondary_gce_zone,
15498            __disk_encryption_configuration,
15499            __disk_encryption_status,
15500            __root_password,
15501            __scheduled_maintenance,
15502            __satisfies_pzs,
15503            __database_installed_version,
15504            __out_of_disk_report,
15505            __create_time,
15506            __available_maintenance_versions,
15507            __maintenance_version,
15508            __upgradable_database_versions,
15509            __sql_network_architecture,
15510            __psc_service_attachment_link,
15511            __dns_name,
15512            __primary_dns_name,
15513            __write_endpoint,
15514            __replication_cluster,
15515            __gemini_config,
15516            __satisfies_pzi,
15517            __switch_transaction_logs_to_cloud_storage_enabled,
15518            Unknown(std::string::String),
15519        }
15520        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15521            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15522            where
15523                D: serde::Deserializer<'de>,
15524            {
15525                struct Visitor;
15526                impl<'de> serde::de::Visitor<'de> for Visitor {
15527                    type Value = __FieldTag;
15528                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15529                        formatter.write_str("a field name for DatabaseInstance")
15530                    }
15531                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
15532                    where
15533                        E: serde::de::Error,
15534                    {
15535                        use std::result::Result::Ok;
15536                        use std::string::ToString;
15537                        match value {
15538                            "kind" => Ok(__FieldTag::__kind),
15539                            "state" => Ok(__FieldTag::__state),
15540                            "databaseVersion" => Ok(__FieldTag::__database_version),
15541                            "database_version" => Ok(__FieldTag::__database_version),
15542                            "settings" => Ok(__FieldTag::__settings),
15543                            "etag" => Ok(__FieldTag::__etag),
15544                            "failoverReplica" => Ok(__FieldTag::__failover_replica),
15545                            "failover_replica" => Ok(__FieldTag::__failover_replica),
15546                            "masterInstanceName" => Ok(__FieldTag::__master_instance_name),
15547                            "master_instance_name" => Ok(__FieldTag::__master_instance_name),
15548                            "replicaNames" => Ok(__FieldTag::__replica_names),
15549                            "replica_names" => Ok(__FieldTag::__replica_names),
15550                            "maxDiskSize" => Ok(__FieldTag::__max_disk_size),
15551                            "max_disk_size" => Ok(__FieldTag::__max_disk_size),
15552                            "currentDiskSize" => Ok(__FieldTag::__current_disk_size),
15553                            "current_disk_size" => Ok(__FieldTag::__current_disk_size),
15554                            "ipAddresses" => Ok(__FieldTag::__ip_addresses),
15555                            "ip_addresses" => Ok(__FieldTag::__ip_addresses),
15556                            "serverCaCert" => Ok(__FieldTag::__server_ca_cert),
15557                            "server_ca_cert" => Ok(__FieldTag::__server_ca_cert),
15558                            "instanceType" => Ok(__FieldTag::__instance_type),
15559                            "instance_type" => Ok(__FieldTag::__instance_type),
15560                            "project" => Ok(__FieldTag::__project),
15561                            "ipv6Address" => Ok(__FieldTag::__ipv6_address),
15562                            "ipv6_address" => Ok(__FieldTag::__ipv6_address),
15563                            "serviceAccountEmailAddress" => {
15564                                Ok(__FieldTag::__service_account_email_address)
15565                            }
15566                            "service_account_email_address" => {
15567                                Ok(__FieldTag::__service_account_email_address)
15568                            }
15569                            "onPremisesConfiguration" => {
15570                                Ok(__FieldTag::__on_premises_configuration)
15571                            }
15572                            "on_premises_configuration" => {
15573                                Ok(__FieldTag::__on_premises_configuration)
15574                            }
15575                            "replicaConfiguration" => Ok(__FieldTag::__replica_configuration),
15576                            "replica_configuration" => Ok(__FieldTag::__replica_configuration),
15577                            "backendType" => Ok(__FieldTag::__backend_type),
15578                            "backend_type" => Ok(__FieldTag::__backend_type),
15579                            "selfLink" => Ok(__FieldTag::__self_link),
15580                            "self_link" => Ok(__FieldTag::__self_link),
15581                            "suspensionReason" => Ok(__FieldTag::__suspension_reason),
15582                            "suspension_reason" => Ok(__FieldTag::__suspension_reason),
15583                            "connectionName" => Ok(__FieldTag::__connection_name),
15584                            "connection_name" => Ok(__FieldTag::__connection_name),
15585                            "name" => Ok(__FieldTag::__name),
15586                            "region" => Ok(__FieldTag::__region),
15587                            "gceZone" => Ok(__FieldTag::__gce_zone),
15588                            "gce_zone" => Ok(__FieldTag::__gce_zone),
15589                            "secondaryGceZone" => Ok(__FieldTag::__secondary_gce_zone),
15590                            "secondary_gce_zone" => Ok(__FieldTag::__secondary_gce_zone),
15591                            "diskEncryptionConfiguration" => {
15592                                Ok(__FieldTag::__disk_encryption_configuration)
15593                            }
15594                            "disk_encryption_configuration" => {
15595                                Ok(__FieldTag::__disk_encryption_configuration)
15596                            }
15597                            "diskEncryptionStatus" => Ok(__FieldTag::__disk_encryption_status),
15598                            "disk_encryption_status" => Ok(__FieldTag::__disk_encryption_status),
15599                            "rootPassword" => Ok(__FieldTag::__root_password),
15600                            "root_password" => Ok(__FieldTag::__root_password),
15601                            "scheduledMaintenance" => Ok(__FieldTag::__scheduled_maintenance),
15602                            "scheduled_maintenance" => Ok(__FieldTag::__scheduled_maintenance),
15603                            "satisfiesPzs" => Ok(__FieldTag::__satisfies_pzs),
15604                            "satisfies_pzs" => Ok(__FieldTag::__satisfies_pzs),
15605                            "databaseInstalledVersion" => {
15606                                Ok(__FieldTag::__database_installed_version)
15607                            }
15608                            "database_installed_version" => {
15609                                Ok(__FieldTag::__database_installed_version)
15610                            }
15611                            "outOfDiskReport" => Ok(__FieldTag::__out_of_disk_report),
15612                            "out_of_disk_report" => Ok(__FieldTag::__out_of_disk_report),
15613                            "createTime" => Ok(__FieldTag::__create_time),
15614                            "create_time" => Ok(__FieldTag::__create_time),
15615                            "availableMaintenanceVersions" => {
15616                                Ok(__FieldTag::__available_maintenance_versions)
15617                            }
15618                            "available_maintenance_versions" => {
15619                                Ok(__FieldTag::__available_maintenance_versions)
15620                            }
15621                            "maintenanceVersion" => Ok(__FieldTag::__maintenance_version),
15622                            "maintenance_version" => Ok(__FieldTag::__maintenance_version),
15623                            "upgradableDatabaseVersions" => {
15624                                Ok(__FieldTag::__upgradable_database_versions)
15625                            }
15626                            "upgradable_database_versions" => {
15627                                Ok(__FieldTag::__upgradable_database_versions)
15628                            }
15629                            "sqlNetworkArchitecture" => Ok(__FieldTag::__sql_network_architecture),
15630                            "sql_network_architecture" => {
15631                                Ok(__FieldTag::__sql_network_architecture)
15632                            }
15633                            "pscServiceAttachmentLink" => {
15634                                Ok(__FieldTag::__psc_service_attachment_link)
15635                            }
15636                            "psc_service_attachment_link" => {
15637                                Ok(__FieldTag::__psc_service_attachment_link)
15638                            }
15639                            "dnsName" => Ok(__FieldTag::__dns_name),
15640                            "dns_name" => Ok(__FieldTag::__dns_name),
15641                            "primaryDnsName" => Ok(__FieldTag::__primary_dns_name),
15642                            "primary_dns_name" => Ok(__FieldTag::__primary_dns_name),
15643                            "writeEndpoint" => Ok(__FieldTag::__write_endpoint),
15644                            "write_endpoint" => Ok(__FieldTag::__write_endpoint),
15645                            "replicationCluster" => Ok(__FieldTag::__replication_cluster),
15646                            "replication_cluster" => Ok(__FieldTag::__replication_cluster),
15647                            "geminiConfig" => Ok(__FieldTag::__gemini_config),
15648                            "gemini_config" => Ok(__FieldTag::__gemini_config),
15649                            "satisfiesPzi" => Ok(__FieldTag::__satisfies_pzi),
15650                            "satisfies_pzi" => Ok(__FieldTag::__satisfies_pzi),
15651                            "switchTransactionLogsToCloudStorageEnabled" => {
15652                                Ok(__FieldTag::__switch_transaction_logs_to_cloud_storage_enabled)
15653                            }
15654                            "switch_transaction_logs_to_cloud_storage_enabled" => {
15655                                Ok(__FieldTag::__switch_transaction_logs_to_cloud_storage_enabled)
15656                            }
15657                            _ => Ok(__FieldTag::Unknown(value.to_string())),
15658                        }
15659                    }
15660                }
15661                deserializer.deserialize_identifier(Visitor)
15662            }
15663        }
15664        struct Visitor;
15665        impl<'de> serde::de::Visitor<'de> for Visitor {
15666            type Value = DatabaseInstance;
15667            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15668                formatter.write_str("struct DatabaseInstance")
15669            }
15670            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15671            where
15672                A: serde::de::MapAccess<'de>,
15673            {
15674                #[allow(unused_imports)]
15675                use serde::de::Error;
15676                use std::option::Option::Some;
15677                let mut fields = std::collections::HashSet::new();
15678                let mut result = Self::Value::new();
15679                while let Some(tag) = map.next_key::<__FieldTag>()? {
15680                    #[allow(clippy::match_single_binding)]
15681                    match tag {
15682                        __FieldTag::__kind => {
15683                            if !fields.insert(__FieldTag::__kind) {
15684                                return std::result::Result::Err(A::Error::duplicate_field(
15685                                    "multiple values for kind",
15686                                ));
15687                            }
15688                            result.kind = map
15689                                .next_value::<std::option::Option<std::string::String>>()?
15690                                .unwrap_or_default();
15691                        }
15692                        __FieldTag::__state => {
15693                            if !fields.insert(__FieldTag::__state) {
15694                                return std::result::Result::Err(A::Error::duplicate_field(
15695                                    "multiple values for state",
15696                                ));
15697                            }
15698                            result.state = map
15699                                .next_value::<std::option::Option<
15700                                    crate::model::database_instance::SqlInstanceState,
15701                                >>()?
15702                                .unwrap_or_default();
15703                        }
15704                        __FieldTag::__database_version => {
15705                            if !fields.insert(__FieldTag::__database_version) {
15706                                return std::result::Result::Err(A::Error::duplicate_field(
15707                                    "multiple values for database_version",
15708                                ));
15709                            }
15710                            result.database_version = map.next_value::<std::option::Option<crate::model::SqlDatabaseVersion>>()?.unwrap_or_default();
15711                        }
15712                        __FieldTag::__settings => {
15713                            if !fields.insert(__FieldTag::__settings) {
15714                                return std::result::Result::Err(A::Error::duplicate_field(
15715                                    "multiple values for settings",
15716                                ));
15717                            }
15718                            result.settings =
15719                                map.next_value::<std::option::Option<crate::model::Settings>>()?;
15720                        }
15721                        __FieldTag::__etag => {
15722                            if !fields.insert(__FieldTag::__etag) {
15723                                return std::result::Result::Err(A::Error::duplicate_field(
15724                                    "multiple values for etag",
15725                                ));
15726                            }
15727                            result.etag = map
15728                                .next_value::<std::option::Option<std::string::String>>()?
15729                                .unwrap_or_default();
15730                        }
15731                        __FieldTag::__failover_replica => {
15732                            if !fields.insert(__FieldTag::__failover_replica) {
15733                                return std::result::Result::Err(A::Error::duplicate_field(
15734                                    "multiple values for failover_replica",
15735                                ));
15736                            }
15737                            result.failover_replica = map.next_value::<std::option::Option<
15738                                crate::model::database_instance::SqlFailoverReplica,
15739                            >>()?;
15740                        }
15741                        __FieldTag::__master_instance_name => {
15742                            if !fields.insert(__FieldTag::__master_instance_name) {
15743                                return std::result::Result::Err(A::Error::duplicate_field(
15744                                    "multiple values for master_instance_name",
15745                                ));
15746                            }
15747                            result.master_instance_name = map
15748                                .next_value::<std::option::Option<std::string::String>>()?
15749                                .unwrap_or_default();
15750                        }
15751                        __FieldTag::__replica_names => {
15752                            if !fields.insert(__FieldTag::__replica_names) {
15753                                return std::result::Result::Err(A::Error::duplicate_field(
15754                                    "multiple values for replica_names",
15755                                ));
15756                            }
15757                            result.replica_names = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
15758                        }
15759                        __FieldTag::__max_disk_size => {
15760                            if !fields.insert(__FieldTag::__max_disk_size) {
15761                                return std::result::Result::Err(A::Error::duplicate_field(
15762                                    "multiple values for max_disk_size",
15763                                ));
15764                            }
15765                            struct __With(std::option::Option<wkt::Int64Value>);
15766                            impl<'de> serde::de::Deserialize<'de> for __With {
15767                                fn deserialize<D>(
15768                                    deserializer: D,
15769                                ) -> std::result::Result<Self, D::Error>
15770                                where
15771                                    D: serde::de::Deserializer<'de>,
15772                                {
15773                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
15774                                }
15775                            }
15776                            result.max_disk_size = map.next_value::<__With>()?.0;
15777                        }
15778                        __FieldTag::__current_disk_size => {
15779                            if !fields.insert(__FieldTag::__current_disk_size) {
15780                                return std::result::Result::Err(A::Error::duplicate_field(
15781                                    "multiple values for current_disk_size",
15782                                ));
15783                            }
15784                            struct __With(std::option::Option<wkt::Int64Value>);
15785                            impl<'de> serde::de::Deserialize<'de> for __With {
15786                                fn deserialize<D>(
15787                                    deserializer: D,
15788                                ) -> std::result::Result<Self, D::Error>
15789                                where
15790                                    D: serde::de::Deserializer<'de>,
15791                                {
15792                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
15793                                }
15794                            }
15795                            result.current_disk_size = map.next_value::<__With>()?.0;
15796                        }
15797                        __FieldTag::__ip_addresses => {
15798                            if !fields.insert(__FieldTag::__ip_addresses) {
15799                                return std::result::Result::Err(A::Error::duplicate_field(
15800                                    "multiple values for ip_addresses",
15801                                ));
15802                            }
15803                            result.ip_addresses = map.next_value::<std::option::Option<std::vec::Vec<crate::model::IpMapping>>>()?.unwrap_or_default();
15804                        }
15805                        __FieldTag::__server_ca_cert => {
15806                            if !fields.insert(__FieldTag::__server_ca_cert) {
15807                                return std::result::Result::Err(A::Error::duplicate_field(
15808                                    "multiple values for server_ca_cert",
15809                                ));
15810                            }
15811                            result.server_ca_cert =
15812                                map.next_value::<std::option::Option<crate::model::SslCert>>()?;
15813                        }
15814                        __FieldTag::__instance_type => {
15815                            if !fields.insert(__FieldTag::__instance_type) {
15816                                return std::result::Result::Err(A::Error::duplicate_field(
15817                                    "multiple values for instance_type",
15818                                ));
15819                            }
15820                            result.instance_type = map
15821                                .next_value::<std::option::Option<crate::model::SqlInstanceType>>()?
15822                                .unwrap_or_default();
15823                        }
15824                        __FieldTag::__project => {
15825                            if !fields.insert(__FieldTag::__project) {
15826                                return std::result::Result::Err(A::Error::duplicate_field(
15827                                    "multiple values for project",
15828                                ));
15829                            }
15830                            result.project = map
15831                                .next_value::<std::option::Option<std::string::String>>()?
15832                                .unwrap_or_default();
15833                        }
15834                        __FieldTag::__ipv6_address => {
15835                            if !fields.insert(__FieldTag::__ipv6_address) {
15836                                return std::result::Result::Err(A::Error::duplicate_field(
15837                                    "multiple values for ipv6_address",
15838                                ));
15839                            }
15840                            result.ipv6_address = map
15841                                .next_value::<std::option::Option<std::string::String>>()?
15842                                .unwrap_or_default();
15843                        }
15844                        __FieldTag::__service_account_email_address => {
15845                            if !fields.insert(__FieldTag::__service_account_email_address) {
15846                                return std::result::Result::Err(A::Error::duplicate_field(
15847                                    "multiple values for service_account_email_address",
15848                                ));
15849                            }
15850                            result.service_account_email_address = map
15851                                .next_value::<std::option::Option<std::string::String>>()?
15852                                .unwrap_or_default();
15853                        }
15854                        __FieldTag::__on_premises_configuration => {
15855                            if !fields.insert(__FieldTag::__on_premises_configuration) {
15856                                return std::result::Result::Err(A::Error::duplicate_field(
15857                                    "multiple values for on_premises_configuration",
15858                                ));
15859                            }
15860                            result.on_premises_configuration = map.next_value::<std::option::Option<crate::model::OnPremisesConfiguration>>()?
15861                                ;
15862                        }
15863                        __FieldTag::__replica_configuration => {
15864                            if !fields.insert(__FieldTag::__replica_configuration) {
15865                                return std::result::Result::Err(A::Error::duplicate_field(
15866                                    "multiple values for replica_configuration",
15867                                ));
15868                            }
15869                            result.replica_configuration = map.next_value::<std::option::Option<crate::model::ReplicaConfiguration>>()?
15870                                ;
15871                        }
15872                        __FieldTag::__backend_type => {
15873                            if !fields.insert(__FieldTag::__backend_type) {
15874                                return std::result::Result::Err(A::Error::duplicate_field(
15875                                    "multiple values for backend_type",
15876                                ));
15877                            }
15878                            result.backend_type = map
15879                                .next_value::<std::option::Option<crate::model::SqlBackendType>>()?
15880                                .unwrap_or_default();
15881                        }
15882                        __FieldTag::__self_link => {
15883                            if !fields.insert(__FieldTag::__self_link) {
15884                                return std::result::Result::Err(A::Error::duplicate_field(
15885                                    "multiple values for self_link",
15886                                ));
15887                            }
15888                            result.self_link = map
15889                                .next_value::<std::option::Option<std::string::String>>()?
15890                                .unwrap_or_default();
15891                        }
15892                        __FieldTag::__suspension_reason => {
15893                            if !fields.insert(__FieldTag::__suspension_reason) {
15894                                return std::result::Result::Err(A::Error::duplicate_field(
15895                                    "multiple values for suspension_reason",
15896                                ));
15897                            }
15898                            result.suspension_reason = map
15899                                .next_value::<std::option::Option<
15900                                    std::vec::Vec<crate::model::SqlSuspensionReason>,
15901                                >>()?
15902                                .unwrap_or_default();
15903                        }
15904                        __FieldTag::__connection_name => {
15905                            if !fields.insert(__FieldTag::__connection_name) {
15906                                return std::result::Result::Err(A::Error::duplicate_field(
15907                                    "multiple values for connection_name",
15908                                ));
15909                            }
15910                            result.connection_name = map
15911                                .next_value::<std::option::Option<std::string::String>>()?
15912                                .unwrap_or_default();
15913                        }
15914                        __FieldTag::__name => {
15915                            if !fields.insert(__FieldTag::__name) {
15916                                return std::result::Result::Err(A::Error::duplicate_field(
15917                                    "multiple values for name",
15918                                ));
15919                            }
15920                            result.name = map
15921                                .next_value::<std::option::Option<std::string::String>>()?
15922                                .unwrap_or_default();
15923                        }
15924                        __FieldTag::__region => {
15925                            if !fields.insert(__FieldTag::__region) {
15926                                return std::result::Result::Err(A::Error::duplicate_field(
15927                                    "multiple values for region",
15928                                ));
15929                            }
15930                            result.region = map
15931                                .next_value::<std::option::Option<std::string::String>>()?
15932                                .unwrap_or_default();
15933                        }
15934                        __FieldTag::__gce_zone => {
15935                            if !fields.insert(__FieldTag::__gce_zone) {
15936                                return std::result::Result::Err(A::Error::duplicate_field(
15937                                    "multiple values for gce_zone",
15938                                ));
15939                            }
15940                            result.gce_zone = map
15941                                .next_value::<std::option::Option<std::string::String>>()?
15942                                .unwrap_or_default();
15943                        }
15944                        __FieldTag::__secondary_gce_zone => {
15945                            if !fields.insert(__FieldTag::__secondary_gce_zone) {
15946                                return std::result::Result::Err(A::Error::duplicate_field(
15947                                    "multiple values for secondary_gce_zone",
15948                                ));
15949                            }
15950                            result.secondary_gce_zone = map
15951                                .next_value::<std::option::Option<std::string::String>>()?
15952                                .unwrap_or_default();
15953                        }
15954                        __FieldTag::__disk_encryption_configuration => {
15955                            if !fields.insert(__FieldTag::__disk_encryption_configuration) {
15956                                return std::result::Result::Err(A::Error::duplicate_field(
15957                                    "multiple values for disk_encryption_configuration",
15958                                ));
15959                            }
15960                            result.disk_encryption_configuration = map.next_value::<std::option::Option<crate::model::DiskEncryptionConfiguration>>()?
15961                                ;
15962                        }
15963                        __FieldTag::__disk_encryption_status => {
15964                            if !fields.insert(__FieldTag::__disk_encryption_status) {
15965                                return std::result::Result::Err(A::Error::duplicate_field(
15966                                    "multiple values for disk_encryption_status",
15967                                ));
15968                            }
15969                            result.disk_encryption_status = map.next_value::<std::option::Option<crate::model::DiskEncryptionStatus>>()?
15970                                ;
15971                        }
15972                        __FieldTag::__root_password => {
15973                            if !fields.insert(__FieldTag::__root_password) {
15974                                return std::result::Result::Err(A::Error::duplicate_field(
15975                                    "multiple values for root_password",
15976                                ));
15977                            }
15978                            result.root_password = map
15979                                .next_value::<std::option::Option<std::string::String>>()?
15980                                .unwrap_or_default();
15981                        }
15982                        __FieldTag::__scheduled_maintenance => {
15983                            if !fields.insert(__FieldTag::__scheduled_maintenance) {
15984                                return std::result::Result::Err(A::Error::duplicate_field(
15985                                    "multiple values for scheduled_maintenance",
15986                                ));
15987                            }
15988                            result.scheduled_maintenance = map.next_value::<std::option::Option<
15989                                crate::model::database_instance::SqlScheduledMaintenance,
15990                            >>()?;
15991                        }
15992                        __FieldTag::__satisfies_pzs => {
15993                            if !fields.insert(__FieldTag::__satisfies_pzs) {
15994                                return std::result::Result::Err(A::Error::duplicate_field(
15995                                    "multiple values for satisfies_pzs",
15996                                ));
15997                            }
15998                            result.satisfies_pzs =
15999                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
16000                        }
16001                        __FieldTag::__database_installed_version => {
16002                            if !fields.insert(__FieldTag::__database_installed_version) {
16003                                return std::result::Result::Err(A::Error::duplicate_field(
16004                                    "multiple values for database_installed_version",
16005                                ));
16006                            }
16007                            result.database_installed_version = map
16008                                .next_value::<std::option::Option<std::string::String>>()?
16009                                .unwrap_or_default();
16010                        }
16011                        __FieldTag::__out_of_disk_report => {
16012                            if !fields.insert(__FieldTag::__out_of_disk_report) {
16013                                return std::result::Result::Err(A::Error::duplicate_field(
16014                                    "multiple values for out_of_disk_report",
16015                                ));
16016                            }
16017                            result.out_of_disk_report = map.next_value::<std::option::Option<
16018                                crate::model::database_instance::SqlOutOfDiskReport,
16019                            >>()?;
16020                        }
16021                        __FieldTag::__create_time => {
16022                            if !fields.insert(__FieldTag::__create_time) {
16023                                return std::result::Result::Err(A::Error::duplicate_field(
16024                                    "multiple values for create_time",
16025                                ));
16026                            }
16027                            result.create_time =
16028                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
16029                        }
16030                        __FieldTag::__available_maintenance_versions => {
16031                            if !fields.insert(__FieldTag::__available_maintenance_versions) {
16032                                return std::result::Result::Err(A::Error::duplicate_field(
16033                                    "multiple values for available_maintenance_versions",
16034                                ));
16035                            }
16036                            result.available_maintenance_versions = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
16037                        }
16038                        __FieldTag::__maintenance_version => {
16039                            if !fields.insert(__FieldTag::__maintenance_version) {
16040                                return std::result::Result::Err(A::Error::duplicate_field(
16041                                    "multiple values for maintenance_version",
16042                                ));
16043                            }
16044                            result.maintenance_version = map
16045                                .next_value::<std::option::Option<std::string::String>>()?
16046                                .unwrap_or_default();
16047                        }
16048                        __FieldTag::__upgradable_database_versions => {
16049                            if !fields.insert(__FieldTag::__upgradable_database_versions) {
16050                                return std::result::Result::Err(A::Error::duplicate_field(
16051                                    "multiple values for upgradable_database_versions",
16052                                ));
16053                            }
16054                            result.upgradable_database_versions = map
16055                                .next_value::<std::option::Option<
16056                                    std::vec::Vec<crate::model::AvailableDatabaseVersion>,
16057                                >>()?
16058                                .unwrap_or_default();
16059                        }
16060                        __FieldTag::__sql_network_architecture => {
16061                            if !fields.insert(__FieldTag::__sql_network_architecture) {
16062                                return std::result::Result::Err(A::Error::duplicate_field(
16063                                    "multiple values for sql_network_architecture",
16064                                ));
16065                            }
16066                            result.sql_network_architecture = map
16067                                .next_value::<std::option::Option<
16068                                    crate::model::database_instance::SqlNetworkArchitecture,
16069                                >>()?;
16070                        }
16071                        __FieldTag::__psc_service_attachment_link => {
16072                            if !fields.insert(__FieldTag::__psc_service_attachment_link) {
16073                                return std::result::Result::Err(A::Error::duplicate_field(
16074                                    "multiple values for psc_service_attachment_link",
16075                                ));
16076                            }
16077                            result.psc_service_attachment_link =
16078                                map.next_value::<std::option::Option<std::string::String>>()?;
16079                        }
16080                        __FieldTag::__dns_name => {
16081                            if !fields.insert(__FieldTag::__dns_name) {
16082                                return std::result::Result::Err(A::Error::duplicate_field(
16083                                    "multiple values for dns_name",
16084                                ));
16085                            }
16086                            result.dns_name =
16087                                map.next_value::<std::option::Option<std::string::String>>()?;
16088                        }
16089                        __FieldTag::__primary_dns_name => {
16090                            if !fields.insert(__FieldTag::__primary_dns_name) {
16091                                return std::result::Result::Err(A::Error::duplicate_field(
16092                                    "multiple values for primary_dns_name",
16093                                ));
16094                            }
16095                            result.primary_dns_name =
16096                                map.next_value::<std::option::Option<std::string::String>>()?;
16097                        }
16098                        __FieldTag::__write_endpoint => {
16099                            if !fields.insert(__FieldTag::__write_endpoint) {
16100                                return std::result::Result::Err(A::Error::duplicate_field(
16101                                    "multiple values for write_endpoint",
16102                                ));
16103                            }
16104                            result.write_endpoint =
16105                                map.next_value::<std::option::Option<std::string::String>>()?;
16106                        }
16107                        __FieldTag::__replication_cluster => {
16108                            if !fields.insert(__FieldTag::__replication_cluster) {
16109                                return std::result::Result::Err(A::Error::duplicate_field(
16110                                    "multiple values for replication_cluster",
16111                                ));
16112                            }
16113                            result.replication_cluster = map.next_value::<std::option::Option<crate::model::ReplicationCluster>>()?
16114                                ;
16115                        }
16116                        __FieldTag::__gemini_config => {
16117                            if !fields.insert(__FieldTag::__gemini_config) {
16118                                return std::result::Result::Err(A::Error::duplicate_field(
16119                                    "multiple values for gemini_config",
16120                                ));
16121                            }
16122                            result.gemini_config = map.next_value::<std::option::Option<crate::model::GeminiInstanceConfig>>()?
16123                                ;
16124                        }
16125                        __FieldTag::__satisfies_pzi => {
16126                            if !fields.insert(__FieldTag::__satisfies_pzi) {
16127                                return std::result::Result::Err(A::Error::duplicate_field(
16128                                    "multiple values for satisfies_pzi",
16129                                ));
16130                            }
16131                            result.satisfies_pzi =
16132                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
16133                        }
16134                        __FieldTag::__switch_transaction_logs_to_cloud_storage_enabled => {
16135                            if !fields.insert(
16136                                __FieldTag::__switch_transaction_logs_to_cloud_storage_enabled,
16137                            ) {
16138                                return std::result::Result::Err(A::Error::duplicate_field(
16139                                    "multiple values for switch_transaction_logs_to_cloud_storage_enabled",
16140                                ));
16141                            }
16142                            result.switch_transaction_logs_to_cloud_storage_enabled =
16143                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
16144                        }
16145                        __FieldTag::Unknown(key) => {
16146                            let value = map.next_value::<serde_json::Value>()?;
16147                            result._unknown_fields.insert(key, value);
16148                        }
16149                    }
16150                }
16151                std::result::Result::Ok(result)
16152            }
16153        }
16154        deserializer.deserialize_any(Visitor)
16155    }
16156}
16157
16158#[doc(hidden)]
16159impl serde::ser::Serialize for DatabaseInstance {
16160    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16161    where
16162        S: serde::ser::Serializer,
16163    {
16164        use serde::ser::SerializeMap;
16165        #[allow(unused_imports)]
16166        use std::option::Option::Some;
16167        let mut state = serializer.serialize_map(std::option::Option::None)?;
16168        if !self.kind.is_empty() {
16169            state.serialize_entry("kind", &self.kind)?;
16170        }
16171        if !wkt::internal::is_default(&self.state) {
16172            state.serialize_entry("state", &self.state)?;
16173        }
16174        if !wkt::internal::is_default(&self.database_version) {
16175            state.serialize_entry("databaseVersion", &self.database_version)?;
16176        }
16177        if self.settings.is_some() {
16178            state.serialize_entry("settings", &self.settings)?;
16179        }
16180        if !self.etag.is_empty() {
16181            state.serialize_entry("etag", &self.etag)?;
16182        }
16183        if self.failover_replica.is_some() {
16184            state.serialize_entry("failoverReplica", &self.failover_replica)?;
16185        }
16186        if !self.master_instance_name.is_empty() {
16187            state.serialize_entry("masterInstanceName", &self.master_instance_name)?;
16188        }
16189        if !self.replica_names.is_empty() {
16190            state.serialize_entry("replicaNames", &self.replica_names)?;
16191        }
16192        if self.max_disk_size.is_some() {
16193            struct __With<'a>(&'a std::option::Option<wkt::Int64Value>);
16194            impl<'a> serde::ser::Serialize for __With<'a> {
16195                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16196                where
16197                    S: serde::ser::Serializer,
16198                {
16199                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
16200                        self.0, serializer,
16201                    )
16202                }
16203            }
16204            state.serialize_entry("maxDiskSize", &__With(&self.max_disk_size))?;
16205        }
16206        if self.current_disk_size.is_some() {
16207            struct __With<'a>(&'a std::option::Option<wkt::Int64Value>);
16208            impl<'a> serde::ser::Serialize for __With<'a> {
16209                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16210                where
16211                    S: serde::ser::Serializer,
16212                {
16213                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
16214                        self.0, serializer,
16215                    )
16216                }
16217            }
16218            state.serialize_entry("currentDiskSize", &__With(&self.current_disk_size))?;
16219        }
16220        if !self.ip_addresses.is_empty() {
16221            state.serialize_entry("ipAddresses", &self.ip_addresses)?;
16222        }
16223        if self.server_ca_cert.is_some() {
16224            state.serialize_entry("serverCaCert", &self.server_ca_cert)?;
16225        }
16226        if !wkt::internal::is_default(&self.instance_type) {
16227            state.serialize_entry("instanceType", &self.instance_type)?;
16228        }
16229        if !self.project.is_empty() {
16230            state.serialize_entry("project", &self.project)?;
16231        }
16232        if !self.ipv6_address.is_empty() {
16233            state.serialize_entry("ipv6Address", &self.ipv6_address)?;
16234        }
16235        if !self.service_account_email_address.is_empty() {
16236            state.serialize_entry(
16237                "serviceAccountEmailAddress",
16238                &self.service_account_email_address,
16239            )?;
16240        }
16241        if self.on_premises_configuration.is_some() {
16242            state.serialize_entry("onPremisesConfiguration", &self.on_premises_configuration)?;
16243        }
16244        if self.replica_configuration.is_some() {
16245            state.serialize_entry("replicaConfiguration", &self.replica_configuration)?;
16246        }
16247        if !wkt::internal::is_default(&self.backend_type) {
16248            state.serialize_entry("backendType", &self.backend_type)?;
16249        }
16250        if !self.self_link.is_empty() {
16251            state.serialize_entry("selfLink", &self.self_link)?;
16252        }
16253        if !self.suspension_reason.is_empty() {
16254            state.serialize_entry("suspensionReason", &self.suspension_reason)?;
16255        }
16256        if !self.connection_name.is_empty() {
16257            state.serialize_entry("connectionName", &self.connection_name)?;
16258        }
16259        if !self.name.is_empty() {
16260            state.serialize_entry("name", &self.name)?;
16261        }
16262        if !self.region.is_empty() {
16263            state.serialize_entry("region", &self.region)?;
16264        }
16265        if !self.gce_zone.is_empty() {
16266            state.serialize_entry("gceZone", &self.gce_zone)?;
16267        }
16268        if !self.secondary_gce_zone.is_empty() {
16269            state.serialize_entry("secondaryGceZone", &self.secondary_gce_zone)?;
16270        }
16271        if self.disk_encryption_configuration.is_some() {
16272            state.serialize_entry(
16273                "diskEncryptionConfiguration",
16274                &self.disk_encryption_configuration,
16275            )?;
16276        }
16277        if self.disk_encryption_status.is_some() {
16278            state.serialize_entry("diskEncryptionStatus", &self.disk_encryption_status)?;
16279        }
16280        if !self.root_password.is_empty() {
16281            state.serialize_entry("rootPassword", &self.root_password)?;
16282        }
16283        if self.scheduled_maintenance.is_some() {
16284            state.serialize_entry("scheduledMaintenance", &self.scheduled_maintenance)?;
16285        }
16286        if self.satisfies_pzs.is_some() {
16287            state.serialize_entry("satisfiesPzs", &self.satisfies_pzs)?;
16288        }
16289        if !self.database_installed_version.is_empty() {
16290            state.serialize_entry("databaseInstalledVersion", &self.database_installed_version)?;
16291        }
16292        if self.out_of_disk_report.is_some() {
16293            state.serialize_entry("outOfDiskReport", &self.out_of_disk_report)?;
16294        }
16295        if self.create_time.is_some() {
16296            state.serialize_entry("createTime", &self.create_time)?;
16297        }
16298        if !self.available_maintenance_versions.is_empty() {
16299            state.serialize_entry(
16300                "availableMaintenanceVersions",
16301                &self.available_maintenance_versions,
16302            )?;
16303        }
16304        if !self.maintenance_version.is_empty() {
16305            state.serialize_entry("maintenanceVersion", &self.maintenance_version)?;
16306        }
16307        if !self.upgradable_database_versions.is_empty() {
16308            state.serialize_entry(
16309                "upgradableDatabaseVersions",
16310                &self.upgradable_database_versions,
16311            )?;
16312        }
16313        if self.sql_network_architecture.is_some() {
16314            state.serialize_entry("sqlNetworkArchitecture", &self.sql_network_architecture)?;
16315        }
16316        if self.psc_service_attachment_link.is_some() {
16317            state.serialize_entry(
16318                "pscServiceAttachmentLink",
16319                &self.psc_service_attachment_link,
16320            )?;
16321        }
16322        if self.dns_name.is_some() {
16323            state.serialize_entry("dnsName", &self.dns_name)?;
16324        }
16325        if self.primary_dns_name.is_some() {
16326            state.serialize_entry("primaryDnsName", &self.primary_dns_name)?;
16327        }
16328        if self.write_endpoint.is_some() {
16329            state.serialize_entry("writeEndpoint", &self.write_endpoint)?;
16330        }
16331        if self.replication_cluster.is_some() {
16332            state.serialize_entry("replicationCluster", &self.replication_cluster)?;
16333        }
16334        if self.gemini_config.is_some() {
16335            state.serialize_entry("geminiConfig", &self.gemini_config)?;
16336        }
16337        if self.satisfies_pzi.is_some() {
16338            state.serialize_entry("satisfiesPzi", &self.satisfies_pzi)?;
16339        }
16340        if self
16341            .switch_transaction_logs_to_cloud_storage_enabled
16342            .is_some()
16343        {
16344            state.serialize_entry(
16345                "switchTransactionLogsToCloudStorageEnabled",
16346                &self.switch_transaction_logs_to_cloud_storage_enabled,
16347            )?;
16348        }
16349        if !self._unknown_fields.is_empty() {
16350            for (key, value) in self._unknown_fields.iter() {
16351                state.serialize_entry(key, &value)?;
16352            }
16353        }
16354        state.end()
16355    }
16356}
16357
16358/// Defines additional types related to [DatabaseInstance].
16359pub mod database_instance {
16360    #[allow(unused_imports)]
16361    use super::*;
16362
16363    #[derive(Clone, Debug, Default, PartialEq)]
16364    #[non_exhaustive]
16365    pub struct SqlFailoverReplica {
16366        /// The name of the failover replica. If specified at instance creation, a
16367        /// failover replica is created for the instance. The name
16368        /// doesn't include the project ID.
16369        pub name: std::string::String,
16370
16371        /// The availability status of the failover replica. A false status indicates
16372        /// that the failover replica is out of sync. The primary instance can only
16373        /// failover to the failover replica when the status is true.
16374        pub available: std::option::Option<wkt::BoolValue>,
16375
16376        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16377    }
16378
16379    impl SqlFailoverReplica {
16380        pub fn new() -> Self {
16381            std::default::Default::default()
16382        }
16383
16384        /// Sets the value of [name][crate::model::database_instance::SqlFailoverReplica::name].
16385        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16386            self.name = v.into();
16387            self
16388        }
16389
16390        /// Sets the value of [available][crate::model::database_instance::SqlFailoverReplica::available].
16391        pub fn set_available<T>(mut self, v: T) -> Self
16392        where
16393            T: std::convert::Into<wkt::BoolValue>,
16394        {
16395            self.available = std::option::Option::Some(v.into());
16396            self
16397        }
16398
16399        /// Sets or clears the value of [available][crate::model::database_instance::SqlFailoverReplica::available].
16400        pub fn set_or_clear_available<T>(mut self, v: std::option::Option<T>) -> Self
16401        where
16402            T: std::convert::Into<wkt::BoolValue>,
16403        {
16404            self.available = v.map(|x| x.into());
16405            self
16406        }
16407    }
16408
16409    impl wkt::message::Message for SqlFailoverReplica {
16410        fn typename() -> &'static str {
16411            "type.googleapis.com/google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica"
16412        }
16413    }
16414
16415    #[doc(hidden)]
16416    impl<'de> serde::de::Deserialize<'de> for SqlFailoverReplica {
16417        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16418        where
16419            D: serde::Deserializer<'de>,
16420        {
16421            #[allow(non_camel_case_types)]
16422            #[doc(hidden)]
16423            #[derive(PartialEq, Eq, Hash)]
16424            enum __FieldTag {
16425                __name,
16426                __available,
16427                Unknown(std::string::String),
16428            }
16429            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16430                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16431                where
16432                    D: serde::Deserializer<'de>,
16433                {
16434                    struct Visitor;
16435                    impl<'de> serde::de::Visitor<'de> for Visitor {
16436                        type Value = __FieldTag;
16437                        fn expecting(
16438                            &self,
16439                            formatter: &mut std::fmt::Formatter,
16440                        ) -> std::fmt::Result {
16441                            formatter.write_str("a field name for SqlFailoverReplica")
16442                        }
16443                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16444                        where
16445                            E: serde::de::Error,
16446                        {
16447                            use std::result::Result::Ok;
16448                            use std::string::ToString;
16449                            match value {
16450                                "name" => Ok(__FieldTag::__name),
16451                                "available" => Ok(__FieldTag::__available),
16452                                _ => Ok(__FieldTag::Unknown(value.to_string())),
16453                            }
16454                        }
16455                    }
16456                    deserializer.deserialize_identifier(Visitor)
16457                }
16458            }
16459            struct Visitor;
16460            impl<'de> serde::de::Visitor<'de> for Visitor {
16461                type Value = SqlFailoverReplica;
16462                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16463                    formatter.write_str("struct SqlFailoverReplica")
16464                }
16465                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16466                where
16467                    A: serde::de::MapAccess<'de>,
16468                {
16469                    #[allow(unused_imports)]
16470                    use serde::de::Error;
16471                    use std::option::Option::Some;
16472                    let mut fields = std::collections::HashSet::new();
16473                    let mut result = Self::Value::new();
16474                    while let Some(tag) = map.next_key::<__FieldTag>()? {
16475                        #[allow(clippy::match_single_binding)]
16476                        match tag {
16477                            __FieldTag::__name => {
16478                                if !fields.insert(__FieldTag::__name) {
16479                                    return std::result::Result::Err(A::Error::duplicate_field(
16480                                        "multiple values for name",
16481                                    ));
16482                                }
16483                                result.name = map
16484                                    .next_value::<std::option::Option<std::string::String>>()?
16485                                    .unwrap_or_default();
16486                            }
16487                            __FieldTag::__available => {
16488                                if !fields.insert(__FieldTag::__available) {
16489                                    return std::result::Result::Err(A::Error::duplicate_field(
16490                                        "multiple values for available",
16491                                    ));
16492                                }
16493                                result.available =
16494                                    map.next_value::<std::option::Option<wkt::BoolValue>>()?;
16495                            }
16496                            __FieldTag::Unknown(key) => {
16497                                let value = map.next_value::<serde_json::Value>()?;
16498                                result._unknown_fields.insert(key, value);
16499                            }
16500                        }
16501                    }
16502                    std::result::Result::Ok(result)
16503                }
16504            }
16505            deserializer.deserialize_any(Visitor)
16506        }
16507    }
16508
16509    #[doc(hidden)]
16510    impl serde::ser::Serialize for SqlFailoverReplica {
16511        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16512        where
16513            S: serde::ser::Serializer,
16514        {
16515            use serde::ser::SerializeMap;
16516            #[allow(unused_imports)]
16517            use std::option::Option::Some;
16518            let mut state = serializer.serialize_map(std::option::Option::None)?;
16519            if !self.name.is_empty() {
16520                state.serialize_entry("name", &self.name)?;
16521            }
16522            if self.available.is_some() {
16523                state.serialize_entry("available", &self.available)?;
16524            }
16525            if !self._unknown_fields.is_empty() {
16526                for (key, value) in self._unknown_fields.iter() {
16527                    state.serialize_entry(key, &value)?;
16528                }
16529            }
16530            state.end()
16531        }
16532    }
16533
16534    /// Any scheduled maintenance for this instance.
16535    #[derive(Clone, Debug, Default, PartialEq)]
16536    #[non_exhaustive]
16537    pub struct SqlScheduledMaintenance {
16538        /// The start time of any upcoming scheduled maintenance for this instance.
16539        pub start_time: std::option::Option<wkt::Timestamp>,
16540
16541        #[deprecated]
16542        pub can_defer: bool,
16543
16544        /// If the scheduled maintenance can be rescheduled.
16545        pub can_reschedule: bool,
16546
16547        /// Maintenance cannot be rescheduled to start beyond this deadline.
16548        pub schedule_deadline_time: std::option::Option<wkt::Timestamp>,
16549
16550        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16551    }
16552
16553    impl SqlScheduledMaintenance {
16554        pub fn new() -> Self {
16555            std::default::Default::default()
16556        }
16557
16558        /// Sets the value of [start_time][crate::model::database_instance::SqlScheduledMaintenance::start_time].
16559        pub fn set_start_time<T>(mut self, v: T) -> Self
16560        where
16561            T: std::convert::Into<wkt::Timestamp>,
16562        {
16563            self.start_time = std::option::Option::Some(v.into());
16564            self
16565        }
16566
16567        /// Sets or clears the value of [start_time][crate::model::database_instance::SqlScheduledMaintenance::start_time].
16568        pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
16569        where
16570            T: std::convert::Into<wkt::Timestamp>,
16571        {
16572            self.start_time = v.map(|x| x.into());
16573            self
16574        }
16575
16576        /// Sets the value of [can_defer][crate::model::database_instance::SqlScheduledMaintenance::can_defer].
16577        #[deprecated]
16578        pub fn set_can_defer<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16579            self.can_defer = v.into();
16580            self
16581        }
16582
16583        /// Sets the value of [can_reschedule][crate::model::database_instance::SqlScheduledMaintenance::can_reschedule].
16584        pub fn set_can_reschedule<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16585            self.can_reschedule = v.into();
16586            self
16587        }
16588
16589        /// Sets the value of [schedule_deadline_time][crate::model::database_instance::SqlScheduledMaintenance::schedule_deadline_time].
16590        pub fn set_schedule_deadline_time<T>(mut self, v: T) -> Self
16591        where
16592            T: std::convert::Into<wkt::Timestamp>,
16593        {
16594            self.schedule_deadline_time = std::option::Option::Some(v.into());
16595            self
16596        }
16597
16598        /// Sets or clears the value of [schedule_deadline_time][crate::model::database_instance::SqlScheduledMaintenance::schedule_deadline_time].
16599        pub fn set_or_clear_schedule_deadline_time<T>(mut self, v: std::option::Option<T>) -> Self
16600        where
16601            T: std::convert::Into<wkt::Timestamp>,
16602        {
16603            self.schedule_deadline_time = v.map(|x| x.into());
16604            self
16605        }
16606    }
16607
16608    impl wkt::message::Message for SqlScheduledMaintenance {
16609        fn typename() -> &'static str {
16610            "type.googleapis.com/google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance"
16611        }
16612    }
16613
16614    #[doc(hidden)]
16615    impl<'de> serde::de::Deserialize<'de> for SqlScheduledMaintenance {
16616        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16617        where
16618            D: serde::Deserializer<'de>,
16619        {
16620            #[allow(non_camel_case_types)]
16621            #[doc(hidden)]
16622            #[derive(PartialEq, Eq, Hash)]
16623            enum __FieldTag {
16624                __start_time,
16625                __can_defer,
16626                __can_reschedule,
16627                __schedule_deadline_time,
16628                Unknown(std::string::String),
16629            }
16630            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16631                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16632                where
16633                    D: serde::Deserializer<'de>,
16634                {
16635                    struct Visitor;
16636                    impl<'de> serde::de::Visitor<'de> for Visitor {
16637                        type Value = __FieldTag;
16638                        fn expecting(
16639                            &self,
16640                            formatter: &mut std::fmt::Formatter,
16641                        ) -> std::fmt::Result {
16642                            formatter.write_str("a field name for SqlScheduledMaintenance")
16643                        }
16644                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16645                        where
16646                            E: serde::de::Error,
16647                        {
16648                            use std::result::Result::Ok;
16649                            use std::string::ToString;
16650                            match value {
16651                                "startTime" => Ok(__FieldTag::__start_time),
16652                                "start_time" => Ok(__FieldTag::__start_time),
16653                                "canDefer" => Ok(__FieldTag::__can_defer),
16654                                "can_defer" => Ok(__FieldTag::__can_defer),
16655                                "canReschedule" => Ok(__FieldTag::__can_reschedule),
16656                                "can_reschedule" => Ok(__FieldTag::__can_reschedule),
16657                                "scheduleDeadlineTime" => Ok(__FieldTag::__schedule_deadline_time),
16658                                "schedule_deadline_time" => {
16659                                    Ok(__FieldTag::__schedule_deadline_time)
16660                                }
16661                                _ => Ok(__FieldTag::Unknown(value.to_string())),
16662                            }
16663                        }
16664                    }
16665                    deserializer.deserialize_identifier(Visitor)
16666                }
16667            }
16668            struct Visitor;
16669            impl<'de> serde::de::Visitor<'de> for Visitor {
16670                type Value = SqlScheduledMaintenance;
16671                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16672                    formatter.write_str("struct SqlScheduledMaintenance")
16673                }
16674                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16675                where
16676                    A: serde::de::MapAccess<'de>,
16677                {
16678                    #[allow(unused_imports)]
16679                    use serde::de::Error;
16680                    use std::option::Option::Some;
16681                    let mut fields = std::collections::HashSet::new();
16682                    let mut result = Self::Value::new();
16683                    while let Some(tag) = map.next_key::<__FieldTag>()? {
16684                        #[allow(clippy::match_single_binding)]
16685                        match tag {
16686                            __FieldTag::__start_time => {
16687                                if !fields.insert(__FieldTag::__start_time) {
16688                                    return std::result::Result::Err(A::Error::duplicate_field(
16689                                        "multiple values for start_time",
16690                                    ));
16691                                }
16692                                result.start_time =
16693                                    map.next_value::<std::option::Option<wkt::Timestamp>>()?;
16694                            }
16695                            __FieldTag::__can_defer => {
16696                                if !fields.insert(__FieldTag::__can_defer) {
16697                                    return std::result::Result::Err(A::Error::duplicate_field(
16698                                        "multiple values for can_defer",
16699                                    ));
16700                                }
16701                                result.can_defer = map
16702                                    .next_value::<std::option::Option<bool>>()?
16703                                    .unwrap_or_default();
16704                            }
16705                            __FieldTag::__can_reschedule => {
16706                                if !fields.insert(__FieldTag::__can_reschedule) {
16707                                    return std::result::Result::Err(A::Error::duplicate_field(
16708                                        "multiple values for can_reschedule",
16709                                    ));
16710                                }
16711                                result.can_reschedule = map
16712                                    .next_value::<std::option::Option<bool>>()?
16713                                    .unwrap_or_default();
16714                            }
16715                            __FieldTag::__schedule_deadline_time => {
16716                                if !fields.insert(__FieldTag::__schedule_deadline_time) {
16717                                    return std::result::Result::Err(A::Error::duplicate_field(
16718                                        "multiple values for schedule_deadline_time",
16719                                    ));
16720                                }
16721                                result.schedule_deadline_time =
16722                                    map.next_value::<std::option::Option<wkt::Timestamp>>()?;
16723                            }
16724                            __FieldTag::Unknown(key) => {
16725                                let value = map.next_value::<serde_json::Value>()?;
16726                                result._unknown_fields.insert(key, value);
16727                            }
16728                        }
16729                    }
16730                    std::result::Result::Ok(result)
16731                }
16732            }
16733            deserializer.deserialize_any(Visitor)
16734        }
16735    }
16736
16737    #[doc(hidden)]
16738    impl serde::ser::Serialize for SqlScheduledMaintenance {
16739        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16740        where
16741            S: serde::ser::Serializer,
16742        {
16743            use serde::ser::SerializeMap;
16744            #[allow(unused_imports)]
16745            use std::option::Option::Some;
16746            let mut state = serializer.serialize_map(std::option::Option::None)?;
16747            if self.start_time.is_some() {
16748                state.serialize_entry("startTime", &self.start_time)?;
16749            }
16750            if !wkt::internal::is_default(&self.can_defer) {
16751                state.serialize_entry("canDefer", &self.can_defer)?;
16752            }
16753            if !wkt::internal::is_default(&self.can_reschedule) {
16754                state.serialize_entry("canReschedule", &self.can_reschedule)?;
16755            }
16756            if self.schedule_deadline_time.is_some() {
16757                state.serialize_entry("scheduleDeadlineTime", &self.schedule_deadline_time)?;
16758            }
16759            if !self._unknown_fields.is_empty() {
16760                for (key, value) in self._unknown_fields.iter() {
16761                    state.serialize_entry(key, &value)?;
16762                }
16763            }
16764            state.end()
16765        }
16766    }
16767
16768    /// This message wraps up the information written by out-of-disk detection job.
16769    #[derive(Clone, Debug, Default, PartialEq)]
16770    #[non_exhaustive]
16771    pub struct SqlOutOfDiskReport {
16772        /// This field represents the state generated by the proactive database
16773        /// wellness job for OutOfDisk issues.
16774        ///
16775        /// * Writers:
16776        /// * the proactive database wellness job for OOD.
16777        /// * Readers:
16778        /// * the proactive database wellness job
16779        pub sql_out_of_disk_state: std::option::Option<
16780            crate::model::database_instance::sql_out_of_disk_report::SqlOutOfDiskState,
16781        >,
16782
16783        /// The minimum recommended increase size in GigaBytes
16784        /// This field is consumed by the frontend
16785        ///
16786        /// * Writers:
16787        /// * the proactive database wellness job for OOD.
16788        /// * Readers:
16789        pub sql_min_recommended_increase_size_gb: std::option::Option<i32>,
16790
16791        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16792    }
16793
16794    impl SqlOutOfDiskReport {
16795        pub fn new() -> Self {
16796            std::default::Default::default()
16797        }
16798
16799        /// Sets the value of [sql_out_of_disk_state][crate::model::database_instance::SqlOutOfDiskReport::sql_out_of_disk_state].
16800        pub fn set_sql_out_of_disk_state<T>(mut self, v: T) -> Self
16801        where
16802            T: std::convert::Into<
16803                    crate::model::database_instance::sql_out_of_disk_report::SqlOutOfDiskState,
16804                >,
16805        {
16806            self.sql_out_of_disk_state = std::option::Option::Some(v.into());
16807            self
16808        }
16809
16810        /// Sets or clears the value of [sql_out_of_disk_state][crate::model::database_instance::SqlOutOfDiskReport::sql_out_of_disk_state].
16811        pub fn set_or_clear_sql_out_of_disk_state<T>(mut self, v: std::option::Option<T>) -> Self
16812        where
16813            T: std::convert::Into<
16814                    crate::model::database_instance::sql_out_of_disk_report::SqlOutOfDiskState,
16815                >,
16816        {
16817            self.sql_out_of_disk_state = v.map(|x| x.into());
16818            self
16819        }
16820
16821        /// Sets the value of [sql_min_recommended_increase_size_gb][crate::model::database_instance::SqlOutOfDiskReport::sql_min_recommended_increase_size_gb].
16822        pub fn set_sql_min_recommended_increase_size_gb<T>(mut self, v: T) -> Self
16823        where
16824            T: std::convert::Into<i32>,
16825        {
16826            self.sql_min_recommended_increase_size_gb = std::option::Option::Some(v.into());
16827            self
16828        }
16829
16830        /// Sets or clears the value of [sql_min_recommended_increase_size_gb][crate::model::database_instance::SqlOutOfDiskReport::sql_min_recommended_increase_size_gb].
16831        pub fn set_or_clear_sql_min_recommended_increase_size_gb<T>(
16832            mut self,
16833            v: std::option::Option<T>,
16834        ) -> Self
16835        where
16836            T: std::convert::Into<i32>,
16837        {
16838            self.sql_min_recommended_increase_size_gb = v.map(|x| x.into());
16839            self
16840        }
16841    }
16842
16843    impl wkt::message::Message for SqlOutOfDiskReport {
16844        fn typename() -> &'static str {
16845            "type.googleapis.com/google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport"
16846        }
16847    }
16848
16849    #[doc(hidden)]
16850    impl<'de> serde::de::Deserialize<'de> for SqlOutOfDiskReport {
16851        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16852        where
16853            D: serde::Deserializer<'de>,
16854        {
16855            #[allow(non_camel_case_types)]
16856            #[doc(hidden)]
16857            #[derive(PartialEq, Eq, Hash)]
16858            enum __FieldTag {
16859                __sql_out_of_disk_state,
16860                __sql_min_recommended_increase_size_gb,
16861                Unknown(std::string::String),
16862            }
16863            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16864                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16865                where
16866                    D: serde::Deserializer<'de>,
16867                {
16868                    struct Visitor;
16869                    impl<'de> serde::de::Visitor<'de> for Visitor {
16870                        type Value = __FieldTag;
16871                        fn expecting(
16872                            &self,
16873                            formatter: &mut std::fmt::Formatter,
16874                        ) -> std::fmt::Result {
16875                            formatter.write_str("a field name for SqlOutOfDiskReport")
16876                        }
16877                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16878                        where
16879                            E: serde::de::Error,
16880                        {
16881                            use std::result::Result::Ok;
16882                            use std::string::ToString;
16883                            match value {
16884                                "sqlOutOfDiskState" => Ok(__FieldTag::__sql_out_of_disk_state),
16885                                "sql_out_of_disk_state" => Ok(__FieldTag::__sql_out_of_disk_state),
16886                                "sqlMinRecommendedIncreaseSizeGb" => {
16887                                    Ok(__FieldTag::__sql_min_recommended_increase_size_gb)
16888                                }
16889                                "sql_min_recommended_increase_size_gb" => {
16890                                    Ok(__FieldTag::__sql_min_recommended_increase_size_gb)
16891                                }
16892                                _ => Ok(__FieldTag::Unknown(value.to_string())),
16893                            }
16894                        }
16895                    }
16896                    deserializer.deserialize_identifier(Visitor)
16897                }
16898            }
16899            struct Visitor;
16900            impl<'de> serde::de::Visitor<'de> for Visitor {
16901                type Value = SqlOutOfDiskReport;
16902                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16903                    formatter.write_str("struct SqlOutOfDiskReport")
16904                }
16905                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16906                where
16907                    A: serde::de::MapAccess<'de>,
16908                {
16909                    #[allow(unused_imports)]
16910                    use serde::de::Error;
16911                    use std::option::Option::Some;
16912                    let mut fields = std::collections::HashSet::new();
16913                    let mut result = Self::Value::new();
16914                    while let Some(tag) = map.next_key::<__FieldTag>()? {
16915                        #[allow(clippy::match_single_binding)]
16916                        match tag {
16917                            __FieldTag::__sql_out_of_disk_state => {
16918                                if !fields.insert(__FieldTag::__sql_out_of_disk_state) {
16919                                    return std::result::Result::Err(A::Error::duplicate_field(
16920                                        "multiple values for sql_out_of_disk_state",
16921                                    ));
16922                                }
16923                                result.sql_out_of_disk_state = map.next_value::<std::option::Option<crate::model::database_instance::sql_out_of_disk_report::SqlOutOfDiskState>>()?
16924                                    ;
16925                            }
16926                            __FieldTag::__sql_min_recommended_increase_size_gb => {
16927                                if !fields
16928                                    .insert(__FieldTag::__sql_min_recommended_increase_size_gb)
16929                                {
16930                                    return std::result::Result::Err(A::Error::duplicate_field(
16931                                        "multiple values for sql_min_recommended_increase_size_gb",
16932                                    ));
16933                                }
16934                                struct __With(std::option::Option<i32>);
16935                                impl<'de> serde::de::Deserialize<'de> for __With {
16936                                    fn deserialize<D>(
16937                                        deserializer: D,
16938                                    ) -> std::result::Result<Self, D::Error>
16939                                    where
16940                                        D: serde::de::Deserializer<'de>,
16941                                    {
16942                                        serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
16943                                    }
16944                                }
16945                                result.sql_min_recommended_increase_size_gb =
16946                                    map.next_value::<__With>()?.0;
16947                            }
16948                            __FieldTag::Unknown(key) => {
16949                                let value = map.next_value::<serde_json::Value>()?;
16950                                result._unknown_fields.insert(key, value);
16951                            }
16952                        }
16953                    }
16954                    std::result::Result::Ok(result)
16955                }
16956            }
16957            deserializer.deserialize_any(Visitor)
16958        }
16959    }
16960
16961    #[doc(hidden)]
16962    impl serde::ser::Serialize for SqlOutOfDiskReport {
16963        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16964        where
16965            S: serde::ser::Serializer,
16966        {
16967            use serde::ser::SerializeMap;
16968            #[allow(unused_imports)]
16969            use std::option::Option::Some;
16970            let mut state = serializer.serialize_map(std::option::Option::None)?;
16971            if self.sql_out_of_disk_state.is_some() {
16972                state.serialize_entry("sqlOutOfDiskState", &self.sql_out_of_disk_state)?;
16973            }
16974            if self.sql_min_recommended_increase_size_gb.is_some() {
16975                struct __With<'a>(&'a std::option::Option<i32>);
16976                impl<'a> serde::ser::Serialize for __With<'a> {
16977                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16978                    where
16979                        S: serde::ser::Serializer,
16980                    {
16981                        serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
16982                            self.0, serializer,
16983                        )
16984                    }
16985                }
16986                state.serialize_entry(
16987                    "sqlMinRecommendedIncreaseSizeGb",
16988                    &__With(&self.sql_min_recommended_increase_size_gb),
16989                )?;
16990            }
16991            if !self._unknown_fields.is_empty() {
16992                for (key, value) in self._unknown_fields.iter() {
16993                    state.serialize_entry(key, &value)?;
16994                }
16995            }
16996            state.end()
16997        }
16998    }
16999
17000    /// Defines additional types related to [SqlOutOfDiskReport].
17001    pub mod sql_out_of_disk_report {
17002        #[allow(unused_imports)]
17003        use super::*;
17004
17005        /// This enum lists all possible states regarding out-of-disk issues.
17006        ///
17007        /// # Working with unknown values
17008        ///
17009        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17010        /// additional enum variants at any time. Adding new variants is not considered
17011        /// a breaking change. Applications should write their code in anticipation of:
17012        ///
17013        /// - New values appearing in future releases of the client library, **and**
17014        /// - New values received dynamically, without application changes.
17015        ///
17016        /// Please consult the [Working with enums] section in the user guide for some
17017        /// guidelines.
17018        ///
17019        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17020        #[derive(Clone, Debug, PartialEq)]
17021        #[non_exhaustive]
17022        pub enum SqlOutOfDiskState {
17023            /// Unspecified state
17024            Unspecified,
17025            /// The instance has plenty space on data disk
17026            Normal,
17027            /// Data disk is almost used up. It is shutdown to prevent data
17028            /// corruption.
17029            SoftShutdown,
17030            /// If set, the enum was initialized with an unknown value.
17031            ///
17032            /// Applications can examine the value using [SqlOutOfDiskState::value] or
17033            /// [SqlOutOfDiskState::name].
17034            UnknownValue(sql_out_of_disk_state::UnknownValue),
17035        }
17036
17037        #[doc(hidden)]
17038        pub mod sql_out_of_disk_state {
17039            #[allow(unused_imports)]
17040            use super::*;
17041            #[derive(Clone, Debug, PartialEq)]
17042            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17043        }
17044
17045        impl SqlOutOfDiskState {
17046            /// Gets the enum value.
17047            ///
17048            /// Returns `None` if the enum contains an unknown value deserialized from
17049            /// the string representation of enums.
17050            pub fn value(&self) -> std::option::Option<i32> {
17051                match self {
17052                    Self::Unspecified => std::option::Option::Some(0),
17053                    Self::Normal => std::option::Option::Some(1),
17054                    Self::SoftShutdown => std::option::Option::Some(2),
17055                    Self::UnknownValue(u) => u.0.value(),
17056                }
17057            }
17058
17059            /// Gets the enum value as a string.
17060            ///
17061            /// Returns `None` if the enum contains an unknown value deserialized from
17062            /// the integer representation of enums.
17063            pub fn name(&self) -> std::option::Option<&str> {
17064                match self {
17065                    Self::Unspecified => {
17066                        std::option::Option::Some("SQL_OUT_OF_DISK_STATE_UNSPECIFIED")
17067                    }
17068                    Self::Normal => std::option::Option::Some("NORMAL"),
17069                    Self::SoftShutdown => std::option::Option::Some("SOFT_SHUTDOWN"),
17070                    Self::UnknownValue(u) => u.0.name(),
17071                }
17072            }
17073        }
17074
17075        impl std::default::Default for SqlOutOfDiskState {
17076            fn default() -> Self {
17077                use std::convert::From;
17078                Self::from(0)
17079            }
17080        }
17081
17082        impl std::fmt::Display for SqlOutOfDiskState {
17083            fn fmt(
17084                &self,
17085                f: &mut std::fmt::Formatter<'_>,
17086            ) -> std::result::Result<(), std::fmt::Error> {
17087                wkt::internal::display_enum(f, self.name(), self.value())
17088            }
17089        }
17090
17091        impl std::convert::From<i32> for SqlOutOfDiskState {
17092            fn from(value: i32) -> Self {
17093                match value {
17094                    0 => Self::Unspecified,
17095                    1 => Self::Normal,
17096                    2 => Self::SoftShutdown,
17097                    _ => Self::UnknownValue(sql_out_of_disk_state::UnknownValue(
17098                        wkt::internal::UnknownEnumValue::Integer(value),
17099                    )),
17100                }
17101            }
17102        }
17103
17104        impl std::convert::From<&str> for SqlOutOfDiskState {
17105            fn from(value: &str) -> Self {
17106                use std::string::ToString;
17107                match value {
17108                    "SQL_OUT_OF_DISK_STATE_UNSPECIFIED" => Self::Unspecified,
17109                    "NORMAL" => Self::Normal,
17110                    "SOFT_SHUTDOWN" => Self::SoftShutdown,
17111                    _ => Self::UnknownValue(sql_out_of_disk_state::UnknownValue(
17112                        wkt::internal::UnknownEnumValue::String(value.to_string()),
17113                    )),
17114                }
17115            }
17116        }
17117
17118        impl serde::ser::Serialize for SqlOutOfDiskState {
17119            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17120            where
17121                S: serde::Serializer,
17122            {
17123                match self {
17124                    Self::Unspecified => serializer.serialize_i32(0),
17125                    Self::Normal => serializer.serialize_i32(1),
17126                    Self::SoftShutdown => serializer.serialize_i32(2),
17127                    Self::UnknownValue(u) => u.0.serialize(serializer),
17128                }
17129            }
17130        }
17131
17132        impl<'de> serde::de::Deserialize<'de> for SqlOutOfDiskState {
17133            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17134            where
17135                D: serde::Deserializer<'de>,
17136            {
17137                deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlOutOfDiskState>::new(
17138                    ".google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState",
17139                ))
17140            }
17141        }
17142    }
17143
17144    /// The current serving state of the database instance.
17145    ///
17146    /// # Working with unknown values
17147    ///
17148    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17149    /// additional enum variants at any time. Adding new variants is not considered
17150    /// a breaking change. Applications should write their code in anticipation of:
17151    ///
17152    /// - New values appearing in future releases of the client library, **and**
17153    /// - New values received dynamically, without application changes.
17154    ///
17155    /// Please consult the [Working with enums] section in the user guide for some
17156    /// guidelines.
17157    ///
17158    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17159    #[derive(Clone, Debug, PartialEq)]
17160    #[non_exhaustive]
17161    pub enum SqlInstanceState {
17162        /// The state of the instance is unknown.
17163        Unspecified,
17164        /// The instance is running, or has been stopped by owner.
17165        Runnable,
17166        /// The instance is not available, for example due to problems with billing.
17167        Suspended,
17168        /// The instance is being deleted.
17169        PendingDelete,
17170        /// The instance is being created.
17171        PendingCreate,
17172        /// The instance is down for maintenance.
17173        Maintenance,
17174        /// The creation of the instance failed or a fatal error occurred during
17175        /// maintenance.
17176        Failed,
17177        /// Deprecated
17178        #[deprecated]
17179        OnlineMaintenance,
17180        /// If set, the enum was initialized with an unknown value.
17181        ///
17182        /// Applications can examine the value using [SqlInstanceState::value] or
17183        /// [SqlInstanceState::name].
17184        UnknownValue(sql_instance_state::UnknownValue),
17185    }
17186
17187    #[doc(hidden)]
17188    pub mod sql_instance_state {
17189        #[allow(unused_imports)]
17190        use super::*;
17191        #[derive(Clone, Debug, PartialEq)]
17192        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17193    }
17194
17195    impl SqlInstanceState {
17196        /// Gets the enum value.
17197        ///
17198        /// Returns `None` if the enum contains an unknown value deserialized from
17199        /// the string representation of enums.
17200        pub fn value(&self) -> std::option::Option<i32> {
17201            match self {
17202                Self::Unspecified => std::option::Option::Some(0),
17203                Self::Runnable => std::option::Option::Some(1),
17204                Self::Suspended => std::option::Option::Some(2),
17205                Self::PendingDelete => std::option::Option::Some(3),
17206                Self::PendingCreate => std::option::Option::Some(4),
17207                Self::Maintenance => std::option::Option::Some(5),
17208                Self::Failed => std::option::Option::Some(6),
17209                Self::OnlineMaintenance => std::option::Option::Some(7),
17210                Self::UnknownValue(u) => u.0.value(),
17211            }
17212        }
17213
17214        /// Gets the enum value as a string.
17215        ///
17216        /// Returns `None` if the enum contains an unknown value deserialized from
17217        /// the integer representation of enums.
17218        pub fn name(&self) -> std::option::Option<&str> {
17219            match self {
17220                Self::Unspecified => std::option::Option::Some("SQL_INSTANCE_STATE_UNSPECIFIED"),
17221                Self::Runnable => std::option::Option::Some("RUNNABLE"),
17222                Self::Suspended => std::option::Option::Some("SUSPENDED"),
17223                Self::PendingDelete => std::option::Option::Some("PENDING_DELETE"),
17224                Self::PendingCreate => std::option::Option::Some("PENDING_CREATE"),
17225                Self::Maintenance => std::option::Option::Some("MAINTENANCE"),
17226                Self::Failed => std::option::Option::Some("FAILED"),
17227                Self::OnlineMaintenance => std::option::Option::Some("ONLINE_MAINTENANCE"),
17228                Self::UnknownValue(u) => u.0.name(),
17229            }
17230        }
17231    }
17232
17233    impl std::default::Default for SqlInstanceState {
17234        fn default() -> Self {
17235            use std::convert::From;
17236            Self::from(0)
17237        }
17238    }
17239
17240    impl std::fmt::Display for SqlInstanceState {
17241        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17242            wkt::internal::display_enum(f, self.name(), self.value())
17243        }
17244    }
17245
17246    impl std::convert::From<i32> for SqlInstanceState {
17247        fn from(value: i32) -> Self {
17248            match value {
17249                0 => Self::Unspecified,
17250                1 => Self::Runnable,
17251                2 => Self::Suspended,
17252                3 => Self::PendingDelete,
17253                4 => Self::PendingCreate,
17254                5 => Self::Maintenance,
17255                6 => Self::Failed,
17256                7 => Self::OnlineMaintenance,
17257                _ => Self::UnknownValue(sql_instance_state::UnknownValue(
17258                    wkt::internal::UnknownEnumValue::Integer(value),
17259                )),
17260            }
17261        }
17262    }
17263
17264    impl std::convert::From<&str> for SqlInstanceState {
17265        fn from(value: &str) -> Self {
17266            use std::string::ToString;
17267            match value {
17268                "SQL_INSTANCE_STATE_UNSPECIFIED" => Self::Unspecified,
17269                "RUNNABLE" => Self::Runnable,
17270                "SUSPENDED" => Self::Suspended,
17271                "PENDING_DELETE" => Self::PendingDelete,
17272                "PENDING_CREATE" => Self::PendingCreate,
17273                "MAINTENANCE" => Self::Maintenance,
17274                "FAILED" => Self::Failed,
17275                "ONLINE_MAINTENANCE" => Self::OnlineMaintenance,
17276                _ => Self::UnknownValue(sql_instance_state::UnknownValue(
17277                    wkt::internal::UnknownEnumValue::String(value.to_string()),
17278                )),
17279            }
17280        }
17281    }
17282
17283    impl serde::ser::Serialize for SqlInstanceState {
17284        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17285        where
17286            S: serde::Serializer,
17287        {
17288            match self {
17289                Self::Unspecified => serializer.serialize_i32(0),
17290                Self::Runnable => serializer.serialize_i32(1),
17291                Self::Suspended => serializer.serialize_i32(2),
17292                Self::PendingDelete => serializer.serialize_i32(3),
17293                Self::PendingCreate => serializer.serialize_i32(4),
17294                Self::Maintenance => serializer.serialize_i32(5),
17295                Self::Failed => serializer.serialize_i32(6),
17296                Self::OnlineMaintenance => serializer.serialize_i32(7),
17297                Self::UnknownValue(u) => u.0.serialize(serializer),
17298            }
17299        }
17300    }
17301
17302    impl<'de> serde::de::Deserialize<'de> for SqlInstanceState {
17303        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17304        where
17305            D: serde::Deserializer<'de>,
17306        {
17307            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlInstanceState>::new(
17308                ".google.cloud.sql.v1.DatabaseInstance.SqlInstanceState",
17309            ))
17310        }
17311    }
17312
17313    /// The SQL network architecture for the instance.
17314    ///
17315    /// # Working with unknown values
17316    ///
17317    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17318    /// additional enum variants at any time. Adding new variants is not considered
17319    /// a breaking change. Applications should write their code in anticipation of:
17320    ///
17321    /// - New values appearing in future releases of the client library, **and**
17322    /// - New values received dynamically, without application changes.
17323    ///
17324    /// Please consult the [Working with enums] section in the user guide for some
17325    /// guidelines.
17326    ///
17327    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17328    #[derive(Clone, Debug, PartialEq)]
17329    #[non_exhaustive]
17330    pub enum SqlNetworkArchitecture {
17331        Unspecified,
17332        /// The instance uses the new network architecture.
17333        NewNetworkArchitecture,
17334        /// The instance uses the old network architecture.
17335        OldNetworkArchitecture,
17336        /// If set, the enum was initialized with an unknown value.
17337        ///
17338        /// Applications can examine the value using [SqlNetworkArchitecture::value] or
17339        /// [SqlNetworkArchitecture::name].
17340        UnknownValue(sql_network_architecture::UnknownValue),
17341    }
17342
17343    #[doc(hidden)]
17344    pub mod sql_network_architecture {
17345        #[allow(unused_imports)]
17346        use super::*;
17347        #[derive(Clone, Debug, PartialEq)]
17348        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17349    }
17350
17351    impl SqlNetworkArchitecture {
17352        /// Gets the enum value.
17353        ///
17354        /// Returns `None` if the enum contains an unknown value deserialized from
17355        /// the string representation of enums.
17356        pub fn value(&self) -> std::option::Option<i32> {
17357            match self {
17358                Self::Unspecified => std::option::Option::Some(0),
17359                Self::NewNetworkArchitecture => std::option::Option::Some(1),
17360                Self::OldNetworkArchitecture => std::option::Option::Some(2),
17361                Self::UnknownValue(u) => u.0.value(),
17362            }
17363        }
17364
17365        /// Gets the enum value as a string.
17366        ///
17367        /// Returns `None` if the enum contains an unknown value deserialized from
17368        /// the integer representation of enums.
17369        pub fn name(&self) -> std::option::Option<&str> {
17370            match self {
17371                Self::Unspecified => {
17372                    std::option::Option::Some("SQL_NETWORK_ARCHITECTURE_UNSPECIFIED")
17373                }
17374                Self::NewNetworkArchitecture => {
17375                    std::option::Option::Some("NEW_NETWORK_ARCHITECTURE")
17376                }
17377                Self::OldNetworkArchitecture => {
17378                    std::option::Option::Some("OLD_NETWORK_ARCHITECTURE")
17379                }
17380                Self::UnknownValue(u) => u.0.name(),
17381            }
17382        }
17383    }
17384
17385    impl std::default::Default for SqlNetworkArchitecture {
17386        fn default() -> Self {
17387            use std::convert::From;
17388            Self::from(0)
17389        }
17390    }
17391
17392    impl std::fmt::Display for SqlNetworkArchitecture {
17393        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17394            wkt::internal::display_enum(f, self.name(), self.value())
17395        }
17396    }
17397
17398    impl std::convert::From<i32> for SqlNetworkArchitecture {
17399        fn from(value: i32) -> Self {
17400            match value {
17401                0 => Self::Unspecified,
17402                1 => Self::NewNetworkArchitecture,
17403                2 => Self::OldNetworkArchitecture,
17404                _ => Self::UnknownValue(sql_network_architecture::UnknownValue(
17405                    wkt::internal::UnknownEnumValue::Integer(value),
17406                )),
17407            }
17408        }
17409    }
17410
17411    impl std::convert::From<&str> for SqlNetworkArchitecture {
17412        fn from(value: &str) -> Self {
17413            use std::string::ToString;
17414            match value {
17415                "SQL_NETWORK_ARCHITECTURE_UNSPECIFIED" => Self::Unspecified,
17416                "NEW_NETWORK_ARCHITECTURE" => Self::NewNetworkArchitecture,
17417                "OLD_NETWORK_ARCHITECTURE" => Self::OldNetworkArchitecture,
17418                _ => Self::UnknownValue(sql_network_architecture::UnknownValue(
17419                    wkt::internal::UnknownEnumValue::String(value.to_string()),
17420                )),
17421            }
17422        }
17423    }
17424
17425    impl serde::ser::Serialize for SqlNetworkArchitecture {
17426        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17427        where
17428            S: serde::Serializer,
17429        {
17430            match self {
17431                Self::Unspecified => serializer.serialize_i32(0),
17432                Self::NewNetworkArchitecture => serializer.serialize_i32(1),
17433                Self::OldNetworkArchitecture => serializer.serialize_i32(2),
17434                Self::UnknownValue(u) => u.0.serialize(serializer),
17435            }
17436        }
17437    }
17438
17439    impl<'de> serde::de::Deserialize<'de> for SqlNetworkArchitecture {
17440        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17441        where
17442            D: serde::Deserializer<'de>,
17443        {
17444            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlNetworkArchitecture>::new(
17445                ".google.cloud.sql.v1.DatabaseInstance.SqlNetworkArchitecture",
17446            ))
17447        }
17448    }
17449}
17450
17451/// Gemini instance configuration.
17452#[derive(Clone, Debug, Default, PartialEq)]
17453#[non_exhaustive]
17454pub struct GeminiInstanceConfig {
17455    /// Output only. Whether Gemini is enabled.
17456    pub entitled: std::option::Option<bool>,
17457
17458    /// Output only. Whether the vacuum management is enabled.
17459    pub google_vacuum_mgmt_enabled: std::option::Option<bool>,
17460
17461    /// Output only. Whether canceling the out-of-memory (OOM) session is enabled.
17462    pub oom_session_cancel_enabled: std::option::Option<bool>,
17463
17464    /// Output only. Whether the active query is enabled.
17465    pub active_query_enabled: std::option::Option<bool>,
17466
17467    /// Output only. Whether the index advisor is enabled.
17468    pub index_advisor_enabled: std::option::Option<bool>,
17469
17470    /// Output only. Whether the flag recommender is enabled.
17471    pub flag_recommender_enabled: std::option::Option<bool>,
17472
17473    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17474}
17475
17476impl GeminiInstanceConfig {
17477    pub fn new() -> Self {
17478        std::default::Default::default()
17479    }
17480
17481    /// Sets the value of [entitled][crate::model::GeminiInstanceConfig::entitled].
17482    pub fn set_entitled<T>(mut self, v: T) -> Self
17483    where
17484        T: std::convert::Into<bool>,
17485    {
17486        self.entitled = std::option::Option::Some(v.into());
17487        self
17488    }
17489
17490    /// Sets or clears the value of [entitled][crate::model::GeminiInstanceConfig::entitled].
17491    pub fn set_or_clear_entitled<T>(mut self, v: std::option::Option<T>) -> Self
17492    where
17493        T: std::convert::Into<bool>,
17494    {
17495        self.entitled = v.map(|x| x.into());
17496        self
17497    }
17498
17499    /// Sets the value of [google_vacuum_mgmt_enabled][crate::model::GeminiInstanceConfig::google_vacuum_mgmt_enabled].
17500    pub fn set_google_vacuum_mgmt_enabled<T>(mut self, v: T) -> Self
17501    where
17502        T: std::convert::Into<bool>,
17503    {
17504        self.google_vacuum_mgmt_enabled = std::option::Option::Some(v.into());
17505        self
17506    }
17507
17508    /// Sets or clears the value of [google_vacuum_mgmt_enabled][crate::model::GeminiInstanceConfig::google_vacuum_mgmt_enabled].
17509    pub fn set_or_clear_google_vacuum_mgmt_enabled<T>(mut self, v: std::option::Option<T>) -> Self
17510    where
17511        T: std::convert::Into<bool>,
17512    {
17513        self.google_vacuum_mgmt_enabled = v.map(|x| x.into());
17514        self
17515    }
17516
17517    /// Sets the value of [oom_session_cancel_enabled][crate::model::GeminiInstanceConfig::oom_session_cancel_enabled].
17518    pub fn set_oom_session_cancel_enabled<T>(mut self, v: T) -> Self
17519    where
17520        T: std::convert::Into<bool>,
17521    {
17522        self.oom_session_cancel_enabled = std::option::Option::Some(v.into());
17523        self
17524    }
17525
17526    /// Sets or clears the value of [oom_session_cancel_enabled][crate::model::GeminiInstanceConfig::oom_session_cancel_enabled].
17527    pub fn set_or_clear_oom_session_cancel_enabled<T>(mut self, v: std::option::Option<T>) -> Self
17528    where
17529        T: std::convert::Into<bool>,
17530    {
17531        self.oom_session_cancel_enabled = v.map(|x| x.into());
17532        self
17533    }
17534
17535    /// Sets the value of [active_query_enabled][crate::model::GeminiInstanceConfig::active_query_enabled].
17536    pub fn set_active_query_enabled<T>(mut self, v: T) -> Self
17537    where
17538        T: std::convert::Into<bool>,
17539    {
17540        self.active_query_enabled = std::option::Option::Some(v.into());
17541        self
17542    }
17543
17544    /// Sets or clears the value of [active_query_enabled][crate::model::GeminiInstanceConfig::active_query_enabled].
17545    pub fn set_or_clear_active_query_enabled<T>(mut self, v: std::option::Option<T>) -> Self
17546    where
17547        T: std::convert::Into<bool>,
17548    {
17549        self.active_query_enabled = v.map(|x| x.into());
17550        self
17551    }
17552
17553    /// Sets the value of [index_advisor_enabled][crate::model::GeminiInstanceConfig::index_advisor_enabled].
17554    pub fn set_index_advisor_enabled<T>(mut self, v: T) -> Self
17555    where
17556        T: std::convert::Into<bool>,
17557    {
17558        self.index_advisor_enabled = std::option::Option::Some(v.into());
17559        self
17560    }
17561
17562    /// Sets or clears the value of [index_advisor_enabled][crate::model::GeminiInstanceConfig::index_advisor_enabled].
17563    pub fn set_or_clear_index_advisor_enabled<T>(mut self, v: std::option::Option<T>) -> Self
17564    where
17565        T: std::convert::Into<bool>,
17566    {
17567        self.index_advisor_enabled = v.map(|x| x.into());
17568        self
17569    }
17570
17571    /// Sets the value of [flag_recommender_enabled][crate::model::GeminiInstanceConfig::flag_recommender_enabled].
17572    pub fn set_flag_recommender_enabled<T>(mut self, v: T) -> Self
17573    where
17574        T: std::convert::Into<bool>,
17575    {
17576        self.flag_recommender_enabled = std::option::Option::Some(v.into());
17577        self
17578    }
17579
17580    /// Sets or clears the value of [flag_recommender_enabled][crate::model::GeminiInstanceConfig::flag_recommender_enabled].
17581    pub fn set_or_clear_flag_recommender_enabled<T>(mut self, v: std::option::Option<T>) -> Self
17582    where
17583        T: std::convert::Into<bool>,
17584    {
17585        self.flag_recommender_enabled = v.map(|x| x.into());
17586        self
17587    }
17588}
17589
17590impl wkt::message::Message for GeminiInstanceConfig {
17591    fn typename() -> &'static str {
17592        "type.googleapis.com/google.cloud.sql.v1.GeminiInstanceConfig"
17593    }
17594}
17595
17596#[doc(hidden)]
17597impl<'de> serde::de::Deserialize<'de> for GeminiInstanceConfig {
17598    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17599    where
17600        D: serde::Deserializer<'de>,
17601    {
17602        #[allow(non_camel_case_types)]
17603        #[doc(hidden)]
17604        #[derive(PartialEq, Eq, Hash)]
17605        enum __FieldTag {
17606            __entitled,
17607            __google_vacuum_mgmt_enabled,
17608            __oom_session_cancel_enabled,
17609            __active_query_enabled,
17610            __index_advisor_enabled,
17611            __flag_recommender_enabled,
17612            Unknown(std::string::String),
17613        }
17614        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17615            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17616            where
17617                D: serde::Deserializer<'de>,
17618            {
17619                struct Visitor;
17620                impl<'de> serde::de::Visitor<'de> for Visitor {
17621                    type Value = __FieldTag;
17622                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17623                        formatter.write_str("a field name for GeminiInstanceConfig")
17624                    }
17625                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17626                    where
17627                        E: serde::de::Error,
17628                    {
17629                        use std::result::Result::Ok;
17630                        use std::string::ToString;
17631                        match value {
17632                            "entitled" => Ok(__FieldTag::__entitled),
17633                            "googleVacuumMgmtEnabled" => {
17634                                Ok(__FieldTag::__google_vacuum_mgmt_enabled)
17635                            }
17636                            "google_vacuum_mgmt_enabled" => {
17637                                Ok(__FieldTag::__google_vacuum_mgmt_enabled)
17638                            }
17639                            "oomSessionCancelEnabled" => {
17640                                Ok(__FieldTag::__oom_session_cancel_enabled)
17641                            }
17642                            "oom_session_cancel_enabled" => {
17643                                Ok(__FieldTag::__oom_session_cancel_enabled)
17644                            }
17645                            "activeQueryEnabled" => Ok(__FieldTag::__active_query_enabled),
17646                            "active_query_enabled" => Ok(__FieldTag::__active_query_enabled),
17647                            "indexAdvisorEnabled" => Ok(__FieldTag::__index_advisor_enabled),
17648                            "index_advisor_enabled" => Ok(__FieldTag::__index_advisor_enabled),
17649                            "flagRecommenderEnabled" => Ok(__FieldTag::__flag_recommender_enabled),
17650                            "flag_recommender_enabled" => {
17651                                Ok(__FieldTag::__flag_recommender_enabled)
17652                            }
17653                            _ => Ok(__FieldTag::Unknown(value.to_string())),
17654                        }
17655                    }
17656                }
17657                deserializer.deserialize_identifier(Visitor)
17658            }
17659        }
17660        struct Visitor;
17661        impl<'de> serde::de::Visitor<'de> for Visitor {
17662            type Value = GeminiInstanceConfig;
17663            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17664                formatter.write_str("struct GeminiInstanceConfig")
17665            }
17666            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17667            where
17668                A: serde::de::MapAccess<'de>,
17669            {
17670                #[allow(unused_imports)]
17671                use serde::de::Error;
17672                use std::option::Option::Some;
17673                let mut fields = std::collections::HashSet::new();
17674                let mut result = Self::Value::new();
17675                while let Some(tag) = map.next_key::<__FieldTag>()? {
17676                    #[allow(clippy::match_single_binding)]
17677                    match tag {
17678                        __FieldTag::__entitled => {
17679                            if !fields.insert(__FieldTag::__entitled) {
17680                                return std::result::Result::Err(A::Error::duplicate_field(
17681                                    "multiple values for entitled",
17682                                ));
17683                            }
17684                            result.entitled = map.next_value::<std::option::Option<bool>>()?;
17685                        }
17686                        __FieldTag::__google_vacuum_mgmt_enabled => {
17687                            if !fields.insert(__FieldTag::__google_vacuum_mgmt_enabled) {
17688                                return std::result::Result::Err(A::Error::duplicate_field(
17689                                    "multiple values for google_vacuum_mgmt_enabled",
17690                                ));
17691                            }
17692                            result.google_vacuum_mgmt_enabled =
17693                                map.next_value::<std::option::Option<bool>>()?;
17694                        }
17695                        __FieldTag::__oom_session_cancel_enabled => {
17696                            if !fields.insert(__FieldTag::__oom_session_cancel_enabled) {
17697                                return std::result::Result::Err(A::Error::duplicate_field(
17698                                    "multiple values for oom_session_cancel_enabled",
17699                                ));
17700                            }
17701                            result.oom_session_cancel_enabled =
17702                                map.next_value::<std::option::Option<bool>>()?;
17703                        }
17704                        __FieldTag::__active_query_enabled => {
17705                            if !fields.insert(__FieldTag::__active_query_enabled) {
17706                                return std::result::Result::Err(A::Error::duplicate_field(
17707                                    "multiple values for active_query_enabled",
17708                                ));
17709                            }
17710                            result.active_query_enabled =
17711                                map.next_value::<std::option::Option<bool>>()?;
17712                        }
17713                        __FieldTag::__index_advisor_enabled => {
17714                            if !fields.insert(__FieldTag::__index_advisor_enabled) {
17715                                return std::result::Result::Err(A::Error::duplicate_field(
17716                                    "multiple values for index_advisor_enabled",
17717                                ));
17718                            }
17719                            result.index_advisor_enabled =
17720                                map.next_value::<std::option::Option<bool>>()?;
17721                        }
17722                        __FieldTag::__flag_recommender_enabled => {
17723                            if !fields.insert(__FieldTag::__flag_recommender_enabled) {
17724                                return std::result::Result::Err(A::Error::duplicate_field(
17725                                    "multiple values for flag_recommender_enabled",
17726                                ));
17727                            }
17728                            result.flag_recommender_enabled =
17729                                map.next_value::<std::option::Option<bool>>()?;
17730                        }
17731                        __FieldTag::Unknown(key) => {
17732                            let value = map.next_value::<serde_json::Value>()?;
17733                            result._unknown_fields.insert(key, value);
17734                        }
17735                    }
17736                }
17737                std::result::Result::Ok(result)
17738            }
17739        }
17740        deserializer.deserialize_any(Visitor)
17741    }
17742}
17743
17744#[doc(hidden)]
17745impl serde::ser::Serialize for GeminiInstanceConfig {
17746    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17747    where
17748        S: serde::ser::Serializer,
17749    {
17750        use serde::ser::SerializeMap;
17751        #[allow(unused_imports)]
17752        use std::option::Option::Some;
17753        let mut state = serializer.serialize_map(std::option::Option::None)?;
17754        if self.entitled.is_some() {
17755            state.serialize_entry("entitled", &self.entitled)?;
17756        }
17757        if self.google_vacuum_mgmt_enabled.is_some() {
17758            state.serialize_entry("googleVacuumMgmtEnabled", &self.google_vacuum_mgmt_enabled)?;
17759        }
17760        if self.oom_session_cancel_enabled.is_some() {
17761            state.serialize_entry("oomSessionCancelEnabled", &self.oom_session_cancel_enabled)?;
17762        }
17763        if self.active_query_enabled.is_some() {
17764            state.serialize_entry("activeQueryEnabled", &self.active_query_enabled)?;
17765        }
17766        if self.index_advisor_enabled.is_some() {
17767            state.serialize_entry("indexAdvisorEnabled", &self.index_advisor_enabled)?;
17768        }
17769        if self.flag_recommender_enabled.is_some() {
17770            state.serialize_entry("flagRecommenderEnabled", &self.flag_recommender_enabled)?;
17771        }
17772        if !self._unknown_fields.is_empty() {
17773            for (key, value) in self._unknown_fields.iter() {
17774                state.serialize_entry(key, &value)?;
17775            }
17776        }
17777        state.end()
17778    }
17779}
17780
17781/// A primary instance and disaster recovery (DR) replica pair.
17782/// A DR replica is a cross-region replica that you designate for failover in
17783/// the event that the primary instance experiences regional failure.
17784/// Only applicable to MySQL.
17785#[derive(Clone, Debug, Default, PartialEq)]
17786#[non_exhaustive]
17787pub struct ReplicationCluster {
17788    /// Output only. If set, it indicates this instance has a private service
17789    /// access (PSA) dns endpoint that is pointing to the primary instance of the
17790    /// cluster. If this instance is the primary, the dns should be pointing to
17791    /// this instance. After Switchover or Replica failover, this DNS endpoint
17792    /// points to the promoted instance. This is a read-only field, returned to the
17793    /// user as information. This field can exist even if a standalone instance
17794    /// does not yet have a replica, or had a DR replica that was deleted.
17795    pub psa_write_endpoint: std::string::String,
17796
17797    /// Optional. If the instance is a primary instance, then this field identifies
17798    /// the disaster recovery (DR) replica. A DR replica is an optional
17799    /// configuration for Enterprise Plus edition instances. If the instance is a
17800    /// read replica, then the field is not set. Set this field to a replica name
17801    /// to designate a DR replica for a primary instance. Remove the replica name
17802    /// to remove the DR replica designation.
17803    pub failover_dr_replica_name: std::string::String,
17804
17805    /// Output only. Read-only field that indicates whether the replica is a DR
17806    /// replica. This field is not set if the instance is a primary instance.
17807    pub dr_replica: bool,
17808
17809    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17810}
17811
17812impl ReplicationCluster {
17813    pub fn new() -> Self {
17814        std::default::Default::default()
17815    }
17816
17817    /// Sets the value of [psa_write_endpoint][crate::model::ReplicationCluster::psa_write_endpoint].
17818    pub fn set_psa_write_endpoint<T: std::convert::Into<std::string::String>>(
17819        mut self,
17820        v: T,
17821    ) -> Self {
17822        self.psa_write_endpoint = v.into();
17823        self
17824    }
17825
17826    /// Sets the value of [failover_dr_replica_name][crate::model::ReplicationCluster::failover_dr_replica_name].
17827    pub fn set_failover_dr_replica_name<T: std::convert::Into<std::string::String>>(
17828        mut self,
17829        v: T,
17830    ) -> Self {
17831        self.failover_dr_replica_name = v.into();
17832        self
17833    }
17834
17835    /// Sets the value of [dr_replica][crate::model::ReplicationCluster::dr_replica].
17836    pub fn set_dr_replica<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17837        self.dr_replica = v.into();
17838        self
17839    }
17840}
17841
17842impl wkt::message::Message for ReplicationCluster {
17843    fn typename() -> &'static str {
17844        "type.googleapis.com/google.cloud.sql.v1.ReplicationCluster"
17845    }
17846}
17847
17848#[doc(hidden)]
17849impl<'de> serde::de::Deserialize<'de> for ReplicationCluster {
17850    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17851    where
17852        D: serde::Deserializer<'de>,
17853    {
17854        #[allow(non_camel_case_types)]
17855        #[doc(hidden)]
17856        #[derive(PartialEq, Eq, Hash)]
17857        enum __FieldTag {
17858            __psa_write_endpoint,
17859            __failover_dr_replica_name,
17860            __dr_replica,
17861            Unknown(std::string::String),
17862        }
17863        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17864            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17865            where
17866                D: serde::Deserializer<'de>,
17867            {
17868                struct Visitor;
17869                impl<'de> serde::de::Visitor<'de> for Visitor {
17870                    type Value = __FieldTag;
17871                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17872                        formatter.write_str("a field name for ReplicationCluster")
17873                    }
17874                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17875                    where
17876                        E: serde::de::Error,
17877                    {
17878                        use std::result::Result::Ok;
17879                        use std::string::ToString;
17880                        match value {
17881                            "psaWriteEndpoint" => Ok(__FieldTag::__psa_write_endpoint),
17882                            "psa_write_endpoint" => Ok(__FieldTag::__psa_write_endpoint),
17883                            "failoverDrReplicaName" => Ok(__FieldTag::__failover_dr_replica_name),
17884                            "failover_dr_replica_name" => {
17885                                Ok(__FieldTag::__failover_dr_replica_name)
17886                            }
17887                            "drReplica" => Ok(__FieldTag::__dr_replica),
17888                            "dr_replica" => Ok(__FieldTag::__dr_replica),
17889                            _ => Ok(__FieldTag::Unknown(value.to_string())),
17890                        }
17891                    }
17892                }
17893                deserializer.deserialize_identifier(Visitor)
17894            }
17895        }
17896        struct Visitor;
17897        impl<'de> serde::de::Visitor<'de> for Visitor {
17898            type Value = ReplicationCluster;
17899            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17900                formatter.write_str("struct ReplicationCluster")
17901            }
17902            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17903            where
17904                A: serde::de::MapAccess<'de>,
17905            {
17906                #[allow(unused_imports)]
17907                use serde::de::Error;
17908                use std::option::Option::Some;
17909                let mut fields = std::collections::HashSet::new();
17910                let mut result = Self::Value::new();
17911                while let Some(tag) = map.next_key::<__FieldTag>()? {
17912                    #[allow(clippy::match_single_binding)]
17913                    match tag {
17914                        __FieldTag::__psa_write_endpoint => {
17915                            if !fields.insert(__FieldTag::__psa_write_endpoint) {
17916                                return std::result::Result::Err(A::Error::duplicate_field(
17917                                    "multiple values for psa_write_endpoint",
17918                                ));
17919                            }
17920                            result.psa_write_endpoint = map
17921                                .next_value::<std::option::Option<std::string::String>>()?
17922                                .unwrap_or_default();
17923                        }
17924                        __FieldTag::__failover_dr_replica_name => {
17925                            if !fields.insert(__FieldTag::__failover_dr_replica_name) {
17926                                return std::result::Result::Err(A::Error::duplicate_field(
17927                                    "multiple values for failover_dr_replica_name",
17928                                ));
17929                            }
17930                            result.failover_dr_replica_name = map
17931                                .next_value::<std::option::Option<std::string::String>>()?
17932                                .unwrap_or_default();
17933                        }
17934                        __FieldTag::__dr_replica => {
17935                            if !fields.insert(__FieldTag::__dr_replica) {
17936                                return std::result::Result::Err(A::Error::duplicate_field(
17937                                    "multiple values for dr_replica",
17938                                ));
17939                            }
17940                            result.dr_replica = map
17941                                .next_value::<std::option::Option<bool>>()?
17942                                .unwrap_or_default();
17943                        }
17944                        __FieldTag::Unknown(key) => {
17945                            let value = map.next_value::<serde_json::Value>()?;
17946                            result._unknown_fields.insert(key, value);
17947                        }
17948                    }
17949                }
17950                std::result::Result::Ok(result)
17951            }
17952        }
17953        deserializer.deserialize_any(Visitor)
17954    }
17955}
17956
17957#[doc(hidden)]
17958impl serde::ser::Serialize for ReplicationCluster {
17959    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17960    where
17961        S: serde::ser::Serializer,
17962    {
17963        use serde::ser::SerializeMap;
17964        #[allow(unused_imports)]
17965        use std::option::Option::Some;
17966        let mut state = serializer.serialize_map(std::option::Option::None)?;
17967        if !self.psa_write_endpoint.is_empty() {
17968            state.serialize_entry("psaWriteEndpoint", &self.psa_write_endpoint)?;
17969        }
17970        if !self.failover_dr_replica_name.is_empty() {
17971            state.serialize_entry("failoverDrReplicaName", &self.failover_dr_replica_name)?;
17972        }
17973        if !wkt::internal::is_default(&self.dr_replica) {
17974            state.serialize_entry("drReplica", &self.dr_replica)?;
17975        }
17976        if !self._unknown_fields.is_empty() {
17977            for (key, value) in self._unknown_fields.iter() {
17978                state.serialize_entry(key, &value)?;
17979            }
17980        }
17981        state.end()
17982    }
17983}
17984
17985/// An available database version. It can be a major or a minor version.
17986#[derive(Clone, Debug, Default, PartialEq)]
17987#[non_exhaustive]
17988pub struct AvailableDatabaseVersion {
17989    /// The version's major version name.
17990    pub major_version: std::option::Option<std::string::String>,
17991
17992    /// The database version name. For MySQL 8.0, this string provides the database
17993    /// major and minor version.
17994    pub name: std::option::Option<std::string::String>,
17995
17996    /// The database version's display name.
17997    pub display_name: std::option::Option<std::string::String>,
17998
17999    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18000}
18001
18002impl AvailableDatabaseVersion {
18003    pub fn new() -> Self {
18004        std::default::Default::default()
18005    }
18006
18007    /// Sets the value of [major_version][crate::model::AvailableDatabaseVersion::major_version].
18008    pub fn set_major_version<T>(mut self, v: T) -> Self
18009    where
18010        T: std::convert::Into<std::string::String>,
18011    {
18012        self.major_version = std::option::Option::Some(v.into());
18013        self
18014    }
18015
18016    /// Sets or clears the value of [major_version][crate::model::AvailableDatabaseVersion::major_version].
18017    pub fn set_or_clear_major_version<T>(mut self, v: std::option::Option<T>) -> Self
18018    where
18019        T: std::convert::Into<std::string::String>,
18020    {
18021        self.major_version = v.map(|x| x.into());
18022        self
18023    }
18024
18025    /// Sets the value of [name][crate::model::AvailableDatabaseVersion::name].
18026    pub fn set_name<T>(mut self, v: T) -> Self
18027    where
18028        T: std::convert::Into<std::string::String>,
18029    {
18030        self.name = std::option::Option::Some(v.into());
18031        self
18032    }
18033
18034    /// Sets or clears the value of [name][crate::model::AvailableDatabaseVersion::name].
18035    pub fn set_or_clear_name<T>(mut self, v: std::option::Option<T>) -> Self
18036    where
18037        T: std::convert::Into<std::string::String>,
18038    {
18039        self.name = v.map(|x| x.into());
18040        self
18041    }
18042
18043    /// Sets the value of [display_name][crate::model::AvailableDatabaseVersion::display_name].
18044    pub fn set_display_name<T>(mut self, v: T) -> Self
18045    where
18046        T: std::convert::Into<std::string::String>,
18047    {
18048        self.display_name = std::option::Option::Some(v.into());
18049        self
18050    }
18051
18052    /// Sets or clears the value of [display_name][crate::model::AvailableDatabaseVersion::display_name].
18053    pub fn set_or_clear_display_name<T>(mut self, v: std::option::Option<T>) -> Self
18054    where
18055        T: std::convert::Into<std::string::String>,
18056    {
18057        self.display_name = v.map(|x| x.into());
18058        self
18059    }
18060}
18061
18062impl wkt::message::Message for AvailableDatabaseVersion {
18063    fn typename() -> &'static str {
18064        "type.googleapis.com/google.cloud.sql.v1.AvailableDatabaseVersion"
18065    }
18066}
18067
18068#[doc(hidden)]
18069impl<'de> serde::de::Deserialize<'de> for AvailableDatabaseVersion {
18070    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18071    where
18072        D: serde::Deserializer<'de>,
18073    {
18074        #[allow(non_camel_case_types)]
18075        #[doc(hidden)]
18076        #[derive(PartialEq, Eq, Hash)]
18077        enum __FieldTag {
18078            __major_version,
18079            __name,
18080            __display_name,
18081            Unknown(std::string::String),
18082        }
18083        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18084            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18085            where
18086                D: serde::Deserializer<'de>,
18087            {
18088                struct Visitor;
18089                impl<'de> serde::de::Visitor<'de> for Visitor {
18090                    type Value = __FieldTag;
18091                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18092                        formatter.write_str("a field name for AvailableDatabaseVersion")
18093                    }
18094                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18095                    where
18096                        E: serde::de::Error,
18097                    {
18098                        use std::result::Result::Ok;
18099                        use std::string::ToString;
18100                        match value {
18101                            "majorVersion" => Ok(__FieldTag::__major_version),
18102                            "major_version" => Ok(__FieldTag::__major_version),
18103                            "name" => Ok(__FieldTag::__name),
18104                            "displayName" => Ok(__FieldTag::__display_name),
18105                            "display_name" => Ok(__FieldTag::__display_name),
18106                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18107                        }
18108                    }
18109                }
18110                deserializer.deserialize_identifier(Visitor)
18111            }
18112        }
18113        struct Visitor;
18114        impl<'de> serde::de::Visitor<'de> for Visitor {
18115            type Value = AvailableDatabaseVersion;
18116            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18117                formatter.write_str("struct AvailableDatabaseVersion")
18118            }
18119            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18120            where
18121                A: serde::de::MapAccess<'de>,
18122            {
18123                #[allow(unused_imports)]
18124                use serde::de::Error;
18125                use std::option::Option::Some;
18126                let mut fields = std::collections::HashSet::new();
18127                let mut result = Self::Value::new();
18128                while let Some(tag) = map.next_key::<__FieldTag>()? {
18129                    #[allow(clippy::match_single_binding)]
18130                    match tag {
18131                        __FieldTag::__major_version => {
18132                            if !fields.insert(__FieldTag::__major_version) {
18133                                return std::result::Result::Err(A::Error::duplicate_field(
18134                                    "multiple values for major_version",
18135                                ));
18136                            }
18137                            result.major_version =
18138                                map.next_value::<std::option::Option<std::string::String>>()?;
18139                        }
18140                        __FieldTag::__name => {
18141                            if !fields.insert(__FieldTag::__name) {
18142                                return std::result::Result::Err(A::Error::duplicate_field(
18143                                    "multiple values for name",
18144                                ));
18145                            }
18146                            result.name =
18147                                map.next_value::<std::option::Option<std::string::String>>()?;
18148                        }
18149                        __FieldTag::__display_name => {
18150                            if !fields.insert(__FieldTag::__display_name) {
18151                                return std::result::Result::Err(A::Error::duplicate_field(
18152                                    "multiple values for display_name",
18153                                ));
18154                            }
18155                            result.display_name =
18156                                map.next_value::<std::option::Option<std::string::String>>()?;
18157                        }
18158                        __FieldTag::Unknown(key) => {
18159                            let value = map.next_value::<serde_json::Value>()?;
18160                            result._unknown_fields.insert(key, value);
18161                        }
18162                    }
18163                }
18164                std::result::Result::Ok(result)
18165            }
18166        }
18167        deserializer.deserialize_any(Visitor)
18168    }
18169}
18170
18171#[doc(hidden)]
18172impl serde::ser::Serialize for AvailableDatabaseVersion {
18173    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18174    where
18175        S: serde::ser::Serializer,
18176    {
18177        use serde::ser::SerializeMap;
18178        #[allow(unused_imports)]
18179        use std::option::Option::Some;
18180        let mut state = serializer.serialize_map(std::option::Option::None)?;
18181        if self.major_version.is_some() {
18182            state.serialize_entry("majorVersion", &self.major_version)?;
18183        }
18184        if self.name.is_some() {
18185            state.serialize_entry("name", &self.name)?;
18186        }
18187        if self.display_name.is_some() {
18188            state.serialize_entry("displayName", &self.display_name)?;
18189        }
18190        if !self._unknown_fields.is_empty() {
18191            for (key, value) in self._unknown_fields.iter() {
18192                state.serialize_entry(key, &value)?;
18193            }
18194        }
18195        state.end()
18196    }
18197}
18198
18199/// Reschedule options for maintenance windows.
18200#[derive(Clone, Debug, Default, PartialEq)]
18201#[non_exhaustive]
18202pub struct SqlInstancesRescheduleMaintenanceRequestBody {
18203    /// Required. The type of the reschedule the user wants.
18204    pub reschedule: std::option::Option<
18205        crate::model::sql_instances_reschedule_maintenance_request_body::Reschedule,
18206    >,
18207
18208    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18209}
18210
18211impl SqlInstancesRescheduleMaintenanceRequestBody {
18212    pub fn new() -> Self {
18213        std::default::Default::default()
18214    }
18215
18216    /// Sets the value of [reschedule][crate::model::SqlInstancesRescheduleMaintenanceRequestBody::reschedule].
18217    pub fn set_reschedule<T>(mut self, v: T) -> Self
18218    where
18219        T: std::convert::Into<
18220                crate::model::sql_instances_reschedule_maintenance_request_body::Reschedule,
18221            >,
18222    {
18223        self.reschedule = std::option::Option::Some(v.into());
18224        self
18225    }
18226
18227    /// Sets or clears the value of [reschedule][crate::model::SqlInstancesRescheduleMaintenanceRequestBody::reschedule].
18228    pub fn set_or_clear_reschedule<T>(mut self, v: std::option::Option<T>) -> Self
18229    where
18230        T: std::convert::Into<
18231                crate::model::sql_instances_reschedule_maintenance_request_body::Reschedule,
18232            >,
18233    {
18234        self.reschedule = v.map(|x| x.into());
18235        self
18236    }
18237}
18238
18239impl wkt::message::Message for SqlInstancesRescheduleMaintenanceRequestBody {
18240    fn typename() -> &'static str {
18241        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody"
18242    }
18243}
18244
18245#[doc(hidden)]
18246impl<'de> serde::de::Deserialize<'de> for SqlInstancesRescheduleMaintenanceRequestBody {
18247    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18248    where
18249        D: serde::Deserializer<'de>,
18250    {
18251        #[allow(non_camel_case_types)]
18252        #[doc(hidden)]
18253        #[derive(PartialEq, Eq, Hash)]
18254        enum __FieldTag {
18255            __reschedule,
18256            Unknown(std::string::String),
18257        }
18258        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18259            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18260            where
18261                D: serde::Deserializer<'de>,
18262            {
18263                struct Visitor;
18264                impl<'de> serde::de::Visitor<'de> for Visitor {
18265                    type Value = __FieldTag;
18266                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18267                        formatter.write_str(
18268                            "a field name for SqlInstancesRescheduleMaintenanceRequestBody",
18269                        )
18270                    }
18271                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18272                    where
18273                        E: serde::de::Error,
18274                    {
18275                        use std::result::Result::Ok;
18276                        use std::string::ToString;
18277                        match value {
18278                            "reschedule" => Ok(__FieldTag::__reschedule),
18279                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18280                        }
18281                    }
18282                }
18283                deserializer.deserialize_identifier(Visitor)
18284            }
18285        }
18286        struct Visitor;
18287        impl<'de> serde::de::Visitor<'de> for Visitor {
18288            type Value = SqlInstancesRescheduleMaintenanceRequestBody;
18289            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18290                formatter.write_str("struct SqlInstancesRescheduleMaintenanceRequestBody")
18291            }
18292            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18293            where
18294                A: serde::de::MapAccess<'de>,
18295            {
18296                #[allow(unused_imports)]
18297                use serde::de::Error;
18298                use std::option::Option::Some;
18299                let mut fields = std::collections::HashSet::new();
18300                let mut result = Self::Value::new();
18301                while let Some(tag) = map.next_key::<__FieldTag>()? {
18302                    #[allow(clippy::match_single_binding)]
18303                    match tag {
18304                        __FieldTag::__reschedule => {
18305                            if !fields.insert(__FieldTag::__reschedule) {
18306                                return std::result::Result::Err(A::Error::duplicate_field(
18307                                    "multiple values for reschedule",
18308                                ));
18309                            }
18310                            result.reschedule = map.next_value::<std::option::Option<crate::model::sql_instances_reschedule_maintenance_request_body::Reschedule>>()?
18311                                ;
18312                        }
18313                        __FieldTag::Unknown(key) => {
18314                            let value = map.next_value::<serde_json::Value>()?;
18315                            result._unknown_fields.insert(key, value);
18316                        }
18317                    }
18318                }
18319                std::result::Result::Ok(result)
18320            }
18321        }
18322        deserializer.deserialize_any(Visitor)
18323    }
18324}
18325
18326#[doc(hidden)]
18327impl serde::ser::Serialize for SqlInstancesRescheduleMaintenanceRequestBody {
18328    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18329    where
18330        S: serde::ser::Serializer,
18331    {
18332        use serde::ser::SerializeMap;
18333        #[allow(unused_imports)]
18334        use std::option::Option::Some;
18335        let mut state = serializer.serialize_map(std::option::Option::None)?;
18336        if self.reschedule.is_some() {
18337            state.serialize_entry("reschedule", &self.reschedule)?;
18338        }
18339        if !self._unknown_fields.is_empty() {
18340            for (key, value) in self._unknown_fields.iter() {
18341                state.serialize_entry(key, &value)?;
18342            }
18343        }
18344        state.end()
18345    }
18346}
18347
18348/// Defines additional types related to [SqlInstancesRescheduleMaintenanceRequestBody].
18349pub mod sql_instances_reschedule_maintenance_request_body {
18350    #[allow(unused_imports)]
18351    use super::*;
18352
18353    #[derive(Clone, Debug, Default, PartialEq)]
18354    #[non_exhaustive]
18355    pub struct Reschedule {
18356        /// Required. The type of the reschedule.
18357        pub reschedule_type:
18358            crate::model::sql_instances_reschedule_maintenance_request_body::RescheduleType,
18359
18360        /// Optional. Timestamp when the maintenance shall be rescheduled to if
18361        /// reschedule_type=SPECIFIC_TIME, in
18362        /// [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example
18363        /// `2012-11-15T16:19:00.094Z`.
18364        pub schedule_time: std::option::Option<wkt::Timestamp>,
18365
18366        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18367    }
18368
18369    impl Reschedule {
18370        pub fn new() -> Self {
18371            std::default::Default::default()
18372        }
18373
18374        /// Sets the value of [reschedule_type][crate::model::sql_instances_reschedule_maintenance_request_body::Reschedule::reschedule_type].
18375        pub fn set_reschedule_type<
18376            T: std::convert::Into<
18377                    crate::model::sql_instances_reschedule_maintenance_request_body::RescheduleType,
18378                >,
18379        >(
18380            mut self,
18381            v: T,
18382        ) -> Self {
18383            self.reschedule_type = v.into();
18384            self
18385        }
18386
18387        /// Sets the value of [schedule_time][crate::model::sql_instances_reschedule_maintenance_request_body::Reschedule::schedule_time].
18388        pub fn set_schedule_time<T>(mut self, v: T) -> Self
18389        where
18390            T: std::convert::Into<wkt::Timestamp>,
18391        {
18392            self.schedule_time = std::option::Option::Some(v.into());
18393            self
18394        }
18395
18396        /// Sets or clears the value of [schedule_time][crate::model::sql_instances_reschedule_maintenance_request_body::Reschedule::schedule_time].
18397        pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
18398        where
18399            T: std::convert::Into<wkt::Timestamp>,
18400        {
18401            self.schedule_time = v.map(|x| x.into());
18402            self
18403        }
18404    }
18405
18406    impl wkt::message::Message for Reschedule {
18407        fn typename() -> &'static str {
18408            "type.googleapis.com/google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule"
18409        }
18410    }
18411
18412    #[doc(hidden)]
18413    impl<'de> serde::de::Deserialize<'de> for Reschedule {
18414        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18415        where
18416            D: serde::Deserializer<'de>,
18417        {
18418            #[allow(non_camel_case_types)]
18419            #[doc(hidden)]
18420            #[derive(PartialEq, Eq, Hash)]
18421            enum __FieldTag {
18422                __reschedule_type,
18423                __schedule_time,
18424                Unknown(std::string::String),
18425            }
18426            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18427                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18428                where
18429                    D: serde::Deserializer<'de>,
18430                {
18431                    struct Visitor;
18432                    impl<'de> serde::de::Visitor<'de> for Visitor {
18433                        type Value = __FieldTag;
18434                        fn expecting(
18435                            &self,
18436                            formatter: &mut std::fmt::Formatter,
18437                        ) -> std::fmt::Result {
18438                            formatter.write_str("a field name for Reschedule")
18439                        }
18440                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18441                        where
18442                            E: serde::de::Error,
18443                        {
18444                            use std::result::Result::Ok;
18445                            use std::string::ToString;
18446                            match value {
18447                                "rescheduleType" => Ok(__FieldTag::__reschedule_type),
18448                                "reschedule_type" => Ok(__FieldTag::__reschedule_type),
18449                                "scheduleTime" => Ok(__FieldTag::__schedule_time),
18450                                "schedule_time" => Ok(__FieldTag::__schedule_time),
18451                                _ => Ok(__FieldTag::Unknown(value.to_string())),
18452                            }
18453                        }
18454                    }
18455                    deserializer.deserialize_identifier(Visitor)
18456                }
18457            }
18458            struct Visitor;
18459            impl<'de> serde::de::Visitor<'de> for Visitor {
18460                type Value = Reschedule;
18461                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18462                    formatter.write_str("struct Reschedule")
18463                }
18464                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18465                where
18466                    A: serde::de::MapAccess<'de>,
18467                {
18468                    #[allow(unused_imports)]
18469                    use serde::de::Error;
18470                    use std::option::Option::Some;
18471                    let mut fields = std::collections::HashSet::new();
18472                    let mut result = Self::Value::new();
18473                    while let Some(tag) = map.next_key::<__FieldTag>()? {
18474                        #[allow(clippy::match_single_binding)]
18475                        match tag {
18476                            __FieldTag::__reschedule_type => {
18477                                if !fields.insert(__FieldTag::__reschedule_type) {
18478                                    return std::result::Result::Err(A::Error::duplicate_field(
18479                                        "multiple values for reschedule_type",
18480                                    ));
18481                                }
18482                                result.reschedule_type = map.next_value::<std::option::Option<crate::model::sql_instances_reschedule_maintenance_request_body::RescheduleType>>()?.unwrap_or_default();
18483                            }
18484                            __FieldTag::__schedule_time => {
18485                                if !fields.insert(__FieldTag::__schedule_time) {
18486                                    return std::result::Result::Err(A::Error::duplicate_field(
18487                                        "multiple values for schedule_time",
18488                                    ));
18489                                }
18490                                result.schedule_time =
18491                                    map.next_value::<std::option::Option<wkt::Timestamp>>()?;
18492                            }
18493                            __FieldTag::Unknown(key) => {
18494                                let value = map.next_value::<serde_json::Value>()?;
18495                                result._unknown_fields.insert(key, value);
18496                            }
18497                        }
18498                    }
18499                    std::result::Result::Ok(result)
18500                }
18501            }
18502            deserializer.deserialize_any(Visitor)
18503        }
18504    }
18505
18506    #[doc(hidden)]
18507    impl serde::ser::Serialize for Reschedule {
18508        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18509        where
18510            S: serde::ser::Serializer,
18511        {
18512            use serde::ser::SerializeMap;
18513            #[allow(unused_imports)]
18514            use std::option::Option::Some;
18515            let mut state = serializer.serialize_map(std::option::Option::None)?;
18516            if !wkt::internal::is_default(&self.reschedule_type) {
18517                state.serialize_entry("rescheduleType", &self.reschedule_type)?;
18518            }
18519            if self.schedule_time.is_some() {
18520                state.serialize_entry("scheduleTime", &self.schedule_time)?;
18521            }
18522            if !self._unknown_fields.is_empty() {
18523                for (key, value) in self._unknown_fields.iter() {
18524                    state.serialize_entry(key, &value)?;
18525                }
18526            }
18527            state.end()
18528        }
18529    }
18530
18531    ///
18532    /// # Working with unknown values
18533    ///
18534    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18535    /// additional enum variants at any time. Adding new variants is not considered
18536    /// a breaking change. Applications should write their code in anticipation of:
18537    ///
18538    /// - New values appearing in future releases of the client library, **and**
18539    /// - New values received dynamically, without application changes.
18540    ///
18541    /// Please consult the [Working with enums] section in the user guide for some
18542    /// guidelines.
18543    ///
18544    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
18545    #[derive(Clone, Debug, PartialEq)]
18546    #[non_exhaustive]
18547    pub enum RescheduleType {
18548        Unspecified,
18549        /// Reschedules maintenance to happen now (within 5 minutes).
18550        Immediate,
18551        /// Reschedules maintenance to occur within one week from the originally
18552        /// scheduled day and time.
18553        NextAvailableWindow,
18554        /// Reschedules maintenance to a specific time and day.
18555        SpecificTime,
18556        /// If set, the enum was initialized with an unknown value.
18557        ///
18558        /// Applications can examine the value using [RescheduleType::value] or
18559        /// [RescheduleType::name].
18560        UnknownValue(reschedule_type::UnknownValue),
18561    }
18562
18563    #[doc(hidden)]
18564    pub mod reschedule_type {
18565        #[allow(unused_imports)]
18566        use super::*;
18567        #[derive(Clone, Debug, PartialEq)]
18568        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18569    }
18570
18571    impl RescheduleType {
18572        /// Gets the enum value.
18573        ///
18574        /// Returns `None` if the enum contains an unknown value deserialized from
18575        /// the string representation of enums.
18576        pub fn value(&self) -> std::option::Option<i32> {
18577            match self {
18578                Self::Unspecified => std::option::Option::Some(0),
18579                Self::Immediate => std::option::Option::Some(1),
18580                Self::NextAvailableWindow => std::option::Option::Some(2),
18581                Self::SpecificTime => std::option::Option::Some(3),
18582                Self::UnknownValue(u) => u.0.value(),
18583            }
18584        }
18585
18586        /// Gets the enum value as a string.
18587        ///
18588        /// Returns `None` if the enum contains an unknown value deserialized from
18589        /// the integer representation of enums.
18590        pub fn name(&self) -> std::option::Option<&str> {
18591            match self {
18592                Self::Unspecified => std::option::Option::Some("RESCHEDULE_TYPE_UNSPECIFIED"),
18593                Self::Immediate => std::option::Option::Some("IMMEDIATE"),
18594                Self::NextAvailableWindow => std::option::Option::Some("NEXT_AVAILABLE_WINDOW"),
18595                Self::SpecificTime => std::option::Option::Some("SPECIFIC_TIME"),
18596                Self::UnknownValue(u) => u.0.name(),
18597            }
18598        }
18599    }
18600
18601    impl std::default::Default for RescheduleType {
18602        fn default() -> Self {
18603            use std::convert::From;
18604            Self::from(0)
18605        }
18606    }
18607
18608    impl std::fmt::Display for RescheduleType {
18609        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
18610            wkt::internal::display_enum(f, self.name(), self.value())
18611        }
18612    }
18613
18614    impl std::convert::From<i32> for RescheduleType {
18615        fn from(value: i32) -> Self {
18616            match value {
18617                0 => Self::Unspecified,
18618                1 => Self::Immediate,
18619                2 => Self::NextAvailableWindow,
18620                3 => Self::SpecificTime,
18621                _ => Self::UnknownValue(reschedule_type::UnknownValue(
18622                    wkt::internal::UnknownEnumValue::Integer(value),
18623                )),
18624            }
18625        }
18626    }
18627
18628    impl std::convert::From<&str> for RescheduleType {
18629        fn from(value: &str) -> Self {
18630            use std::string::ToString;
18631            match value {
18632                "RESCHEDULE_TYPE_UNSPECIFIED" => Self::Unspecified,
18633                "IMMEDIATE" => Self::Immediate,
18634                "NEXT_AVAILABLE_WINDOW" => Self::NextAvailableWindow,
18635                "SPECIFIC_TIME" => Self::SpecificTime,
18636                _ => Self::UnknownValue(reschedule_type::UnknownValue(
18637                    wkt::internal::UnknownEnumValue::String(value.to_string()),
18638                )),
18639            }
18640        }
18641    }
18642
18643    impl serde::ser::Serialize for RescheduleType {
18644        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18645        where
18646            S: serde::Serializer,
18647        {
18648            match self {
18649                Self::Unspecified => serializer.serialize_i32(0),
18650                Self::Immediate => serializer.serialize_i32(1),
18651                Self::NextAvailableWindow => serializer.serialize_i32(2),
18652                Self::SpecificTime => serializer.serialize_i32(3),
18653                Self::UnknownValue(u) => u.0.serialize(serializer),
18654            }
18655        }
18656    }
18657
18658    impl<'de> serde::de::Deserialize<'de> for RescheduleType {
18659        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18660        where
18661            D: serde::Deserializer<'de>,
18662        {
18663            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RescheduleType>::new(
18664                ".google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType",
18665            ))
18666        }
18667    }
18668}
18669
18670/// Database instance demote primary instance context.
18671#[derive(Clone, Debug, Default, PartialEq)]
18672#[non_exhaustive]
18673pub struct DemoteMasterContext {
18674    /// This is always `sql#demoteMasterContext`.
18675    pub kind: std::string::String,
18676
18677    /// Verify the GTID consistency for demote operation. Default value:
18678    /// `True`. Setting this flag to `false` enables you to bypass the GTID
18679    /// consistency check between on-premises primary instance and Cloud SQL
18680    /// instance during the demotion operation but also exposes you to the risk of
18681    /// future replication failures. Change the value only if you know the reason
18682    /// for the GTID divergence and are confident that doing so will not cause any
18683    /// replication issues.
18684    pub verify_gtid_consistency: std::option::Option<wkt::BoolValue>,
18685
18686    /// The name of the instance which will act as on-premises primary instance
18687    /// in the replication setup.
18688    pub master_instance_name: std::string::String,
18689
18690    /// Configuration specific to read-replicas replicating from the on-premises
18691    /// primary instance.
18692    pub replica_configuration: std::option::Option<crate::model::DemoteMasterConfiguration>,
18693
18694    /// Flag to skip replication setup on the instance.
18695    pub skip_replication_setup: bool,
18696
18697    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18698}
18699
18700impl DemoteMasterContext {
18701    pub fn new() -> Self {
18702        std::default::Default::default()
18703    }
18704
18705    /// Sets the value of [kind][crate::model::DemoteMasterContext::kind].
18706    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18707        self.kind = v.into();
18708        self
18709    }
18710
18711    /// Sets the value of [verify_gtid_consistency][crate::model::DemoteMasterContext::verify_gtid_consistency].
18712    pub fn set_verify_gtid_consistency<T>(mut self, v: T) -> Self
18713    where
18714        T: std::convert::Into<wkt::BoolValue>,
18715    {
18716        self.verify_gtid_consistency = std::option::Option::Some(v.into());
18717        self
18718    }
18719
18720    /// Sets or clears the value of [verify_gtid_consistency][crate::model::DemoteMasterContext::verify_gtid_consistency].
18721    pub fn set_or_clear_verify_gtid_consistency<T>(mut self, v: std::option::Option<T>) -> Self
18722    where
18723        T: std::convert::Into<wkt::BoolValue>,
18724    {
18725        self.verify_gtid_consistency = v.map(|x| x.into());
18726        self
18727    }
18728
18729    /// Sets the value of [master_instance_name][crate::model::DemoteMasterContext::master_instance_name].
18730    pub fn set_master_instance_name<T: std::convert::Into<std::string::String>>(
18731        mut self,
18732        v: T,
18733    ) -> Self {
18734        self.master_instance_name = v.into();
18735        self
18736    }
18737
18738    /// Sets the value of [replica_configuration][crate::model::DemoteMasterContext::replica_configuration].
18739    pub fn set_replica_configuration<T>(mut self, v: T) -> Self
18740    where
18741        T: std::convert::Into<crate::model::DemoteMasterConfiguration>,
18742    {
18743        self.replica_configuration = std::option::Option::Some(v.into());
18744        self
18745    }
18746
18747    /// Sets or clears the value of [replica_configuration][crate::model::DemoteMasterContext::replica_configuration].
18748    pub fn set_or_clear_replica_configuration<T>(mut self, v: std::option::Option<T>) -> Self
18749    where
18750        T: std::convert::Into<crate::model::DemoteMasterConfiguration>,
18751    {
18752        self.replica_configuration = v.map(|x| x.into());
18753        self
18754    }
18755
18756    /// Sets the value of [skip_replication_setup][crate::model::DemoteMasterContext::skip_replication_setup].
18757    pub fn set_skip_replication_setup<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18758        self.skip_replication_setup = v.into();
18759        self
18760    }
18761}
18762
18763impl wkt::message::Message for DemoteMasterContext {
18764    fn typename() -> &'static str {
18765        "type.googleapis.com/google.cloud.sql.v1.DemoteMasterContext"
18766    }
18767}
18768
18769#[doc(hidden)]
18770impl<'de> serde::de::Deserialize<'de> for DemoteMasterContext {
18771    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18772    where
18773        D: serde::Deserializer<'de>,
18774    {
18775        #[allow(non_camel_case_types)]
18776        #[doc(hidden)]
18777        #[derive(PartialEq, Eq, Hash)]
18778        enum __FieldTag {
18779            __kind,
18780            __verify_gtid_consistency,
18781            __master_instance_name,
18782            __replica_configuration,
18783            __skip_replication_setup,
18784            Unknown(std::string::String),
18785        }
18786        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18787            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18788            where
18789                D: serde::Deserializer<'de>,
18790            {
18791                struct Visitor;
18792                impl<'de> serde::de::Visitor<'de> for Visitor {
18793                    type Value = __FieldTag;
18794                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18795                        formatter.write_str("a field name for DemoteMasterContext")
18796                    }
18797                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18798                    where
18799                        E: serde::de::Error,
18800                    {
18801                        use std::result::Result::Ok;
18802                        use std::string::ToString;
18803                        match value {
18804                            "kind" => Ok(__FieldTag::__kind),
18805                            "verifyGtidConsistency" => Ok(__FieldTag::__verify_gtid_consistency),
18806                            "verify_gtid_consistency" => Ok(__FieldTag::__verify_gtid_consistency),
18807                            "masterInstanceName" => Ok(__FieldTag::__master_instance_name),
18808                            "master_instance_name" => Ok(__FieldTag::__master_instance_name),
18809                            "replicaConfiguration" => Ok(__FieldTag::__replica_configuration),
18810                            "replica_configuration" => Ok(__FieldTag::__replica_configuration),
18811                            "skipReplicationSetup" => Ok(__FieldTag::__skip_replication_setup),
18812                            "skip_replication_setup" => Ok(__FieldTag::__skip_replication_setup),
18813                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18814                        }
18815                    }
18816                }
18817                deserializer.deserialize_identifier(Visitor)
18818            }
18819        }
18820        struct Visitor;
18821        impl<'de> serde::de::Visitor<'de> for Visitor {
18822            type Value = DemoteMasterContext;
18823            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18824                formatter.write_str("struct DemoteMasterContext")
18825            }
18826            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18827            where
18828                A: serde::de::MapAccess<'de>,
18829            {
18830                #[allow(unused_imports)]
18831                use serde::de::Error;
18832                use std::option::Option::Some;
18833                let mut fields = std::collections::HashSet::new();
18834                let mut result = Self::Value::new();
18835                while let Some(tag) = map.next_key::<__FieldTag>()? {
18836                    #[allow(clippy::match_single_binding)]
18837                    match tag {
18838                        __FieldTag::__kind => {
18839                            if !fields.insert(__FieldTag::__kind) {
18840                                return std::result::Result::Err(A::Error::duplicate_field(
18841                                    "multiple values for kind",
18842                                ));
18843                            }
18844                            result.kind = map
18845                                .next_value::<std::option::Option<std::string::String>>()?
18846                                .unwrap_or_default();
18847                        }
18848                        __FieldTag::__verify_gtid_consistency => {
18849                            if !fields.insert(__FieldTag::__verify_gtid_consistency) {
18850                                return std::result::Result::Err(A::Error::duplicate_field(
18851                                    "multiple values for verify_gtid_consistency",
18852                                ));
18853                            }
18854                            result.verify_gtid_consistency =
18855                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
18856                        }
18857                        __FieldTag::__master_instance_name => {
18858                            if !fields.insert(__FieldTag::__master_instance_name) {
18859                                return std::result::Result::Err(A::Error::duplicate_field(
18860                                    "multiple values for master_instance_name",
18861                                ));
18862                            }
18863                            result.master_instance_name = map
18864                                .next_value::<std::option::Option<std::string::String>>()?
18865                                .unwrap_or_default();
18866                        }
18867                        __FieldTag::__replica_configuration => {
18868                            if !fields.insert(__FieldTag::__replica_configuration) {
18869                                return std::result::Result::Err(A::Error::duplicate_field(
18870                                    "multiple values for replica_configuration",
18871                                ));
18872                            }
18873                            result.replica_configuration = map.next_value::<std::option::Option<crate::model::DemoteMasterConfiguration>>()?
18874                                ;
18875                        }
18876                        __FieldTag::__skip_replication_setup => {
18877                            if !fields.insert(__FieldTag::__skip_replication_setup) {
18878                                return std::result::Result::Err(A::Error::duplicate_field(
18879                                    "multiple values for skip_replication_setup",
18880                                ));
18881                            }
18882                            result.skip_replication_setup = map
18883                                .next_value::<std::option::Option<bool>>()?
18884                                .unwrap_or_default();
18885                        }
18886                        __FieldTag::Unknown(key) => {
18887                            let value = map.next_value::<serde_json::Value>()?;
18888                            result._unknown_fields.insert(key, value);
18889                        }
18890                    }
18891                }
18892                std::result::Result::Ok(result)
18893            }
18894        }
18895        deserializer.deserialize_any(Visitor)
18896    }
18897}
18898
18899#[doc(hidden)]
18900impl serde::ser::Serialize for DemoteMasterContext {
18901    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18902    where
18903        S: serde::ser::Serializer,
18904    {
18905        use serde::ser::SerializeMap;
18906        #[allow(unused_imports)]
18907        use std::option::Option::Some;
18908        let mut state = serializer.serialize_map(std::option::Option::None)?;
18909        if !self.kind.is_empty() {
18910            state.serialize_entry("kind", &self.kind)?;
18911        }
18912        if self.verify_gtid_consistency.is_some() {
18913            state.serialize_entry("verifyGtidConsistency", &self.verify_gtid_consistency)?;
18914        }
18915        if !self.master_instance_name.is_empty() {
18916            state.serialize_entry("masterInstanceName", &self.master_instance_name)?;
18917        }
18918        if self.replica_configuration.is_some() {
18919            state.serialize_entry("replicaConfiguration", &self.replica_configuration)?;
18920        }
18921        if !wkt::internal::is_default(&self.skip_replication_setup) {
18922            state.serialize_entry("skipReplicationSetup", &self.skip_replication_setup)?;
18923        }
18924        if !self._unknown_fields.is_empty() {
18925            for (key, value) in self._unknown_fields.iter() {
18926                state.serialize_entry(key, &value)?;
18927            }
18928        }
18929        state.end()
18930    }
18931}
18932
18933/// This context is used to demote an existing standalone instance to be
18934/// a Cloud SQL read replica for an external database server.
18935#[derive(Clone, Debug, Default, PartialEq)]
18936#[non_exhaustive]
18937pub struct DemoteContext {
18938    /// This is always `sql#demoteContext`.
18939    pub kind: std::string::String,
18940
18941    /// Required. The name of the instance which acts as the on-premises primary
18942    /// instance in the replication setup.
18943    pub source_representative_instance_name: std::string::String,
18944
18945    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18946}
18947
18948impl DemoteContext {
18949    pub fn new() -> Self {
18950        std::default::Default::default()
18951    }
18952
18953    /// Sets the value of [kind][crate::model::DemoteContext::kind].
18954    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18955        self.kind = v.into();
18956        self
18957    }
18958
18959    /// Sets the value of [source_representative_instance_name][crate::model::DemoteContext::source_representative_instance_name].
18960    pub fn set_source_representative_instance_name<T: std::convert::Into<std::string::String>>(
18961        mut self,
18962        v: T,
18963    ) -> Self {
18964        self.source_representative_instance_name = v.into();
18965        self
18966    }
18967}
18968
18969impl wkt::message::Message for DemoteContext {
18970    fn typename() -> &'static str {
18971        "type.googleapis.com/google.cloud.sql.v1.DemoteContext"
18972    }
18973}
18974
18975#[doc(hidden)]
18976impl<'de> serde::de::Deserialize<'de> for DemoteContext {
18977    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18978    where
18979        D: serde::Deserializer<'de>,
18980    {
18981        #[allow(non_camel_case_types)]
18982        #[doc(hidden)]
18983        #[derive(PartialEq, Eq, Hash)]
18984        enum __FieldTag {
18985            __kind,
18986            __source_representative_instance_name,
18987            Unknown(std::string::String),
18988        }
18989        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18990            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18991            where
18992                D: serde::Deserializer<'de>,
18993            {
18994                struct Visitor;
18995                impl<'de> serde::de::Visitor<'de> for Visitor {
18996                    type Value = __FieldTag;
18997                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18998                        formatter.write_str("a field name for DemoteContext")
18999                    }
19000                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19001                    where
19002                        E: serde::de::Error,
19003                    {
19004                        use std::result::Result::Ok;
19005                        use std::string::ToString;
19006                        match value {
19007                            "kind" => Ok(__FieldTag::__kind),
19008                            "sourceRepresentativeInstanceName" => {
19009                                Ok(__FieldTag::__source_representative_instance_name)
19010                            }
19011                            "source_representative_instance_name" => {
19012                                Ok(__FieldTag::__source_representative_instance_name)
19013                            }
19014                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19015                        }
19016                    }
19017                }
19018                deserializer.deserialize_identifier(Visitor)
19019            }
19020        }
19021        struct Visitor;
19022        impl<'de> serde::de::Visitor<'de> for Visitor {
19023            type Value = DemoteContext;
19024            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19025                formatter.write_str("struct DemoteContext")
19026            }
19027            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19028            where
19029                A: serde::de::MapAccess<'de>,
19030            {
19031                #[allow(unused_imports)]
19032                use serde::de::Error;
19033                use std::option::Option::Some;
19034                let mut fields = std::collections::HashSet::new();
19035                let mut result = Self::Value::new();
19036                while let Some(tag) = map.next_key::<__FieldTag>()? {
19037                    #[allow(clippy::match_single_binding)]
19038                    match tag {
19039                        __FieldTag::__kind => {
19040                            if !fields.insert(__FieldTag::__kind) {
19041                                return std::result::Result::Err(A::Error::duplicate_field(
19042                                    "multiple values for kind",
19043                                ));
19044                            }
19045                            result.kind = map
19046                                .next_value::<std::option::Option<std::string::String>>()?
19047                                .unwrap_or_default();
19048                        }
19049                        __FieldTag::__source_representative_instance_name => {
19050                            if !fields.insert(__FieldTag::__source_representative_instance_name) {
19051                                return std::result::Result::Err(A::Error::duplicate_field(
19052                                    "multiple values for source_representative_instance_name",
19053                                ));
19054                            }
19055                            result.source_representative_instance_name = map
19056                                .next_value::<std::option::Option<std::string::String>>()?
19057                                .unwrap_or_default();
19058                        }
19059                        __FieldTag::Unknown(key) => {
19060                            let value = map.next_value::<serde_json::Value>()?;
19061                            result._unknown_fields.insert(key, value);
19062                        }
19063                    }
19064                }
19065                std::result::Result::Ok(result)
19066            }
19067        }
19068        deserializer.deserialize_any(Visitor)
19069    }
19070}
19071
19072#[doc(hidden)]
19073impl serde::ser::Serialize for DemoteContext {
19074    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19075    where
19076        S: serde::ser::Serializer,
19077    {
19078        use serde::ser::SerializeMap;
19079        #[allow(unused_imports)]
19080        use std::option::Option::Some;
19081        let mut state = serializer.serialize_map(std::option::Option::None)?;
19082        if !self.kind.is_empty() {
19083            state.serialize_entry("kind", &self.kind)?;
19084        }
19085        if !self.source_representative_instance_name.is_empty() {
19086            state.serialize_entry(
19087                "sourceRepresentativeInstanceName",
19088                &self.source_representative_instance_name,
19089            )?;
19090        }
19091        if !self._unknown_fields.is_empty() {
19092            for (key, value) in self._unknown_fields.iter() {
19093                state.serialize_entry(key, &value)?;
19094            }
19095        }
19096        state.end()
19097    }
19098}
19099
19100/// Database instance failover context.
19101#[derive(Clone, Debug, Default, PartialEq)]
19102#[non_exhaustive]
19103pub struct FailoverContext {
19104    /// The current settings version of this instance. Request will be rejected if
19105    /// this version doesn't match the current settings version.
19106    pub settings_version: i64,
19107
19108    /// This is always `sql#failoverContext`.
19109    pub kind: std::string::String,
19110
19111    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19112}
19113
19114impl FailoverContext {
19115    pub fn new() -> Self {
19116        std::default::Default::default()
19117    }
19118
19119    /// Sets the value of [settings_version][crate::model::FailoverContext::settings_version].
19120    pub fn set_settings_version<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19121        self.settings_version = v.into();
19122        self
19123    }
19124
19125    /// Sets the value of [kind][crate::model::FailoverContext::kind].
19126    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19127        self.kind = v.into();
19128        self
19129    }
19130}
19131
19132impl wkt::message::Message for FailoverContext {
19133    fn typename() -> &'static str {
19134        "type.googleapis.com/google.cloud.sql.v1.FailoverContext"
19135    }
19136}
19137
19138#[doc(hidden)]
19139impl<'de> serde::de::Deserialize<'de> for FailoverContext {
19140    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19141    where
19142        D: serde::Deserializer<'de>,
19143    {
19144        #[allow(non_camel_case_types)]
19145        #[doc(hidden)]
19146        #[derive(PartialEq, Eq, Hash)]
19147        enum __FieldTag {
19148            __settings_version,
19149            __kind,
19150            Unknown(std::string::String),
19151        }
19152        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
19153            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19154            where
19155                D: serde::Deserializer<'de>,
19156            {
19157                struct Visitor;
19158                impl<'de> serde::de::Visitor<'de> for Visitor {
19159                    type Value = __FieldTag;
19160                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19161                        formatter.write_str("a field name for FailoverContext")
19162                    }
19163                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19164                    where
19165                        E: serde::de::Error,
19166                    {
19167                        use std::result::Result::Ok;
19168                        use std::string::ToString;
19169                        match value {
19170                            "settingsVersion" => Ok(__FieldTag::__settings_version),
19171                            "settings_version" => Ok(__FieldTag::__settings_version),
19172                            "kind" => Ok(__FieldTag::__kind),
19173                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19174                        }
19175                    }
19176                }
19177                deserializer.deserialize_identifier(Visitor)
19178            }
19179        }
19180        struct Visitor;
19181        impl<'de> serde::de::Visitor<'de> for Visitor {
19182            type Value = FailoverContext;
19183            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19184                formatter.write_str("struct FailoverContext")
19185            }
19186            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19187            where
19188                A: serde::de::MapAccess<'de>,
19189            {
19190                #[allow(unused_imports)]
19191                use serde::de::Error;
19192                use std::option::Option::Some;
19193                let mut fields = std::collections::HashSet::new();
19194                let mut result = Self::Value::new();
19195                while let Some(tag) = map.next_key::<__FieldTag>()? {
19196                    #[allow(clippy::match_single_binding)]
19197                    match tag {
19198                        __FieldTag::__settings_version => {
19199                            if !fields.insert(__FieldTag::__settings_version) {
19200                                return std::result::Result::Err(A::Error::duplicate_field(
19201                                    "multiple values for settings_version",
19202                                ));
19203                            }
19204                            struct __With(std::option::Option<i64>);
19205                            impl<'de> serde::de::Deserialize<'de> for __With {
19206                                fn deserialize<D>(
19207                                    deserializer: D,
19208                                ) -> std::result::Result<Self, D::Error>
19209                                where
19210                                    D: serde::de::Deserializer<'de>,
19211                                {
19212                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
19213                                }
19214                            }
19215                            result.settings_version =
19216                                map.next_value::<__With>()?.0.unwrap_or_default();
19217                        }
19218                        __FieldTag::__kind => {
19219                            if !fields.insert(__FieldTag::__kind) {
19220                                return std::result::Result::Err(A::Error::duplicate_field(
19221                                    "multiple values for kind",
19222                                ));
19223                            }
19224                            result.kind = map
19225                                .next_value::<std::option::Option<std::string::String>>()?
19226                                .unwrap_or_default();
19227                        }
19228                        __FieldTag::Unknown(key) => {
19229                            let value = map.next_value::<serde_json::Value>()?;
19230                            result._unknown_fields.insert(key, value);
19231                        }
19232                    }
19233                }
19234                std::result::Result::Ok(result)
19235            }
19236        }
19237        deserializer.deserialize_any(Visitor)
19238    }
19239}
19240
19241#[doc(hidden)]
19242impl serde::ser::Serialize for FailoverContext {
19243    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19244    where
19245        S: serde::ser::Serializer,
19246    {
19247        use serde::ser::SerializeMap;
19248        #[allow(unused_imports)]
19249        use std::option::Option::Some;
19250        let mut state = serializer.serialize_map(std::option::Option::None)?;
19251        if !wkt::internal::is_default(&self.settings_version) {
19252            struct __With<'a>(&'a i64);
19253            impl<'a> serde::ser::Serialize for __With<'a> {
19254                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19255                where
19256                    S: serde::ser::Serializer,
19257                {
19258                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
19259                }
19260            }
19261            state.serialize_entry("settingsVersion", &__With(&self.settings_version))?;
19262        }
19263        if !self.kind.is_empty() {
19264            state.serialize_entry("kind", &self.kind)?;
19265        }
19266        if !self._unknown_fields.is_empty() {
19267            for (key, value) in self._unknown_fields.iter() {
19268                state.serialize_entry(key, &value)?;
19269            }
19270        }
19271        state.end()
19272    }
19273}
19274
19275/// Database instance restore from backup context.
19276/// Backup context contains source instance id and project id.
19277#[derive(Clone, Debug, Default, PartialEq)]
19278#[non_exhaustive]
19279pub struct RestoreBackupContext {
19280    /// This is always `sql#restoreBackupContext`.
19281    pub kind: std::string::String,
19282
19283    /// The ID of the backup run to restore from.
19284    pub backup_run_id: i64,
19285
19286    /// The ID of the instance that the backup was taken from.
19287    pub instance_id: std::string::String,
19288
19289    /// The full project ID of the source instance.
19290    pub project: std::string::String,
19291
19292    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19293}
19294
19295impl RestoreBackupContext {
19296    pub fn new() -> Self {
19297        std::default::Default::default()
19298    }
19299
19300    /// Sets the value of [kind][crate::model::RestoreBackupContext::kind].
19301    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19302        self.kind = v.into();
19303        self
19304    }
19305
19306    /// Sets the value of [backup_run_id][crate::model::RestoreBackupContext::backup_run_id].
19307    pub fn set_backup_run_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19308        self.backup_run_id = v.into();
19309        self
19310    }
19311
19312    /// Sets the value of [instance_id][crate::model::RestoreBackupContext::instance_id].
19313    pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19314        self.instance_id = v.into();
19315        self
19316    }
19317
19318    /// Sets the value of [project][crate::model::RestoreBackupContext::project].
19319    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19320        self.project = v.into();
19321        self
19322    }
19323}
19324
19325impl wkt::message::Message for RestoreBackupContext {
19326    fn typename() -> &'static str {
19327        "type.googleapis.com/google.cloud.sql.v1.RestoreBackupContext"
19328    }
19329}
19330
19331#[doc(hidden)]
19332impl<'de> serde::de::Deserialize<'de> for RestoreBackupContext {
19333    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19334    where
19335        D: serde::Deserializer<'de>,
19336    {
19337        #[allow(non_camel_case_types)]
19338        #[doc(hidden)]
19339        #[derive(PartialEq, Eq, Hash)]
19340        enum __FieldTag {
19341            __kind,
19342            __backup_run_id,
19343            __instance_id,
19344            __project,
19345            Unknown(std::string::String),
19346        }
19347        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
19348            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19349            where
19350                D: serde::Deserializer<'de>,
19351            {
19352                struct Visitor;
19353                impl<'de> serde::de::Visitor<'de> for Visitor {
19354                    type Value = __FieldTag;
19355                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19356                        formatter.write_str("a field name for RestoreBackupContext")
19357                    }
19358                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19359                    where
19360                        E: serde::de::Error,
19361                    {
19362                        use std::result::Result::Ok;
19363                        use std::string::ToString;
19364                        match value {
19365                            "kind" => Ok(__FieldTag::__kind),
19366                            "backupRunId" => Ok(__FieldTag::__backup_run_id),
19367                            "backup_run_id" => Ok(__FieldTag::__backup_run_id),
19368                            "instanceId" => Ok(__FieldTag::__instance_id),
19369                            "instance_id" => Ok(__FieldTag::__instance_id),
19370                            "project" => Ok(__FieldTag::__project),
19371                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19372                        }
19373                    }
19374                }
19375                deserializer.deserialize_identifier(Visitor)
19376            }
19377        }
19378        struct Visitor;
19379        impl<'de> serde::de::Visitor<'de> for Visitor {
19380            type Value = RestoreBackupContext;
19381            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19382                formatter.write_str("struct RestoreBackupContext")
19383            }
19384            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19385            where
19386                A: serde::de::MapAccess<'de>,
19387            {
19388                #[allow(unused_imports)]
19389                use serde::de::Error;
19390                use std::option::Option::Some;
19391                let mut fields = std::collections::HashSet::new();
19392                let mut result = Self::Value::new();
19393                while let Some(tag) = map.next_key::<__FieldTag>()? {
19394                    #[allow(clippy::match_single_binding)]
19395                    match tag {
19396                        __FieldTag::__kind => {
19397                            if !fields.insert(__FieldTag::__kind) {
19398                                return std::result::Result::Err(A::Error::duplicate_field(
19399                                    "multiple values for kind",
19400                                ));
19401                            }
19402                            result.kind = map
19403                                .next_value::<std::option::Option<std::string::String>>()?
19404                                .unwrap_or_default();
19405                        }
19406                        __FieldTag::__backup_run_id => {
19407                            if !fields.insert(__FieldTag::__backup_run_id) {
19408                                return std::result::Result::Err(A::Error::duplicate_field(
19409                                    "multiple values for backup_run_id",
19410                                ));
19411                            }
19412                            struct __With(std::option::Option<i64>);
19413                            impl<'de> serde::de::Deserialize<'de> for __With {
19414                                fn deserialize<D>(
19415                                    deserializer: D,
19416                                ) -> std::result::Result<Self, D::Error>
19417                                where
19418                                    D: serde::de::Deserializer<'de>,
19419                                {
19420                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
19421                                }
19422                            }
19423                            result.backup_run_id =
19424                                map.next_value::<__With>()?.0.unwrap_or_default();
19425                        }
19426                        __FieldTag::__instance_id => {
19427                            if !fields.insert(__FieldTag::__instance_id) {
19428                                return std::result::Result::Err(A::Error::duplicate_field(
19429                                    "multiple values for instance_id",
19430                                ));
19431                            }
19432                            result.instance_id = map
19433                                .next_value::<std::option::Option<std::string::String>>()?
19434                                .unwrap_or_default();
19435                        }
19436                        __FieldTag::__project => {
19437                            if !fields.insert(__FieldTag::__project) {
19438                                return std::result::Result::Err(A::Error::duplicate_field(
19439                                    "multiple values for project",
19440                                ));
19441                            }
19442                            result.project = map
19443                                .next_value::<std::option::Option<std::string::String>>()?
19444                                .unwrap_or_default();
19445                        }
19446                        __FieldTag::Unknown(key) => {
19447                            let value = map.next_value::<serde_json::Value>()?;
19448                            result._unknown_fields.insert(key, value);
19449                        }
19450                    }
19451                }
19452                std::result::Result::Ok(result)
19453            }
19454        }
19455        deserializer.deserialize_any(Visitor)
19456    }
19457}
19458
19459#[doc(hidden)]
19460impl serde::ser::Serialize for RestoreBackupContext {
19461    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19462    where
19463        S: serde::ser::Serializer,
19464    {
19465        use serde::ser::SerializeMap;
19466        #[allow(unused_imports)]
19467        use std::option::Option::Some;
19468        let mut state = serializer.serialize_map(std::option::Option::None)?;
19469        if !self.kind.is_empty() {
19470            state.serialize_entry("kind", &self.kind)?;
19471        }
19472        if !wkt::internal::is_default(&self.backup_run_id) {
19473            struct __With<'a>(&'a i64);
19474            impl<'a> serde::ser::Serialize for __With<'a> {
19475                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19476                where
19477                    S: serde::ser::Serializer,
19478                {
19479                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
19480                }
19481            }
19482            state.serialize_entry("backupRunId", &__With(&self.backup_run_id))?;
19483        }
19484        if !self.instance_id.is_empty() {
19485            state.serialize_entry("instanceId", &self.instance_id)?;
19486        }
19487        if !self.project.is_empty() {
19488            state.serialize_entry("project", &self.project)?;
19489        }
19490        if !self._unknown_fields.is_empty() {
19491            for (key, value) in self._unknown_fields.iter() {
19492                state.serialize_entry(key, &value)?;
19493            }
19494        }
19495        state.end()
19496    }
19497}
19498
19499/// Instance rotate server CA context.
19500#[derive(Clone, Debug, Default, PartialEq)]
19501#[non_exhaustive]
19502pub struct RotateServerCaContext {
19503    /// This is always `sql#rotateServerCaContext`.
19504    pub kind: std::string::String,
19505
19506    /// The fingerprint of the next version to be rotated to. If left unspecified,
19507    /// will be rotated to the most recently added server CA version.
19508    pub next_version: std::string::String,
19509
19510    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19511}
19512
19513impl RotateServerCaContext {
19514    pub fn new() -> Self {
19515        std::default::Default::default()
19516    }
19517
19518    /// Sets the value of [kind][crate::model::RotateServerCaContext::kind].
19519    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19520        self.kind = v.into();
19521        self
19522    }
19523
19524    /// Sets the value of [next_version][crate::model::RotateServerCaContext::next_version].
19525    pub fn set_next_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19526        self.next_version = v.into();
19527        self
19528    }
19529}
19530
19531impl wkt::message::Message for RotateServerCaContext {
19532    fn typename() -> &'static str {
19533        "type.googleapis.com/google.cloud.sql.v1.RotateServerCaContext"
19534    }
19535}
19536
19537#[doc(hidden)]
19538impl<'de> serde::de::Deserialize<'de> for RotateServerCaContext {
19539    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19540    where
19541        D: serde::Deserializer<'de>,
19542    {
19543        #[allow(non_camel_case_types)]
19544        #[doc(hidden)]
19545        #[derive(PartialEq, Eq, Hash)]
19546        enum __FieldTag {
19547            __kind,
19548            __next_version,
19549            Unknown(std::string::String),
19550        }
19551        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
19552            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19553            where
19554                D: serde::Deserializer<'de>,
19555            {
19556                struct Visitor;
19557                impl<'de> serde::de::Visitor<'de> for Visitor {
19558                    type Value = __FieldTag;
19559                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19560                        formatter.write_str("a field name for RotateServerCaContext")
19561                    }
19562                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19563                    where
19564                        E: serde::de::Error,
19565                    {
19566                        use std::result::Result::Ok;
19567                        use std::string::ToString;
19568                        match value {
19569                            "kind" => Ok(__FieldTag::__kind),
19570                            "nextVersion" => Ok(__FieldTag::__next_version),
19571                            "next_version" => Ok(__FieldTag::__next_version),
19572                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19573                        }
19574                    }
19575                }
19576                deserializer.deserialize_identifier(Visitor)
19577            }
19578        }
19579        struct Visitor;
19580        impl<'de> serde::de::Visitor<'de> for Visitor {
19581            type Value = RotateServerCaContext;
19582            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19583                formatter.write_str("struct RotateServerCaContext")
19584            }
19585            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19586            where
19587                A: serde::de::MapAccess<'de>,
19588            {
19589                #[allow(unused_imports)]
19590                use serde::de::Error;
19591                use std::option::Option::Some;
19592                let mut fields = std::collections::HashSet::new();
19593                let mut result = Self::Value::new();
19594                while let Some(tag) = map.next_key::<__FieldTag>()? {
19595                    #[allow(clippy::match_single_binding)]
19596                    match tag {
19597                        __FieldTag::__kind => {
19598                            if !fields.insert(__FieldTag::__kind) {
19599                                return std::result::Result::Err(A::Error::duplicate_field(
19600                                    "multiple values for kind",
19601                                ));
19602                            }
19603                            result.kind = map
19604                                .next_value::<std::option::Option<std::string::String>>()?
19605                                .unwrap_or_default();
19606                        }
19607                        __FieldTag::__next_version => {
19608                            if !fields.insert(__FieldTag::__next_version) {
19609                                return std::result::Result::Err(A::Error::duplicate_field(
19610                                    "multiple values for next_version",
19611                                ));
19612                            }
19613                            result.next_version = map
19614                                .next_value::<std::option::Option<std::string::String>>()?
19615                                .unwrap_or_default();
19616                        }
19617                        __FieldTag::Unknown(key) => {
19618                            let value = map.next_value::<serde_json::Value>()?;
19619                            result._unknown_fields.insert(key, value);
19620                        }
19621                    }
19622                }
19623                std::result::Result::Ok(result)
19624            }
19625        }
19626        deserializer.deserialize_any(Visitor)
19627    }
19628}
19629
19630#[doc(hidden)]
19631impl serde::ser::Serialize for RotateServerCaContext {
19632    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19633    where
19634        S: serde::ser::Serializer,
19635    {
19636        use serde::ser::SerializeMap;
19637        #[allow(unused_imports)]
19638        use std::option::Option::Some;
19639        let mut state = serializer.serialize_map(std::option::Option::None)?;
19640        if !self.kind.is_empty() {
19641            state.serialize_entry("kind", &self.kind)?;
19642        }
19643        if !self.next_version.is_empty() {
19644            state.serialize_entry("nextVersion", &self.next_version)?;
19645        }
19646        if !self._unknown_fields.is_empty() {
19647            for (key, value) in self._unknown_fields.iter() {
19648                state.serialize_entry(key, &value)?;
19649            }
19650        }
19651        state.end()
19652    }
19653}
19654
19655/// Database Instance truncate log context.
19656#[derive(Clone, Debug, Default, PartialEq)]
19657#[non_exhaustive]
19658pub struct TruncateLogContext {
19659    /// This is always `sql#truncateLogContext`.
19660    pub kind: std::string::String,
19661
19662    /// The type of log to truncate. Valid values are `MYSQL_GENERAL_TABLE` and
19663    /// `MYSQL_SLOW_TABLE`.
19664    pub log_type: std::string::String,
19665
19666    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19667}
19668
19669impl TruncateLogContext {
19670    pub fn new() -> Self {
19671        std::default::Default::default()
19672    }
19673
19674    /// Sets the value of [kind][crate::model::TruncateLogContext::kind].
19675    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19676        self.kind = v.into();
19677        self
19678    }
19679
19680    /// Sets the value of [log_type][crate::model::TruncateLogContext::log_type].
19681    pub fn set_log_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19682        self.log_type = v.into();
19683        self
19684    }
19685}
19686
19687impl wkt::message::Message for TruncateLogContext {
19688    fn typename() -> &'static str {
19689        "type.googleapis.com/google.cloud.sql.v1.TruncateLogContext"
19690    }
19691}
19692
19693#[doc(hidden)]
19694impl<'de> serde::de::Deserialize<'de> for TruncateLogContext {
19695    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19696    where
19697        D: serde::Deserializer<'de>,
19698    {
19699        #[allow(non_camel_case_types)]
19700        #[doc(hidden)]
19701        #[derive(PartialEq, Eq, Hash)]
19702        enum __FieldTag {
19703            __kind,
19704            __log_type,
19705            Unknown(std::string::String),
19706        }
19707        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
19708            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19709            where
19710                D: serde::Deserializer<'de>,
19711            {
19712                struct Visitor;
19713                impl<'de> serde::de::Visitor<'de> for Visitor {
19714                    type Value = __FieldTag;
19715                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19716                        formatter.write_str("a field name for TruncateLogContext")
19717                    }
19718                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19719                    where
19720                        E: serde::de::Error,
19721                    {
19722                        use std::result::Result::Ok;
19723                        use std::string::ToString;
19724                        match value {
19725                            "kind" => Ok(__FieldTag::__kind),
19726                            "logType" => Ok(__FieldTag::__log_type),
19727                            "log_type" => Ok(__FieldTag::__log_type),
19728                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19729                        }
19730                    }
19731                }
19732                deserializer.deserialize_identifier(Visitor)
19733            }
19734        }
19735        struct Visitor;
19736        impl<'de> serde::de::Visitor<'de> for Visitor {
19737            type Value = TruncateLogContext;
19738            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19739                formatter.write_str("struct TruncateLogContext")
19740            }
19741            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19742            where
19743                A: serde::de::MapAccess<'de>,
19744            {
19745                #[allow(unused_imports)]
19746                use serde::de::Error;
19747                use std::option::Option::Some;
19748                let mut fields = std::collections::HashSet::new();
19749                let mut result = Self::Value::new();
19750                while let Some(tag) = map.next_key::<__FieldTag>()? {
19751                    #[allow(clippy::match_single_binding)]
19752                    match tag {
19753                        __FieldTag::__kind => {
19754                            if !fields.insert(__FieldTag::__kind) {
19755                                return std::result::Result::Err(A::Error::duplicate_field(
19756                                    "multiple values for kind",
19757                                ));
19758                            }
19759                            result.kind = map
19760                                .next_value::<std::option::Option<std::string::String>>()?
19761                                .unwrap_or_default();
19762                        }
19763                        __FieldTag::__log_type => {
19764                            if !fields.insert(__FieldTag::__log_type) {
19765                                return std::result::Result::Err(A::Error::duplicate_field(
19766                                    "multiple values for log_type",
19767                                ));
19768                            }
19769                            result.log_type = map
19770                                .next_value::<std::option::Option<std::string::String>>()?
19771                                .unwrap_or_default();
19772                        }
19773                        __FieldTag::Unknown(key) => {
19774                            let value = map.next_value::<serde_json::Value>()?;
19775                            result._unknown_fields.insert(key, value);
19776                        }
19777                    }
19778                }
19779                std::result::Result::Ok(result)
19780            }
19781        }
19782        deserializer.deserialize_any(Visitor)
19783    }
19784}
19785
19786#[doc(hidden)]
19787impl serde::ser::Serialize for TruncateLogContext {
19788    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19789    where
19790        S: serde::ser::Serializer,
19791    {
19792        use serde::ser::SerializeMap;
19793        #[allow(unused_imports)]
19794        use std::option::Option::Some;
19795        let mut state = serializer.serialize_map(std::option::Option::None)?;
19796        if !self.kind.is_empty() {
19797            state.serialize_entry("kind", &self.kind)?;
19798        }
19799        if !self.log_type.is_empty() {
19800            state.serialize_entry("logType", &self.log_type)?;
19801        }
19802        if !self._unknown_fields.is_empty() {
19803            for (key, value) in self._unknown_fields.iter() {
19804                state.serialize_entry(key, &value)?;
19805            }
19806        }
19807        state.end()
19808    }
19809}
19810
19811/// External primary instance migration setting error/warning.
19812#[derive(Clone, Debug, Default, PartialEq)]
19813#[non_exhaustive]
19814pub struct SqlExternalSyncSettingError {
19815    /// Can be `sql#externalSyncSettingError` or
19816    /// `sql#externalSyncSettingWarning`.
19817    pub kind: std::string::String,
19818
19819    /// Identifies the specific error that occurred.
19820    pub r#type: crate::model::sql_external_sync_setting_error::SqlExternalSyncSettingErrorType,
19821
19822    /// Additional information about the error encountered.
19823    pub detail: std::string::String,
19824
19825    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19826}
19827
19828impl SqlExternalSyncSettingError {
19829    pub fn new() -> Self {
19830        std::default::Default::default()
19831    }
19832
19833    /// Sets the value of [kind][crate::model::SqlExternalSyncSettingError::kind].
19834    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19835        self.kind = v.into();
19836        self
19837    }
19838
19839    /// Sets the value of [r#type][crate::model::SqlExternalSyncSettingError::type].
19840    pub fn set_type<
19841        T: std::convert::Into<
19842                crate::model::sql_external_sync_setting_error::SqlExternalSyncSettingErrorType,
19843            >,
19844    >(
19845        mut self,
19846        v: T,
19847    ) -> Self {
19848        self.r#type = v.into();
19849        self
19850    }
19851
19852    /// Sets the value of [detail][crate::model::SqlExternalSyncSettingError::detail].
19853    pub fn set_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19854        self.detail = v.into();
19855        self
19856    }
19857}
19858
19859impl wkt::message::Message for SqlExternalSyncSettingError {
19860    fn typename() -> &'static str {
19861        "type.googleapis.com/google.cloud.sql.v1.SqlExternalSyncSettingError"
19862    }
19863}
19864
19865#[doc(hidden)]
19866impl<'de> serde::de::Deserialize<'de> for SqlExternalSyncSettingError {
19867    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19868    where
19869        D: serde::Deserializer<'de>,
19870    {
19871        #[allow(non_camel_case_types)]
19872        #[doc(hidden)]
19873        #[derive(PartialEq, Eq, Hash)]
19874        enum __FieldTag {
19875            __kind,
19876            __type,
19877            __detail,
19878            Unknown(std::string::String),
19879        }
19880        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
19881            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19882            where
19883                D: serde::Deserializer<'de>,
19884            {
19885                struct Visitor;
19886                impl<'de> serde::de::Visitor<'de> for Visitor {
19887                    type Value = __FieldTag;
19888                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19889                        formatter.write_str("a field name for SqlExternalSyncSettingError")
19890                    }
19891                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19892                    where
19893                        E: serde::de::Error,
19894                    {
19895                        use std::result::Result::Ok;
19896                        use std::string::ToString;
19897                        match value {
19898                            "kind" => Ok(__FieldTag::__kind),
19899                            "type" => Ok(__FieldTag::__type),
19900                            "detail" => Ok(__FieldTag::__detail),
19901                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19902                        }
19903                    }
19904                }
19905                deserializer.deserialize_identifier(Visitor)
19906            }
19907        }
19908        struct Visitor;
19909        impl<'de> serde::de::Visitor<'de> for Visitor {
19910            type Value = SqlExternalSyncSettingError;
19911            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19912                formatter.write_str("struct SqlExternalSyncSettingError")
19913            }
19914            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19915            where
19916                A: serde::de::MapAccess<'de>,
19917            {
19918                #[allow(unused_imports)]
19919                use serde::de::Error;
19920                use std::option::Option::Some;
19921                let mut fields = std::collections::HashSet::new();
19922                let mut result = Self::Value::new();
19923                while let Some(tag) = map.next_key::<__FieldTag>()? {
19924                    #[allow(clippy::match_single_binding)]
19925                    match tag {
19926                        __FieldTag::__kind => {
19927                            if !fields.insert(__FieldTag::__kind) {
19928                                return std::result::Result::Err(A::Error::duplicate_field(
19929                                    "multiple values for kind",
19930                                ));
19931                            }
19932                            result.kind = map
19933                                .next_value::<std::option::Option<std::string::String>>()?
19934                                .unwrap_or_default();
19935                        }
19936                        __FieldTag::__type => {
19937                            if !fields.insert(__FieldTag::__type) {
19938                                return std::result::Result::Err(A::Error::duplicate_field(
19939                                    "multiple values for type",
19940                                ));
19941                            }
19942                            result.r#type = map.next_value::<std::option::Option<crate::model::sql_external_sync_setting_error::SqlExternalSyncSettingErrorType>>()?.unwrap_or_default();
19943                        }
19944                        __FieldTag::__detail => {
19945                            if !fields.insert(__FieldTag::__detail) {
19946                                return std::result::Result::Err(A::Error::duplicate_field(
19947                                    "multiple values for detail",
19948                                ));
19949                            }
19950                            result.detail = map
19951                                .next_value::<std::option::Option<std::string::String>>()?
19952                                .unwrap_or_default();
19953                        }
19954                        __FieldTag::Unknown(key) => {
19955                            let value = map.next_value::<serde_json::Value>()?;
19956                            result._unknown_fields.insert(key, value);
19957                        }
19958                    }
19959                }
19960                std::result::Result::Ok(result)
19961            }
19962        }
19963        deserializer.deserialize_any(Visitor)
19964    }
19965}
19966
19967#[doc(hidden)]
19968impl serde::ser::Serialize for SqlExternalSyncSettingError {
19969    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19970    where
19971        S: serde::ser::Serializer,
19972    {
19973        use serde::ser::SerializeMap;
19974        #[allow(unused_imports)]
19975        use std::option::Option::Some;
19976        let mut state = serializer.serialize_map(std::option::Option::None)?;
19977        if !self.kind.is_empty() {
19978            state.serialize_entry("kind", &self.kind)?;
19979        }
19980        if !wkt::internal::is_default(&self.r#type) {
19981            state.serialize_entry("type", &self.r#type)?;
19982        }
19983        if !self.detail.is_empty() {
19984            state.serialize_entry("detail", &self.detail)?;
19985        }
19986        if !self._unknown_fields.is_empty() {
19987            for (key, value) in self._unknown_fields.iter() {
19988                state.serialize_entry(key, &value)?;
19989            }
19990        }
19991        state.end()
19992    }
19993}
19994
19995/// Defines additional types related to [SqlExternalSyncSettingError].
19996pub mod sql_external_sync_setting_error {
19997    #[allow(unused_imports)]
19998    use super::*;
19999
20000    ///
20001    /// # Working with unknown values
20002    ///
20003    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
20004    /// additional enum variants at any time. Adding new variants is not considered
20005    /// a breaking change. Applications should write their code in anticipation of:
20006    ///
20007    /// - New values appearing in future releases of the client library, **and**
20008    /// - New values received dynamically, without application changes.
20009    ///
20010    /// Please consult the [Working with enums] section in the user guide for some
20011    /// guidelines.
20012    ///
20013    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
20014    #[derive(Clone, Debug, PartialEq)]
20015    #[non_exhaustive]
20016    pub enum SqlExternalSyncSettingErrorType {
20017        Unspecified,
20018        ConnectionFailure,
20019        BinlogNotEnabled,
20020        IncompatibleDatabaseVersion,
20021        ReplicaAlreadySetup,
20022        /// The replication user is missing privileges that are required.
20023        InsufficientPrivilege,
20024        /// Unsupported migration type.
20025        UnsupportedMigrationType,
20026        /// No pglogical extension installed on databases, applicable for postgres.
20027        NoPglogicalInstalled,
20028        /// pglogical node already exists on databases, applicable for postgres.
20029        PglogicalNodeAlreadyExists,
20030        /// The value of parameter wal_level is not set to logical.
20031        InvalidWalLevel,
20032        /// The value of parameter shared_preload_libraries does not include
20033        /// pglogical.
20034        InvalidSharedPreloadLibrary,
20035        /// The value of parameter max_replication_slots is not sufficient.
20036        InsufficientMaxReplicationSlots,
20037        /// The value of parameter max_wal_senders is not sufficient.
20038        InsufficientMaxWalSenders,
20039        /// The value of parameter max_worker_processes is not sufficient.
20040        InsufficientMaxWorkerProcesses,
20041        /// Extensions installed are either not supported or having unsupported
20042        /// versions.
20043        UnsupportedExtensions,
20044        /// The value of parameter rds.logical_replication is not set to 1.
20045        InvalidRdsLogicalReplication,
20046        /// The primary instance logging setup doesn't allow EM sync.
20047        InvalidLoggingSetup,
20048        /// The primary instance database parameter setup doesn't allow EM sync.
20049        InvalidDbParam,
20050        /// The gtid_mode is not supported, applicable for MySQL.
20051        UnsupportedGtidMode,
20052        /// SQL Server Agent is not running.
20053        SqlserverAgentNotRunning,
20054        /// The table definition is not support due to missing primary key or replica
20055        /// identity, applicable for postgres.
20056        UnsupportedTableDefinition,
20057        /// The customer has a definer that will break EM setup.
20058        UnsupportedDefiner,
20059        /// SQL Server @@SERVERNAME does not match actual host name.
20060        SqlserverServernameMismatch,
20061        /// The primary instance has been setup and will fail the setup.
20062        PrimaryAlreadySetup,
20063        /// The primary instance has unsupported binary log format.
20064        UnsupportedBinlogFormat,
20065        /// The primary instance's binary log retention setting.
20066        BinlogRetentionSetting,
20067        /// The primary instance has tables with unsupported storage engine.
20068        UnsupportedStorageEngine,
20069        /// Source has tables with limited support
20070        /// eg: PostgreSQL tables without primary keys.
20071        LimitedSupportTables,
20072        /// The replica instance contains existing data.
20073        ExistingDataInReplica,
20074        /// The replication user is missing privileges that are optional.
20075        MissingOptionalPrivileges,
20076        /// Additional BACKUP_ADMIN privilege is granted to the replication user
20077        /// which may lock source MySQL 8 instance for DDLs during initial sync.
20078        RiskyBackupAdminPrivilege,
20079        /// The Cloud Storage bucket is missing necessary permissions.
20080        InsufficientGcsPermissions,
20081        /// The Cloud Storage bucket has an error in the file or contains invalid
20082        /// file information.
20083        InvalidFileInfo,
20084        /// The source instance has unsupported database settings for migration.
20085        UnsupportedDatabaseSettings,
20086        /// The replication user is missing parallel import specific privileges.
20087        /// (e.g. LOCK TABLES) for MySQL.
20088        MysqlParallelImportInsufficientPrivilege,
20089        /// The global variable local_infile is off on external server replica.
20090        LocalInfileOff,
20091        /// This code instructs customers to turn on point-in-time recovery manually
20092        /// for the instance after promoting the Cloud SQL for PostgreSQL instance.
20093        TurnOnPitrAfterPromote,
20094        /// The minor version of replica database is incompatible with the source.
20095        IncompatibleDatabaseMinorVersion,
20096        /// This warning message indicates that Cloud SQL uses the maximum number of
20097        /// subscriptions to migrate data from the source to the destination.
20098        SourceMaxSubscriptions,
20099        /// Unable to verify definers on the source for MySQL.
20100        UnableToVerifyDefiners,
20101        /// If a time out occurs while the subscription counts are calculated, then
20102        /// this value is set to 1. Otherwise, this value is set to 2.
20103        SubscriptionCalculationStatus,
20104        /// Count of subscriptions needed to sync source data for PostgreSQL
20105        /// database.
20106        PgSubscriptionCount,
20107        /// Final parallel level that is used to do migration.
20108        PgSyncParallelLevel,
20109        /// The disk size of the replica instance is smaller than the data size of
20110        /// the source instance.
20111        InsufficientDiskSize,
20112        /// The data size of the source instance is greater than 1 TB, the number of
20113        /// cores of the replica instance is less than 8, and the memory of the
20114        /// replica is less than 32 GB.
20115        InsufficientMachineTier,
20116        /// The warning message indicates the unsupported extensions will not be
20117        /// migrated to the destination.
20118        UnsupportedExtensionsNotMigrated,
20119        /// The warning message indicates the pg_cron extension and settings will not
20120        /// be migrated to the destination.
20121        ExtensionsNotMigrated,
20122        /// The error message indicates that pg_cron flags are enabled on the
20123        /// destination which is not supported during the migration.
20124        PgCronFlagEnabledInReplica,
20125        /// This error message indicates that the specified extensions are not
20126        /// enabled on destination instance. For example, before you can migrate
20127        /// data to the destination instance, you must enable the PGAudit extension
20128        /// on the instance.
20129        ExtensionsNotEnabledInReplica,
20130        /// The source database has generated columns that can't be migrated. Please
20131        /// change them to regular columns before migration.
20132        UnsupportedColumns,
20133        /// If set, the enum was initialized with an unknown value.
20134        ///
20135        /// Applications can examine the value using [SqlExternalSyncSettingErrorType::value] or
20136        /// [SqlExternalSyncSettingErrorType::name].
20137        UnknownValue(sql_external_sync_setting_error_type::UnknownValue),
20138    }
20139
20140    #[doc(hidden)]
20141    pub mod sql_external_sync_setting_error_type {
20142        #[allow(unused_imports)]
20143        use super::*;
20144        #[derive(Clone, Debug, PartialEq)]
20145        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
20146    }
20147
20148    impl SqlExternalSyncSettingErrorType {
20149        /// Gets the enum value.
20150        ///
20151        /// Returns `None` if the enum contains an unknown value deserialized from
20152        /// the string representation of enums.
20153        pub fn value(&self) -> std::option::Option<i32> {
20154            match self {
20155                Self::Unspecified => std::option::Option::Some(0),
20156                Self::ConnectionFailure => std::option::Option::Some(1),
20157                Self::BinlogNotEnabled => std::option::Option::Some(2),
20158                Self::IncompatibleDatabaseVersion => std::option::Option::Some(3),
20159                Self::ReplicaAlreadySetup => std::option::Option::Some(4),
20160                Self::InsufficientPrivilege => std::option::Option::Some(5),
20161                Self::UnsupportedMigrationType => std::option::Option::Some(6),
20162                Self::NoPglogicalInstalled => std::option::Option::Some(7),
20163                Self::PglogicalNodeAlreadyExists => std::option::Option::Some(8),
20164                Self::InvalidWalLevel => std::option::Option::Some(9),
20165                Self::InvalidSharedPreloadLibrary => std::option::Option::Some(10),
20166                Self::InsufficientMaxReplicationSlots => std::option::Option::Some(11),
20167                Self::InsufficientMaxWalSenders => std::option::Option::Some(12),
20168                Self::InsufficientMaxWorkerProcesses => std::option::Option::Some(13),
20169                Self::UnsupportedExtensions => std::option::Option::Some(14),
20170                Self::InvalidRdsLogicalReplication => std::option::Option::Some(15),
20171                Self::InvalidLoggingSetup => std::option::Option::Some(16),
20172                Self::InvalidDbParam => std::option::Option::Some(17),
20173                Self::UnsupportedGtidMode => std::option::Option::Some(18),
20174                Self::SqlserverAgentNotRunning => std::option::Option::Some(19),
20175                Self::UnsupportedTableDefinition => std::option::Option::Some(20),
20176                Self::UnsupportedDefiner => std::option::Option::Some(21),
20177                Self::SqlserverServernameMismatch => std::option::Option::Some(22),
20178                Self::PrimaryAlreadySetup => std::option::Option::Some(23),
20179                Self::UnsupportedBinlogFormat => std::option::Option::Some(24),
20180                Self::BinlogRetentionSetting => std::option::Option::Some(25),
20181                Self::UnsupportedStorageEngine => std::option::Option::Some(26),
20182                Self::LimitedSupportTables => std::option::Option::Some(27),
20183                Self::ExistingDataInReplica => std::option::Option::Some(28),
20184                Self::MissingOptionalPrivileges => std::option::Option::Some(29),
20185                Self::RiskyBackupAdminPrivilege => std::option::Option::Some(30),
20186                Self::InsufficientGcsPermissions => std::option::Option::Some(31),
20187                Self::InvalidFileInfo => std::option::Option::Some(32),
20188                Self::UnsupportedDatabaseSettings => std::option::Option::Some(33),
20189                Self::MysqlParallelImportInsufficientPrivilege => std::option::Option::Some(34),
20190                Self::LocalInfileOff => std::option::Option::Some(35),
20191                Self::TurnOnPitrAfterPromote => std::option::Option::Some(36),
20192                Self::IncompatibleDatabaseMinorVersion => std::option::Option::Some(37),
20193                Self::SourceMaxSubscriptions => std::option::Option::Some(38),
20194                Self::UnableToVerifyDefiners => std::option::Option::Some(39),
20195                Self::SubscriptionCalculationStatus => std::option::Option::Some(40),
20196                Self::PgSubscriptionCount => std::option::Option::Some(41),
20197                Self::PgSyncParallelLevel => std::option::Option::Some(42),
20198                Self::InsufficientDiskSize => std::option::Option::Some(43),
20199                Self::InsufficientMachineTier => std::option::Option::Some(44),
20200                Self::UnsupportedExtensionsNotMigrated => std::option::Option::Some(45),
20201                Self::ExtensionsNotMigrated => std::option::Option::Some(46),
20202                Self::PgCronFlagEnabledInReplica => std::option::Option::Some(47),
20203                Self::ExtensionsNotEnabledInReplica => std::option::Option::Some(48),
20204                Self::UnsupportedColumns => std::option::Option::Some(49),
20205                Self::UnknownValue(u) => u.0.value(),
20206            }
20207        }
20208
20209        /// Gets the enum value as a string.
20210        ///
20211        /// Returns `None` if the enum contains an unknown value deserialized from
20212        /// the integer representation of enums.
20213        pub fn name(&self) -> std::option::Option<&str> {
20214            match self {
20215                Self::Unspecified => {
20216                    std::option::Option::Some("SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED")
20217                }
20218                Self::ConnectionFailure => std::option::Option::Some("CONNECTION_FAILURE"),
20219                Self::BinlogNotEnabled => std::option::Option::Some("BINLOG_NOT_ENABLED"),
20220                Self::IncompatibleDatabaseVersion => {
20221                    std::option::Option::Some("INCOMPATIBLE_DATABASE_VERSION")
20222                }
20223                Self::ReplicaAlreadySetup => std::option::Option::Some("REPLICA_ALREADY_SETUP"),
20224                Self::InsufficientPrivilege => std::option::Option::Some("INSUFFICIENT_PRIVILEGE"),
20225                Self::UnsupportedMigrationType => {
20226                    std::option::Option::Some("UNSUPPORTED_MIGRATION_TYPE")
20227                }
20228                Self::NoPglogicalInstalled => std::option::Option::Some("NO_PGLOGICAL_INSTALLED"),
20229                Self::PglogicalNodeAlreadyExists => {
20230                    std::option::Option::Some("PGLOGICAL_NODE_ALREADY_EXISTS")
20231                }
20232                Self::InvalidWalLevel => std::option::Option::Some("INVALID_WAL_LEVEL"),
20233                Self::InvalidSharedPreloadLibrary => {
20234                    std::option::Option::Some("INVALID_SHARED_PRELOAD_LIBRARY")
20235                }
20236                Self::InsufficientMaxReplicationSlots => {
20237                    std::option::Option::Some("INSUFFICIENT_MAX_REPLICATION_SLOTS")
20238                }
20239                Self::InsufficientMaxWalSenders => {
20240                    std::option::Option::Some("INSUFFICIENT_MAX_WAL_SENDERS")
20241                }
20242                Self::InsufficientMaxWorkerProcesses => {
20243                    std::option::Option::Some("INSUFFICIENT_MAX_WORKER_PROCESSES")
20244                }
20245                Self::UnsupportedExtensions => std::option::Option::Some("UNSUPPORTED_EXTENSIONS"),
20246                Self::InvalidRdsLogicalReplication => {
20247                    std::option::Option::Some("INVALID_RDS_LOGICAL_REPLICATION")
20248                }
20249                Self::InvalidLoggingSetup => std::option::Option::Some("INVALID_LOGGING_SETUP"),
20250                Self::InvalidDbParam => std::option::Option::Some("INVALID_DB_PARAM"),
20251                Self::UnsupportedGtidMode => std::option::Option::Some("UNSUPPORTED_GTID_MODE"),
20252                Self::SqlserverAgentNotRunning => {
20253                    std::option::Option::Some("SQLSERVER_AGENT_NOT_RUNNING")
20254                }
20255                Self::UnsupportedTableDefinition => {
20256                    std::option::Option::Some("UNSUPPORTED_TABLE_DEFINITION")
20257                }
20258                Self::UnsupportedDefiner => std::option::Option::Some("UNSUPPORTED_DEFINER"),
20259                Self::SqlserverServernameMismatch => {
20260                    std::option::Option::Some("SQLSERVER_SERVERNAME_MISMATCH")
20261                }
20262                Self::PrimaryAlreadySetup => std::option::Option::Some("PRIMARY_ALREADY_SETUP"),
20263                Self::UnsupportedBinlogFormat => {
20264                    std::option::Option::Some("UNSUPPORTED_BINLOG_FORMAT")
20265                }
20266                Self::BinlogRetentionSetting => {
20267                    std::option::Option::Some("BINLOG_RETENTION_SETTING")
20268                }
20269                Self::UnsupportedStorageEngine => {
20270                    std::option::Option::Some("UNSUPPORTED_STORAGE_ENGINE")
20271                }
20272                Self::LimitedSupportTables => std::option::Option::Some("LIMITED_SUPPORT_TABLES"),
20273                Self::ExistingDataInReplica => {
20274                    std::option::Option::Some("EXISTING_DATA_IN_REPLICA")
20275                }
20276                Self::MissingOptionalPrivileges => {
20277                    std::option::Option::Some("MISSING_OPTIONAL_PRIVILEGES")
20278                }
20279                Self::RiskyBackupAdminPrivilege => {
20280                    std::option::Option::Some("RISKY_BACKUP_ADMIN_PRIVILEGE")
20281                }
20282                Self::InsufficientGcsPermissions => {
20283                    std::option::Option::Some("INSUFFICIENT_GCS_PERMISSIONS")
20284                }
20285                Self::InvalidFileInfo => std::option::Option::Some("INVALID_FILE_INFO"),
20286                Self::UnsupportedDatabaseSettings => {
20287                    std::option::Option::Some("UNSUPPORTED_DATABASE_SETTINGS")
20288                }
20289                Self::MysqlParallelImportInsufficientPrivilege => {
20290                    std::option::Option::Some("MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE")
20291                }
20292                Self::LocalInfileOff => std::option::Option::Some("LOCAL_INFILE_OFF"),
20293                Self::TurnOnPitrAfterPromote => {
20294                    std::option::Option::Some("TURN_ON_PITR_AFTER_PROMOTE")
20295                }
20296                Self::IncompatibleDatabaseMinorVersion => {
20297                    std::option::Option::Some("INCOMPATIBLE_DATABASE_MINOR_VERSION")
20298                }
20299                Self::SourceMaxSubscriptions => {
20300                    std::option::Option::Some("SOURCE_MAX_SUBSCRIPTIONS")
20301                }
20302                Self::UnableToVerifyDefiners => {
20303                    std::option::Option::Some("UNABLE_TO_VERIFY_DEFINERS")
20304                }
20305                Self::SubscriptionCalculationStatus => {
20306                    std::option::Option::Some("SUBSCRIPTION_CALCULATION_STATUS")
20307                }
20308                Self::PgSubscriptionCount => std::option::Option::Some("PG_SUBSCRIPTION_COUNT"),
20309                Self::PgSyncParallelLevel => std::option::Option::Some("PG_SYNC_PARALLEL_LEVEL"),
20310                Self::InsufficientDiskSize => std::option::Option::Some("INSUFFICIENT_DISK_SIZE"),
20311                Self::InsufficientMachineTier => {
20312                    std::option::Option::Some("INSUFFICIENT_MACHINE_TIER")
20313                }
20314                Self::UnsupportedExtensionsNotMigrated => {
20315                    std::option::Option::Some("UNSUPPORTED_EXTENSIONS_NOT_MIGRATED")
20316                }
20317                Self::ExtensionsNotMigrated => std::option::Option::Some("EXTENSIONS_NOT_MIGRATED"),
20318                Self::PgCronFlagEnabledInReplica => {
20319                    std::option::Option::Some("PG_CRON_FLAG_ENABLED_IN_REPLICA")
20320                }
20321                Self::ExtensionsNotEnabledInReplica => {
20322                    std::option::Option::Some("EXTENSIONS_NOT_ENABLED_IN_REPLICA")
20323                }
20324                Self::UnsupportedColumns => std::option::Option::Some("UNSUPPORTED_COLUMNS"),
20325                Self::UnknownValue(u) => u.0.name(),
20326            }
20327        }
20328    }
20329
20330    impl std::default::Default for SqlExternalSyncSettingErrorType {
20331        fn default() -> Self {
20332            use std::convert::From;
20333            Self::from(0)
20334        }
20335    }
20336
20337    impl std::fmt::Display for SqlExternalSyncSettingErrorType {
20338        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
20339            wkt::internal::display_enum(f, self.name(), self.value())
20340        }
20341    }
20342
20343    impl std::convert::From<i32> for SqlExternalSyncSettingErrorType {
20344        fn from(value: i32) -> Self {
20345            match value {
20346                0 => Self::Unspecified,
20347                1 => Self::ConnectionFailure,
20348                2 => Self::BinlogNotEnabled,
20349                3 => Self::IncompatibleDatabaseVersion,
20350                4 => Self::ReplicaAlreadySetup,
20351                5 => Self::InsufficientPrivilege,
20352                6 => Self::UnsupportedMigrationType,
20353                7 => Self::NoPglogicalInstalled,
20354                8 => Self::PglogicalNodeAlreadyExists,
20355                9 => Self::InvalidWalLevel,
20356                10 => Self::InvalidSharedPreloadLibrary,
20357                11 => Self::InsufficientMaxReplicationSlots,
20358                12 => Self::InsufficientMaxWalSenders,
20359                13 => Self::InsufficientMaxWorkerProcesses,
20360                14 => Self::UnsupportedExtensions,
20361                15 => Self::InvalidRdsLogicalReplication,
20362                16 => Self::InvalidLoggingSetup,
20363                17 => Self::InvalidDbParam,
20364                18 => Self::UnsupportedGtidMode,
20365                19 => Self::SqlserverAgentNotRunning,
20366                20 => Self::UnsupportedTableDefinition,
20367                21 => Self::UnsupportedDefiner,
20368                22 => Self::SqlserverServernameMismatch,
20369                23 => Self::PrimaryAlreadySetup,
20370                24 => Self::UnsupportedBinlogFormat,
20371                25 => Self::BinlogRetentionSetting,
20372                26 => Self::UnsupportedStorageEngine,
20373                27 => Self::LimitedSupportTables,
20374                28 => Self::ExistingDataInReplica,
20375                29 => Self::MissingOptionalPrivileges,
20376                30 => Self::RiskyBackupAdminPrivilege,
20377                31 => Self::InsufficientGcsPermissions,
20378                32 => Self::InvalidFileInfo,
20379                33 => Self::UnsupportedDatabaseSettings,
20380                34 => Self::MysqlParallelImportInsufficientPrivilege,
20381                35 => Self::LocalInfileOff,
20382                36 => Self::TurnOnPitrAfterPromote,
20383                37 => Self::IncompatibleDatabaseMinorVersion,
20384                38 => Self::SourceMaxSubscriptions,
20385                39 => Self::UnableToVerifyDefiners,
20386                40 => Self::SubscriptionCalculationStatus,
20387                41 => Self::PgSubscriptionCount,
20388                42 => Self::PgSyncParallelLevel,
20389                43 => Self::InsufficientDiskSize,
20390                44 => Self::InsufficientMachineTier,
20391                45 => Self::UnsupportedExtensionsNotMigrated,
20392                46 => Self::ExtensionsNotMigrated,
20393                47 => Self::PgCronFlagEnabledInReplica,
20394                48 => Self::ExtensionsNotEnabledInReplica,
20395                49 => Self::UnsupportedColumns,
20396                _ => Self::UnknownValue(sql_external_sync_setting_error_type::UnknownValue(
20397                    wkt::internal::UnknownEnumValue::Integer(value),
20398                )),
20399            }
20400        }
20401    }
20402
20403    impl std::convert::From<&str> for SqlExternalSyncSettingErrorType {
20404        fn from(value: &str) -> Self {
20405            use std::string::ToString;
20406            match value {
20407                "SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED" => Self::Unspecified,
20408                "CONNECTION_FAILURE" => Self::ConnectionFailure,
20409                "BINLOG_NOT_ENABLED" => Self::BinlogNotEnabled,
20410                "INCOMPATIBLE_DATABASE_VERSION" => Self::IncompatibleDatabaseVersion,
20411                "REPLICA_ALREADY_SETUP" => Self::ReplicaAlreadySetup,
20412                "INSUFFICIENT_PRIVILEGE" => Self::InsufficientPrivilege,
20413                "UNSUPPORTED_MIGRATION_TYPE" => Self::UnsupportedMigrationType,
20414                "NO_PGLOGICAL_INSTALLED" => Self::NoPglogicalInstalled,
20415                "PGLOGICAL_NODE_ALREADY_EXISTS" => Self::PglogicalNodeAlreadyExists,
20416                "INVALID_WAL_LEVEL" => Self::InvalidWalLevel,
20417                "INVALID_SHARED_PRELOAD_LIBRARY" => Self::InvalidSharedPreloadLibrary,
20418                "INSUFFICIENT_MAX_REPLICATION_SLOTS" => Self::InsufficientMaxReplicationSlots,
20419                "INSUFFICIENT_MAX_WAL_SENDERS" => Self::InsufficientMaxWalSenders,
20420                "INSUFFICIENT_MAX_WORKER_PROCESSES" => Self::InsufficientMaxWorkerProcesses,
20421                "UNSUPPORTED_EXTENSIONS" => Self::UnsupportedExtensions,
20422                "INVALID_RDS_LOGICAL_REPLICATION" => Self::InvalidRdsLogicalReplication,
20423                "INVALID_LOGGING_SETUP" => Self::InvalidLoggingSetup,
20424                "INVALID_DB_PARAM" => Self::InvalidDbParam,
20425                "UNSUPPORTED_GTID_MODE" => Self::UnsupportedGtidMode,
20426                "SQLSERVER_AGENT_NOT_RUNNING" => Self::SqlserverAgentNotRunning,
20427                "UNSUPPORTED_TABLE_DEFINITION" => Self::UnsupportedTableDefinition,
20428                "UNSUPPORTED_DEFINER" => Self::UnsupportedDefiner,
20429                "SQLSERVER_SERVERNAME_MISMATCH" => Self::SqlserverServernameMismatch,
20430                "PRIMARY_ALREADY_SETUP" => Self::PrimaryAlreadySetup,
20431                "UNSUPPORTED_BINLOG_FORMAT" => Self::UnsupportedBinlogFormat,
20432                "BINLOG_RETENTION_SETTING" => Self::BinlogRetentionSetting,
20433                "UNSUPPORTED_STORAGE_ENGINE" => Self::UnsupportedStorageEngine,
20434                "LIMITED_SUPPORT_TABLES" => Self::LimitedSupportTables,
20435                "EXISTING_DATA_IN_REPLICA" => Self::ExistingDataInReplica,
20436                "MISSING_OPTIONAL_PRIVILEGES" => Self::MissingOptionalPrivileges,
20437                "RISKY_BACKUP_ADMIN_PRIVILEGE" => Self::RiskyBackupAdminPrivilege,
20438                "INSUFFICIENT_GCS_PERMISSIONS" => Self::InsufficientGcsPermissions,
20439                "INVALID_FILE_INFO" => Self::InvalidFileInfo,
20440                "UNSUPPORTED_DATABASE_SETTINGS" => Self::UnsupportedDatabaseSettings,
20441                "MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE" => {
20442                    Self::MysqlParallelImportInsufficientPrivilege
20443                }
20444                "LOCAL_INFILE_OFF" => Self::LocalInfileOff,
20445                "TURN_ON_PITR_AFTER_PROMOTE" => Self::TurnOnPitrAfterPromote,
20446                "INCOMPATIBLE_DATABASE_MINOR_VERSION" => Self::IncompatibleDatabaseMinorVersion,
20447                "SOURCE_MAX_SUBSCRIPTIONS" => Self::SourceMaxSubscriptions,
20448                "UNABLE_TO_VERIFY_DEFINERS" => Self::UnableToVerifyDefiners,
20449                "SUBSCRIPTION_CALCULATION_STATUS" => Self::SubscriptionCalculationStatus,
20450                "PG_SUBSCRIPTION_COUNT" => Self::PgSubscriptionCount,
20451                "PG_SYNC_PARALLEL_LEVEL" => Self::PgSyncParallelLevel,
20452                "INSUFFICIENT_DISK_SIZE" => Self::InsufficientDiskSize,
20453                "INSUFFICIENT_MACHINE_TIER" => Self::InsufficientMachineTier,
20454                "UNSUPPORTED_EXTENSIONS_NOT_MIGRATED" => Self::UnsupportedExtensionsNotMigrated,
20455                "EXTENSIONS_NOT_MIGRATED" => Self::ExtensionsNotMigrated,
20456                "PG_CRON_FLAG_ENABLED_IN_REPLICA" => Self::PgCronFlagEnabledInReplica,
20457                "EXTENSIONS_NOT_ENABLED_IN_REPLICA" => Self::ExtensionsNotEnabledInReplica,
20458                "UNSUPPORTED_COLUMNS" => Self::UnsupportedColumns,
20459                _ => Self::UnknownValue(sql_external_sync_setting_error_type::UnknownValue(
20460                    wkt::internal::UnknownEnumValue::String(value.to_string()),
20461                )),
20462            }
20463        }
20464    }
20465
20466    impl serde::ser::Serialize for SqlExternalSyncSettingErrorType {
20467        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20468        where
20469            S: serde::Serializer,
20470        {
20471            match self {
20472                Self::Unspecified => serializer.serialize_i32(0),
20473                Self::ConnectionFailure => serializer.serialize_i32(1),
20474                Self::BinlogNotEnabled => serializer.serialize_i32(2),
20475                Self::IncompatibleDatabaseVersion => serializer.serialize_i32(3),
20476                Self::ReplicaAlreadySetup => serializer.serialize_i32(4),
20477                Self::InsufficientPrivilege => serializer.serialize_i32(5),
20478                Self::UnsupportedMigrationType => serializer.serialize_i32(6),
20479                Self::NoPglogicalInstalled => serializer.serialize_i32(7),
20480                Self::PglogicalNodeAlreadyExists => serializer.serialize_i32(8),
20481                Self::InvalidWalLevel => serializer.serialize_i32(9),
20482                Self::InvalidSharedPreloadLibrary => serializer.serialize_i32(10),
20483                Self::InsufficientMaxReplicationSlots => serializer.serialize_i32(11),
20484                Self::InsufficientMaxWalSenders => serializer.serialize_i32(12),
20485                Self::InsufficientMaxWorkerProcesses => serializer.serialize_i32(13),
20486                Self::UnsupportedExtensions => serializer.serialize_i32(14),
20487                Self::InvalidRdsLogicalReplication => serializer.serialize_i32(15),
20488                Self::InvalidLoggingSetup => serializer.serialize_i32(16),
20489                Self::InvalidDbParam => serializer.serialize_i32(17),
20490                Self::UnsupportedGtidMode => serializer.serialize_i32(18),
20491                Self::SqlserverAgentNotRunning => serializer.serialize_i32(19),
20492                Self::UnsupportedTableDefinition => serializer.serialize_i32(20),
20493                Self::UnsupportedDefiner => serializer.serialize_i32(21),
20494                Self::SqlserverServernameMismatch => serializer.serialize_i32(22),
20495                Self::PrimaryAlreadySetup => serializer.serialize_i32(23),
20496                Self::UnsupportedBinlogFormat => serializer.serialize_i32(24),
20497                Self::BinlogRetentionSetting => serializer.serialize_i32(25),
20498                Self::UnsupportedStorageEngine => serializer.serialize_i32(26),
20499                Self::LimitedSupportTables => serializer.serialize_i32(27),
20500                Self::ExistingDataInReplica => serializer.serialize_i32(28),
20501                Self::MissingOptionalPrivileges => serializer.serialize_i32(29),
20502                Self::RiskyBackupAdminPrivilege => serializer.serialize_i32(30),
20503                Self::InsufficientGcsPermissions => serializer.serialize_i32(31),
20504                Self::InvalidFileInfo => serializer.serialize_i32(32),
20505                Self::UnsupportedDatabaseSettings => serializer.serialize_i32(33),
20506                Self::MysqlParallelImportInsufficientPrivilege => serializer.serialize_i32(34),
20507                Self::LocalInfileOff => serializer.serialize_i32(35),
20508                Self::TurnOnPitrAfterPromote => serializer.serialize_i32(36),
20509                Self::IncompatibleDatabaseMinorVersion => serializer.serialize_i32(37),
20510                Self::SourceMaxSubscriptions => serializer.serialize_i32(38),
20511                Self::UnableToVerifyDefiners => serializer.serialize_i32(39),
20512                Self::SubscriptionCalculationStatus => serializer.serialize_i32(40),
20513                Self::PgSubscriptionCount => serializer.serialize_i32(41),
20514                Self::PgSyncParallelLevel => serializer.serialize_i32(42),
20515                Self::InsufficientDiskSize => serializer.serialize_i32(43),
20516                Self::InsufficientMachineTier => serializer.serialize_i32(44),
20517                Self::UnsupportedExtensionsNotMigrated => serializer.serialize_i32(45),
20518                Self::ExtensionsNotMigrated => serializer.serialize_i32(46),
20519                Self::PgCronFlagEnabledInReplica => serializer.serialize_i32(47),
20520                Self::ExtensionsNotEnabledInReplica => serializer.serialize_i32(48),
20521                Self::UnsupportedColumns => serializer.serialize_i32(49),
20522                Self::UnknownValue(u) => u.0.serialize(serializer),
20523            }
20524        }
20525    }
20526
20527    impl<'de> serde::de::Deserialize<'de> for SqlExternalSyncSettingErrorType {
20528        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20529        where
20530            D: serde::Deserializer<'de>,
20531        {
20532            deserializer.deserialize_any(wkt::internal::EnumVisitor::<
20533                SqlExternalSyncSettingErrorType,
20534            >::new(
20535                ".google.cloud.sql.v1.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType",
20536            ))
20537        }
20538    }
20539}
20540
20541/// On-premises instance configuration.
20542#[derive(Clone, Debug, Default, PartialEq)]
20543#[non_exhaustive]
20544pub struct OnPremisesConfiguration {
20545    /// The host and port of the on-premises instance in host:port format
20546    pub host_port: std::string::String,
20547
20548    /// This is always `sql#onPremisesConfiguration`.
20549    pub kind: std::string::String,
20550
20551    /// The username for connecting to on-premises instance.
20552    pub username: std::string::String,
20553
20554    /// The password for connecting to on-premises instance.
20555    pub password: std::string::String,
20556
20557    /// PEM representation of the trusted CA's x509 certificate.
20558    pub ca_certificate: std::string::String,
20559
20560    /// PEM representation of the replica's x509 certificate.
20561    pub client_certificate: std::string::String,
20562
20563    /// PEM representation of the replica's private key. The corresponsing public
20564    /// key is encoded in the client's certificate.
20565    pub client_key: std::string::String,
20566
20567    /// The dump file to create the Cloud SQL replica.
20568    pub dump_file_path: std::string::String,
20569
20570    /// The reference to Cloud SQL instance if the source is Cloud SQL.
20571    pub source_instance: std::option::Option<crate::model::InstanceReference>,
20572
20573    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20574}
20575
20576impl OnPremisesConfiguration {
20577    pub fn new() -> Self {
20578        std::default::Default::default()
20579    }
20580
20581    /// Sets the value of [host_port][crate::model::OnPremisesConfiguration::host_port].
20582    pub fn set_host_port<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20583        self.host_port = v.into();
20584        self
20585    }
20586
20587    /// Sets the value of [kind][crate::model::OnPremisesConfiguration::kind].
20588    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20589        self.kind = v.into();
20590        self
20591    }
20592
20593    /// Sets the value of [username][crate::model::OnPremisesConfiguration::username].
20594    pub fn set_username<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20595        self.username = v.into();
20596        self
20597    }
20598
20599    /// Sets the value of [password][crate::model::OnPremisesConfiguration::password].
20600    pub fn set_password<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20601        self.password = v.into();
20602        self
20603    }
20604
20605    /// Sets the value of [ca_certificate][crate::model::OnPremisesConfiguration::ca_certificate].
20606    pub fn set_ca_certificate<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20607        self.ca_certificate = v.into();
20608        self
20609    }
20610
20611    /// Sets the value of [client_certificate][crate::model::OnPremisesConfiguration::client_certificate].
20612    pub fn set_client_certificate<T: std::convert::Into<std::string::String>>(
20613        mut self,
20614        v: T,
20615    ) -> Self {
20616        self.client_certificate = v.into();
20617        self
20618    }
20619
20620    /// Sets the value of [client_key][crate::model::OnPremisesConfiguration::client_key].
20621    pub fn set_client_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20622        self.client_key = v.into();
20623        self
20624    }
20625
20626    /// Sets the value of [dump_file_path][crate::model::OnPremisesConfiguration::dump_file_path].
20627    pub fn set_dump_file_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20628        self.dump_file_path = v.into();
20629        self
20630    }
20631
20632    /// Sets the value of [source_instance][crate::model::OnPremisesConfiguration::source_instance].
20633    pub fn set_source_instance<T>(mut self, v: T) -> Self
20634    where
20635        T: std::convert::Into<crate::model::InstanceReference>,
20636    {
20637        self.source_instance = std::option::Option::Some(v.into());
20638        self
20639    }
20640
20641    /// Sets or clears the value of [source_instance][crate::model::OnPremisesConfiguration::source_instance].
20642    pub fn set_or_clear_source_instance<T>(mut self, v: std::option::Option<T>) -> Self
20643    where
20644        T: std::convert::Into<crate::model::InstanceReference>,
20645    {
20646        self.source_instance = v.map(|x| x.into());
20647        self
20648    }
20649}
20650
20651impl wkt::message::Message for OnPremisesConfiguration {
20652    fn typename() -> &'static str {
20653        "type.googleapis.com/google.cloud.sql.v1.OnPremisesConfiguration"
20654    }
20655}
20656
20657#[doc(hidden)]
20658impl<'de> serde::de::Deserialize<'de> for OnPremisesConfiguration {
20659    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20660    where
20661        D: serde::Deserializer<'de>,
20662    {
20663        #[allow(non_camel_case_types)]
20664        #[doc(hidden)]
20665        #[derive(PartialEq, Eq, Hash)]
20666        enum __FieldTag {
20667            __host_port,
20668            __kind,
20669            __username,
20670            __password,
20671            __ca_certificate,
20672            __client_certificate,
20673            __client_key,
20674            __dump_file_path,
20675            __source_instance,
20676            Unknown(std::string::String),
20677        }
20678        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
20679            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20680            where
20681                D: serde::Deserializer<'de>,
20682            {
20683                struct Visitor;
20684                impl<'de> serde::de::Visitor<'de> for Visitor {
20685                    type Value = __FieldTag;
20686                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20687                        formatter.write_str("a field name for OnPremisesConfiguration")
20688                    }
20689                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
20690                    where
20691                        E: serde::de::Error,
20692                    {
20693                        use std::result::Result::Ok;
20694                        use std::string::ToString;
20695                        match value {
20696                            "hostPort" => Ok(__FieldTag::__host_port),
20697                            "host_port" => Ok(__FieldTag::__host_port),
20698                            "kind" => Ok(__FieldTag::__kind),
20699                            "username" => Ok(__FieldTag::__username),
20700                            "password" => Ok(__FieldTag::__password),
20701                            "caCertificate" => Ok(__FieldTag::__ca_certificate),
20702                            "ca_certificate" => Ok(__FieldTag::__ca_certificate),
20703                            "clientCertificate" => Ok(__FieldTag::__client_certificate),
20704                            "client_certificate" => Ok(__FieldTag::__client_certificate),
20705                            "clientKey" => Ok(__FieldTag::__client_key),
20706                            "client_key" => Ok(__FieldTag::__client_key),
20707                            "dumpFilePath" => Ok(__FieldTag::__dump_file_path),
20708                            "dump_file_path" => Ok(__FieldTag::__dump_file_path),
20709                            "sourceInstance" => Ok(__FieldTag::__source_instance),
20710                            "source_instance" => Ok(__FieldTag::__source_instance),
20711                            _ => Ok(__FieldTag::Unknown(value.to_string())),
20712                        }
20713                    }
20714                }
20715                deserializer.deserialize_identifier(Visitor)
20716            }
20717        }
20718        struct Visitor;
20719        impl<'de> serde::de::Visitor<'de> for Visitor {
20720            type Value = OnPremisesConfiguration;
20721            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20722                formatter.write_str("struct OnPremisesConfiguration")
20723            }
20724            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
20725            where
20726                A: serde::de::MapAccess<'de>,
20727            {
20728                #[allow(unused_imports)]
20729                use serde::de::Error;
20730                use std::option::Option::Some;
20731                let mut fields = std::collections::HashSet::new();
20732                let mut result = Self::Value::new();
20733                while let Some(tag) = map.next_key::<__FieldTag>()? {
20734                    #[allow(clippy::match_single_binding)]
20735                    match tag {
20736                        __FieldTag::__host_port => {
20737                            if !fields.insert(__FieldTag::__host_port) {
20738                                return std::result::Result::Err(A::Error::duplicate_field(
20739                                    "multiple values for host_port",
20740                                ));
20741                            }
20742                            result.host_port = map
20743                                .next_value::<std::option::Option<std::string::String>>()?
20744                                .unwrap_or_default();
20745                        }
20746                        __FieldTag::__kind => {
20747                            if !fields.insert(__FieldTag::__kind) {
20748                                return std::result::Result::Err(A::Error::duplicate_field(
20749                                    "multiple values for kind",
20750                                ));
20751                            }
20752                            result.kind = map
20753                                .next_value::<std::option::Option<std::string::String>>()?
20754                                .unwrap_or_default();
20755                        }
20756                        __FieldTag::__username => {
20757                            if !fields.insert(__FieldTag::__username) {
20758                                return std::result::Result::Err(A::Error::duplicate_field(
20759                                    "multiple values for username",
20760                                ));
20761                            }
20762                            result.username = map
20763                                .next_value::<std::option::Option<std::string::String>>()?
20764                                .unwrap_or_default();
20765                        }
20766                        __FieldTag::__password => {
20767                            if !fields.insert(__FieldTag::__password) {
20768                                return std::result::Result::Err(A::Error::duplicate_field(
20769                                    "multiple values for password",
20770                                ));
20771                            }
20772                            result.password = map
20773                                .next_value::<std::option::Option<std::string::String>>()?
20774                                .unwrap_or_default();
20775                        }
20776                        __FieldTag::__ca_certificate => {
20777                            if !fields.insert(__FieldTag::__ca_certificate) {
20778                                return std::result::Result::Err(A::Error::duplicate_field(
20779                                    "multiple values for ca_certificate",
20780                                ));
20781                            }
20782                            result.ca_certificate = map
20783                                .next_value::<std::option::Option<std::string::String>>()?
20784                                .unwrap_or_default();
20785                        }
20786                        __FieldTag::__client_certificate => {
20787                            if !fields.insert(__FieldTag::__client_certificate) {
20788                                return std::result::Result::Err(A::Error::duplicate_field(
20789                                    "multiple values for client_certificate",
20790                                ));
20791                            }
20792                            result.client_certificate = map
20793                                .next_value::<std::option::Option<std::string::String>>()?
20794                                .unwrap_or_default();
20795                        }
20796                        __FieldTag::__client_key => {
20797                            if !fields.insert(__FieldTag::__client_key) {
20798                                return std::result::Result::Err(A::Error::duplicate_field(
20799                                    "multiple values for client_key",
20800                                ));
20801                            }
20802                            result.client_key = map
20803                                .next_value::<std::option::Option<std::string::String>>()?
20804                                .unwrap_or_default();
20805                        }
20806                        __FieldTag::__dump_file_path => {
20807                            if !fields.insert(__FieldTag::__dump_file_path) {
20808                                return std::result::Result::Err(A::Error::duplicate_field(
20809                                    "multiple values for dump_file_path",
20810                                ));
20811                            }
20812                            result.dump_file_path = map
20813                                .next_value::<std::option::Option<std::string::String>>()?
20814                                .unwrap_or_default();
20815                        }
20816                        __FieldTag::__source_instance => {
20817                            if !fields.insert(__FieldTag::__source_instance) {
20818                                return std::result::Result::Err(A::Error::duplicate_field(
20819                                    "multiple values for source_instance",
20820                                ));
20821                            }
20822                            result.source_instance = map
20823                                .next_value::<std::option::Option<crate::model::InstanceReference>>(
20824                                )?;
20825                        }
20826                        __FieldTag::Unknown(key) => {
20827                            let value = map.next_value::<serde_json::Value>()?;
20828                            result._unknown_fields.insert(key, value);
20829                        }
20830                    }
20831                }
20832                std::result::Result::Ok(result)
20833            }
20834        }
20835        deserializer.deserialize_any(Visitor)
20836    }
20837}
20838
20839#[doc(hidden)]
20840impl serde::ser::Serialize for OnPremisesConfiguration {
20841    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20842    where
20843        S: serde::ser::Serializer,
20844    {
20845        use serde::ser::SerializeMap;
20846        #[allow(unused_imports)]
20847        use std::option::Option::Some;
20848        let mut state = serializer.serialize_map(std::option::Option::None)?;
20849        if !self.host_port.is_empty() {
20850            state.serialize_entry("hostPort", &self.host_port)?;
20851        }
20852        if !self.kind.is_empty() {
20853            state.serialize_entry("kind", &self.kind)?;
20854        }
20855        if !self.username.is_empty() {
20856            state.serialize_entry("username", &self.username)?;
20857        }
20858        if !self.password.is_empty() {
20859            state.serialize_entry("password", &self.password)?;
20860        }
20861        if !self.ca_certificate.is_empty() {
20862            state.serialize_entry("caCertificate", &self.ca_certificate)?;
20863        }
20864        if !self.client_certificate.is_empty() {
20865            state.serialize_entry("clientCertificate", &self.client_certificate)?;
20866        }
20867        if !self.client_key.is_empty() {
20868            state.serialize_entry("clientKey", &self.client_key)?;
20869        }
20870        if !self.dump_file_path.is_empty() {
20871            state.serialize_entry("dumpFilePath", &self.dump_file_path)?;
20872        }
20873        if self.source_instance.is_some() {
20874            state.serialize_entry("sourceInstance", &self.source_instance)?;
20875        }
20876        if !self._unknown_fields.is_empty() {
20877            for (key, value) in self._unknown_fields.iter() {
20878                state.serialize_entry(key, &value)?;
20879            }
20880        }
20881        state.end()
20882    }
20883}
20884
20885/// Read-replica configuration for connecting to the primary instance.
20886#[derive(Clone, Debug, Default, PartialEq)]
20887#[non_exhaustive]
20888pub struct ReplicaConfiguration {
20889    /// This is always `sql#replicaConfiguration`.
20890    pub kind: std::string::String,
20891
20892    /// MySQL specific configuration when replicating from a MySQL on-premises
20893    /// primary instance. Replication configuration information such as the
20894    /// username, password, certificates, and keys are not stored in the instance
20895    /// metadata. The configuration information is used only to set up the
20896    /// replication connection and is stored by MySQL in a file named
20897    /// `master.info` in the data directory.
20898    pub mysql_replica_configuration: std::option::Option<crate::model::MySqlReplicaConfiguration>,
20899
20900    /// Specifies if the replica is the failover target. If the field is set to
20901    /// `true`, the replica will be designated as a failover replica. In case the
20902    /// primary instance fails, the replica instance will be promoted as the new
20903    /// primary instance. Only one replica can be specified as failover target, and
20904    /// the replica has to be in different zone with the primary instance.
20905    pub failover_target: std::option::Option<wkt::BoolValue>,
20906
20907    /// Optional. Specifies if a SQL Server replica is a cascadable replica. A
20908    /// cascadable replica is a SQL Server cross region replica that supports
20909    /// replica(s) under it.
20910    pub cascadable_replica: std::option::Option<wkt::BoolValue>,
20911
20912    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20913}
20914
20915impl ReplicaConfiguration {
20916    pub fn new() -> Self {
20917        std::default::Default::default()
20918    }
20919
20920    /// Sets the value of [kind][crate::model::ReplicaConfiguration::kind].
20921    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20922        self.kind = v.into();
20923        self
20924    }
20925
20926    /// Sets the value of [mysql_replica_configuration][crate::model::ReplicaConfiguration::mysql_replica_configuration].
20927    pub fn set_mysql_replica_configuration<T>(mut self, v: T) -> Self
20928    where
20929        T: std::convert::Into<crate::model::MySqlReplicaConfiguration>,
20930    {
20931        self.mysql_replica_configuration = std::option::Option::Some(v.into());
20932        self
20933    }
20934
20935    /// Sets or clears the value of [mysql_replica_configuration][crate::model::ReplicaConfiguration::mysql_replica_configuration].
20936    pub fn set_or_clear_mysql_replica_configuration<T>(mut self, v: std::option::Option<T>) -> Self
20937    where
20938        T: std::convert::Into<crate::model::MySqlReplicaConfiguration>,
20939    {
20940        self.mysql_replica_configuration = v.map(|x| x.into());
20941        self
20942    }
20943
20944    /// Sets the value of [failover_target][crate::model::ReplicaConfiguration::failover_target].
20945    pub fn set_failover_target<T>(mut self, v: T) -> Self
20946    where
20947        T: std::convert::Into<wkt::BoolValue>,
20948    {
20949        self.failover_target = std::option::Option::Some(v.into());
20950        self
20951    }
20952
20953    /// Sets or clears the value of [failover_target][crate::model::ReplicaConfiguration::failover_target].
20954    pub fn set_or_clear_failover_target<T>(mut self, v: std::option::Option<T>) -> Self
20955    where
20956        T: std::convert::Into<wkt::BoolValue>,
20957    {
20958        self.failover_target = v.map(|x| x.into());
20959        self
20960    }
20961
20962    /// Sets the value of [cascadable_replica][crate::model::ReplicaConfiguration::cascadable_replica].
20963    pub fn set_cascadable_replica<T>(mut self, v: T) -> Self
20964    where
20965        T: std::convert::Into<wkt::BoolValue>,
20966    {
20967        self.cascadable_replica = std::option::Option::Some(v.into());
20968        self
20969    }
20970
20971    /// Sets or clears the value of [cascadable_replica][crate::model::ReplicaConfiguration::cascadable_replica].
20972    pub fn set_or_clear_cascadable_replica<T>(mut self, v: std::option::Option<T>) -> Self
20973    where
20974        T: std::convert::Into<wkt::BoolValue>,
20975    {
20976        self.cascadable_replica = v.map(|x| x.into());
20977        self
20978    }
20979}
20980
20981impl wkt::message::Message for ReplicaConfiguration {
20982    fn typename() -> &'static str {
20983        "type.googleapis.com/google.cloud.sql.v1.ReplicaConfiguration"
20984    }
20985}
20986
20987#[doc(hidden)]
20988impl<'de> serde::de::Deserialize<'de> for ReplicaConfiguration {
20989    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20990    where
20991        D: serde::Deserializer<'de>,
20992    {
20993        #[allow(non_camel_case_types)]
20994        #[doc(hidden)]
20995        #[derive(PartialEq, Eq, Hash)]
20996        enum __FieldTag {
20997            __kind,
20998            __mysql_replica_configuration,
20999            __failover_target,
21000            __cascadable_replica,
21001            Unknown(std::string::String),
21002        }
21003        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
21004            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21005            where
21006                D: serde::Deserializer<'de>,
21007            {
21008                struct Visitor;
21009                impl<'de> serde::de::Visitor<'de> for Visitor {
21010                    type Value = __FieldTag;
21011                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21012                        formatter.write_str("a field name for ReplicaConfiguration")
21013                    }
21014                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
21015                    where
21016                        E: serde::de::Error,
21017                    {
21018                        use std::result::Result::Ok;
21019                        use std::string::ToString;
21020                        match value {
21021                            "kind" => Ok(__FieldTag::__kind),
21022                            "mysqlReplicaConfiguration" => {
21023                                Ok(__FieldTag::__mysql_replica_configuration)
21024                            }
21025                            "mysql_replica_configuration" => {
21026                                Ok(__FieldTag::__mysql_replica_configuration)
21027                            }
21028                            "failoverTarget" => Ok(__FieldTag::__failover_target),
21029                            "failover_target" => Ok(__FieldTag::__failover_target),
21030                            "cascadableReplica" => Ok(__FieldTag::__cascadable_replica),
21031                            "cascadable_replica" => Ok(__FieldTag::__cascadable_replica),
21032                            _ => Ok(__FieldTag::Unknown(value.to_string())),
21033                        }
21034                    }
21035                }
21036                deserializer.deserialize_identifier(Visitor)
21037            }
21038        }
21039        struct Visitor;
21040        impl<'de> serde::de::Visitor<'de> for Visitor {
21041            type Value = ReplicaConfiguration;
21042            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21043                formatter.write_str("struct ReplicaConfiguration")
21044            }
21045            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
21046            where
21047                A: serde::de::MapAccess<'de>,
21048            {
21049                #[allow(unused_imports)]
21050                use serde::de::Error;
21051                use std::option::Option::Some;
21052                let mut fields = std::collections::HashSet::new();
21053                let mut result = Self::Value::new();
21054                while let Some(tag) = map.next_key::<__FieldTag>()? {
21055                    #[allow(clippy::match_single_binding)]
21056                    match tag {
21057                        __FieldTag::__kind => {
21058                            if !fields.insert(__FieldTag::__kind) {
21059                                return std::result::Result::Err(A::Error::duplicate_field(
21060                                    "multiple values for kind",
21061                                ));
21062                            }
21063                            result.kind = map
21064                                .next_value::<std::option::Option<std::string::String>>()?
21065                                .unwrap_or_default();
21066                        }
21067                        __FieldTag::__mysql_replica_configuration => {
21068                            if !fields.insert(__FieldTag::__mysql_replica_configuration) {
21069                                return std::result::Result::Err(A::Error::duplicate_field(
21070                                    "multiple values for mysql_replica_configuration",
21071                                ));
21072                            }
21073                            result.mysql_replica_configuration = map.next_value::<std::option::Option<crate::model::MySqlReplicaConfiguration>>()?
21074                                ;
21075                        }
21076                        __FieldTag::__failover_target => {
21077                            if !fields.insert(__FieldTag::__failover_target) {
21078                                return std::result::Result::Err(A::Error::duplicate_field(
21079                                    "multiple values for failover_target",
21080                                ));
21081                            }
21082                            result.failover_target =
21083                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
21084                        }
21085                        __FieldTag::__cascadable_replica => {
21086                            if !fields.insert(__FieldTag::__cascadable_replica) {
21087                                return std::result::Result::Err(A::Error::duplicate_field(
21088                                    "multiple values for cascadable_replica",
21089                                ));
21090                            }
21091                            result.cascadable_replica =
21092                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
21093                        }
21094                        __FieldTag::Unknown(key) => {
21095                            let value = map.next_value::<serde_json::Value>()?;
21096                            result._unknown_fields.insert(key, value);
21097                        }
21098                    }
21099                }
21100                std::result::Result::Ok(result)
21101            }
21102        }
21103        deserializer.deserialize_any(Visitor)
21104    }
21105}
21106
21107#[doc(hidden)]
21108impl serde::ser::Serialize for ReplicaConfiguration {
21109    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21110    where
21111        S: serde::ser::Serializer,
21112    {
21113        use serde::ser::SerializeMap;
21114        #[allow(unused_imports)]
21115        use std::option::Option::Some;
21116        let mut state = serializer.serialize_map(std::option::Option::None)?;
21117        if !self.kind.is_empty() {
21118            state.serialize_entry("kind", &self.kind)?;
21119        }
21120        if self.mysql_replica_configuration.is_some() {
21121            state.serialize_entry(
21122                "mysqlReplicaConfiguration",
21123                &self.mysql_replica_configuration,
21124            )?;
21125        }
21126        if self.failover_target.is_some() {
21127            state.serialize_entry("failoverTarget", &self.failover_target)?;
21128        }
21129        if self.cascadable_replica.is_some() {
21130            state.serialize_entry("cascadableReplica", &self.cascadable_replica)?;
21131        }
21132        if !self._unknown_fields.is_empty() {
21133            for (key, value) in self._unknown_fields.iter() {
21134                state.serialize_entry(key, &value)?;
21135            }
21136        }
21137        state.end()
21138    }
21139}
21140
21141/// Request to acquire a lease for SSRS.
21142#[derive(Clone, Debug, Default, PartialEq)]
21143#[non_exhaustive]
21144pub struct SqlInstancesAcquireSsrsLeaseRequest {
21145    /// Required. Cloud SQL instance ID. This doesn't include the project ID. It's
21146    /// composed of lowercase letters, numbers, and hyphens, and it must start with
21147    /// a letter. The total length must be 98 characters or less (Example:
21148    /// instance-id).
21149    pub instance: std::string::String,
21150
21151    /// Required. Project ID of the project that contains the instance (Example:
21152    /// project-id).
21153    pub project: std::string::String,
21154
21155    /// Required. The request body.
21156    pub body: std::option::Option<crate::model::InstancesAcquireSsrsLeaseRequest>,
21157
21158    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21159}
21160
21161impl SqlInstancesAcquireSsrsLeaseRequest {
21162    pub fn new() -> Self {
21163        std::default::Default::default()
21164    }
21165
21166    /// Sets the value of [instance][crate::model::SqlInstancesAcquireSsrsLeaseRequest::instance].
21167    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21168        self.instance = v.into();
21169        self
21170    }
21171
21172    /// Sets the value of [project][crate::model::SqlInstancesAcquireSsrsLeaseRequest::project].
21173    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21174        self.project = v.into();
21175        self
21176    }
21177
21178    /// Sets the value of [body][crate::model::SqlInstancesAcquireSsrsLeaseRequest::body].
21179    pub fn set_body<T>(mut self, v: T) -> Self
21180    where
21181        T: std::convert::Into<crate::model::InstancesAcquireSsrsLeaseRequest>,
21182    {
21183        self.body = std::option::Option::Some(v.into());
21184        self
21185    }
21186
21187    /// Sets or clears the value of [body][crate::model::SqlInstancesAcquireSsrsLeaseRequest::body].
21188    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
21189    where
21190        T: std::convert::Into<crate::model::InstancesAcquireSsrsLeaseRequest>,
21191    {
21192        self.body = v.map(|x| x.into());
21193        self
21194    }
21195}
21196
21197impl wkt::message::Message for SqlInstancesAcquireSsrsLeaseRequest {
21198    fn typename() -> &'static str {
21199        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest"
21200    }
21201}
21202
21203#[doc(hidden)]
21204impl<'de> serde::de::Deserialize<'de> for SqlInstancesAcquireSsrsLeaseRequest {
21205    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21206    where
21207        D: serde::Deserializer<'de>,
21208    {
21209        #[allow(non_camel_case_types)]
21210        #[doc(hidden)]
21211        #[derive(PartialEq, Eq, Hash)]
21212        enum __FieldTag {
21213            __instance,
21214            __project,
21215            __body,
21216            Unknown(std::string::String),
21217        }
21218        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
21219            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21220            where
21221                D: serde::Deserializer<'de>,
21222            {
21223                struct Visitor;
21224                impl<'de> serde::de::Visitor<'de> for Visitor {
21225                    type Value = __FieldTag;
21226                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21227                        formatter.write_str("a field name for SqlInstancesAcquireSsrsLeaseRequest")
21228                    }
21229                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
21230                    where
21231                        E: serde::de::Error,
21232                    {
21233                        use std::result::Result::Ok;
21234                        use std::string::ToString;
21235                        match value {
21236                            "instance" => Ok(__FieldTag::__instance),
21237                            "project" => Ok(__FieldTag::__project),
21238                            "body" => Ok(__FieldTag::__body),
21239                            _ => Ok(__FieldTag::Unknown(value.to_string())),
21240                        }
21241                    }
21242                }
21243                deserializer.deserialize_identifier(Visitor)
21244            }
21245        }
21246        struct Visitor;
21247        impl<'de> serde::de::Visitor<'de> for Visitor {
21248            type Value = SqlInstancesAcquireSsrsLeaseRequest;
21249            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21250                formatter.write_str("struct SqlInstancesAcquireSsrsLeaseRequest")
21251            }
21252            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
21253            where
21254                A: serde::de::MapAccess<'de>,
21255            {
21256                #[allow(unused_imports)]
21257                use serde::de::Error;
21258                use std::option::Option::Some;
21259                let mut fields = std::collections::HashSet::new();
21260                let mut result = Self::Value::new();
21261                while let Some(tag) = map.next_key::<__FieldTag>()? {
21262                    #[allow(clippy::match_single_binding)]
21263                    match tag {
21264                        __FieldTag::__instance => {
21265                            if !fields.insert(__FieldTag::__instance) {
21266                                return std::result::Result::Err(A::Error::duplicate_field(
21267                                    "multiple values for instance",
21268                                ));
21269                            }
21270                            result.instance = map
21271                                .next_value::<std::option::Option<std::string::String>>()?
21272                                .unwrap_or_default();
21273                        }
21274                        __FieldTag::__project => {
21275                            if !fields.insert(__FieldTag::__project) {
21276                                return std::result::Result::Err(A::Error::duplicate_field(
21277                                    "multiple values for project",
21278                                ));
21279                            }
21280                            result.project = map
21281                                .next_value::<std::option::Option<std::string::String>>()?
21282                                .unwrap_or_default();
21283                        }
21284                        __FieldTag::__body => {
21285                            if !fields.insert(__FieldTag::__body) {
21286                                return std::result::Result::Err(A::Error::duplicate_field(
21287                                    "multiple values for body",
21288                                ));
21289                            }
21290                            result.body = map.next_value::<std::option::Option<
21291                                crate::model::InstancesAcquireSsrsLeaseRequest,
21292                            >>()?;
21293                        }
21294                        __FieldTag::Unknown(key) => {
21295                            let value = map.next_value::<serde_json::Value>()?;
21296                            result._unknown_fields.insert(key, value);
21297                        }
21298                    }
21299                }
21300                std::result::Result::Ok(result)
21301            }
21302        }
21303        deserializer.deserialize_any(Visitor)
21304    }
21305}
21306
21307#[doc(hidden)]
21308impl serde::ser::Serialize for SqlInstancesAcquireSsrsLeaseRequest {
21309    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21310    where
21311        S: serde::ser::Serializer,
21312    {
21313        use serde::ser::SerializeMap;
21314        #[allow(unused_imports)]
21315        use std::option::Option::Some;
21316        let mut state = serializer.serialize_map(std::option::Option::None)?;
21317        if !self.instance.is_empty() {
21318            state.serialize_entry("instance", &self.instance)?;
21319        }
21320        if !self.project.is_empty() {
21321            state.serialize_entry("project", &self.project)?;
21322        }
21323        if self.body.is_some() {
21324            state.serialize_entry("body", &self.body)?;
21325        }
21326        if !self._unknown_fields.is_empty() {
21327            for (key, value) in self._unknown_fields.iter() {
21328                state.serialize_entry(key, &value)?;
21329            }
21330        }
21331        state.end()
21332    }
21333}
21334
21335/// Response for the acquire SSRS lease request.
21336#[derive(Clone, Debug, Default, PartialEq)]
21337#[non_exhaustive]
21338pub struct SqlInstancesAcquireSsrsLeaseResponse {
21339    /// The unique identifier for this operation.
21340    pub operation_id: std::string::String,
21341
21342    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21343}
21344
21345impl SqlInstancesAcquireSsrsLeaseResponse {
21346    pub fn new() -> Self {
21347        std::default::Default::default()
21348    }
21349
21350    /// Sets the value of [operation_id][crate::model::SqlInstancesAcquireSsrsLeaseResponse::operation_id].
21351    pub fn set_operation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21352        self.operation_id = v.into();
21353        self
21354    }
21355}
21356
21357impl wkt::message::Message for SqlInstancesAcquireSsrsLeaseResponse {
21358    fn typename() -> &'static str {
21359        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse"
21360    }
21361}
21362
21363#[doc(hidden)]
21364impl<'de> serde::de::Deserialize<'de> for SqlInstancesAcquireSsrsLeaseResponse {
21365    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21366    where
21367        D: serde::Deserializer<'de>,
21368    {
21369        #[allow(non_camel_case_types)]
21370        #[doc(hidden)]
21371        #[derive(PartialEq, Eq, Hash)]
21372        enum __FieldTag {
21373            __operation_id,
21374            Unknown(std::string::String),
21375        }
21376        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
21377            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21378            where
21379                D: serde::Deserializer<'de>,
21380            {
21381                struct Visitor;
21382                impl<'de> serde::de::Visitor<'de> for Visitor {
21383                    type Value = __FieldTag;
21384                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21385                        formatter.write_str("a field name for SqlInstancesAcquireSsrsLeaseResponse")
21386                    }
21387                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
21388                    where
21389                        E: serde::de::Error,
21390                    {
21391                        use std::result::Result::Ok;
21392                        use std::string::ToString;
21393                        match value {
21394                            "operationId" => Ok(__FieldTag::__operation_id),
21395                            "operation_id" => Ok(__FieldTag::__operation_id),
21396                            _ => Ok(__FieldTag::Unknown(value.to_string())),
21397                        }
21398                    }
21399                }
21400                deserializer.deserialize_identifier(Visitor)
21401            }
21402        }
21403        struct Visitor;
21404        impl<'de> serde::de::Visitor<'de> for Visitor {
21405            type Value = SqlInstancesAcquireSsrsLeaseResponse;
21406            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21407                formatter.write_str("struct SqlInstancesAcquireSsrsLeaseResponse")
21408            }
21409            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
21410            where
21411                A: serde::de::MapAccess<'de>,
21412            {
21413                #[allow(unused_imports)]
21414                use serde::de::Error;
21415                use std::option::Option::Some;
21416                let mut fields = std::collections::HashSet::new();
21417                let mut result = Self::Value::new();
21418                while let Some(tag) = map.next_key::<__FieldTag>()? {
21419                    #[allow(clippy::match_single_binding)]
21420                    match tag {
21421                        __FieldTag::__operation_id => {
21422                            if !fields.insert(__FieldTag::__operation_id) {
21423                                return std::result::Result::Err(A::Error::duplicate_field(
21424                                    "multiple values for operation_id",
21425                                ));
21426                            }
21427                            result.operation_id = map
21428                                .next_value::<std::option::Option<std::string::String>>()?
21429                                .unwrap_or_default();
21430                        }
21431                        __FieldTag::Unknown(key) => {
21432                            let value = map.next_value::<serde_json::Value>()?;
21433                            result._unknown_fields.insert(key, value);
21434                        }
21435                    }
21436                }
21437                std::result::Result::Ok(result)
21438            }
21439        }
21440        deserializer.deserialize_any(Visitor)
21441    }
21442}
21443
21444#[doc(hidden)]
21445impl serde::ser::Serialize for SqlInstancesAcquireSsrsLeaseResponse {
21446    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21447    where
21448        S: serde::ser::Serializer,
21449    {
21450        use serde::ser::SerializeMap;
21451        #[allow(unused_imports)]
21452        use std::option::Option::Some;
21453        let mut state = serializer.serialize_map(std::option::Option::None)?;
21454        if !self.operation_id.is_empty() {
21455            state.serialize_entry("operationId", &self.operation_id)?;
21456        }
21457        if !self._unknown_fields.is_empty() {
21458            for (key, value) in self._unknown_fields.iter() {
21459                state.serialize_entry(key, &value)?;
21460            }
21461        }
21462        state.end()
21463    }
21464}
21465
21466/// Request to release a lease for SSRS.
21467#[derive(Clone, Debug, Default, PartialEq)]
21468#[non_exhaustive]
21469pub struct SqlInstancesReleaseSsrsLeaseRequest {
21470    /// Required. The Cloud SQL instance ID. This doesn't include the project ID.
21471    /// The instance ID contains lowercase letters, numbers, and hyphens, and it
21472    /// must start with a letter. This ID can have a maximum length of 98
21473    /// characters.
21474    pub instance: std::string::String,
21475
21476    /// Required. The project ID that contains the instance.
21477    pub project: std::string::String,
21478
21479    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21480}
21481
21482impl SqlInstancesReleaseSsrsLeaseRequest {
21483    pub fn new() -> Self {
21484        std::default::Default::default()
21485    }
21486
21487    /// Sets the value of [instance][crate::model::SqlInstancesReleaseSsrsLeaseRequest::instance].
21488    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21489        self.instance = v.into();
21490        self
21491    }
21492
21493    /// Sets the value of [project][crate::model::SqlInstancesReleaseSsrsLeaseRequest::project].
21494    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21495        self.project = v.into();
21496        self
21497    }
21498}
21499
21500impl wkt::message::Message for SqlInstancesReleaseSsrsLeaseRequest {
21501    fn typename() -> &'static str {
21502        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest"
21503    }
21504}
21505
21506#[doc(hidden)]
21507impl<'de> serde::de::Deserialize<'de> for SqlInstancesReleaseSsrsLeaseRequest {
21508    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21509    where
21510        D: serde::Deserializer<'de>,
21511    {
21512        #[allow(non_camel_case_types)]
21513        #[doc(hidden)]
21514        #[derive(PartialEq, Eq, Hash)]
21515        enum __FieldTag {
21516            __instance,
21517            __project,
21518            Unknown(std::string::String),
21519        }
21520        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
21521            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21522            where
21523                D: serde::Deserializer<'de>,
21524            {
21525                struct Visitor;
21526                impl<'de> serde::de::Visitor<'de> for Visitor {
21527                    type Value = __FieldTag;
21528                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21529                        formatter.write_str("a field name for SqlInstancesReleaseSsrsLeaseRequest")
21530                    }
21531                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
21532                    where
21533                        E: serde::de::Error,
21534                    {
21535                        use std::result::Result::Ok;
21536                        use std::string::ToString;
21537                        match value {
21538                            "instance" => Ok(__FieldTag::__instance),
21539                            "project" => Ok(__FieldTag::__project),
21540                            _ => Ok(__FieldTag::Unknown(value.to_string())),
21541                        }
21542                    }
21543                }
21544                deserializer.deserialize_identifier(Visitor)
21545            }
21546        }
21547        struct Visitor;
21548        impl<'de> serde::de::Visitor<'de> for Visitor {
21549            type Value = SqlInstancesReleaseSsrsLeaseRequest;
21550            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21551                formatter.write_str("struct SqlInstancesReleaseSsrsLeaseRequest")
21552            }
21553            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
21554            where
21555                A: serde::de::MapAccess<'de>,
21556            {
21557                #[allow(unused_imports)]
21558                use serde::de::Error;
21559                use std::option::Option::Some;
21560                let mut fields = std::collections::HashSet::new();
21561                let mut result = Self::Value::new();
21562                while let Some(tag) = map.next_key::<__FieldTag>()? {
21563                    #[allow(clippy::match_single_binding)]
21564                    match tag {
21565                        __FieldTag::__instance => {
21566                            if !fields.insert(__FieldTag::__instance) {
21567                                return std::result::Result::Err(A::Error::duplicate_field(
21568                                    "multiple values for instance",
21569                                ));
21570                            }
21571                            result.instance = map
21572                                .next_value::<std::option::Option<std::string::String>>()?
21573                                .unwrap_or_default();
21574                        }
21575                        __FieldTag::__project => {
21576                            if !fields.insert(__FieldTag::__project) {
21577                                return std::result::Result::Err(A::Error::duplicate_field(
21578                                    "multiple values for project",
21579                                ));
21580                            }
21581                            result.project = map
21582                                .next_value::<std::option::Option<std::string::String>>()?
21583                                .unwrap_or_default();
21584                        }
21585                        __FieldTag::Unknown(key) => {
21586                            let value = map.next_value::<serde_json::Value>()?;
21587                            result._unknown_fields.insert(key, value);
21588                        }
21589                    }
21590                }
21591                std::result::Result::Ok(result)
21592            }
21593        }
21594        deserializer.deserialize_any(Visitor)
21595    }
21596}
21597
21598#[doc(hidden)]
21599impl serde::ser::Serialize for SqlInstancesReleaseSsrsLeaseRequest {
21600    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21601    where
21602        S: serde::ser::Serializer,
21603    {
21604        use serde::ser::SerializeMap;
21605        #[allow(unused_imports)]
21606        use std::option::Option::Some;
21607        let mut state = serializer.serialize_map(std::option::Option::None)?;
21608        if !self.instance.is_empty() {
21609            state.serialize_entry("instance", &self.instance)?;
21610        }
21611        if !self.project.is_empty() {
21612            state.serialize_entry("project", &self.project)?;
21613        }
21614        if !self._unknown_fields.is_empty() {
21615            for (key, value) in self._unknown_fields.iter() {
21616                state.serialize_entry(key, &value)?;
21617            }
21618        }
21619        state.end()
21620    }
21621}
21622
21623/// Response for the release SSRS lease request.
21624#[derive(Clone, Debug, Default, PartialEq)]
21625#[non_exhaustive]
21626pub struct SqlInstancesReleaseSsrsLeaseResponse {
21627    /// The unique identifier for this operation.
21628    pub operation_id: std::string::String,
21629
21630    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21631}
21632
21633impl SqlInstancesReleaseSsrsLeaseResponse {
21634    pub fn new() -> Self {
21635        std::default::Default::default()
21636    }
21637
21638    /// Sets the value of [operation_id][crate::model::SqlInstancesReleaseSsrsLeaseResponse::operation_id].
21639    pub fn set_operation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21640        self.operation_id = v.into();
21641        self
21642    }
21643}
21644
21645impl wkt::message::Message for SqlInstancesReleaseSsrsLeaseResponse {
21646    fn typename() -> &'static str {
21647        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse"
21648    }
21649}
21650
21651#[doc(hidden)]
21652impl<'de> serde::de::Deserialize<'de> for SqlInstancesReleaseSsrsLeaseResponse {
21653    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21654    where
21655        D: serde::Deserializer<'de>,
21656    {
21657        #[allow(non_camel_case_types)]
21658        #[doc(hidden)]
21659        #[derive(PartialEq, Eq, Hash)]
21660        enum __FieldTag {
21661            __operation_id,
21662            Unknown(std::string::String),
21663        }
21664        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
21665            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21666            where
21667                D: serde::Deserializer<'de>,
21668            {
21669                struct Visitor;
21670                impl<'de> serde::de::Visitor<'de> for Visitor {
21671                    type Value = __FieldTag;
21672                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21673                        formatter.write_str("a field name for SqlInstancesReleaseSsrsLeaseResponse")
21674                    }
21675                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
21676                    where
21677                        E: serde::de::Error,
21678                    {
21679                        use std::result::Result::Ok;
21680                        use std::string::ToString;
21681                        match value {
21682                            "operationId" => Ok(__FieldTag::__operation_id),
21683                            "operation_id" => Ok(__FieldTag::__operation_id),
21684                            _ => Ok(__FieldTag::Unknown(value.to_string())),
21685                        }
21686                    }
21687                }
21688                deserializer.deserialize_identifier(Visitor)
21689            }
21690        }
21691        struct Visitor;
21692        impl<'de> serde::de::Visitor<'de> for Visitor {
21693            type Value = SqlInstancesReleaseSsrsLeaseResponse;
21694            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21695                formatter.write_str("struct SqlInstancesReleaseSsrsLeaseResponse")
21696            }
21697            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
21698            where
21699                A: serde::de::MapAccess<'de>,
21700            {
21701                #[allow(unused_imports)]
21702                use serde::de::Error;
21703                use std::option::Option::Some;
21704                let mut fields = std::collections::HashSet::new();
21705                let mut result = Self::Value::new();
21706                while let Some(tag) = map.next_key::<__FieldTag>()? {
21707                    #[allow(clippy::match_single_binding)]
21708                    match tag {
21709                        __FieldTag::__operation_id => {
21710                            if !fields.insert(__FieldTag::__operation_id) {
21711                                return std::result::Result::Err(A::Error::duplicate_field(
21712                                    "multiple values for operation_id",
21713                                ));
21714                            }
21715                            result.operation_id = map
21716                                .next_value::<std::option::Option<std::string::String>>()?
21717                                .unwrap_or_default();
21718                        }
21719                        __FieldTag::Unknown(key) => {
21720                            let value = map.next_value::<serde_json::Value>()?;
21721                            result._unknown_fields.insert(key, value);
21722                        }
21723                    }
21724                }
21725                std::result::Result::Ok(result)
21726            }
21727        }
21728        deserializer.deserialize_any(Visitor)
21729    }
21730}
21731
21732#[doc(hidden)]
21733impl serde::ser::Serialize for SqlInstancesReleaseSsrsLeaseResponse {
21734    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21735    where
21736        S: serde::ser::Serializer,
21737    {
21738        use serde::ser::SerializeMap;
21739        #[allow(unused_imports)]
21740        use std::option::Option::Some;
21741        let mut state = serializer.serialize_map(std::option::Option::None)?;
21742        if !self.operation_id.is_empty() {
21743            state.serialize_entry("operationId", &self.operation_id)?;
21744        }
21745        if !self._unknown_fields.is_empty() {
21746            for (key, value) in self._unknown_fields.iter() {
21747                state.serialize_entry(key, &value)?;
21748            }
21749        }
21750        state.end()
21751    }
21752}
21753
21754/// Operations get request.
21755#[derive(Clone, Debug, Default, PartialEq)]
21756#[non_exhaustive]
21757pub struct SqlOperationsGetRequest {
21758    /// Instance operation ID.
21759    pub operation: std::string::String,
21760
21761    /// Project ID of the project that contains the instance.
21762    pub project: std::string::String,
21763
21764    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21765}
21766
21767impl SqlOperationsGetRequest {
21768    pub fn new() -> Self {
21769        std::default::Default::default()
21770    }
21771
21772    /// Sets the value of [operation][crate::model::SqlOperationsGetRequest::operation].
21773    pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21774        self.operation = v.into();
21775        self
21776    }
21777
21778    /// Sets the value of [project][crate::model::SqlOperationsGetRequest::project].
21779    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21780        self.project = v.into();
21781        self
21782    }
21783}
21784
21785impl wkt::message::Message for SqlOperationsGetRequest {
21786    fn typename() -> &'static str {
21787        "type.googleapis.com/google.cloud.sql.v1.SqlOperationsGetRequest"
21788    }
21789}
21790
21791#[doc(hidden)]
21792impl<'de> serde::de::Deserialize<'de> for SqlOperationsGetRequest {
21793    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21794    where
21795        D: serde::Deserializer<'de>,
21796    {
21797        #[allow(non_camel_case_types)]
21798        #[doc(hidden)]
21799        #[derive(PartialEq, Eq, Hash)]
21800        enum __FieldTag {
21801            __operation,
21802            __project,
21803            Unknown(std::string::String),
21804        }
21805        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
21806            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21807            where
21808                D: serde::Deserializer<'de>,
21809            {
21810                struct Visitor;
21811                impl<'de> serde::de::Visitor<'de> for Visitor {
21812                    type Value = __FieldTag;
21813                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21814                        formatter.write_str("a field name for SqlOperationsGetRequest")
21815                    }
21816                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
21817                    where
21818                        E: serde::de::Error,
21819                    {
21820                        use std::result::Result::Ok;
21821                        use std::string::ToString;
21822                        match value {
21823                            "operation" => Ok(__FieldTag::__operation),
21824                            "project" => Ok(__FieldTag::__project),
21825                            _ => Ok(__FieldTag::Unknown(value.to_string())),
21826                        }
21827                    }
21828                }
21829                deserializer.deserialize_identifier(Visitor)
21830            }
21831        }
21832        struct Visitor;
21833        impl<'de> serde::de::Visitor<'de> for Visitor {
21834            type Value = SqlOperationsGetRequest;
21835            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21836                formatter.write_str("struct SqlOperationsGetRequest")
21837            }
21838            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
21839            where
21840                A: serde::de::MapAccess<'de>,
21841            {
21842                #[allow(unused_imports)]
21843                use serde::de::Error;
21844                use std::option::Option::Some;
21845                let mut fields = std::collections::HashSet::new();
21846                let mut result = Self::Value::new();
21847                while let Some(tag) = map.next_key::<__FieldTag>()? {
21848                    #[allow(clippy::match_single_binding)]
21849                    match tag {
21850                        __FieldTag::__operation => {
21851                            if !fields.insert(__FieldTag::__operation) {
21852                                return std::result::Result::Err(A::Error::duplicate_field(
21853                                    "multiple values for operation",
21854                                ));
21855                            }
21856                            result.operation = map
21857                                .next_value::<std::option::Option<std::string::String>>()?
21858                                .unwrap_or_default();
21859                        }
21860                        __FieldTag::__project => {
21861                            if !fields.insert(__FieldTag::__project) {
21862                                return std::result::Result::Err(A::Error::duplicate_field(
21863                                    "multiple values for project",
21864                                ));
21865                            }
21866                            result.project = map
21867                                .next_value::<std::option::Option<std::string::String>>()?
21868                                .unwrap_or_default();
21869                        }
21870                        __FieldTag::Unknown(key) => {
21871                            let value = map.next_value::<serde_json::Value>()?;
21872                            result._unknown_fields.insert(key, value);
21873                        }
21874                    }
21875                }
21876                std::result::Result::Ok(result)
21877            }
21878        }
21879        deserializer.deserialize_any(Visitor)
21880    }
21881}
21882
21883#[doc(hidden)]
21884impl serde::ser::Serialize for SqlOperationsGetRequest {
21885    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21886    where
21887        S: serde::ser::Serializer,
21888    {
21889        use serde::ser::SerializeMap;
21890        #[allow(unused_imports)]
21891        use std::option::Option::Some;
21892        let mut state = serializer.serialize_map(std::option::Option::None)?;
21893        if !self.operation.is_empty() {
21894            state.serialize_entry("operation", &self.operation)?;
21895        }
21896        if !self.project.is_empty() {
21897            state.serialize_entry("project", &self.project)?;
21898        }
21899        if !self._unknown_fields.is_empty() {
21900            for (key, value) in self._unknown_fields.iter() {
21901                state.serialize_entry(key, &value)?;
21902            }
21903        }
21904        state.end()
21905    }
21906}
21907
21908/// Operations list request.
21909#[derive(Clone, Debug, Default, PartialEq)]
21910#[non_exhaustive]
21911pub struct SqlOperationsListRequest {
21912    /// Cloud SQL instance ID. This does not include the project ID.
21913    pub instance: std::string::String,
21914
21915    /// Maximum number of operations per response.
21916    pub max_results: u32,
21917
21918    /// A previously-returned page token representing part of the larger set of
21919    /// results to view.
21920    pub page_token: std::string::String,
21921
21922    /// Project ID of the project that contains the instance.
21923    pub project: std::string::String,
21924
21925    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21926}
21927
21928impl SqlOperationsListRequest {
21929    pub fn new() -> Self {
21930        std::default::Default::default()
21931    }
21932
21933    /// Sets the value of [instance][crate::model::SqlOperationsListRequest::instance].
21934    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21935        self.instance = v.into();
21936        self
21937    }
21938
21939    /// Sets the value of [max_results][crate::model::SqlOperationsListRequest::max_results].
21940    pub fn set_max_results<T: std::convert::Into<u32>>(mut self, v: T) -> Self {
21941        self.max_results = v.into();
21942        self
21943    }
21944
21945    /// Sets the value of [page_token][crate::model::SqlOperationsListRequest::page_token].
21946    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21947        self.page_token = v.into();
21948        self
21949    }
21950
21951    /// Sets the value of [project][crate::model::SqlOperationsListRequest::project].
21952    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21953        self.project = v.into();
21954        self
21955    }
21956}
21957
21958impl wkt::message::Message for SqlOperationsListRequest {
21959    fn typename() -> &'static str {
21960        "type.googleapis.com/google.cloud.sql.v1.SqlOperationsListRequest"
21961    }
21962}
21963
21964#[doc(hidden)]
21965impl<'de> serde::de::Deserialize<'de> for SqlOperationsListRequest {
21966    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21967    where
21968        D: serde::Deserializer<'de>,
21969    {
21970        #[allow(non_camel_case_types)]
21971        #[doc(hidden)]
21972        #[derive(PartialEq, Eq, Hash)]
21973        enum __FieldTag {
21974            __instance,
21975            __max_results,
21976            __page_token,
21977            __project,
21978            Unknown(std::string::String),
21979        }
21980        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
21981            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21982            where
21983                D: serde::Deserializer<'de>,
21984            {
21985                struct Visitor;
21986                impl<'de> serde::de::Visitor<'de> for Visitor {
21987                    type Value = __FieldTag;
21988                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21989                        formatter.write_str("a field name for SqlOperationsListRequest")
21990                    }
21991                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
21992                    where
21993                        E: serde::de::Error,
21994                    {
21995                        use std::result::Result::Ok;
21996                        use std::string::ToString;
21997                        match value {
21998                            "instance" => Ok(__FieldTag::__instance),
21999                            "maxResults" => Ok(__FieldTag::__max_results),
22000                            "max_results" => Ok(__FieldTag::__max_results),
22001                            "pageToken" => Ok(__FieldTag::__page_token),
22002                            "page_token" => Ok(__FieldTag::__page_token),
22003                            "project" => Ok(__FieldTag::__project),
22004                            _ => Ok(__FieldTag::Unknown(value.to_string())),
22005                        }
22006                    }
22007                }
22008                deserializer.deserialize_identifier(Visitor)
22009            }
22010        }
22011        struct Visitor;
22012        impl<'de> serde::de::Visitor<'de> for Visitor {
22013            type Value = SqlOperationsListRequest;
22014            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22015                formatter.write_str("struct SqlOperationsListRequest")
22016            }
22017            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22018            where
22019                A: serde::de::MapAccess<'de>,
22020            {
22021                #[allow(unused_imports)]
22022                use serde::de::Error;
22023                use std::option::Option::Some;
22024                let mut fields = std::collections::HashSet::new();
22025                let mut result = Self::Value::new();
22026                while let Some(tag) = map.next_key::<__FieldTag>()? {
22027                    #[allow(clippy::match_single_binding)]
22028                    match tag {
22029                        __FieldTag::__instance => {
22030                            if !fields.insert(__FieldTag::__instance) {
22031                                return std::result::Result::Err(A::Error::duplicate_field(
22032                                    "multiple values for instance",
22033                                ));
22034                            }
22035                            result.instance = map
22036                                .next_value::<std::option::Option<std::string::String>>()?
22037                                .unwrap_or_default();
22038                        }
22039                        __FieldTag::__max_results => {
22040                            if !fields.insert(__FieldTag::__max_results) {
22041                                return std::result::Result::Err(A::Error::duplicate_field(
22042                                    "multiple values for max_results",
22043                                ));
22044                            }
22045                            struct __With(std::option::Option<u32>);
22046                            impl<'de> serde::de::Deserialize<'de> for __With {
22047                                fn deserialize<D>(
22048                                    deserializer: D,
22049                                ) -> std::result::Result<Self, D::Error>
22050                                where
22051                                    D: serde::de::Deserializer<'de>,
22052                                {
22053                                    serde_with::As::< std::option::Option<wkt::internal::U32> >::deserialize(deserializer).map(__With)
22054                                }
22055                            }
22056                            result.max_results = map.next_value::<__With>()?.0.unwrap_or_default();
22057                        }
22058                        __FieldTag::__page_token => {
22059                            if !fields.insert(__FieldTag::__page_token) {
22060                                return std::result::Result::Err(A::Error::duplicate_field(
22061                                    "multiple values for page_token",
22062                                ));
22063                            }
22064                            result.page_token = map
22065                                .next_value::<std::option::Option<std::string::String>>()?
22066                                .unwrap_or_default();
22067                        }
22068                        __FieldTag::__project => {
22069                            if !fields.insert(__FieldTag::__project) {
22070                                return std::result::Result::Err(A::Error::duplicate_field(
22071                                    "multiple values for project",
22072                                ));
22073                            }
22074                            result.project = map
22075                                .next_value::<std::option::Option<std::string::String>>()?
22076                                .unwrap_or_default();
22077                        }
22078                        __FieldTag::Unknown(key) => {
22079                            let value = map.next_value::<serde_json::Value>()?;
22080                            result._unknown_fields.insert(key, value);
22081                        }
22082                    }
22083                }
22084                std::result::Result::Ok(result)
22085            }
22086        }
22087        deserializer.deserialize_any(Visitor)
22088    }
22089}
22090
22091#[doc(hidden)]
22092impl serde::ser::Serialize for SqlOperationsListRequest {
22093    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22094    where
22095        S: serde::ser::Serializer,
22096    {
22097        use serde::ser::SerializeMap;
22098        #[allow(unused_imports)]
22099        use std::option::Option::Some;
22100        let mut state = serializer.serialize_map(std::option::Option::None)?;
22101        if !self.instance.is_empty() {
22102            state.serialize_entry("instance", &self.instance)?;
22103        }
22104        if !wkt::internal::is_default(&self.max_results) {
22105            struct __With<'a>(&'a u32);
22106            impl<'a> serde::ser::Serialize for __With<'a> {
22107                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22108                where
22109                    S: serde::ser::Serializer,
22110                {
22111                    serde_with::As::<wkt::internal::U32>::serialize(self.0, serializer)
22112                }
22113            }
22114            state.serialize_entry("maxResults", &__With(&self.max_results))?;
22115        }
22116        if !self.page_token.is_empty() {
22117            state.serialize_entry("pageToken", &self.page_token)?;
22118        }
22119        if !self.project.is_empty() {
22120            state.serialize_entry("project", &self.project)?;
22121        }
22122        if !self._unknown_fields.is_empty() {
22123            for (key, value) in self._unknown_fields.iter() {
22124                state.serialize_entry(key, &value)?;
22125            }
22126        }
22127        state.end()
22128    }
22129}
22130
22131/// Operations list response.
22132#[derive(Clone, Debug, Default, PartialEq)]
22133#[non_exhaustive]
22134pub struct OperationsListResponse {
22135    /// This is always `sql#operationsList`.
22136    pub kind: std::string::String,
22137
22138    /// List of operation resources.
22139    pub items: std::vec::Vec<crate::model::Operation>,
22140
22141    /// The continuation token, used to page through large result sets. Provide
22142    /// this value in a subsequent request to return the next page of results.
22143    pub next_page_token: std::string::String,
22144
22145    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22146}
22147
22148impl OperationsListResponse {
22149    pub fn new() -> Self {
22150        std::default::Default::default()
22151    }
22152
22153    /// Sets the value of [kind][crate::model::OperationsListResponse::kind].
22154    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22155        self.kind = v.into();
22156        self
22157    }
22158
22159    /// Sets the value of [items][crate::model::OperationsListResponse::items].
22160    pub fn set_items<T, V>(mut self, v: T) -> Self
22161    where
22162        T: std::iter::IntoIterator<Item = V>,
22163        V: std::convert::Into<crate::model::Operation>,
22164    {
22165        use std::iter::Iterator;
22166        self.items = v.into_iter().map(|i| i.into()).collect();
22167        self
22168    }
22169
22170    /// Sets the value of [next_page_token][crate::model::OperationsListResponse::next_page_token].
22171    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22172        self.next_page_token = v.into();
22173        self
22174    }
22175}
22176
22177impl wkt::message::Message for OperationsListResponse {
22178    fn typename() -> &'static str {
22179        "type.googleapis.com/google.cloud.sql.v1.OperationsListResponse"
22180    }
22181}
22182
22183#[doc(hidden)]
22184impl gax::paginator::internal::PageableResponse for OperationsListResponse {
22185    type PageItem = crate::model::Operation;
22186
22187    fn items(self) -> std::vec::Vec<Self::PageItem> {
22188        self.items
22189    }
22190
22191    fn next_page_token(&self) -> std::string::String {
22192        use std::clone::Clone;
22193        self.next_page_token.clone()
22194    }
22195}
22196
22197#[doc(hidden)]
22198impl<'de> serde::de::Deserialize<'de> for OperationsListResponse {
22199    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22200    where
22201        D: serde::Deserializer<'de>,
22202    {
22203        #[allow(non_camel_case_types)]
22204        #[doc(hidden)]
22205        #[derive(PartialEq, Eq, Hash)]
22206        enum __FieldTag {
22207            __kind,
22208            __items,
22209            __next_page_token,
22210            Unknown(std::string::String),
22211        }
22212        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
22213            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22214            where
22215                D: serde::Deserializer<'de>,
22216            {
22217                struct Visitor;
22218                impl<'de> serde::de::Visitor<'de> for Visitor {
22219                    type Value = __FieldTag;
22220                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22221                        formatter.write_str("a field name for OperationsListResponse")
22222                    }
22223                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22224                    where
22225                        E: serde::de::Error,
22226                    {
22227                        use std::result::Result::Ok;
22228                        use std::string::ToString;
22229                        match value {
22230                            "kind" => Ok(__FieldTag::__kind),
22231                            "items" => Ok(__FieldTag::__items),
22232                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
22233                            "next_page_token" => Ok(__FieldTag::__next_page_token),
22234                            _ => Ok(__FieldTag::Unknown(value.to_string())),
22235                        }
22236                    }
22237                }
22238                deserializer.deserialize_identifier(Visitor)
22239            }
22240        }
22241        struct Visitor;
22242        impl<'de> serde::de::Visitor<'de> for Visitor {
22243            type Value = OperationsListResponse;
22244            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22245                formatter.write_str("struct OperationsListResponse")
22246            }
22247            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22248            where
22249                A: serde::de::MapAccess<'de>,
22250            {
22251                #[allow(unused_imports)]
22252                use serde::de::Error;
22253                use std::option::Option::Some;
22254                let mut fields = std::collections::HashSet::new();
22255                let mut result = Self::Value::new();
22256                while let Some(tag) = map.next_key::<__FieldTag>()? {
22257                    #[allow(clippy::match_single_binding)]
22258                    match tag {
22259                        __FieldTag::__kind => {
22260                            if !fields.insert(__FieldTag::__kind) {
22261                                return std::result::Result::Err(A::Error::duplicate_field(
22262                                    "multiple values for kind",
22263                                ));
22264                            }
22265                            result.kind = map
22266                                .next_value::<std::option::Option<std::string::String>>()?
22267                                .unwrap_or_default();
22268                        }
22269                        __FieldTag::__items => {
22270                            if !fields.insert(__FieldTag::__items) {
22271                                return std::result::Result::Err(A::Error::duplicate_field(
22272                                    "multiple values for items",
22273                                ));
22274                            }
22275                            result.items = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Operation>>>()?.unwrap_or_default();
22276                        }
22277                        __FieldTag::__next_page_token => {
22278                            if !fields.insert(__FieldTag::__next_page_token) {
22279                                return std::result::Result::Err(A::Error::duplicate_field(
22280                                    "multiple values for next_page_token",
22281                                ));
22282                            }
22283                            result.next_page_token = map
22284                                .next_value::<std::option::Option<std::string::String>>()?
22285                                .unwrap_or_default();
22286                        }
22287                        __FieldTag::Unknown(key) => {
22288                            let value = map.next_value::<serde_json::Value>()?;
22289                            result._unknown_fields.insert(key, value);
22290                        }
22291                    }
22292                }
22293                std::result::Result::Ok(result)
22294            }
22295        }
22296        deserializer.deserialize_any(Visitor)
22297    }
22298}
22299
22300#[doc(hidden)]
22301impl serde::ser::Serialize for OperationsListResponse {
22302    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22303    where
22304        S: serde::ser::Serializer,
22305    {
22306        use serde::ser::SerializeMap;
22307        #[allow(unused_imports)]
22308        use std::option::Option::Some;
22309        let mut state = serializer.serialize_map(std::option::Option::None)?;
22310        if !self.kind.is_empty() {
22311            state.serialize_entry("kind", &self.kind)?;
22312        }
22313        if !self.items.is_empty() {
22314            state.serialize_entry("items", &self.items)?;
22315        }
22316        if !self.next_page_token.is_empty() {
22317            state.serialize_entry("nextPageToken", &self.next_page_token)?;
22318        }
22319        if !self._unknown_fields.is_empty() {
22320            for (key, value) in self._unknown_fields.iter() {
22321                state.serialize_entry(key, &value)?;
22322            }
22323        }
22324        state.end()
22325    }
22326}
22327
22328/// Operations cancel request.
22329#[derive(Clone, Debug, Default, PartialEq)]
22330#[non_exhaustive]
22331pub struct SqlOperationsCancelRequest {
22332    /// Instance operation ID.
22333    pub operation: std::string::String,
22334
22335    /// Project ID of the project that contains the instance.
22336    pub project: std::string::String,
22337
22338    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22339}
22340
22341impl SqlOperationsCancelRequest {
22342    pub fn new() -> Self {
22343        std::default::Default::default()
22344    }
22345
22346    /// Sets the value of [operation][crate::model::SqlOperationsCancelRequest::operation].
22347    pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22348        self.operation = v.into();
22349        self
22350    }
22351
22352    /// Sets the value of [project][crate::model::SqlOperationsCancelRequest::project].
22353    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22354        self.project = v.into();
22355        self
22356    }
22357}
22358
22359impl wkt::message::Message for SqlOperationsCancelRequest {
22360    fn typename() -> &'static str {
22361        "type.googleapis.com/google.cloud.sql.v1.SqlOperationsCancelRequest"
22362    }
22363}
22364
22365#[doc(hidden)]
22366impl<'de> serde::de::Deserialize<'de> for SqlOperationsCancelRequest {
22367    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22368    where
22369        D: serde::Deserializer<'de>,
22370    {
22371        #[allow(non_camel_case_types)]
22372        #[doc(hidden)]
22373        #[derive(PartialEq, Eq, Hash)]
22374        enum __FieldTag {
22375            __operation,
22376            __project,
22377            Unknown(std::string::String),
22378        }
22379        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
22380            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22381            where
22382                D: serde::Deserializer<'de>,
22383            {
22384                struct Visitor;
22385                impl<'de> serde::de::Visitor<'de> for Visitor {
22386                    type Value = __FieldTag;
22387                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22388                        formatter.write_str("a field name for SqlOperationsCancelRequest")
22389                    }
22390                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22391                    where
22392                        E: serde::de::Error,
22393                    {
22394                        use std::result::Result::Ok;
22395                        use std::string::ToString;
22396                        match value {
22397                            "operation" => Ok(__FieldTag::__operation),
22398                            "project" => Ok(__FieldTag::__project),
22399                            _ => Ok(__FieldTag::Unknown(value.to_string())),
22400                        }
22401                    }
22402                }
22403                deserializer.deserialize_identifier(Visitor)
22404            }
22405        }
22406        struct Visitor;
22407        impl<'de> serde::de::Visitor<'de> for Visitor {
22408            type Value = SqlOperationsCancelRequest;
22409            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22410                formatter.write_str("struct SqlOperationsCancelRequest")
22411            }
22412            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22413            where
22414                A: serde::de::MapAccess<'de>,
22415            {
22416                #[allow(unused_imports)]
22417                use serde::de::Error;
22418                use std::option::Option::Some;
22419                let mut fields = std::collections::HashSet::new();
22420                let mut result = Self::Value::new();
22421                while let Some(tag) = map.next_key::<__FieldTag>()? {
22422                    #[allow(clippy::match_single_binding)]
22423                    match tag {
22424                        __FieldTag::__operation => {
22425                            if !fields.insert(__FieldTag::__operation) {
22426                                return std::result::Result::Err(A::Error::duplicate_field(
22427                                    "multiple values for operation",
22428                                ));
22429                            }
22430                            result.operation = map
22431                                .next_value::<std::option::Option<std::string::String>>()?
22432                                .unwrap_or_default();
22433                        }
22434                        __FieldTag::__project => {
22435                            if !fields.insert(__FieldTag::__project) {
22436                                return std::result::Result::Err(A::Error::duplicate_field(
22437                                    "multiple values for project",
22438                                ));
22439                            }
22440                            result.project = map
22441                                .next_value::<std::option::Option<std::string::String>>()?
22442                                .unwrap_or_default();
22443                        }
22444                        __FieldTag::Unknown(key) => {
22445                            let value = map.next_value::<serde_json::Value>()?;
22446                            result._unknown_fields.insert(key, value);
22447                        }
22448                    }
22449                }
22450                std::result::Result::Ok(result)
22451            }
22452        }
22453        deserializer.deserialize_any(Visitor)
22454    }
22455}
22456
22457#[doc(hidden)]
22458impl serde::ser::Serialize for SqlOperationsCancelRequest {
22459    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22460    where
22461        S: serde::ser::Serializer,
22462    {
22463        use serde::ser::SerializeMap;
22464        #[allow(unused_imports)]
22465        use std::option::Option::Some;
22466        let mut state = serializer.serialize_map(std::option::Option::None)?;
22467        if !self.operation.is_empty() {
22468            state.serialize_entry("operation", &self.operation)?;
22469        }
22470        if !self.project.is_empty() {
22471            state.serialize_entry("project", &self.project)?;
22472        }
22473        if !self._unknown_fields.is_empty() {
22474            for (key, value) in self._unknown_fields.iter() {
22475                state.serialize_entry(key, &value)?;
22476            }
22477        }
22478        state.end()
22479    }
22480}
22481
22482/// An entry for an Access Control list.
22483#[derive(Clone, Debug, Default, PartialEq)]
22484#[non_exhaustive]
22485pub struct AclEntry {
22486    /// The allowlisted value for the access control list.
22487    pub value: std::string::String,
22488
22489    /// The time when this access control entry expires in
22490    /// [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example
22491    /// `2012-11-15T16:19:00.094Z`.
22492    pub expiration_time: std::option::Option<wkt::Timestamp>,
22493
22494    /// Optional. A label to identify this entry.
22495    pub name: std::string::String,
22496
22497    /// This is always `sql#aclEntry`.
22498    pub kind: std::string::String,
22499
22500    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22501}
22502
22503impl AclEntry {
22504    pub fn new() -> Self {
22505        std::default::Default::default()
22506    }
22507
22508    /// Sets the value of [value][crate::model::AclEntry::value].
22509    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22510        self.value = v.into();
22511        self
22512    }
22513
22514    /// Sets the value of [expiration_time][crate::model::AclEntry::expiration_time].
22515    pub fn set_expiration_time<T>(mut self, v: T) -> Self
22516    where
22517        T: std::convert::Into<wkt::Timestamp>,
22518    {
22519        self.expiration_time = std::option::Option::Some(v.into());
22520        self
22521    }
22522
22523    /// Sets or clears the value of [expiration_time][crate::model::AclEntry::expiration_time].
22524    pub fn set_or_clear_expiration_time<T>(mut self, v: std::option::Option<T>) -> Self
22525    where
22526        T: std::convert::Into<wkt::Timestamp>,
22527    {
22528        self.expiration_time = v.map(|x| x.into());
22529        self
22530    }
22531
22532    /// Sets the value of [name][crate::model::AclEntry::name].
22533    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22534        self.name = v.into();
22535        self
22536    }
22537
22538    /// Sets the value of [kind][crate::model::AclEntry::kind].
22539    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22540        self.kind = v.into();
22541        self
22542    }
22543}
22544
22545impl wkt::message::Message for AclEntry {
22546    fn typename() -> &'static str {
22547        "type.googleapis.com/google.cloud.sql.v1.AclEntry"
22548    }
22549}
22550
22551#[doc(hidden)]
22552impl<'de> serde::de::Deserialize<'de> for AclEntry {
22553    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22554    where
22555        D: serde::Deserializer<'de>,
22556    {
22557        #[allow(non_camel_case_types)]
22558        #[doc(hidden)]
22559        #[derive(PartialEq, Eq, Hash)]
22560        enum __FieldTag {
22561            __value,
22562            __expiration_time,
22563            __name,
22564            __kind,
22565            Unknown(std::string::String),
22566        }
22567        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
22568            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22569            where
22570                D: serde::Deserializer<'de>,
22571            {
22572                struct Visitor;
22573                impl<'de> serde::de::Visitor<'de> for Visitor {
22574                    type Value = __FieldTag;
22575                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22576                        formatter.write_str("a field name for AclEntry")
22577                    }
22578                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22579                    where
22580                        E: serde::de::Error,
22581                    {
22582                        use std::result::Result::Ok;
22583                        use std::string::ToString;
22584                        match value {
22585                            "value" => Ok(__FieldTag::__value),
22586                            "expirationTime" => Ok(__FieldTag::__expiration_time),
22587                            "expiration_time" => Ok(__FieldTag::__expiration_time),
22588                            "name" => Ok(__FieldTag::__name),
22589                            "kind" => Ok(__FieldTag::__kind),
22590                            _ => Ok(__FieldTag::Unknown(value.to_string())),
22591                        }
22592                    }
22593                }
22594                deserializer.deserialize_identifier(Visitor)
22595            }
22596        }
22597        struct Visitor;
22598        impl<'de> serde::de::Visitor<'de> for Visitor {
22599            type Value = AclEntry;
22600            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22601                formatter.write_str("struct AclEntry")
22602            }
22603            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22604            where
22605                A: serde::de::MapAccess<'de>,
22606            {
22607                #[allow(unused_imports)]
22608                use serde::de::Error;
22609                use std::option::Option::Some;
22610                let mut fields = std::collections::HashSet::new();
22611                let mut result = Self::Value::new();
22612                while let Some(tag) = map.next_key::<__FieldTag>()? {
22613                    #[allow(clippy::match_single_binding)]
22614                    match tag {
22615                        __FieldTag::__value => {
22616                            if !fields.insert(__FieldTag::__value) {
22617                                return std::result::Result::Err(A::Error::duplicate_field(
22618                                    "multiple values for value",
22619                                ));
22620                            }
22621                            result.value = map
22622                                .next_value::<std::option::Option<std::string::String>>()?
22623                                .unwrap_or_default();
22624                        }
22625                        __FieldTag::__expiration_time => {
22626                            if !fields.insert(__FieldTag::__expiration_time) {
22627                                return std::result::Result::Err(A::Error::duplicate_field(
22628                                    "multiple values for expiration_time",
22629                                ));
22630                            }
22631                            result.expiration_time =
22632                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
22633                        }
22634                        __FieldTag::__name => {
22635                            if !fields.insert(__FieldTag::__name) {
22636                                return std::result::Result::Err(A::Error::duplicate_field(
22637                                    "multiple values for name",
22638                                ));
22639                            }
22640                            result.name = map
22641                                .next_value::<std::option::Option<std::string::String>>()?
22642                                .unwrap_or_default();
22643                        }
22644                        __FieldTag::__kind => {
22645                            if !fields.insert(__FieldTag::__kind) {
22646                                return std::result::Result::Err(A::Error::duplicate_field(
22647                                    "multiple values for kind",
22648                                ));
22649                            }
22650                            result.kind = map
22651                                .next_value::<std::option::Option<std::string::String>>()?
22652                                .unwrap_or_default();
22653                        }
22654                        __FieldTag::Unknown(key) => {
22655                            let value = map.next_value::<serde_json::Value>()?;
22656                            result._unknown_fields.insert(key, value);
22657                        }
22658                    }
22659                }
22660                std::result::Result::Ok(result)
22661            }
22662        }
22663        deserializer.deserialize_any(Visitor)
22664    }
22665}
22666
22667#[doc(hidden)]
22668impl serde::ser::Serialize for AclEntry {
22669    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22670    where
22671        S: serde::ser::Serializer,
22672    {
22673        use serde::ser::SerializeMap;
22674        #[allow(unused_imports)]
22675        use std::option::Option::Some;
22676        let mut state = serializer.serialize_map(std::option::Option::None)?;
22677        if !self.value.is_empty() {
22678            state.serialize_entry("value", &self.value)?;
22679        }
22680        if self.expiration_time.is_some() {
22681            state.serialize_entry("expirationTime", &self.expiration_time)?;
22682        }
22683        if !self.name.is_empty() {
22684            state.serialize_entry("name", &self.name)?;
22685        }
22686        if !self.kind.is_empty() {
22687            state.serialize_entry("kind", &self.kind)?;
22688        }
22689        if !self._unknown_fields.is_empty() {
22690            for (key, value) in self._unknown_fields.iter() {
22691                state.serialize_entry(key, &value)?;
22692            }
22693        }
22694        state.end()
22695    }
22696}
22697
22698/// An Admin API warning message.
22699#[derive(Clone, Debug, Default, PartialEq)]
22700#[non_exhaustive]
22701pub struct ApiWarning {
22702    /// Code to uniquely identify the warning type.
22703    pub code: crate::model::api_warning::SqlApiWarningCode,
22704
22705    /// The warning message.
22706    pub message: std::string::String,
22707
22708    /// The region name for REGION_UNREACHABLE warning.
22709    pub region: std::string::String,
22710
22711    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22712}
22713
22714impl ApiWarning {
22715    pub fn new() -> Self {
22716        std::default::Default::default()
22717    }
22718
22719    /// Sets the value of [code][crate::model::ApiWarning::code].
22720    pub fn set_code<T: std::convert::Into<crate::model::api_warning::SqlApiWarningCode>>(
22721        mut self,
22722        v: T,
22723    ) -> Self {
22724        self.code = v.into();
22725        self
22726    }
22727
22728    /// Sets the value of [message][crate::model::ApiWarning::message].
22729    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22730        self.message = v.into();
22731        self
22732    }
22733
22734    /// Sets the value of [region][crate::model::ApiWarning::region].
22735    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22736        self.region = v.into();
22737        self
22738    }
22739}
22740
22741impl wkt::message::Message for ApiWarning {
22742    fn typename() -> &'static str {
22743        "type.googleapis.com/google.cloud.sql.v1.ApiWarning"
22744    }
22745}
22746
22747#[doc(hidden)]
22748impl<'de> serde::de::Deserialize<'de> for ApiWarning {
22749    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22750    where
22751        D: serde::Deserializer<'de>,
22752    {
22753        #[allow(non_camel_case_types)]
22754        #[doc(hidden)]
22755        #[derive(PartialEq, Eq, Hash)]
22756        enum __FieldTag {
22757            __code,
22758            __message,
22759            __region,
22760            Unknown(std::string::String),
22761        }
22762        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
22763            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22764            where
22765                D: serde::Deserializer<'de>,
22766            {
22767                struct Visitor;
22768                impl<'de> serde::de::Visitor<'de> for Visitor {
22769                    type Value = __FieldTag;
22770                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22771                        formatter.write_str("a field name for ApiWarning")
22772                    }
22773                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22774                    where
22775                        E: serde::de::Error,
22776                    {
22777                        use std::result::Result::Ok;
22778                        use std::string::ToString;
22779                        match value {
22780                            "code" => Ok(__FieldTag::__code),
22781                            "message" => Ok(__FieldTag::__message),
22782                            "region" => Ok(__FieldTag::__region),
22783                            _ => Ok(__FieldTag::Unknown(value.to_string())),
22784                        }
22785                    }
22786                }
22787                deserializer.deserialize_identifier(Visitor)
22788            }
22789        }
22790        struct Visitor;
22791        impl<'de> serde::de::Visitor<'de> for Visitor {
22792            type Value = ApiWarning;
22793            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22794                formatter.write_str("struct ApiWarning")
22795            }
22796            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22797            where
22798                A: serde::de::MapAccess<'de>,
22799            {
22800                #[allow(unused_imports)]
22801                use serde::de::Error;
22802                use std::option::Option::Some;
22803                let mut fields = std::collections::HashSet::new();
22804                let mut result = Self::Value::new();
22805                while let Some(tag) = map.next_key::<__FieldTag>()? {
22806                    #[allow(clippy::match_single_binding)]
22807                    match tag {
22808                        __FieldTag::__code => {
22809                            if !fields.insert(__FieldTag::__code) {
22810                                return std::result::Result::Err(A::Error::duplicate_field(
22811                                    "multiple values for code",
22812                                ));
22813                            }
22814                            result.code =
22815                                map.next_value::<std::option::Option<
22816                                    crate::model::api_warning::SqlApiWarningCode,
22817                                >>()?
22818                                .unwrap_or_default();
22819                        }
22820                        __FieldTag::__message => {
22821                            if !fields.insert(__FieldTag::__message) {
22822                                return std::result::Result::Err(A::Error::duplicate_field(
22823                                    "multiple values for message",
22824                                ));
22825                            }
22826                            result.message = map
22827                                .next_value::<std::option::Option<std::string::String>>()?
22828                                .unwrap_or_default();
22829                        }
22830                        __FieldTag::__region => {
22831                            if !fields.insert(__FieldTag::__region) {
22832                                return std::result::Result::Err(A::Error::duplicate_field(
22833                                    "multiple values for region",
22834                                ));
22835                            }
22836                            result.region = map
22837                                .next_value::<std::option::Option<std::string::String>>()?
22838                                .unwrap_or_default();
22839                        }
22840                        __FieldTag::Unknown(key) => {
22841                            let value = map.next_value::<serde_json::Value>()?;
22842                            result._unknown_fields.insert(key, value);
22843                        }
22844                    }
22845                }
22846                std::result::Result::Ok(result)
22847            }
22848        }
22849        deserializer.deserialize_any(Visitor)
22850    }
22851}
22852
22853#[doc(hidden)]
22854impl serde::ser::Serialize for ApiWarning {
22855    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22856    where
22857        S: serde::ser::Serializer,
22858    {
22859        use serde::ser::SerializeMap;
22860        #[allow(unused_imports)]
22861        use std::option::Option::Some;
22862        let mut state = serializer.serialize_map(std::option::Option::None)?;
22863        if !wkt::internal::is_default(&self.code) {
22864            state.serialize_entry("code", &self.code)?;
22865        }
22866        if !self.message.is_empty() {
22867            state.serialize_entry("message", &self.message)?;
22868        }
22869        if !self.region.is_empty() {
22870            state.serialize_entry("region", &self.region)?;
22871        }
22872        if !self._unknown_fields.is_empty() {
22873            for (key, value) in self._unknown_fields.iter() {
22874                state.serialize_entry(key, &value)?;
22875            }
22876        }
22877        state.end()
22878    }
22879}
22880
22881/// Defines additional types related to [ApiWarning].
22882pub mod api_warning {
22883    #[allow(unused_imports)]
22884    use super::*;
22885
22886    ///
22887    /// # Working with unknown values
22888    ///
22889    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22890    /// additional enum variants at any time. Adding new variants is not considered
22891    /// a breaking change. Applications should write their code in anticipation of:
22892    ///
22893    /// - New values appearing in future releases of the client library, **and**
22894    /// - New values received dynamically, without application changes.
22895    ///
22896    /// Please consult the [Working with enums] section in the user guide for some
22897    /// guidelines.
22898    ///
22899    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
22900    #[derive(Clone, Debug, PartialEq)]
22901    #[non_exhaustive]
22902    pub enum SqlApiWarningCode {
22903        /// An unknown or unset warning type from Cloud SQL API.
22904        Unspecified,
22905        /// Warning when one or more regions are not reachable.  The returned result
22906        /// set may be incomplete.
22907        RegionUnreachable,
22908        /// Warning when user provided maxResults parameter exceeds the limit.  The
22909        /// returned result set may be incomplete.
22910        MaxResultsExceedsLimit,
22911        /// Warning when user tries to create/update a user with credentials that
22912        /// have previously been compromised by a public data breach.
22913        CompromisedCredentials,
22914        /// Warning when the operation succeeds but some non-critical workflow state
22915        /// failed.
22916        InternalStateFailure,
22917        /// If set, the enum was initialized with an unknown value.
22918        ///
22919        /// Applications can examine the value using [SqlApiWarningCode::value] or
22920        /// [SqlApiWarningCode::name].
22921        UnknownValue(sql_api_warning_code::UnknownValue),
22922    }
22923
22924    #[doc(hidden)]
22925    pub mod sql_api_warning_code {
22926        #[allow(unused_imports)]
22927        use super::*;
22928        #[derive(Clone, Debug, PartialEq)]
22929        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22930    }
22931
22932    impl SqlApiWarningCode {
22933        /// Gets the enum value.
22934        ///
22935        /// Returns `None` if the enum contains an unknown value deserialized from
22936        /// the string representation of enums.
22937        pub fn value(&self) -> std::option::Option<i32> {
22938            match self {
22939                Self::Unspecified => std::option::Option::Some(0),
22940                Self::RegionUnreachable => std::option::Option::Some(1),
22941                Self::MaxResultsExceedsLimit => std::option::Option::Some(2),
22942                Self::CompromisedCredentials => std::option::Option::Some(3),
22943                Self::InternalStateFailure => std::option::Option::Some(4),
22944                Self::UnknownValue(u) => u.0.value(),
22945            }
22946        }
22947
22948        /// Gets the enum value as a string.
22949        ///
22950        /// Returns `None` if the enum contains an unknown value deserialized from
22951        /// the integer representation of enums.
22952        pub fn name(&self) -> std::option::Option<&str> {
22953            match self {
22954                Self::Unspecified => std::option::Option::Some("SQL_API_WARNING_CODE_UNSPECIFIED"),
22955                Self::RegionUnreachable => std::option::Option::Some("REGION_UNREACHABLE"),
22956                Self::MaxResultsExceedsLimit => {
22957                    std::option::Option::Some("MAX_RESULTS_EXCEEDS_LIMIT")
22958                }
22959                Self::CompromisedCredentials => {
22960                    std::option::Option::Some("COMPROMISED_CREDENTIALS")
22961                }
22962                Self::InternalStateFailure => std::option::Option::Some("INTERNAL_STATE_FAILURE"),
22963                Self::UnknownValue(u) => u.0.name(),
22964            }
22965        }
22966    }
22967
22968    impl std::default::Default for SqlApiWarningCode {
22969        fn default() -> Self {
22970            use std::convert::From;
22971            Self::from(0)
22972        }
22973    }
22974
22975    impl std::fmt::Display for SqlApiWarningCode {
22976        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
22977            wkt::internal::display_enum(f, self.name(), self.value())
22978        }
22979    }
22980
22981    impl std::convert::From<i32> for SqlApiWarningCode {
22982        fn from(value: i32) -> Self {
22983            match value {
22984                0 => Self::Unspecified,
22985                1 => Self::RegionUnreachable,
22986                2 => Self::MaxResultsExceedsLimit,
22987                3 => Self::CompromisedCredentials,
22988                4 => Self::InternalStateFailure,
22989                _ => Self::UnknownValue(sql_api_warning_code::UnknownValue(
22990                    wkt::internal::UnknownEnumValue::Integer(value),
22991                )),
22992            }
22993        }
22994    }
22995
22996    impl std::convert::From<&str> for SqlApiWarningCode {
22997        fn from(value: &str) -> Self {
22998            use std::string::ToString;
22999            match value {
23000                "SQL_API_WARNING_CODE_UNSPECIFIED" => Self::Unspecified,
23001                "REGION_UNREACHABLE" => Self::RegionUnreachable,
23002                "MAX_RESULTS_EXCEEDS_LIMIT" => Self::MaxResultsExceedsLimit,
23003                "COMPROMISED_CREDENTIALS" => Self::CompromisedCredentials,
23004                "INTERNAL_STATE_FAILURE" => Self::InternalStateFailure,
23005                _ => Self::UnknownValue(sql_api_warning_code::UnknownValue(
23006                    wkt::internal::UnknownEnumValue::String(value.to_string()),
23007                )),
23008            }
23009        }
23010    }
23011
23012    impl serde::ser::Serialize for SqlApiWarningCode {
23013        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23014        where
23015            S: serde::Serializer,
23016        {
23017            match self {
23018                Self::Unspecified => serializer.serialize_i32(0),
23019                Self::RegionUnreachable => serializer.serialize_i32(1),
23020                Self::MaxResultsExceedsLimit => serializer.serialize_i32(2),
23021                Self::CompromisedCredentials => serializer.serialize_i32(3),
23022                Self::InternalStateFailure => serializer.serialize_i32(4),
23023                Self::UnknownValue(u) => u.0.serialize(serializer),
23024            }
23025        }
23026    }
23027
23028    impl<'de> serde::de::Deserialize<'de> for SqlApiWarningCode {
23029        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23030        where
23031            D: serde::Deserializer<'de>,
23032        {
23033            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlApiWarningCode>::new(
23034                ".google.cloud.sql.v1.ApiWarning.SqlApiWarningCode",
23035            ))
23036        }
23037    }
23038}
23039
23040/// We currently only support backup retention by specifying the number
23041/// of backups we will retain.
23042#[derive(Clone, Debug, Default, PartialEq)]
23043#[non_exhaustive]
23044pub struct BackupRetentionSettings {
23045    /// The unit that 'retained_backups' represents.
23046    pub retention_unit: crate::model::backup_retention_settings::RetentionUnit,
23047
23048    /// Depending on the value of retention_unit, this is used to determine
23049    /// if a backup needs to be deleted.  If retention_unit is 'COUNT', we will
23050    /// retain this many backups.
23051    pub retained_backups: std::option::Option<wkt::Int32Value>,
23052
23053    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23054}
23055
23056impl BackupRetentionSettings {
23057    pub fn new() -> Self {
23058        std::default::Default::default()
23059    }
23060
23061    /// Sets the value of [retention_unit][crate::model::BackupRetentionSettings::retention_unit].
23062    pub fn set_retention_unit<
23063        T: std::convert::Into<crate::model::backup_retention_settings::RetentionUnit>,
23064    >(
23065        mut self,
23066        v: T,
23067    ) -> Self {
23068        self.retention_unit = v.into();
23069        self
23070    }
23071
23072    /// Sets the value of [retained_backups][crate::model::BackupRetentionSettings::retained_backups].
23073    pub fn set_retained_backups<T>(mut self, v: T) -> Self
23074    where
23075        T: std::convert::Into<wkt::Int32Value>,
23076    {
23077        self.retained_backups = std::option::Option::Some(v.into());
23078        self
23079    }
23080
23081    /// Sets or clears the value of [retained_backups][crate::model::BackupRetentionSettings::retained_backups].
23082    pub fn set_or_clear_retained_backups<T>(mut self, v: std::option::Option<T>) -> Self
23083    where
23084        T: std::convert::Into<wkt::Int32Value>,
23085    {
23086        self.retained_backups = v.map(|x| x.into());
23087        self
23088    }
23089}
23090
23091impl wkt::message::Message for BackupRetentionSettings {
23092    fn typename() -> &'static str {
23093        "type.googleapis.com/google.cloud.sql.v1.BackupRetentionSettings"
23094    }
23095}
23096
23097#[doc(hidden)]
23098impl<'de> serde::de::Deserialize<'de> for BackupRetentionSettings {
23099    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23100    where
23101        D: serde::Deserializer<'de>,
23102    {
23103        #[allow(non_camel_case_types)]
23104        #[doc(hidden)]
23105        #[derive(PartialEq, Eq, Hash)]
23106        enum __FieldTag {
23107            __retention_unit,
23108            __retained_backups,
23109            Unknown(std::string::String),
23110        }
23111        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
23112            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23113            where
23114                D: serde::Deserializer<'de>,
23115            {
23116                struct Visitor;
23117                impl<'de> serde::de::Visitor<'de> for Visitor {
23118                    type Value = __FieldTag;
23119                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23120                        formatter.write_str("a field name for BackupRetentionSettings")
23121                    }
23122                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
23123                    where
23124                        E: serde::de::Error,
23125                    {
23126                        use std::result::Result::Ok;
23127                        use std::string::ToString;
23128                        match value {
23129                            "retentionUnit" => Ok(__FieldTag::__retention_unit),
23130                            "retention_unit" => Ok(__FieldTag::__retention_unit),
23131                            "retainedBackups" => Ok(__FieldTag::__retained_backups),
23132                            "retained_backups" => Ok(__FieldTag::__retained_backups),
23133                            _ => Ok(__FieldTag::Unknown(value.to_string())),
23134                        }
23135                    }
23136                }
23137                deserializer.deserialize_identifier(Visitor)
23138            }
23139        }
23140        struct Visitor;
23141        impl<'de> serde::de::Visitor<'de> for Visitor {
23142            type Value = BackupRetentionSettings;
23143            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23144                formatter.write_str("struct BackupRetentionSettings")
23145            }
23146            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
23147            where
23148                A: serde::de::MapAccess<'de>,
23149            {
23150                #[allow(unused_imports)]
23151                use serde::de::Error;
23152                use std::option::Option::Some;
23153                let mut fields = std::collections::HashSet::new();
23154                let mut result = Self::Value::new();
23155                while let Some(tag) = map.next_key::<__FieldTag>()? {
23156                    #[allow(clippy::match_single_binding)]
23157                    match tag {
23158                        __FieldTag::__retention_unit => {
23159                            if !fields.insert(__FieldTag::__retention_unit) {
23160                                return std::result::Result::Err(A::Error::duplicate_field(
23161                                    "multiple values for retention_unit",
23162                                ));
23163                            }
23164                            result.retention_unit = map
23165                                .next_value::<std::option::Option<
23166                                    crate::model::backup_retention_settings::RetentionUnit,
23167                                >>()?
23168                                .unwrap_or_default();
23169                        }
23170                        __FieldTag::__retained_backups => {
23171                            if !fields.insert(__FieldTag::__retained_backups) {
23172                                return std::result::Result::Err(A::Error::duplicate_field(
23173                                    "multiple values for retained_backups",
23174                                ));
23175                            }
23176                            struct __With(std::option::Option<wkt::Int32Value>);
23177                            impl<'de> serde::de::Deserialize<'de> for __With {
23178                                fn deserialize<D>(
23179                                    deserializer: D,
23180                                ) -> std::result::Result<Self, D::Error>
23181                                where
23182                                    D: serde::de::Deserializer<'de>,
23183                                {
23184                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
23185                                }
23186                            }
23187                            result.retained_backups = map.next_value::<__With>()?.0;
23188                        }
23189                        __FieldTag::Unknown(key) => {
23190                            let value = map.next_value::<serde_json::Value>()?;
23191                            result._unknown_fields.insert(key, value);
23192                        }
23193                    }
23194                }
23195                std::result::Result::Ok(result)
23196            }
23197        }
23198        deserializer.deserialize_any(Visitor)
23199    }
23200}
23201
23202#[doc(hidden)]
23203impl serde::ser::Serialize for BackupRetentionSettings {
23204    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23205    where
23206        S: serde::ser::Serializer,
23207    {
23208        use serde::ser::SerializeMap;
23209        #[allow(unused_imports)]
23210        use std::option::Option::Some;
23211        let mut state = serializer.serialize_map(std::option::Option::None)?;
23212        if !wkt::internal::is_default(&self.retention_unit) {
23213            state.serialize_entry("retentionUnit", &self.retention_unit)?;
23214        }
23215        if self.retained_backups.is_some() {
23216            struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
23217            impl<'a> serde::ser::Serialize for __With<'a> {
23218                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23219                where
23220                    S: serde::ser::Serializer,
23221                {
23222                    serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
23223                        self.0, serializer,
23224                    )
23225                }
23226            }
23227            state.serialize_entry("retainedBackups", &__With(&self.retained_backups))?;
23228        }
23229        if !self._unknown_fields.is_empty() {
23230            for (key, value) in self._unknown_fields.iter() {
23231                state.serialize_entry(key, &value)?;
23232            }
23233        }
23234        state.end()
23235    }
23236}
23237
23238/// Defines additional types related to [BackupRetentionSettings].
23239pub mod backup_retention_settings {
23240    #[allow(unused_imports)]
23241    use super::*;
23242
23243    /// The units that retained_backups specifies, we only support COUNT.
23244    ///
23245    /// # Working with unknown values
23246    ///
23247    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
23248    /// additional enum variants at any time. Adding new variants is not considered
23249    /// a breaking change. Applications should write their code in anticipation of:
23250    ///
23251    /// - New values appearing in future releases of the client library, **and**
23252    /// - New values received dynamically, without application changes.
23253    ///
23254    /// Please consult the [Working with enums] section in the user guide for some
23255    /// guidelines.
23256    ///
23257    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
23258    #[derive(Clone, Debug, PartialEq)]
23259    #[non_exhaustive]
23260    pub enum RetentionUnit {
23261        /// Backup retention unit is unspecified, will be treated as COUNT.
23262        Unspecified,
23263        /// Retention will be by count, eg. "retain the most recent 7 backups".
23264        Count,
23265        /// If set, the enum was initialized with an unknown value.
23266        ///
23267        /// Applications can examine the value using [RetentionUnit::value] or
23268        /// [RetentionUnit::name].
23269        UnknownValue(retention_unit::UnknownValue),
23270    }
23271
23272    #[doc(hidden)]
23273    pub mod retention_unit {
23274        #[allow(unused_imports)]
23275        use super::*;
23276        #[derive(Clone, Debug, PartialEq)]
23277        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
23278    }
23279
23280    impl RetentionUnit {
23281        /// Gets the enum value.
23282        ///
23283        /// Returns `None` if the enum contains an unknown value deserialized from
23284        /// the string representation of enums.
23285        pub fn value(&self) -> std::option::Option<i32> {
23286            match self {
23287                Self::Unspecified => std::option::Option::Some(0),
23288                Self::Count => std::option::Option::Some(1),
23289                Self::UnknownValue(u) => u.0.value(),
23290            }
23291        }
23292
23293        /// Gets the enum value as a string.
23294        ///
23295        /// Returns `None` if the enum contains an unknown value deserialized from
23296        /// the integer representation of enums.
23297        pub fn name(&self) -> std::option::Option<&str> {
23298            match self {
23299                Self::Unspecified => std::option::Option::Some("RETENTION_UNIT_UNSPECIFIED"),
23300                Self::Count => std::option::Option::Some("COUNT"),
23301                Self::UnknownValue(u) => u.0.name(),
23302            }
23303        }
23304    }
23305
23306    impl std::default::Default for RetentionUnit {
23307        fn default() -> Self {
23308            use std::convert::From;
23309            Self::from(0)
23310        }
23311    }
23312
23313    impl std::fmt::Display for RetentionUnit {
23314        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
23315            wkt::internal::display_enum(f, self.name(), self.value())
23316        }
23317    }
23318
23319    impl std::convert::From<i32> for RetentionUnit {
23320        fn from(value: i32) -> Self {
23321            match value {
23322                0 => Self::Unspecified,
23323                1 => Self::Count,
23324                _ => Self::UnknownValue(retention_unit::UnknownValue(
23325                    wkt::internal::UnknownEnumValue::Integer(value),
23326                )),
23327            }
23328        }
23329    }
23330
23331    impl std::convert::From<&str> for RetentionUnit {
23332        fn from(value: &str) -> Self {
23333            use std::string::ToString;
23334            match value {
23335                "RETENTION_UNIT_UNSPECIFIED" => Self::Unspecified,
23336                "COUNT" => Self::Count,
23337                _ => Self::UnknownValue(retention_unit::UnknownValue(
23338                    wkt::internal::UnknownEnumValue::String(value.to_string()),
23339                )),
23340            }
23341        }
23342    }
23343
23344    impl serde::ser::Serialize for RetentionUnit {
23345        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23346        where
23347            S: serde::Serializer,
23348        {
23349            match self {
23350                Self::Unspecified => serializer.serialize_i32(0),
23351                Self::Count => serializer.serialize_i32(1),
23352                Self::UnknownValue(u) => u.0.serialize(serializer),
23353            }
23354        }
23355    }
23356
23357    impl<'de> serde::de::Deserialize<'de> for RetentionUnit {
23358        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23359        where
23360            D: serde::Deserializer<'de>,
23361        {
23362            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RetentionUnit>::new(
23363                ".google.cloud.sql.v1.BackupRetentionSettings.RetentionUnit",
23364            ))
23365        }
23366    }
23367}
23368
23369/// Database instance backup configuration.
23370#[derive(Clone, Debug, Default, PartialEq)]
23371#[non_exhaustive]
23372pub struct BackupConfiguration {
23373    /// Start time for the daily backup configuration in UTC timezone in the 24
23374    /// hour format - `HH:MM`.
23375    pub start_time: std::string::String,
23376
23377    /// Whether this configuration is enabled.
23378    pub enabled: std::option::Option<wkt::BoolValue>,
23379
23380    /// This is always `sql#backupConfiguration`.
23381    pub kind: std::string::String,
23382
23383    /// (MySQL only) Whether binary log is enabled. If backup configuration is
23384    /// disabled, binarylog must be disabled as well.
23385    pub binary_log_enabled: std::option::Option<wkt::BoolValue>,
23386
23387    /// Reserved for future use.
23388    pub replication_log_archiving_enabled: std::option::Option<wkt::BoolValue>,
23389
23390    /// Location of the backup
23391    pub location: std::string::String,
23392
23393    /// Whether point in time recovery is enabled.
23394    pub point_in_time_recovery_enabled: std::option::Option<wkt::BoolValue>,
23395
23396    /// Backup retention settings.
23397    pub backup_retention_settings: std::option::Option<crate::model::BackupRetentionSettings>,
23398
23399    /// The number of days of transaction logs we retain for point in time
23400    /// restore, from 1-7.
23401    pub transaction_log_retention_days: std::option::Option<wkt::Int32Value>,
23402
23403    /// Output only. This value contains the storage location of transactional logs
23404    /// used to perform point-in-time recovery (PITR) for the database.
23405    pub transactional_log_storage_state:
23406        std::option::Option<crate::model::backup_configuration::TransactionalLogStorageState>,
23407
23408    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23409}
23410
23411impl BackupConfiguration {
23412    pub fn new() -> Self {
23413        std::default::Default::default()
23414    }
23415
23416    /// Sets the value of [start_time][crate::model::BackupConfiguration::start_time].
23417    pub fn set_start_time<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23418        self.start_time = v.into();
23419        self
23420    }
23421
23422    /// Sets the value of [enabled][crate::model::BackupConfiguration::enabled].
23423    pub fn set_enabled<T>(mut self, v: T) -> Self
23424    where
23425        T: std::convert::Into<wkt::BoolValue>,
23426    {
23427        self.enabled = std::option::Option::Some(v.into());
23428        self
23429    }
23430
23431    /// Sets or clears the value of [enabled][crate::model::BackupConfiguration::enabled].
23432    pub fn set_or_clear_enabled<T>(mut self, v: std::option::Option<T>) -> Self
23433    where
23434        T: std::convert::Into<wkt::BoolValue>,
23435    {
23436        self.enabled = v.map(|x| x.into());
23437        self
23438    }
23439
23440    /// Sets the value of [kind][crate::model::BackupConfiguration::kind].
23441    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23442        self.kind = v.into();
23443        self
23444    }
23445
23446    /// Sets the value of [binary_log_enabled][crate::model::BackupConfiguration::binary_log_enabled].
23447    pub fn set_binary_log_enabled<T>(mut self, v: T) -> Self
23448    where
23449        T: std::convert::Into<wkt::BoolValue>,
23450    {
23451        self.binary_log_enabled = std::option::Option::Some(v.into());
23452        self
23453    }
23454
23455    /// Sets or clears the value of [binary_log_enabled][crate::model::BackupConfiguration::binary_log_enabled].
23456    pub fn set_or_clear_binary_log_enabled<T>(mut self, v: std::option::Option<T>) -> Self
23457    where
23458        T: std::convert::Into<wkt::BoolValue>,
23459    {
23460        self.binary_log_enabled = v.map(|x| x.into());
23461        self
23462    }
23463
23464    /// Sets the value of [replication_log_archiving_enabled][crate::model::BackupConfiguration::replication_log_archiving_enabled].
23465    pub fn set_replication_log_archiving_enabled<T>(mut self, v: T) -> Self
23466    where
23467        T: std::convert::Into<wkt::BoolValue>,
23468    {
23469        self.replication_log_archiving_enabled = std::option::Option::Some(v.into());
23470        self
23471    }
23472
23473    /// Sets or clears the value of [replication_log_archiving_enabled][crate::model::BackupConfiguration::replication_log_archiving_enabled].
23474    pub fn set_or_clear_replication_log_archiving_enabled<T>(
23475        mut self,
23476        v: std::option::Option<T>,
23477    ) -> Self
23478    where
23479        T: std::convert::Into<wkt::BoolValue>,
23480    {
23481        self.replication_log_archiving_enabled = v.map(|x| x.into());
23482        self
23483    }
23484
23485    /// Sets the value of [location][crate::model::BackupConfiguration::location].
23486    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23487        self.location = v.into();
23488        self
23489    }
23490
23491    /// Sets the value of [point_in_time_recovery_enabled][crate::model::BackupConfiguration::point_in_time_recovery_enabled].
23492    pub fn set_point_in_time_recovery_enabled<T>(mut self, v: T) -> Self
23493    where
23494        T: std::convert::Into<wkt::BoolValue>,
23495    {
23496        self.point_in_time_recovery_enabled = std::option::Option::Some(v.into());
23497        self
23498    }
23499
23500    /// Sets or clears the value of [point_in_time_recovery_enabled][crate::model::BackupConfiguration::point_in_time_recovery_enabled].
23501    pub fn set_or_clear_point_in_time_recovery_enabled<T>(
23502        mut self,
23503        v: std::option::Option<T>,
23504    ) -> Self
23505    where
23506        T: std::convert::Into<wkt::BoolValue>,
23507    {
23508        self.point_in_time_recovery_enabled = v.map(|x| x.into());
23509        self
23510    }
23511
23512    /// Sets the value of [backup_retention_settings][crate::model::BackupConfiguration::backup_retention_settings].
23513    pub fn set_backup_retention_settings<T>(mut self, v: T) -> Self
23514    where
23515        T: std::convert::Into<crate::model::BackupRetentionSettings>,
23516    {
23517        self.backup_retention_settings = std::option::Option::Some(v.into());
23518        self
23519    }
23520
23521    /// Sets or clears the value of [backup_retention_settings][crate::model::BackupConfiguration::backup_retention_settings].
23522    pub fn set_or_clear_backup_retention_settings<T>(mut self, v: std::option::Option<T>) -> Self
23523    where
23524        T: std::convert::Into<crate::model::BackupRetentionSettings>,
23525    {
23526        self.backup_retention_settings = v.map(|x| x.into());
23527        self
23528    }
23529
23530    /// Sets the value of [transaction_log_retention_days][crate::model::BackupConfiguration::transaction_log_retention_days].
23531    pub fn set_transaction_log_retention_days<T>(mut self, v: T) -> Self
23532    where
23533        T: std::convert::Into<wkt::Int32Value>,
23534    {
23535        self.transaction_log_retention_days = std::option::Option::Some(v.into());
23536        self
23537    }
23538
23539    /// Sets or clears the value of [transaction_log_retention_days][crate::model::BackupConfiguration::transaction_log_retention_days].
23540    pub fn set_or_clear_transaction_log_retention_days<T>(
23541        mut self,
23542        v: std::option::Option<T>,
23543    ) -> Self
23544    where
23545        T: std::convert::Into<wkt::Int32Value>,
23546    {
23547        self.transaction_log_retention_days = v.map(|x| x.into());
23548        self
23549    }
23550
23551    /// Sets the value of [transactional_log_storage_state][crate::model::BackupConfiguration::transactional_log_storage_state].
23552    pub fn set_transactional_log_storage_state<T>(mut self, v: T) -> Self
23553    where
23554        T: std::convert::Into<crate::model::backup_configuration::TransactionalLogStorageState>,
23555    {
23556        self.transactional_log_storage_state = std::option::Option::Some(v.into());
23557        self
23558    }
23559
23560    /// Sets or clears the value of [transactional_log_storage_state][crate::model::BackupConfiguration::transactional_log_storage_state].
23561    pub fn set_or_clear_transactional_log_storage_state<T>(
23562        mut self,
23563        v: std::option::Option<T>,
23564    ) -> Self
23565    where
23566        T: std::convert::Into<crate::model::backup_configuration::TransactionalLogStorageState>,
23567    {
23568        self.transactional_log_storage_state = v.map(|x| x.into());
23569        self
23570    }
23571}
23572
23573impl wkt::message::Message for BackupConfiguration {
23574    fn typename() -> &'static str {
23575        "type.googleapis.com/google.cloud.sql.v1.BackupConfiguration"
23576    }
23577}
23578
23579#[doc(hidden)]
23580impl<'de> serde::de::Deserialize<'de> for BackupConfiguration {
23581    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23582    where
23583        D: serde::Deserializer<'de>,
23584    {
23585        #[allow(non_camel_case_types)]
23586        #[doc(hidden)]
23587        #[derive(PartialEq, Eq, Hash)]
23588        enum __FieldTag {
23589            __start_time,
23590            __enabled,
23591            __kind,
23592            __binary_log_enabled,
23593            __replication_log_archiving_enabled,
23594            __location,
23595            __point_in_time_recovery_enabled,
23596            __backup_retention_settings,
23597            __transaction_log_retention_days,
23598            __transactional_log_storage_state,
23599            Unknown(std::string::String),
23600        }
23601        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
23602            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23603            where
23604                D: serde::Deserializer<'de>,
23605            {
23606                struct Visitor;
23607                impl<'de> serde::de::Visitor<'de> for Visitor {
23608                    type Value = __FieldTag;
23609                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23610                        formatter.write_str("a field name for BackupConfiguration")
23611                    }
23612                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
23613                    where
23614                        E: serde::de::Error,
23615                    {
23616                        use std::result::Result::Ok;
23617                        use std::string::ToString;
23618                        match value {
23619                            "startTime" => Ok(__FieldTag::__start_time),
23620                            "start_time" => Ok(__FieldTag::__start_time),
23621                            "enabled" => Ok(__FieldTag::__enabled),
23622                            "kind" => Ok(__FieldTag::__kind),
23623                            "binaryLogEnabled" => Ok(__FieldTag::__binary_log_enabled),
23624                            "binary_log_enabled" => Ok(__FieldTag::__binary_log_enabled),
23625                            "replicationLogArchivingEnabled" => {
23626                                Ok(__FieldTag::__replication_log_archiving_enabled)
23627                            }
23628                            "replication_log_archiving_enabled" => {
23629                                Ok(__FieldTag::__replication_log_archiving_enabled)
23630                            }
23631                            "location" => Ok(__FieldTag::__location),
23632                            "pointInTimeRecoveryEnabled" => {
23633                                Ok(__FieldTag::__point_in_time_recovery_enabled)
23634                            }
23635                            "point_in_time_recovery_enabled" => {
23636                                Ok(__FieldTag::__point_in_time_recovery_enabled)
23637                            }
23638                            "backupRetentionSettings" => {
23639                                Ok(__FieldTag::__backup_retention_settings)
23640                            }
23641                            "backup_retention_settings" => {
23642                                Ok(__FieldTag::__backup_retention_settings)
23643                            }
23644                            "transactionLogRetentionDays" => {
23645                                Ok(__FieldTag::__transaction_log_retention_days)
23646                            }
23647                            "transaction_log_retention_days" => {
23648                                Ok(__FieldTag::__transaction_log_retention_days)
23649                            }
23650                            "transactionalLogStorageState" => {
23651                                Ok(__FieldTag::__transactional_log_storage_state)
23652                            }
23653                            "transactional_log_storage_state" => {
23654                                Ok(__FieldTag::__transactional_log_storage_state)
23655                            }
23656                            _ => Ok(__FieldTag::Unknown(value.to_string())),
23657                        }
23658                    }
23659                }
23660                deserializer.deserialize_identifier(Visitor)
23661            }
23662        }
23663        struct Visitor;
23664        impl<'de> serde::de::Visitor<'de> for Visitor {
23665            type Value = BackupConfiguration;
23666            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23667                formatter.write_str("struct BackupConfiguration")
23668            }
23669            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
23670            where
23671                A: serde::de::MapAccess<'de>,
23672            {
23673                #[allow(unused_imports)]
23674                use serde::de::Error;
23675                use std::option::Option::Some;
23676                let mut fields = std::collections::HashSet::new();
23677                let mut result = Self::Value::new();
23678                while let Some(tag) = map.next_key::<__FieldTag>()? {
23679                    #[allow(clippy::match_single_binding)]
23680                    match tag {
23681                        __FieldTag::__start_time => {
23682                            if !fields.insert(__FieldTag::__start_time) {
23683                                return std::result::Result::Err(A::Error::duplicate_field(
23684                                    "multiple values for start_time",
23685                                ));
23686                            }
23687                            result.start_time = map
23688                                .next_value::<std::option::Option<std::string::String>>()?
23689                                .unwrap_or_default();
23690                        }
23691                        __FieldTag::__enabled => {
23692                            if !fields.insert(__FieldTag::__enabled) {
23693                                return std::result::Result::Err(A::Error::duplicate_field(
23694                                    "multiple values for enabled",
23695                                ));
23696                            }
23697                            result.enabled =
23698                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
23699                        }
23700                        __FieldTag::__kind => {
23701                            if !fields.insert(__FieldTag::__kind) {
23702                                return std::result::Result::Err(A::Error::duplicate_field(
23703                                    "multiple values for kind",
23704                                ));
23705                            }
23706                            result.kind = map
23707                                .next_value::<std::option::Option<std::string::String>>()?
23708                                .unwrap_or_default();
23709                        }
23710                        __FieldTag::__binary_log_enabled => {
23711                            if !fields.insert(__FieldTag::__binary_log_enabled) {
23712                                return std::result::Result::Err(A::Error::duplicate_field(
23713                                    "multiple values for binary_log_enabled",
23714                                ));
23715                            }
23716                            result.binary_log_enabled =
23717                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
23718                        }
23719                        __FieldTag::__replication_log_archiving_enabled => {
23720                            if !fields.insert(__FieldTag::__replication_log_archiving_enabled) {
23721                                return std::result::Result::Err(A::Error::duplicate_field(
23722                                    "multiple values for replication_log_archiving_enabled",
23723                                ));
23724                            }
23725                            result.replication_log_archiving_enabled =
23726                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
23727                        }
23728                        __FieldTag::__location => {
23729                            if !fields.insert(__FieldTag::__location) {
23730                                return std::result::Result::Err(A::Error::duplicate_field(
23731                                    "multiple values for location",
23732                                ));
23733                            }
23734                            result.location = map
23735                                .next_value::<std::option::Option<std::string::String>>()?
23736                                .unwrap_or_default();
23737                        }
23738                        __FieldTag::__point_in_time_recovery_enabled => {
23739                            if !fields.insert(__FieldTag::__point_in_time_recovery_enabled) {
23740                                return std::result::Result::Err(A::Error::duplicate_field(
23741                                    "multiple values for point_in_time_recovery_enabled",
23742                                ));
23743                            }
23744                            result.point_in_time_recovery_enabled =
23745                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
23746                        }
23747                        __FieldTag::__backup_retention_settings => {
23748                            if !fields.insert(__FieldTag::__backup_retention_settings) {
23749                                return std::result::Result::Err(A::Error::duplicate_field(
23750                                    "multiple values for backup_retention_settings",
23751                                ));
23752                            }
23753                            result.backup_retention_settings = map.next_value::<std::option::Option<crate::model::BackupRetentionSettings>>()?
23754                                ;
23755                        }
23756                        __FieldTag::__transaction_log_retention_days => {
23757                            if !fields.insert(__FieldTag::__transaction_log_retention_days) {
23758                                return std::result::Result::Err(A::Error::duplicate_field(
23759                                    "multiple values for transaction_log_retention_days",
23760                                ));
23761                            }
23762                            struct __With(std::option::Option<wkt::Int32Value>);
23763                            impl<'de> serde::de::Deserialize<'de> for __With {
23764                                fn deserialize<D>(
23765                                    deserializer: D,
23766                                ) -> std::result::Result<Self, D::Error>
23767                                where
23768                                    D: serde::de::Deserializer<'de>,
23769                                {
23770                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
23771                                }
23772                            }
23773                            result.transaction_log_retention_days = map.next_value::<__With>()?.0;
23774                        }
23775                        __FieldTag::__transactional_log_storage_state => {
23776                            if !fields.insert(__FieldTag::__transactional_log_storage_state) {
23777                                return std::result::Result::Err(A::Error::duplicate_field(
23778                                    "multiple values for transactional_log_storage_state",
23779                                ));
23780                            }
23781                            result.transactional_log_storage_state = map
23782                                .next_value::<std::option::Option<
23783                                crate::model::backup_configuration::TransactionalLogStorageState,
23784                            >>(
23785                            )?;
23786                        }
23787                        __FieldTag::Unknown(key) => {
23788                            let value = map.next_value::<serde_json::Value>()?;
23789                            result._unknown_fields.insert(key, value);
23790                        }
23791                    }
23792                }
23793                std::result::Result::Ok(result)
23794            }
23795        }
23796        deserializer.deserialize_any(Visitor)
23797    }
23798}
23799
23800#[doc(hidden)]
23801impl serde::ser::Serialize for BackupConfiguration {
23802    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23803    where
23804        S: serde::ser::Serializer,
23805    {
23806        use serde::ser::SerializeMap;
23807        #[allow(unused_imports)]
23808        use std::option::Option::Some;
23809        let mut state = serializer.serialize_map(std::option::Option::None)?;
23810        if !self.start_time.is_empty() {
23811            state.serialize_entry("startTime", &self.start_time)?;
23812        }
23813        if self.enabled.is_some() {
23814            state.serialize_entry("enabled", &self.enabled)?;
23815        }
23816        if !self.kind.is_empty() {
23817            state.serialize_entry("kind", &self.kind)?;
23818        }
23819        if self.binary_log_enabled.is_some() {
23820            state.serialize_entry("binaryLogEnabled", &self.binary_log_enabled)?;
23821        }
23822        if self.replication_log_archiving_enabled.is_some() {
23823            state.serialize_entry(
23824                "replicationLogArchivingEnabled",
23825                &self.replication_log_archiving_enabled,
23826            )?;
23827        }
23828        if !self.location.is_empty() {
23829            state.serialize_entry("location", &self.location)?;
23830        }
23831        if self.point_in_time_recovery_enabled.is_some() {
23832            state.serialize_entry(
23833                "pointInTimeRecoveryEnabled",
23834                &self.point_in_time_recovery_enabled,
23835            )?;
23836        }
23837        if self.backup_retention_settings.is_some() {
23838            state.serialize_entry("backupRetentionSettings", &self.backup_retention_settings)?;
23839        }
23840        if self.transaction_log_retention_days.is_some() {
23841            struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
23842            impl<'a> serde::ser::Serialize for __With<'a> {
23843                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23844                where
23845                    S: serde::ser::Serializer,
23846                {
23847                    serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
23848                        self.0, serializer,
23849                    )
23850                }
23851            }
23852            state.serialize_entry(
23853                "transactionLogRetentionDays",
23854                &__With(&self.transaction_log_retention_days),
23855            )?;
23856        }
23857        if self.transactional_log_storage_state.is_some() {
23858            state.serialize_entry(
23859                "transactionalLogStorageState",
23860                &self.transactional_log_storage_state,
23861            )?;
23862        }
23863        if !self._unknown_fields.is_empty() {
23864            for (key, value) in self._unknown_fields.iter() {
23865                state.serialize_entry(key, &value)?;
23866            }
23867        }
23868        state.end()
23869    }
23870}
23871
23872/// Defines additional types related to [BackupConfiguration].
23873pub mod backup_configuration {
23874    #[allow(unused_imports)]
23875    use super::*;
23876
23877    /// This value contains the storage location of the transactional logs
23878    /// used to perform point-in-time recovery (PITR) for the database.
23879    ///
23880    /// # Working with unknown values
23881    ///
23882    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
23883    /// additional enum variants at any time. Adding new variants is not considered
23884    /// a breaking change. Applications should write their code in anticipation of:
23885    ///
23886    /// - New values appearing in future releases of the client library, **and**
23887    /// - New values received dynamically, without application changes.
23888    ///
23889    /// Please consult the [Working with enums] section in the user guide for some
23890    /// guidelines.
23891    ///
23892    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
23893    #[derive(Clone, Debug, PartialEq)]
23894    #[non_exhaustive]
23895    pub enum TransactionalLogStorageState {
23896        /// Unspecified.
23897        Unspecified,
23898        /// The transaction logs used for PITR for the instance are stored
23899        /// on a data disk.
23900        Disk,
23901        /// The transaction logs used for PITR for the instance are switching from
23902        /// being stored on a data disk to being stored in Cloud Storage.
23903        /// Only applicable to MySQL.
23904        SwitchingToCloudStorage,
23905        /// The transaction logs used for PITR for the instance are now stored
23906        /// in Cloud Storage. Previously, they were stored on a data disk.
23907        /// Only applicable to MySQL.
23908        SwitchedToCloudStorage,
23909        /// The transaction logs used for PITR for the instance are stored in
23910        /// Cloud Storage. Only applicable to MySQL and PostgreSQL.
23911        CloudStorage,
23912        /// If set, the enum was initialized with an unknown value.
23913        ///
23914        /// Applications can examine the value using [TransactionalLogStorageState::value] or
23915        /// [TransactionalLogStorageState::name].
23916        UnknownValue(transactional_log_storage_state::UnknownValue),
23917    }
23918
23919    #[doc(hidden)]
23920    pub mod transactional_log_storage_state {
23921        #[allow(unused_imports)]
23922        use super::*;
23923        #[derive(Clone, Debug, PartialEq)]
23924        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
23925    }
23926
23927    impl TransactionalLogStorageState {
23928        /// Gets the enum value.
23929        ///
23930        /// Returns `None` if the enum contains an unknown value deserialized from
23931        /// the string representation of enums.
23932        pub fn value(&self) -> std::option::Option<i32> {
23933            match self {
23934                Self::Unspecified => std::option::Option::Some(0),
23935                Self::Disk => std::option::Option::Some(1),
23936                Self::SwitchingToCloudStorage => std::option::Option::Some(2),
23937                Self::SwitchedToCloudStorage => std::option::Option::Some(3),
23938                Self::CloudStorage => std::option::Option::Some(4),
23939                Self::UnknownValue(u) => u.0.value(),
23940            }
23941        }
23942
23943        /// Gets the enum value as a string.
23944        ///
23945        /// Returns `None` if the enum contains an unknown value deserialized from
23946        /// the integer representation of enums.
23947        pub fn name(&self) -> std::option::Option<&str> {
23948            match self {
23949                Self::Unspecified => {
23950                    std::option::Option::Some("TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED")
23951                }
23952                Self::Disk => std::option::Option::Some("DISK"),
23953                Self::SwitchingToCloudStorage => {
23954                    std::option::Option::Some("SWITCHING_TO_CLOUD_STORAGE")
23955                }
23956                Self::SwitchedToCloudStorage => {
23957                    std::option::Option::Some("SWITCHED_TO_CLOUD_STORAGE")
23958                }
23959                Self::CloudStorage => std::option::Option::Some("CLOUD_STORAGE"),
23960                Self::UnknownValue(u) => u.0.name(),
23961            }
23962        }
23963    }
23964
23965    impl std::default::Default for TransactionalLogStorageState {
23966        fn default() -> Self {
23967            use std::convert::From;
23968            Self::from(0)
23969        }
23970    }
23971
23972    impl std::fmt::Display for TransactionalLogStorageState {
23973        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
23974            wkt::internal::display_enum(f, self.name(), self.value())
23975        }
23976    }
23977
23978    impl std::convert::From<i32> for TransactionalLogStorageState {
23979        fn from(value: i32) -> Self {
23980            match value {
23981                0 => Self::Unspecified,
23982                1 => Self::Disk,
23983                2 => Self::SwitchingToCloudStorage,
23984                3 => Self::SwitchedToCloudStorage,
23985                4 => Self::CloudStorage,
23986                _ => Self::UnknownValue(transactional_log_storage_state::UnknownValue(
23987                    wkt::internal::UnknownEnumValue::Integer(value),
23988                )),
23989            }
23990        }
23991    }
23992
23993    impl std::convert::From<&str> for TransactionalLogStorageState {
23994        fn from(value: &str) -> Self {
23995            use std::string::ToString;
23996            match value {
23997                "TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED" => Self::Unspecified,
23998                "DISK" => Self::Disk,
23999                "SWITCHING_TO_CLOUD_STORAGE" => Self::SwitchingToCloudStorage,
24000                "SWITCHED_TO_CLOUD_STORAGE" => Self::SwitchedToCloudStorage,
24001                "CLOUD_STORAGE" => Self::CloudStorage,
24002                _ => Self::UnknownValue(transactional_log_storage_state::UnknownValue(
24003                    wkt::internal::UnknownEnumValue::String(value.to_string()),
24004                )),
24005            }
24006        }
24007    }
24008
24009    impl serde::ser::Serialize for TransactionalLogStorageState {
24010        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24011        where
24012            S: serde::Serializer,
24013        {
24014            match self {
24015                Self::Unspecified => serializer.serialize_i32(0),
24016                Self::Disk => serializer.serialize_i32(1),
24017                Self::SwitchingToCloudStorage => serializer.serialize_i32(2),
24018                Self::SwitchedToCloudStorage => serializer.serialize_i32(3),
24019                Self::CloudStorage => serializer.serialize_i32(4),
24020                Self::UnknownValue(u) => u.0.serialize(serializer),
24021            }
24022        }
24023    }
24024
24025    impl<'de> serde::de::Deserialize<'de> for TransactionalLogStorageState {
24026        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24027        where
24028            D: serde::Deserializer<'de>,
24029        {
24030            deserializer.deserialize_any(
24031                wkt::internal::EnumVisitor::<TransactionalLogStorageState>::new(
24032                    ".google.cloud.sql.v1.BackupConfiguration.TransactionalLogStorageState",
24033                ),
24034            )
24035        }
24036    }
24037}
24038
24039/// Perform disk shrink context.
24040#[derive(Clone, Debug, Default, PartialEq)]
24041#[non_exhaustive]
24042pub struct PerformDiskShrinkContext {
24043    /// The target disk shrink size in GigaBytes.
24044    pub target_size_gb: i64,
24045
24046    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24047}
24048
24049impl PerformDiskShrinkContext {
24050    pub fn new() -> Self {
24051        std::default::Default::default()
24052    }
24053
24054    /// Sets the value of [target_size_gb][crate::model::PerformDiskShrinkContext::target_size_gb].
24055    pub fn set_target_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
24056        self.target_size_gb = v.into();
24057        self
24058    }
24059}
24060
24061impl wkt::message::Message for PerformDiskShrinkContext {
24062    fn typename() -> &'static str {
24063        "type.googleapis.com/google.cloud.sql.v1.PerformDiskShrinkContext"
24064    }
24065}
24066
24067#[doc(hidden)]
24068impl<'de> serde::de::Deserialize<'de> for PerformDiskShrinkContext {
24069    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24070    where
24071        D: serde::Deserializer<'de>,
24072    {
24073        #[allow(non_camel_case_types)]
24074        #[doc(hidden)]
24075        #[derive(PartialEq, Eq, Hash)]
24076        enum __FieldTag {
24077            __target_size_gb,
24078            Unknown(std::string::String),
24079        }
24080        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
24081            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24082            where
24083                D: serde::Deserializer<'de>,
24084            {
24085                struct Visitor;
24086                impl<'de> serde::de::Visitor<'de> for Visitor {
24087                    type Value = __FieldTag;
24088                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24089                        formatter.write_str("a field name for PerformDiskShrinkContext")
24090                    }
24091                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
24092                    where
24093                        E: serde::de::Error,
24094                    {
24095                        use std::result::Result::Ok;
24096                        use std::string::ToString;
24097                        match value {
24098                            "targetSizeGb" => Ok(__FieldTag::__target_size_gb),
24099                            "target_size_gb" => Ok(__FieldTag::__target_size_gb),
24100                            _ => Ok(__FieldTag::Unknown(value.to_string())),
24101                        }
24102                    }
24103                }
24104                deserializer.deserialize_identifier(Visitor)
24105            }
24106        }
24107        struct Visitor;
24108        impl<'de> serde::de::Visitor<'de> for Visitor {
24109            type Value = PerformDiskShrinkContext;
24110            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24111                formatter.write_str("struct PerformDiskShrinkContext")
24112            }
24113            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
24114            where
24115                A: serde::de::MapAccess<'de>,
24116            {
24117                #[allow(unused_imports)]
24118                use serde::de::Error;
24119                use std::option::Option::Some;
24120                let mut fields = std::collections::HashSet::new();
24121                let mut result = Self::Value::new();
24122                while let Some(tag) = map.next_key::<__FieldTag>()? {
24123                    #[allow(clippy::match_single_binding)]
24124                    match tag {
24125                        __FieldTag::__target_size_gb => {
24126                            if !fields.insert(__FieldTag::__target_size_gb) {
24127                                return std::result::Result::Err(A::Error::duplicate_field(
24128                                    "multiple values for target_size_gb",
24129                                ));
24130                            }
24131                            struct __With(std::option::Option<i64>);
24132                            impl<'de> serde::de::Deserialize<'de> for __With {
24133                                fn deserialize<D>(
24134                                    deserializer: D,
24135                                ) -> std::result::Result<Self, D::Error>
24136                                where
24137                                    D: serde::de::Deserializer<'de>,
24138                                {
24139                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
24140                                }
24141                            }
24142                            result.target_size_gb =
24143                                map.next_value::<__With>()?.0.unwrap_or_default();
24144                        }
24145                        __FieldTag::Unknown(key) => {
24146                            let value = map.next_value::<serde_json::Value>()?;
24147                            result._unknown_fields.insert(key, value);
24148                        }
24149                    }
24150                }
24151                std::result::Result::Ok(result)
24152            }
24153        }
24154        deserializer.deserialize_any(Visitor)
24155    }
24156}
24157
24158#[doc(hidden)]
24159impl serde::ser::Serialize for PerformDiskShrinkContext {
24160    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24161    where
24162        S: serde::ser::Serializer,
24163    {
24164        use serde::ser::SerializeMap;
24165        #[allow(unused_imports)]
24166        use std::option::Option::Some;
24167        let mut state = serializer.serialize_map(std::option::Option::None)?;
24168        if !wkt::internal::is_default(&self.target_size_gb) {
24169            struct __With<'a>(&'a i64);
24170            impl<'a> serde::ser::Serialize for __With<'a> {
24171                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24172                where
24173                    S: serde::ser::Serializer,
24174                {
24175                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
24176                }
24177            }
24178            state.serialize_entry("targetSizeGb", &__With(&self.target_size_gb))?;
24179        }
24180        if !self._unknown_fields.is_empty() {
24181            for (key, value) in self._unknown_fields.iter() {
24182                state.serialize_entry(key, &value)?;
24183            }
24184        }
24185        state.end()
24186    }
24187}
24188
24189/// Backup context.
24190#[derive(Clone, Debug, Default, PartialEq)]
24191#[non_exhaustive]
24192pub struct BackupContext {
24193    /// The identifier of the backup.
24194    pub backup_id: i64,
24195
24196    /// This is always `sql#backupContext`.
24197    pub kind: std::string::String,
24198
24199    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24200}
24201
24202impl BackupContext {
24203    pub fn new() -> Self {
24204        std::default::Default::default()
24205    }
24206
24207    /// Sets the value of [backup_id][crate::model::BackupContext::backup_id].
24208    pub fn set_backup_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
24209        self.backup_id = v.into();
24210        self
24211    }
24212
24213    /// Sets the value of [kind][crate::model::BackupContext::kind].
24214    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24215        self.kind = v.into();
24216        self
24217    }
24218}
24219
24220impl wkt::message::Message for BackupContext {
24221    fn typename() -> &'static str {
24222        "type.googleapis.com/google.cloud.sql.v1.BackupContext"
24223    }
24224}
24225
24226#[doc(hidden)]
24227impl<'de> serde::de::Deserialize<'de> for BackupContext {
24228    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24229    where
24230        D: serde::Deserializer<'de>,
24231    {
24232        #[allow(non_camel_case_types)]
24233        #[doc(hidden)]
24234        #[derive(PartialEq, Eq, Hash)]
24235        enum __FieldTag {
24236            __backup_id,
24237            __kind,
24238            Unknown(std::string::String),
24239        }
24240        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
24241            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24242            where
24243                D: serde::Deserializer<'de>,
24244            {
24245                struct Visitor;
24246                impl<'de> serde::de::Visitor<'de> for Visitor {
24247                    type Value = __FieldTag;
24248                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24249                        formatter.write_str("a field name for BackupContext")
24250                    }
24251                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
24252                    where
24253                        E: serde::de::Error,
24254                    {
24255                        use std::result::Result::Ok;
24256                        use std::string::ToString;
24257                        match value {
24258                            "backupId" => Ok(__FieldTag::__backup_id),
24259                            "backup_id" => Ok(__FieldTag::__backup_id),
24260                            "kind" => Ok(__FieldTag::__kind),
24261                            _ => Ok(__FieldTag::Unknown(value.to_string())),
24262                        }
24263                    }
24264                }
24265                deserializer.deserialize_identifier(Visitor)
24266            }
24267        }
24268        struct Visitor;
24269        impl<'de> serde::de::Visitor<'de> for Visitor {
24270            type Value = BackupContext;
24271            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24272                formatter.write_str("struct BackupContext")
24273            }
24274            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
24275            where
24276                A: serde::de::MapAccess<'de>,
24277            {
24278                #[allow(unused_imports)]
24279                use serde::de::Error;
24280                use std::option::Option::Some;
24281                let mut fields = std::collections::HashSet::new();
24282                let mut result = Self::Value::new();
24283                while let Some(tag) = map.next_key::<__FieldTag>()? {
24284                    #[allow(clippy::match_single_binding)]
24285                    match tag {
24286                        __FieldTag::__backup_id => {
24287                            if !fields.insert(__FieldTag::__backup_id) {
24288                                return std::result::Result::Err(A::Error::duplicate_field(
24289                                    "multiple values for backup_id",
24290                                ));
24291                            }
24292                            struct __With(std::option::Option<i64>);
24293                            impl<'de> serde::de::Deserialize<'de> for __With {
24294                                fn deserialize<D>(
24295                                    deserializer: D,
24296                                ) -> std::result::Result<Self, D::Error>
24297                                where
24298                                    D: serde::de::Deserializer<'de>,
24299                                {
24300                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
24301                                }
24302                            }
24303                            result.backup_id = map.next_value::<__With>()?.0.unwrap_or_default();
24304                        }
24305                        __FieldTag::__kind => {
24306                            if !fields.insert(__FieldTag::__kind) {
24307                                return std::result::Result::Err(A::Error::duplicate_field(
24308                                    "multiple values for kind",
24309                                ));
24310                            }
24311                            result.kind = map
24312                                .next_value::<std::option::Option<std::string::String>>()?
24313                                .unwrap_or_default();
24314                        }
24315                        __FieldTag::Unknown(key) => {
24316                            let value = map.next_value::<serde_json::Value>()?;
24317                            result._unknown_fields.insert(key, value);
24318                        }
24319                    }
24320                }
24321                std::result::Result::Ok(result)
24322            }
24323        }
24324        deserializer.deserialize_any(Visitor)
24325    }
24326}
24327
24328#[doc(hidden)]
24329impl serde::ser::Serialize for BackupContext {
24330    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24331    where
24332        S: serde::ser::Serializer,
24333    {
24334        use serde::ser::SerializeMap;
24335        #[allow(unused_imports)]
24336        use std::option::Option::Some;
24337        let mut state = serializer.serialize_map(std::option::Option::None)?;
24338        if !wkt::internal::is_default(&self.backup_id) {
24339            struct __With<'a>(&'a i64);
24340            impl<'a> serde::ser::Serialize for __With<'a> {
24341                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24342                where
24343                    S: serde::ser::Serializer,
24344                {
24345                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
24346                }
24347            }
24348            state.serialize_entry("backupId", &__With(&self.backup_id))?;
24349        }
24350        if !self.kind.is_empty() {
24351            state.serialize_entry("kind", &self.kind)?;
24352        }
24353        if !self._unknown_fields.is_empty() {
24354            for (key, value) in self._unknown_fields.iter() {
24355                state.serialize_entry(key, &value)?;
24356            }
24357        }
24358        state.end()
24359    }
24360}
24361
24362/// Represents a SQL database on the Cloud SQL instance.
24363#[derive(Clone, Debug, Default, PartialEq)]
24364#[non_exhaustive]
24365pub struct Database {
24366    /// This is always `sql#database`.
24367    pub kind: std::string::String,
24368
24369    /// The Cloud SQL charset value.
24370    pub charset: std::string::String,
24371
24372    /// The Cloud SQL collation value.
24373    pub collation: std::string::String,
24374
24375    /// This field is deprecated and will be removed from a future version of the
24376    /// API.
24377    pub etag: std::string::String,
24378
24379    /// The name of the database in the Cloud SQL instance. This does not include
24380    /// the project ID or instance name.
24381    pub name: std::string::String,
24382
24383    /// The name of the Cloud SQL instance. This does not include the project ID.
24384    pub instance: std::string::String,
24385
24386    /// The URI of this resource.
24387    pub self_link: std::string::String,
24388
24389    /// The project ID of the project containing the Cloud SQL database. The Google
24390    /// apps domain is prefixed if applicable.
24391    pub project: std::string::String,
24392
24393    pub database_details: std::option::Option<crate::model::database::DatabaseDetails>,
24394
24395    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24396}
24397
24398impl Database {
24399    pub fn new() -> Self {
24400        std::default::Default::default()
24401    }
24402
24403    /// Sets the value of [kind][crate::model::Database::kind].
24404    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24405        self.kind = v.into();
24406        self
24407    }
24408
24409    /// Sets the value of [charset][crate::model::Database::charset].
24410    pub fn set_charset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24411        self.charset = v.into();
24412        self
24413    }
24414
24415    /// Sets the value of [collation][crate::model::Database::collation].
24416    pub fn set_collation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24417        self.collation = v.into();
24418        self
24419    }
24420
24421    /// Sets the value of [etag][crate::model::Database::etag].
24422    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24423        self.etag = v.into();
24424        self
24425    }
24426
24427    /// Sets the value of [name][crate::model::Database::name].
24428    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24429        self.name = v.into();
24430        self
24431    }
24432
24433    /// Sets the value of [instance][crate::model::Database::instance].
24434    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24435        self.instance = v.into();
24436        self
24437    }
24438
24439    /// Sets the value of [self_link][crate::model::Database::self_link].
24440    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24441        self.self_link = v.into();
24442        self
24443    }
24444
24445    /// Sets the value of [project][crate::model::Database::project].
24446    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24447        self.project = v.into();
24448        self
24449    }
24450
24451    /// Sets the value of [database_details][crate::model::Database::database_details].
24452    ///
24453    /// Note that all the setters affecting `database_details` are mutually
24454    /// exclusive.
24455    pub fn set_database_details<
24456        T: std::convert::Into<std::option::Option<crate::model::database::DatabaseDetails>>,
24457    >(
24458        mut self,
24459        v: T,
24460    ) -> Self {
24461        self.database_details = v.into();
24462        self
24463    }
24464
24465    /// The value of [database_details][crate::model::Database::database_details]
24466    /// if it holds a `SqlserverDatabaseDetails`, `None` if the field is not set or
24467    /// holds a different branch.
24468    pub fn sqlserver_database_details(
24469        &self,
24470    ) -> std::option::Option<&std::boxed::Box<crate::model::SqlServerDatabaseDetails>> {
24471        #[allow(unreachable_patterns)]
24472        self.database_details.as_ref().and_then(|v| match v {
24473            crate::model::database::DatabaseDetails::SqlserverDatabaseDetails(v) => {
24474                std::option::Option::Some(v)
24475            }
24476            _ => std::option::Option::None,
24477        })
24478    }
24479
24480    /// Sets the value of [database_details][crate::model::Database::database_details]
24481    /// to hold a `SqlserverDatabaseDetails`.
24482    ///
24483    /// Note that all the setters affecting `database_details` are
24484    /// mutually exclusive.
24485    pub fn set_sqlserver_database_details<
24486        T: std::convert::Into<std::boxed::Box<crate::model::SqlServerDatabaseDetails>>,
24487    >(
24488        mut self,
24489        v: T,
24490    ) -> Self {
24491        self.database_details = std::option::Option::Some(
24492            crate::model::database::DatabaseDetails::SqlserverDatabaseDetails(v.into()),
24493        );
24494        self
24495    }
24496}
24497
24498impl wkt::message::Message for Database {
24499    fn typename() -> &'static str {
24500        "type.googleapis.com/google.cloud.sql.v1.Database"
24501    }
24502}
24503
24504#[doc(hidden)]
24505impl<'de> serde::de::Deserialize<'de> for Database {
24506    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24507    where
24508        D: serde::Deserializer<'de>,
24509    {
24510        #[allow(non_camel_case_types)]
24511        #[doc(hidden)]
24512        #[derive(PartialEq, Eq, Hash)]
24513        enum __FieldTag {
24514            __kind,
24515            __charset,
24516            __collation,
24517            __etag,
24518            __name,
24519            __instance,
24520            __self_link,
24521            __project,
24522            __sqlserver_database_details,
24523            Unknown(std::string::String),
24524        }
24525        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
24526            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24527            where
24528                D: serde::Deserializer<'de>,
24529            {
24530                struct Visitor;
24531                impl<'de> serde::de::Visitor<'de> for Visitor {
24532                    type Value = __FieldTag;
24533                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24534                        formatter.write_str("a field name for Database")
24535                    }
24536                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
24537                    where
24538                        E: serde::de::Error,
24539                    {
24540                        use std::result::Result::Ok;
24541                        use std::string::ToString;
24542                        match value {
24543                            "kind" => Ok(__FieldTag::__kind),
24544                            "charset" => Ok(__FieldTag::__charset),
24545                            "collation" => Ok(__FieldTag::__collation),
24546                            "etag" => Ok(__FieldTag::__etag),
24547                            "name" => Ok(__FieldTag::__name),
24548                            "instance" => Ok(__FieldTag::__instance),
24549                            "selfLink" => Ok(__FieldTag::__self_link),
24550                            "self_link" => Ok(__FieldTag::__self_link),
24551                            "project" => Ok(__FieldTag::__project),
24552                            "sqlserverDatabaseDetails" => {
24553                                Ok(__FieldTag::__sqlserver_database_details)
24554                            }
24555                            "sqlserver_database_details" => {
24556                                Ok(__FieldTag::__sqlserver_database_details)
24557                            }
24558                            _ => Ok(__FieldTag::Unknown(value.to_string())),
24559                        }
24560                    }
24561                }
24562                deserializer.deserialize_identifier(Visitor)
24563            }
24564        }
24565        struct Visitor;
24566        impl<'de> serde::de::Visitor<'de> for Visitor {
24567            type Value = Database;
24568            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24569                formatter.write_str("struct Database")
24570            }
24571            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
24572            where
24573                A: serde::de::MapAccess<'de>,
24574            {
24575                #[allow(unused_imports)]
24576                use serde::de::Error;
24577                use std::option::Option::Some;
24578                let mut fields = std::collections::HashSet::new();
24579                let mut result = Self::Value::new();
24580                while let Some(tag) = map.next_key::<__FieldTag>()? {
24581                    #[allow(clippy::match_single_binding)]
24582                    match tag {
24583                        __FieldTag::__kind => {
24584                            if !fields.insert(__FieldTag::__kind) {
24585                                return std::result::Result::Err(A::Error::duplicate_field(
24586                                    "multiple values for kind",
24587                                ));
24588                            }
24589                            result.kind = map
24590                                .next_value::<std::option::Option<std::string::String>>()?
24591                                .unwrap_or_default();
24592                        }
24593                        __FieldTag::__charset => {
24594                            if !fields.insert(__FieldTag::__charset) {
24595                                return std::result::Result::Err(A::Error::duplicate_field(
24596                                    "multiple values for charset",
24597                                ));
24598                            }
24599                            result.charset = map
24600                                .next_value::<std::option::Option<std::string::String>>()?
24601                                .unwrap_or_default();
24602                        }
24603                        __FieldTag::__collation => {
24604                            if !fields.insert(__FieldTag::__collation) {
24605                                return std::result::Result::Err(A::Error::duplicate_field(
24606                                    "multiple values for collation",
24607                                ));
24608                            }
24609                            result.collation = map
24610                                .next_value::<std::option::Option<std::string::String>>()?
24611                                .unwrap_or_default();
24612                        }
24613                        __FieldTag::__etag => {
24614                            if !fields.insert(__FieldTag::__etag) {
24615                                return std::result::Result::Err(A::Error::duplicate_field(
24616                                    "multiple values for etag",
24617                                ));
24618                            }
24619                            result.etag = map
24620                                .next_value::<std::option::Option<std::string::String>>()?
24621                                .unwrap_or_default();
24622                        }
24623                        __FieldTag::__name => {
24624                            if !fields.insert(__FieldTag::__name) {
24625                                return std::result::Result::Err(A::Error::duplicate_field(
24626                                    "multiple values for name",
24627                                ));
24628                            }
24629                            result.name = map
24630                                .next_value::<std::option::Option<std::string::String>>()?
24631                                .unwrap_or_default();
24632                        }
24633                        __FieldTag::__instance => {
24634                            if !fields.insert(__FieldTag::__instance) {
24635                                return std::result::Result::Err(A::Error::duplicate_field(
24636                                    "multiple values for instance",
24637                                ));
24638                            }
24639                            result.instance = map
24640                                .next_value::<std::option::Option<std::string::String>>()?
24641                                .unwrap_or_default();
24642                        }
24643                        __FieldTag::__self_link => {
24644                            if !fields.insert(__FieldTag::__self_link) {
24645                                return std::result::Result::Err(A::Error::duplicate_field(
24646                                    "multiple values for self_link",
24647                                ));
24648                            }
24649                            result.self_link = map
24650                                .next_value::<std::option::Option<std::string::String>>()?
24651                                .unwrap_or_default();
24652                        }
24653                        __FieldTag::__project => {
24654                            if !fields.insert(__FieldTag::__project) {
24655                                return std::result::Result::Err(A::Error::duplicate_field(
24656                                    "multiple values for project",
24657                                ));
24658                            }
24659                            result.project = map
24660                                .next_value::<std::option::Option<std::string::String>>()?
24661                                .unwrap_or_default();
24662                        }
24663                        __FieldTag::__sqlserver_database_details => {
24664                            if !fields.insert(__FieldTag::__sqlserver_database_details) {
24665                                return std::result::Result::Err(A::Error::duplicate_field(
24666                                    "multiple values for sqlserver_database_details",
24667                                ));
24668                            }
24669                            if result.database_details.is_some() {
24670                                return std::result::Result::Err(A::Error::duplicate_field(
24671                                    "multiple values for `database_details`, a oneof with full ID .google.cloud.sql.v1.Database.sqlserver_database_details, latest field was sqlserverDatabaseDetails",
24672                                ));
24673                            }
24674                            result.database_details = std::option::Option::Some(
24675                                crate::model::database::DatabaseDetails::SqlserverDatabaseDetails(
24676                                    map.next_value::<std::option::Option<
24677                                        std::boxed::Box<crate::model::SqlServerDatabaseDetails>,
24678                                    >>()?
24679                                    .unwrap_or_default(),
24680                                ),
24681                            );
24682                        }
24683                        __FieldTag::Unknown(key) => {
24684                            let value = map.next_value::<serde_json::Value>()?;
24685                            result._unknown_fields.insert(key, value);
24686                        }
24687                    }
24688                }
24689                std::result::Result::Ok(result)
24690            }
24691        }
24692        deserializer.deserialize_any(Visitor)
24693    }
24694}
24695
24696#[doc(hidden)]
24697impl serde::ser::Serialize for Database {
24698    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24699    where
24700        S: serde::ser::Serializer,
24701    {
24702        use serde::ser::SerializeMap;
24703        #[allow(unused_imports)]
24704        use std::option::Option::Some;
24705        let mut state = serializer.serialize_map(std::option::Option::None)?;
24706        if !self.kind.is_empty() {
24707            state.serialize_entry("kind", &self.kind)?;
24708        }
24709        if !self.charset.is_empty() {
24710            state.serialize_entry("charset", &self.charset)?;
24711        }
24712        if !self.collation.is_empty() {
24713            state.serialize_entry("collation", &self.collation)?;
24714        }
24715        if !self.etag.is_empty() {
24716            state.serialize_entry("etag", &self.etag)?;
24717        }
24718        if !self.name.is_empty() {
24719            state.serialize_entry("name", &self.name)?;
24720        }
24721        if !self.instance.is_empty() {
24722            state.serialize_entry("instance", &self.instance)?;
24723        }
24724        if !self.self_link.is_empty() {
24725            state.serialize_entry("selfLink", &self.self_link)?;
24726        }
24727        if !self.project.is_empty() {
24728            state.serialize_entry("project", &self.project)?;
24729        }
24730        if let Some(value) = self.sqlserver_database_details() {
24731            state.serialize_entry("sqlserverDatabaseDetails", value)?;
24732        }
24733        if !self._unknown_fields.is_empty() {
24734            for (key, value) in self._unknown_fields.iter() {
24735                state.serialize_entry(key, &value)?;
24736            }
24737        }
24738        state.end()
24739    }
24740}
24741
24742/// Defines additional types related to [Database].
24743pub mod database {
24744    #[allow(unused_imports)]
24745    use super::*;
24746
24747    #[derive(Clone, Debug, PartialEq)]
24748    #[non_exhaustive]
24749    pub enum DatabaseDetails {
24750        SqlserverDatabaseDetails(std::boxed::Box<crate::model::SqlServerDatabaseDetails>),
24751    }
24752}
24753
24754/// Represents a Sql Server database on the Cloud SQL instance.
24755#[derive(Clone, Debug, Default, PartialEq)]
24756#[non_exhaustive]
24757pub struct SqlServerDatabaseDetails {
24758    /// The version of SQL Server with which the database is to be made compatible
24759    pub compatibility_level: i32,
24760
24761    /// The recovery model of a SQL Server database
24762    pub recovery_model: std::string::String,
24763
24764    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24765}
24766
24767impl SqlServerDatabaseDetails {
24768    pub fn new() -> Self {
24769        std::default::Default::default()
24770    }
24771
24772    /// Sets the value of [compatibility_level][crate::model::SqlServerDatabaseDetails::compatibility_level].
24773    pub fn set_compatibility_level<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
24774        self.compatibility_level = v.into();
24775        self
24776    }
24777
24778    /// Sets the value of [recovery_model][crate::model::SqlServerDatabaseDetails::recovery_model].
24779    pub fn set_recovery_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24780        self.recovery_model = v.into();
24781        self
24782    }
24783}
24784
24785impl wkt::message::Message for SqlServerDatabaseDetails {
24786    fn typename() -> &'static str {
24787        "type.googleapis.com/google.cloud.sql.v1.SqlServerDatabaseDetails"
24788    }
24789}
24790
24791#[doc(hidden)]
24792impl<'de> serde::de::Deserialize<'de> for SqlServerDatabaseDetails {
24793    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24794    where
24795        D: serde::Deserializer<'de>,
24796    {
24797        #[allow(non_camel_case_types)]
24798        #[doc(hidden)]
24799        #[derive(PartialEq, Eq, Hash)]
24800        enum __FieldTag {
24801            __compatibility_level,
24802            __recovery_model,
24803            Unknown(std::string::String),
24804        }
24805        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
24806            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24807            where
24808                D: serde::Deserializer<'de>,
24809            {
24810                struct Visitor;
24811                impl<'de> serde::de::Visitor<'de> for Visitor {
24812                    type Value = __FieldTag;
24813                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24814                        formatter.write_str("a field name for SqlServerDatabaseDetails")
24815                    }
24816                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
24817                    where
24818                        E: serde::de::Error,
24819                    {
24820                        use std::result::Result::Ok;
24821                        use std::string::ToString;
24822                        match value {
24823                            "compatibilityLevel" => Ok(__FieldTag::__compatibility_level),
24824                            "compatibility_level" => Ok(__FieldTag::__compatibility_level),
24825                            "recoveryModel" => Ok(__FieldTag::__recovery_model),
24826                            "recovery_model" => Ok(__FieldTag::__recovery_model),
24827                            _ => Ok(__FieldTag::Unknown(value.to_string())),
24828                        }
24829                    }
24830                }
24831                deserializer.deserialize_identifier(Visitor)
24832            }
24833        }
24834        struct Visitor;
24835        impl<'de> serde::de::Visitor<'de> for Visitor {
24836            type Value = SqlServerDatabaseDetails;
24837            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24838                formatter.write_str("struct SqlServerDatabaseDetails")
24839            }
24840            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
24841            where
24842                A: serde::de::MapAccess<'de>,
24843            {
24844                #[allow(unused_imports)]
24845                use serde::de::Error;
24846                use std::option::Option::Some;
24847                let mut fields = std::collections::HashSet::new();
24848                let mut result = Self::Value::new();
24849                while let Some(tag) = map.next_key::<__FieldTag>()? {
24850                    #[allow(clippy::match_single_binding)]
24851                    match tag {
24852                        __FieldTag::__compatibility_level => {
24853                            if !fields.insert(__FieldTag::__compatibility_level) {
24854                                return std::result::Result::Err(A::Error::duplicate_field(
24855                                    "multiple values for compatibility_level",
24856                                ));
24857                            }
24858                            struct __With(std::option::Option<i32>);
24859                            impl<'de> serde::de::Deserialize<'de> for __With {
24860                                fn deserialize<D>(
24861                                    deserializer: D,
24862                                ) -> std::result::Result<Self, D::Error>
24863                                where
24864                                    D: serde::de::Deserializer<'de>,
24865                                {
24866                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
24867                                }
24868                            }
24869                            result.compatibility_level =
24870                                map.next_value::<__With>()?.0.unwrap_or_default();
24871                        }
24872                        __FieldTag::__recovery_model => {
24873                            if !fields.insert(__FieldTag::__recovery_model) {
24874                                return std::result::Result::Err(A::Error::duplicate_field(
24875                                    "multiple values for recovery_model",
24876                                ));
24877                            }
24878                            result.recovery_model = map
24879                                .next_value::<std::option::Option<std::string::String>>()?
24880                                .unwrap_or_default();
24881                        }
24882                        __FieldTag::Unknown(key) => {
24883                            let value = map.next_value::<serde_json::Value>()?;
24884                            result._unknown_fields.insert(key, value);
24885                        }
24886                    }
24887                }
24888                std::result::Result::Ok(result)
24889            }
24890        }
24891        deserializer.deserialize_any(Visitor)
24892    }
24893}
24894
24895#[doc(hidden)]
24896impl serde::ser::Serialize for SqlServerDatabaseDetails {
24897    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24898    where
24899        S: serde::ser::Serializer,
24900    {
24901        use serde::ser::SerializeMap;
24902        #[allow(unused_imports)]
24903        use std::option::Option::Some;
24904        let mut state = serializer.serialize_map(std::option::Option::None)?;
24905        if !wkt::internal::is_default(&self.compatibility_level) {
24906            struct __With<'a>(&'a i32);
24907            impl<'a> serde::ser::Serialize for __With<'a> {
24908                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24909                where
24910                    S: serde::ser::Serializer,
24911                {
24912                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
24913                }
24914            }
24915            state.serialize_entry("compatibilityLevel", &__With(&self.compatibility_level))?;
24916        }
24917        if !self.recovery_model.is_empty() {
24918            state.serialize_entry("recoveryModel", &self.recovery_model)?;
24919        }
24920        if !self._unknown_fields.is_empty() {
24921            for (key, value) in self._unknown_fields.iter() {
24922                state.serialize_entry(key, &value)?;
24923            }
24924        }
24925        state.end()
24926    }
24927}
24928
24929/// Database flags for Cloud SQL instances.
24930#[derive(Clone, Debug, Default, PartialEq)]
24931#[non_exhaustive]
24932pub struct DatabaseFlags {
24933    /// The name of the flag. These flags are passed at instance startup, so
24934    /// include both server options and system variables. Flags are
24935    /// specified with underscores, not hyphens. For more information, see
24936    /// [Configuring Database Flags](https://cloud.google.com/sql/docs/mysql/flags)
24937    /// in the Cloud SQL documentation.
24938    pub name: std::string::String,
24939
24940    /// The value of the flag. Boolean flags are set to `on` for true
24941    /// and `off` for false. This field must be omitted if the flag
24942    /// doesn't take a value.
24943    pub value: std::string::String,
24944
24945    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24946}
24947
24948impl DatabaseFlags {
24949    pub fn new() -> Self {
24950        std::default::Default::default()
24951    }
24952
24953    /// Sets the value of [name][crate::model::DatabaseFlags::name].
24954    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24955        self.name = v.into();
24956        self
24957    }
24958
24959    /// Sets the value of [value][crate::model::DatabaseFlags::value].
24960    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24961        self.value = v.into();
24962        self
24963    }
24964}
24965
24966impl wkt::message::Message for DatabaseFlags {
24967    fn typename() -> &'static str {
24968        "type.googleapis.com/google.cloud.sql.v1.DatabaseFlags"
24969    }
24970}
24971
24972#[doc(hidden)]
24973impl<'de> serde::de::Deserialize<'de> for DatabaseFlags {
24974    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24975    where
24976        D: serde::Deserializer<'de>,
24977    {
24978        #[allow(non_camel_case_types)]
24979        #[doc(hidden)]
24980        #[derive(PartialEq, Eq, Hash)]
24981        enum __FieldTag {
24982            __name,
24983            __value,
24984            Unknown(std::string::String),
24985        }
24986        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
24987            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24988            where
24989                D: serde::Deserializer<'de>,
24990            {
24991                struct Visitor;
24992                impl<'de> serde::de::Visitor<'de> for Visitor {
24993                    type Value = __FieldTag;
24994                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24995                        formatter.write_str("a field name for DatabaseFlags")
24996                    }
24997                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
24998                    where
24999                        E: serde::de::Error,
25000                    {
25001                        use std::result::Result::Ok;
25002                        use std::string::ToString;
25003                        match value {
25004                            "name" => Ok(__FieldTag::__name),
25005                            "value" => Ok(__FieldTag::__value),
25006                            _ => Ok(__FieldTag::Unknown(value.to_string())),
25007                        }
25008                    }
25009                }
25010                deserializer.deserialize_identifier(Visitor)
25011            }
25012        }
25013        struct Visitor;
25014        impl<'de> serde::de::Visitor<'de> for Visitor {
25015            type Value = DatabaseFlags;
25016            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25017                formatter.write_str("struct DatabaseFlags")
25018            }
25019            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
25020            where
25021                A: serde::de::MapAccess<'de>,
25022            {
25023                #[allow(unused_imports)]
25024                use serde::de::Error;
25025                use std::option::Option::Some;
25026                let mut fields = std::collections::HashSet::new();
25027                let mut result = Self::Value::new();
25028                while let Some(tag) = map.next_key::<__FieldTag>()? {
25029                    #[allow(clippy::match_single_binding)]
25030                    match tag {
25031                        __FieldTag::__name => {
25032                            if !fields.insert(__FieldTag::__name) {
25033                                return std::result::Result::Err(A::Error::duplicate_field(
25034                                    "multiple values for name",
25035                                ));
25036                            }
25037                            result.name = map
25038                                .next_value::<std::option::Option<std::string::String>>()?
25039                                .unwrap_or_default();
25040                        }
25041                        __FieldTag::__value => {
25042                            if !fields.insert(__FieldTag::__value) {
25043                                return std::result::Result::Err(A::Error::duplicate_field(
25044                                    "multiple values for value",
25045                                ));
25046                            }
25047                            result.value = map
25048                                .next_value::<std::option::Option<std::string::String>>()?
25049                                .unwrap_or_default();
25050                        }
25051                        __FieldTag::Unknown(key) => {
25052                            let value = map.next_value::<serde_json::Value>()?;
25053                            result._unknown_fields.insert(key, value);
25054                        }
25055                    }
25056                }
25057                std::result::Result::Ok(result)
25058            }
25059        }
25060        deserializer.deserialize_any(Visitor)
25061    }
25062}
25063
25064#[doc(hidden)]
25065impl serde::ser::Serialize for DatabaseFlags {
25066    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25067    where
25068        S: serde::ser::Serializer,
25069    {
25070        use serde::ser::SerializeMap;
25071        #[allow(unused_imports)]
25072        use std::option::Option::Some;
25073        let mut state = serializer.serialize_map(std::option::Option::None)?;
25074        if !self.name.is_empty() {
25075            state.serialize_entry("name", &self.name)?;
25076        }
25077        if !self.value.is_empty() {
25078            state.serialize_entry("value", &self.value)?;
25079        }
25080        if !self._unknown_fields.is_empty() {
25081            for (key, value) in self._unknown_fields.iter() {
25082                state.serialize_entry(key, &value)?;
25083            }
25084        }
25085        state.end()
25086    }
25087}
25088
25089/// MySQL-specific external server sync settings.
25090#[derive(Clone, Debug, Default, PartialEq)]
25091#[non_exhaustive]
25092pub struct MySqlSyncConfig {
25093    /// Flags to use for the initial dump.
25094    pub initial_sync_flags: std::vec::Vec<crate::model::SyncFlags>,
25095
25096    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25097}
25098
25099impl MySqlSyncConfig {
25100    pub fn new() -> Self {
25101        std::default::Default::default()
25102    }
25103
25104    /// Sets the value of [initial_sync_flags][crate::model::MySqlSyncConfig::initial_sync_flags].
25105    pub fn set_initial_sync_flags<T, V>(mut self, v: T) -> Self
25106    where
25107        T: std::iter::IntoIterator<Item = V>,
25108        V: std::convert::Into<crate::model::SyncFlags>,
25109    {
25110        use std::iter::Iterator;
25111        self.initial_sync_flags = v.into_iter().map(|i| i.into()).collect();
25112        self
25113    }
25114}
25115
25116impl wkt::message::Message for MySqlSyncConfig {
25117    fn typename() -> &'static str {
25118        "type.googleapis.com/google.cloud.sql.v1.MySqlSyncConfig"
25119    }
25120}
25121
25122#[doc(hidden)]
25123impl<'de> serde::de::Deserialize<'de> for MySqlSyncConfig {
25124    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25125    where
25126        D: serde::Deserializer<'de>,
25127    {
25128        #[allow(non_camel_case_types)]
25129        #[doc(hidden)]
25130        #[derive(PartialEq, Eq, Hash)]
25131        enum __FieldTag {
25132            __initial_sync_flags,
25133            Unknown(std::string::String),
25134        }
25135        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
25136            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25137            where
25138                D: serde::Deserializer<'de>,
25139            {
25140                struct Visitor;
25141                impl<'de> serde::de::Visitor<'de> for Visitor {
25142                    type Value = __FieldTag;
25143                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25144                        formatter.write_str("a field name for MySqlSyncConfig")
25145                    }
25146                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
25147                    where
25148                        E: serde::de::Error,
25149                    {
25150                        use std::result::Result::Ok;
25151                        use std::string::ToString;
25152                        match value {
25153                            "initialSyncFlags" => Ok(__FieldTag::__initial_sync_flags),
25154                            "initial_sync_flags" => Ok(__FieldTag::__initial_sync_flags),
25155                            _ => Ok(__FieldTag::Unknown(value.to_string())),
25156                        }
25157                    }
25158                }
25159                deserializer.deserialize_identifier(Visitor)
25160            }
25161        }
25162        struct Visitor;
25163        impl<'de> serde::de::Visitor<'de> for Visitor {
25164            type Value = MySqlSyncConfig;
25165            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25166                formatter.write_str("struct MySqlSyncConfig")
25167            }
25168            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
25169            where
25170                A: serde::de::MapAccess<'de>,
25171            {
25172                #[allow(unused_imports)]
25173                use serde::de::Error;
25174                use std::option::Option::Some;
25175                let mut fields = std::collections::HashSet::new();
25176                let mut result = Self::Value::new();
25177                while let Some(tag) = map.next_key::<__FieldTag>()? {
25178                    #[allow(clippy::match_single_binding)]
25179                    match tag {
25180                        __FieldTag::__initial_sync_flags => {
25181                            if !fields.insert(__FieldTag::__initial_sync_flags) {
25182                                return std::result::Result::Err(A::Error::duplicate_field(
25183                                    "multiple values for initial_sync_flags",
25184                                ));
25185                            }
25186                            result.initial_sync_flags = map.next_value::<std::option::Option<std::vec::Vec<crate::model::SyncFlags>>>()?.unwrap_or_default();
25187                        }
25188                        __FieldTag::Unknown(key) => {
25189                            let value = map.next_value::<serde_json::Value>()?;
25190                            result._unknown_fields.insert(key, value);
25191                        }
25192                    }
25193                }
25194                std::result::Result::Ok(result)
25195            }
25196        }
25197        deserializer.deserialize_any(Visitor)
25198    }
25199}
25200
25201#[doc(hidden)]
25202impl serde::ser::Serialize for MySqlSyncConfig {
25203    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25204    where
25205        S: serde::ser::Serializer,
25206    {
25207        use serde::ser::SerializeMap;
25208        #[allow(unused_imports)]
25209        use std::option::Option::Some;
25210        let mut state = serializer.serialize_map(std::option::Option::None)?;
25211        if !self.initial_sync_flags.is_empty() {
25212            state.serialize_entry("initialSyncFlags", &self.initial_sync_flags)?;
25213        }
25214        if !self._unknown_fields.is_empty() {
25215            for (key, value) in self._unknown_fields.iter() {
25216                state.serialize_entry(key, &value)?;
25217            }
25218        }
25219        state.end()
25220    }
25221}
25222
25223/// Initial sync flags for certain Cloud SQL APIs.
25224/// Currently used for the MySQL external server initial dump.
25225#[derive(Clone, Debug, Default, PartialEq)]
25226#[non_exhaustive]
25227pub struct SyncFlags {
25228    /// The name of the flag.
25229    pub name: std::string::String,
25230
25231    /// The value of the flag. This field must be omitted if the flag
25232    /// doesn't take a value.
25233    pub value: std::string::String,
25234
25235    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25236}
25237
25238impl SyncFlags {
25239    pub fn new() -> Self {
25240        std::default::Default::default()
25241    }
25242
25243    /// Sets the value of [name][crate::model::SyncFlags::name].
25244    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25245        self.name = v.into();
25246        self
25247    }
25248
25249    /// Sets the value of [value][crate::model::SyncFlags::value].
25250    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25251        self.value = v.into();
25252        self
25253    }
25254}
25255
25256impl wkt::message::Message for SyncFlags {
25257    fn typename() -> &'static str {
25258        "type.googleapis.com/google.cloud.sql.v1.SyncFlags"
25259    }
25260}
25261
25262#[doc(hidden)]
25263impl<'de> serde::de::Deserialize<'de> for SyncFlags {
25264    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25265    where
25266        D: serde::Deserializer<'de>,
25267    {
25268        #[allow(non_camel_case_types)]
25269        #[doc(hidden)]
25270        #[derive(PartialEq, Eq, Hash)]
25271        enum __FieldTag {
25272            __name,
25273            __value,
25274            Unknown(std::string::String),
25275        }
25276        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
25277            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25278            where
25279                D: serde::Deserializer<'de>,
25280            {
25281                struct Visitor;
25282                impl<'de> serde::de::Visitor<'de> for Visitor {
25283                    type Value = __FieldTag;
25284                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25285                        formatter.write_str("a field name for SyncFlags")
25286                    }
25287                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
25288                    where
25289                        E: serde::de::Error,
25290                    {
25291                        use std::result::Result::Ok;
25292                        use std::string::ToString;
25293                        match value {
25294                            "name" => Ok(__FieldTag::__name),
25295                            "value" => Ok(__FieldTag::__value),
25296                            _ => Ok(__FieldTag::Unknown(value.to_string())),
25297                        }
25298                    }
25299                }
25300                deserializer.deserialize_identifier(Visitor)
25301            }
25302        }
25303        struct Visitor;
25304        impl<'de> serde::de::Visitor<'de> for Visitor {
25305            type Value = SyncFlags;
25306            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25307                formatter.write_str("struct SyncFlags")
25308            }
25309            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
25310            where
25311                A: serde::de::MapAccess<'de>,
25312            {
25313                #[allow(unused_imports)]
25314                use serde::de::Error;
25315                use std::option::Option::Some;
25316                let mut fields = std::collections::HashSet::new();
25317                let mut result = Self::Value::new();
25318                while let Some(tag) = map.next_key::<__FieldTag>()? {
25319                    #[allow(clippy::match_single_binding)]
25320                    match tag {
25321                        __FieldTag::__name => {
25322                            if !fields.insert(__FieldTag::__name) {
25323                                return std::result::Result::Err(A::Error::duplicate_field(
25324                                    "multiple values for name",
25325                                ));
25326                            }
25327                            result.name = map
25328                                .next_value::<std::option::Option<std::string::String>>()?
25329                                .unwrap_or_default();
25330                        }
25331                        __FieldTag::__value => {
25332                            if !fields.insert(__FieldTag::__value) {
25333                                return std::result::Result::Err(A::Error::duplicate_field(
25334                                    "multiple values for value",
25335                                ));
25336                            }
25337                            result.value = map
25338                                .next_value::<std::option::Option<std::string::String>>()?
25339                                .unwrap_or_default();
25340                        }
25341                        __FieldTag::Unknown(key) => {
25342                            let value = map.next_value::<serde_json::Value>()?;
25343                            result._unknown_fields.insert(key, value);
25344                        }
25345                    }
25346                }
25347                std::result::Result::Ok(result)
25348            }
25349        }
25350        deserializer.deserialize_any(Visitor)
25351    }
25352}
25353
25354#[doc(hidden)]
25355impl serde::ser::Serialize for SyncFlags {
25356    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25357    where
25358        S: serde::ser::Serializer,
25359    {
25360        use serde::ser::SerializeMap;
25361        #[allow(unused_imports)]
25362        use std::option::Option::Some;
25363        let mut state = serializer.serialize_map(std::option::Option::None)?;
25364        if !self.name.is_empty() {
25365            state.serialize_entry("name", &self.name)?;
25366        }
25367        if !self.value.is_empty() {
25368            state.serialize_entry("value", &self.value)?;
25369        }
25370        if !self._unknown_fields.is_empty() {
25371            for (key, value) in self._unknown_fields.iter() {
25372                state.serialize_entry(key, &value)?;
25373            }
25374        }
25375        state.end()
25376    }
25377}
25378
25379/// Reference to another Cloud SQL instance.
25380#[derive(Clone, Debug, Default, PartialEq)]
25381#[non_exhaustive]
25382pub struct InstanceReference {
25383    /// The name of the Cloud SQL instance being referenced.
25384    /// This does not include the project ID.
25385    pub name: std::string::String,
25386
25387    /// The region of the Cloud SQL instance being referenced.
25388    pub region: std::string::String,
25389
25390    /// The project ID of the Cloud SQL instance being referenced.
25391    /// The default is the same project ID as the instance references it.
25392    pub project: std::string::String,
25393
25394    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25395}
25396
25397impl InstanceReference {
25398    pub fn new() -> Self {
25399        std::default::Default::default()
25400    }
25401
25402    /// Sets the value of [name][crate::model::InstanceReference::name].
25403    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25404        self.name = v.into();
25405        self
25406    }
25407
25408    /// Sets the value of [region][crate::model::InstanceReference::region].
25409    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25410        self.region = v.into();
25411        self
25412    }
25413
25414    /// Sets the value of [project][crate::model::InstanceReference::project].
25415    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25416        self.project = v.into();
25417        self
25418    }
25419}
25420
25421impl wkt::message::Message for InstanceReference {
25422    fn typename() -> &'static str {
25423        "type.googleapis.com/google.cloud.sql.v1.InstanceReference"
25424    }
25425}
25426
25427#[doc(hidden)]
25428impl<'de> serde::de::Deserialize<'de> for InstanceReference {
25429    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25430    where
25431        D: serde::Deserializer<'de>,
25432    {
25433        #[allow(non_camel_case_types)]
25434        #[doc(hidden)]
25435        #[derive(PartialEq, Eq, Hash)]
25436        enum __FieldTag {
25437            __name,
25438            __region,
25439            __project,
25440            Unknown(std::string::String),
25441        }
25442        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
25443            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25444            where
25445                D: serde::Deserializer<'de>,
25446            {
25447                struct Visitor;
25448                impl<'de> serde::de::Visitor<'de> for Visitor {
25449                    type Value = __FieldTag;
25450                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25451                        formatter.write_str("a field name for InstanceReference")
25452                    }
25453                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
25454                    where
25455                        E: serde::de::Error,
25456                    {
25457                        use std::result::Result::Ok;
25458                        use std::string::ToString;
25459                        match value {
25460                            "name" => Ok(__FieldTag::__name),
25461                            "region" => Ok(__FieldTag::__region),
25462                            "project" => Ok(__FieldTag::__project),
25463                            _ => Ok(__FieldTag::Unknown(value.to_string())),
25464                        }
25465                    }
25466                }
25467                deserializer.deserialize_identifier(Visitor)
25468            }
25469        }
25470        struct Visitor;
25471        impl<'de> serde::de::Visitor<'de> for Visitor {
25472            type Value = InstanceReference;
25473            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25474                formatter.write_str("struct InstanceReference")
25475            }
25476            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
25477            where
25478                A: serde::de::MapAccess<'de>,
25479            {
25480                #[allow(unused_imports)]
25481                use serde::de::Error;
25482                use std::option::Option::Some;
25483                let mut fields = std::collections::HashSet::new();
25484                let mut result = Self::Value::new();
25485                while let Some(tag) = map.next_key::<__FieldTag>()? {
25486                    #[allow(clippy::match_single_binding)]
25487                    match tag {
25488                        __FieldTag::__name => {
25489                            if !fields.insert(__FieldTag::__name) {
25490                                return std::result::Result::Err(A::Error::duplicate_field(
25491                                    "multiple values for name",
25492                                ));
25493                            }
25494                            result.name = map
25495                                .next_value::<std::option::Option<std::string::String>>()?
25496                                .unwrap_or_default();
25497                        }
25498                        __FieldTag::__region => {
25499                            if !fields.insert(__FieldTag::__region) {
25500                                return std::result::Result::Err(A::Error::duplicate_field(
25501                                    "multiple values for region",
25502                                ));
25503                            }
25504                            result.region = map
25505                                .next_value::<std::option::Option<std::string::String>>()?
25506                                .unwrap_or_default();
25507                        }
25508                        __FieldTag::__project => {
25509                            if !fields.insert(__FieldTag::__project) {
25510                                return std::result::Result::Err(A::Error::duplicate_field(
25511                                    "multiple values for project",
25512                                ));
25513                            }
25514                            result.project = map
25515                                .next_value::<std::option::Option<std::string::String>>()?
25516                                .unwrap_or_default();
25517                        }
25518                        __FieldTag::Unknown(key) => {
25519                            let value = map.next_value::<serde_json::Value>()?;
25520                            result._unknown_fields.insert(key, value);
25521                        }
25522                    }
25523                }
25524                std::result::Result::Ok(result)
25525            }
25526        }
25527        deserializer.deserialize_any(Visitor)
25528    }
25529}
25530
25531#[doc(hidden)]
25532impl serde::ser::Serialize for InstanceReference {
25533    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25534    where
25535        S: serde::ser::Serializer,
25536    {
25537        use serde::ser::SerializeMap;
25538        #[allow(unused_imports)]
25539        use std::option::Option::Some;
25540        let mut state = serializer.serialize_map(std::option::Option::None)?;
25541        if !self.name.is_empty() {
25542            state.serialize_entry("name", &self.name)?;
25543        }
25544        if !self.region.is_empty() {
25545            state.serialize_entry("region", &self.region)?;
25546        }
25547        if !self.project.is_empty() {
25548            state.serialize_entry("project", &self.project)?;
25549        }
25550        if !self._unknown_fields.is_empty() {
25551            for (key, value) in self._unknown_fields.iter() {
25552                state.serialize_entry(key, &value)?;
25553            }
25554        }
25555        state.end()
25556    }
25557}
25558
25559/// Read-replica configuration for connecting to the on-premises primary
25560/// instance.
25561#[derive(Clone, Debug, Default, PartialEq)]
25562#[non_exhaustive]
25563pub struct DemoteMasterConfiguration {
25564    /// This is always `sql#demoteMasterConfiguration`.
25565    pub kind: std::string::String,
25566
25567    /// MySQL specific configuration when replicating from a MySQL on-premises
25568    /// primary instance. Replication configuration information such as the
25569    /// username, password, certificates, and keys are not stored in the instance
25570    /// metadata. The configuration information is used only to set up the
25571    /// replication connection and is stored by MySQL in a file named
25572    /// `master.info` in the data directory.
25573    pub mysql_replica_configuration:
25574        std::option::Option<crate::model::DemoteMasterMySqlReplicaConfiguration>,
25575
25576    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25577}
25578
25579impl DemoteMasterConfiguration {
25580    pub fn new() -> Self {
25581        std::default::Default::default()
25582    }
25583
25584    /// Sets the value of [kind][crate::model::DemoteMasterConfiguration::kind].
25585    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25586        self.kind = v.into();
25587        self
25588    }
25589
25590    /// Sets the value of [mysql_replica_configuration][crate::model::DemoteMasterConfiguration::mysql_replica_configuration].
25591    pub fn set_mysql_replica_configuration<T>(mut self, v: T) -> Self
25592    where
25593        T: std::convert::Into<crate::model::DemoteMasterMySqlReplicaConfiguration>,
25594    {
25595        self.mysql_replica_configuration = std::option::Option::Some(v.into());
25596        self
25597    }
25598
25599    /// Sets or clears the value of [mysql_replica_configuration][crate::model::DemoteMasterConfiguration::mysql_replica_configuration].
25600    pub fn set_or_clear_mysql_replica_configuration<T>(mut self, v: std::option::Option<T>) -> Self
25601    where
25602        T: std::convert::Into<crate::model::DemoteMasterMySqlReplicaConfiguration>,
25603    {
25604        self.mysql_replica_configuration = v.map(|x| x.into());
25605        self
25606    }
25607}
25608
25609impl wkt::message::Message for DemoteMasterConfiguration {
25610    fn typename() -> &'static str {
25611        "type.googleapis.com/google.cloud.sql.v1.DemoteMasterConfiguration"
25612    }
25613}
25614
25615#[doc(hidden)]
25616impl<'de> serde::de::Deserialize<'de> for DemoteMasterConfiguration {
25617    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25618    where
25619        D: serde::Deserializer<'de>,
25620    {
25621        #[allow(non_camel_case_types)]
25622        #[doc(hidden)]
25623        #[derive(PartialEq, Eq, Hash)]
25624        enum __FieldTag {
25625            __kind,
25626            __mysql_replica_configuration,
25627            Unknown(std::string::String),
25628        }
25629        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
25630            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25631            where
25632                D: serde::Deserializer<'de>,
25633            {
25634                struct Visitor;
25635                impl<'de> serde::de::Visitor<'de> for Visitor {
25636                    type Value = __FieldTag;
25637                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25638                        formatter.write_str("a field name for DemoteMasterConfiguration")
25639                    }
25640                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
25641                    where
25642                        E: serde::de::Error,
25643                    {
25644                        use std::result::Result::Ok;
25645                        use std::string::ToString;
25646                        match value {
25647                            "kind" => Ok(__FieldTag::__kind),
25648                            "mysqlReplicaConfiguration" => {
25649                                Ok(__FieldTag::__mysql_replica_configuration)
25650                            }
25651                            "mysql_replica_configuration" => {
25652                                Ok(__FieldTag::__mysql_replica_configuration)
25653                            }
25654                            _ => Ok(__FieldTag::Unknown(value.to_string())),
25655                        }
25656                    }
25657                }
25658                deserializer.deserialize_identifier(Visitor)
25659            }
25660        }
25661        struct Visitor;
25662        impl<'de> serde::de::Visitor<'de> for Visitor {
25663            type Value = DemoteMasterConfiguration;
25664            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25665                formatter.write_str("struct DemoteMasterConfiguration")
25666            }
25667            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
25668            where
25669                A: serde::de::MapAccess<'de>,
25670            {
25671                #[allow(unused_imports)]
25672                use serde::de::Error;
25673                use std::option::Option::Some;
25674                let mut fields = std::collections::HashSet::new();
25675                let mut result = Self::Value::new();
25676                while let Some(tag) = map.next_key::<__FieldTag>()? {
25677                    #[allow(clippy::match_single_binding)]
25678                    match tag {
25679                        __FieldTag::__kind => {
25680                            if !fields.insert(__FieldTag::__kind) {
25681                                return std::result::Result::Err(A::Error::duplicate_field(
25682                                    "multiple values for kind",
25683                                ));
25684                            }
25685                            result.kind = map
25686                                .next_value::<std::option::Option<std::string::String>>()?
25687                                .unwrap_or_default();
25688                        }
25689                        __FieldTag::__mysql_replica_configuration => {
25690                            if !fields.insert(__FieldTag::__mysql_replica_configuration) {
25691                                return std::result::Result::Err(A::Error::duplicate_field(
25692                                    "multiple values for mysql_replica_configuration",
25693                                ));
25694                            }
25695                            result.mysql_replica_configuration = map
25696                                .next_value::<std::option::Option<
25697                                    crate::model::DemoteMasterMySqlReplicaConfiguration,
25698                                >>()?;
25699                        }
25700                        __FieldTag::Unknown(key) => {
25701                            let value = map.next_value::<serde_json::Value>()?;
25702                            result._unknown_fields.insert(key, value);
25703                        }
25704                    }
25705                }
25706                std::result::Result::Ok(result)
25707            }
25708        }
25709        deserializer.deserialize_any(Visitor)
25710    }
25711}
25712
25713#[doc(hidden)]
25714impl serde::ser::Serialize for DemoteMasterConfiguration {
25715    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25716    where
25717        S: serde::ser::Serializer,
25718    {
25719        use serde::ser::SerializeMap;
25720        #[allow(unused_imports)]
25721        use std::option::Option::Some;
25722        let mut state = serializer.serialize_map(std::option::Option::None)?;
25723        if !self.kind.is_empty() {
25724            state.serialize_entry("kind", &self.kind)?;
25725        }
25726        if self.mysql_replica_configuration.is_some() {
25727            state.serialize_entry(
25728                "mysqlReplicaConfiguration",
25729                &self.mysql_replica_configuration,
25730            )?;
25731        }
25732        if !self._unknown_fields.is_empty() {
25733            for (key, value) in self._unknown_fields.iter() {
25734                state.serialize_entry(key, &value)?;
25735            }
25736        }
25737        state.end()
25738    }
25739}
25740
25741/// Read-replica configuration specific to MySQL databases.
25742#[derive(Clone, Debug, Default, PartialEq)]
25743#[non_exhaustive]
25744pub struct DemoteMasterMySqlReplicaConfiguration {
25745    /// This is always `sql#demoteMasterMysqlReplicaConfiguration`.
25746    pub kind: std::string::String,
25747
25748    /// The username for the replication connection.
25749    pub username: std::string::String,
25750
25751    /// The password for the replication connection.
25752    pub password: std::string::String,
25753
25754    /// PEM representation of the replica's private key. The corresponsing public
25755    /// key is encoded in the client's certificate. The format of the replica's
25756    /// private key can be either PKCS #1 or PKCS #8.
25757    pub client_key: std::string::String,
25758
25759    /// PEM representation of the replica's x509 certificate.
25760    pub client_certificate: std::string::String,
25761
25762    /// PEM representation of the trusted CA's x509 certificate.
25763    pub ca_certificate: std::string::String,
25764
25765    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25766}
25767
25768impl DemoteMasterMySqlReplicaConfiguration {
25769    pub fn new() -> Self {
25770        std::default::Default::default()
25771    }
25772
25773    /// Sets the value of [kind][crate::model::DemoteMasterMySqlReplicaConfiguration::kind].
25774    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25775        self.kind = v.into();
25776        self
25777    }
25778
25779    /// Sets the value of [username][crate::model::DemoteMasterMySqlReplicaConfiguration::username].
25780    pub fn set_username<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25781        self.username = v.into();
25782        self
25783    }
25784
25785    /// Sets the value of [password][crate::model::DemoteMasterMySqlReplicaConfiguration::password].
25786    pub fn set_password<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25787        self.password = v.into();
25788        self
25789    }
25790
25791    /// Sets the value of [client_key][crate::model::DemoteMasterMySqlReplicaConfiguration::client_key].
25792    pub fn set_client_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25793        self.client_key = v.into();
25794        self
25795    }
25796
25797    /// Sets the value of [client_certificate][crate::model::DemoteMasterMySqlReplicaConfiguration::client_certificate].
25798    pub fn set_client_certificate<T: std::convert::Into<std::string::String>>(
25799        mut self,
25800        v: T,
25801    ) -> Self {
25802        self.client_certificate = v.into();
25803        self
25804    }
25805
25806    /// Sets the value of [ca_certificate][crate::model::DemoteMasterMySqlReplicaConfiguration::ca_certificate].
25807    pub fn set_ca_certificate<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25808        self.ca_certificate = v.into();
25809        self
25810    }
25811}
25812
25813impl wkt::message::Message for DemoteMasterMySqlReplicaConfiguration {
25814    fn typename() -> &'static str {
25815        "type.googleapis.com/google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration"
25816    }
25817}
25818
25819#[doc(hidden)]
25820impl<'de> serde::de::Deserialize<'de> for DemoteMasterMySqlReplicaConfiguration {
25821    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25822    where
25823        D: serde::Deserializer<'de>,
25824    {
25825        #[allow(non_camel_case_types)]
25826        #[doc(hidden)]
25827        #[derive(PartialEq, Eq, Hash)]
25828        enum __FieldTag {
25829            __kind,
25830            __username,
25831            __password,
25832            __client_key,
25833            __client_certificate,
25834            __ca_certificate,
25835            Unknown(std::string::String),
25836        }
25837        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
25838            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25839            where
25840                D: serde::Deserializer<'de>,
25841            {
25842                struct Visitor;
25843                impl<'de> serde::de::Visitor<'de> for Visitor {
25844                    type Value = __FieldTag;
25845                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25846                        formatter
25847                            .write_str("a field name for DemoteMasterMySqlReplicaConfiguration")
25848                    }
25849                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
25850                    where
25851                        E: serde::de::Error,
25852                    {
25853                        use std::result::Result::Ok;
25854                        use std::string::ToString;
25855                        match value {
25856                            "kind" => Ok(__FieldTag::__kind),
25857                            "username" => Ok(__FieldTag::__username),
25858                            "password" => Ok(__FieldTag::__password),
25859                            "clientKey" => Ok(__FieldTag::__client_key),
25860                            "client_key" => Ok(__FieldTag::__client_key),
25861                            "clientCertificate" => Ok(__FieldTag::__client_certificate),
25862                            "client_certificate" => Ok(__FieldTag::__client_certificate),
25863                            "caCertificate" => Ok(__FieldTag::__ca_certificate),
25864                            "ca_certificate" => Ok(__FieldTag::__ca_certificate),
25865                            _ => Ok(__FieldTag::Unknown(value.to_string())),
25866                        }
25867                    }
25868                }
25869                deserializer.deserialize_identifier(Visitor)
25870            }
25871        }
25872        struct Visitor;
25873        impl<'de> serde::de::Visitor<'de> for Visitor {
25874            type Value = DemoteMasterMySqlReplicaConfiguration;
25875            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25876                formatter.write_str("struct DemoteMasterMySqlReplicaConfiguration")
25877            }
25878            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
25879            where
25880                A: serde::de::MapAccess<'de>,
25881            {
25882                #[allow(unused_imports)]
25883                use serde::de::Error;
25884                use std::option::Option::Some;
25885                let mut fields = std::collections::HashSet::new();
25886                let mut result = Self::Value::new();
25887                while let Some(tag) = map.next_key::<__FieldTag>()? {
25888                    #[allow(clippy::match_single_binding)]
25889                    match tag {
25890                        __FieldTag::__kind => {
25891                            if !fields.insert(__FieldTag::__kind) {
25892                                return std::result::Result::Err(A::Error::duplicate_field(
25893                                    "multiple values for kind",
25894                                ));
25895                            }
25896                            result.kind = map
25897                                .next_value::<std::option::Option<std::string::String>>()?
25898                                .unwrap_or_default();
25899                        }
25900                        __FieldTag::__username => {
25901                            if !fields.insert(__FieldTag::__username) {
25902                                return std::result::Result::Err(A::Error::duplicate_field(
25903                                    "multiple values for username",
25904                                ));
25905                            }
25906                            result.username = map
25907                                .next_value::<std::option::Option<std::string::String>>()?
25908                                .unwrap_or_default();
25909                        }
25910                        __FieldTag::__password => {
25911                            if !fields.insert(__FieldTag::__password) {
25912                                return std::result::Result::Err(A::Error::duplicate_field(
25913                                    "multiple values for password",
25914                                ));
25915                            }
25916                            result.password = map
25917                                .next_value::<std::option::Option<std::string::String>>()?
25918                                .unwrap_or_default();
25919                        }
25920                        __FieldTag::__client_key => {
25921                            if !fields.insert(__FieldTag::__client_key) {
25922                                return std::result::Result::Err(A::Error::duplicate_field(
25923                                    "multiple values for client_key",
25924                                ));
25925                            }
25926                            result.client_key = map
25927                                .next_value::<std::option::Option<std::string::String>>()?
25928                                .unwrap_or_default();
25929                        }
25930                        __FieldTag::__client_certificate => {
25931                            if !fields.insert(__FieldTag::__client_certificate) {
25932                                return std::result::Result::Err(A::Error::duplicate_field(
25933                                    "multiple values for client_certificate",
25934                                ));
25935                            }
25936                            result.client_certificate = map
25937                                .next_value::<std::option::Option<std::string::String>>()?
25938                                .unwrap_or_default();
25939                        }
25940                        __FieldTag::__ca_certificate => {
25941                            if !fields.insert(__FieldTag::__ca_certificate) {
25942                                return std::result::Result::Err(A::Error::duplicate_field(
25943                                    "multiple values for ca_certificate",
25944                                ));
25945                            }
25946                            result.ca_certificate = map
25947                                .next_value::<std::option::Option<std::string::String>>()?
25948                                .unwrap_or_default();
25949                        }
25950                        __FieldTag::Unknown(key) => {
25951                            let value = map.next_value::<serde_json::Value>()?;
25952                            result._unknown_fields.insert(key, value);
25953                        }
25954                    }
25955                }
25956                std::result::Result::Ok(result)
25957            }
25958        }
25959        deserializer.deserialize_any(Visitor)
25960    }
25961}
25962
25963#[doc(hidden)]
25964impl serde::ser::Serialize for DemoteMasterMySqlReplicaConfiguration {
25965    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25966    where
25967        S: serde::ser::Serializer,
25968    {
25969        use serde::ser::SerializeMap;
25970        #[allow(unused_imports)]
25971        use std::option::Option::Some;
25972        let mut state = serializer.serialize_map(std::option::Option::None)?;
25973        if !self.kind.is_empty() {
25974            state.serialize_entry("kind", &self.kind)?;
25975        }
25976        if !self.username.is_empty() {
25977            state.serialize_entry("username", &self.username)?;
25978        }
25979        if !self.password.is_empty() {
25980            state.serialize_entry("password", &self.password)?;
25981        }
25982        if !self.client_key.is_empty() {
25983            state.serialize_entry("clientKey", &self.client_key)?;
25984        }
25985        if !self.client_certificate.is_empty() {
25986            state.serialize_entry("clientCertificate", &self.client_certificate)?;
25987        }
25988        if !self.ca_certificate.is_empty() {
25989            state.serialize_entry("caCertificate", &self.ca_certificate)?;
25990        }
25991        if !self._unknown_fields.is_empty() {
25992            for (key, value) in self._unknown_fields.iter() {
25993                state.serialize_entry(key, &value)?;
25994            }
25995        }
25996        state.end()
25997    }
25998}
25999
26000/// Database instance export context.
26001#[derive(Clone, Debug, Default, PartialEq)]
26002#[non_exhaustive]
26003pub struct ExportContext {
26004    /// The path to the file in Google Cloud Storage where the export will be
26005    /// stored. The URI is in the form `gs://bucketName/fileName`. If the file
26006    /// already exists, the request succeeds, but the operation fails. If
26007    /// `fileType` is `SQL` and the filename ends with .gz,
26008    /// the contents are compressed.
26009    pub uri: std::string::String,
26010
26011    /// Databases to be exported. <br /> `MySQL instances:` If
26012    /// `fileType` is `SQL` and no database is specified, all
26013    /// databases are exported, except for the `mysql` system database.
26014    /// If `fileType` is `CSV`, you can specify one database,
26015    /// either by using this property or by using the
26016    /// `csvExportOptions.selectQuery` property, which takes precedence
26017    /// over this property. <br /> `PostgreSQL instances:` You must specify
26018    /// one database to be exported. If `fileType` is `CSV`,
26019    /// this database must match the one specified in the
26020    /// `csvExportOptions.selectQuery` property. <br /> `SQL Server
26021    /// instances:` You must specify one database to be exported, and the
26022    /// `fileType` must be `BAK`.
26023    pub databases: std::vec::Vec<std::string::String>,
26024
26025    /// This is always `sql#exportContext`.
26026    pub kind: std::string::String,
26027
26028    /// Options for exporting data as SQL statements.
26029    pub sql_export_options: std::option::Option<crate::model::export_context::SqlExportOptions>,
26030
26031    /// Options for exporting data as CSV. `MySQL` and `PostgreSQL`
26032    /// instances only.
26033    pub csv_export_options: std::option::Option<crate::model::export_context::SqlCsvExportOptions>,
26034
26035    /// The file type for the specified uri.
26036    pub file_type: crate::model::SqlFileType,
26037
26038    /// Option for export offload.
26039    pub offload: std::option::Option<wkt::BoolValue>,
26040
26041    /// Options for exporting data as BAK files.
26042    pub bak_export_options: std::option::Option<crate::model::export_context::SqlBakExportOptions>,
26043
26044    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26045}
26046
26047impl ExportContext {
26048    pub fn new() -> Self {
26049        std::default::Default::default()
26050    }
26051
26052    /// Sets the value of [uri][crate::model::ExportContext::uri].
26053    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26054        self.uri = v.into();
26055        self
26056    }
26057
26058    /// Sets the value of [databases][crate::model::ExportContext::databases].
26059    pub fn set_databases<T, V>(mut self, v: T) -> Self
26060    where
26061        T: std::iter::IntoIterator<Item = V>,
26062        V: std::convert::Into<std::string::String>,
26063    {
26064        use std::iter::Iterator;
26065        self.databases = v.into_iter().map(|i| i.into()).collect();
26066        self
26067    }
26068
26069    /// Sets the value of [kind][crate::model::ExportContext::kind].
26070    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26071        self.kind = v.into();
26072        self
26073    }
26074
26075    /// Sets the value of [sql_export_options][crate::model::ExportContext::sql_export_options].
26076    pub fn set_sql_export_options<T>(mut self, v: T) -> Self
26077    where
26078        T: std::convert::Into<crate::model::export_context::SqlExportOptions>,
26079    {
26080        self.sql_export_options = std::option::Option::Some(v.into());
26081        self
26082    }
26083
26084    /// Sets or clears the value of [sql_export_options][crate::model::ExportContext::sql_export_options].
26085    pub fn set_or_clear_sql_export_options<T>(mut self, v: std::option::Option<T>) -> Self
26086    where
26087        T: std::convert::Into<crate::model::export_context::SqlExportOptions>,
26088    {
26089        self.sql_export_options = v.map(|x| x.into());
26090        self
26091    }
26092
26093    /// Sets the value of [csv_export_options][crate::model::ExportContext::csv_export_options].
26094    pub fn set_csv_export_options<T>(mut self, v: T) -> Self
26095    where
26096        T: std::convert::Into<crate::model::export_context::SqlCsvExportOptions>,
26097    {
26098        self.csv_export_options = std::option::Option::Some(v.into());
26099        self
26100    }
26101
26102    /// Sets or clears the value of [csv_export_options][crate::model::ExportContext::csv_export_options].
26103    pub fn set_or_clear_csv_export_options<T>(mut self, v: std::option::Option<T>) -> Self
26104    where
26105        T: std::convert::Into<crate::model::export_context::SqlCsvExportOptions>,
26106    {
26107        self.csv_export_options = v.map(|x| x.into());
26108        self
26109    }
26110
26111    /// Sets the value of [file_type][crate::model::ExportContext::file_type].
26112    pub fn set_file_type<T: std::convert::Into<crate::model::SqlFileType>>(mut self, v: T) -> Self {
26113        self.file_type = v.into();
26114        self
26115    }
26116
26117    /// Sets the value of [offload][crate::model::ExportContext::offload].
26118    pub fn set_offload<T>(mut self, v: T) -> Self
26119    where
26120        T: std::convert::Into<wkt::BoolValue>,
26121    {
26122        self.offload = std::option::Option::Some(v.into());
26123        self
26124    }
26125
26126    /// Sets or clears the value of [offload][crate::model::ExportContext::offload].
26127    pub fn set_or_clear_offload<T>(mut self, v: std::option::Option<T>) -> Self
26128    where
26129        T: std::convert::Into<wkt::BoolValue>,
26130    {
26131        self.offload = v.map(|x| x.into());
26132        self
26133    }
26134
26135    /// Sets the value of [bak_export_options][crate::model::ExportContext::bak_export_options].
26136    pub fn set_bak_export_options<T>(mut self, v: T) -> Self
26137    where
26138        T: std::convert::Into<crate::model::export_context::SqlBakExportOptions>,
26139    {
26140        self.bak_export_options = std::option::Option::Some(v.into());
26141        self
26142    }
26143
26144    /// Sets or clears the value of [bak_export_options][crate::model::ExportContext::bak_export_options].
26145    pub fn set_or_clear_bak_export_options<T>(mut self, v: std::option::Option<T>) -> Self
26146    where
26147        T: std::convert::Into<crate::model::export_context::SqlBakExportOptions>,
26148    {
26149        self.bak_export_options = v.map(|x| x.into());
26150        self
26151    }
26152}
26153
26154impl wkt::message::Message for ExportContext {
26155    fn typename() -> &'static str {
26156        "type.googleapis.com/google.cloud.sql.v1.ExportContext"
26157    }
26158}
26159
26160#[doc(hidden)]
26161impl<'de> serde::de::Deserialize<'de> for ExportContext {
26162    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26163    where
26164        D: serde::Deserializer<'de>,
26165    {
26166        #[allow(non_camel_case_types)]
26167        #[doc(hidden)]
26168        #[derive(PartialEq, Eq, Hash)]
26169        enum __FieldTag {
26170            __uri,
26171            __databases,
26172            __kind,
26173            __sql_export_options,
26174            __csv_export_options,
26175            __file_type,
26176            __offload,
26177            __bak_export_options,
26178            Unknown(std::string::String),
26179        }
26180        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
26181            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26182            where
26183                D: serde::Deserializer<'de>,
26184            {
26185                struct Visitor;
26186                impl<'de> serde::de::Visitor<'de> for Visitor {
26187                    type Value = __FieldTag;
26188                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
26189                        formatter.write_str("a field name for ExportContext")
26190                    }
26191                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
26192                    where
26193                        E: serde::de::Error,
26194                    {
26195                        use std::result::Result::Ok;
26196                        use std::string::ToString;
26197                        match value {
26198                            "uri" => Ok(__FieldTag::__uri),
26199                            "databases" => Ok(__FieldTag::__databases),
26200                            "kind" => Ok(__FieldTag::__kind),
26201                            "sqlExportOptions" => Ok(__FieldTag::__sql_export_options),
26202                            "sql_export_options" => Ok(__FieldTag::__sql_export_options),
26203                            "csvExportOptions" => Ok(__FieldTag::__csv_export_options),
26204                            "csv_export_options" => Ok(__FieldTag::__csv_export_options),
26205                            "fileType" => Ok(__FieldTag::__file_type),
26206                            "file_type" => Ok(__FieldTag::__file_type),
26207                            "offload" => Ok(__FieldTag::__offload),
26208                            "bakExportOptions" => Ok(__FieldTag::__bak_export_options),
26209                            "bak_export_options" => Ok(__FieldTag::__bak_export_options),
26210                            _ => Ok(__FieldTag::Unknown(value.to_string())),
26211                        }
26212                    }
26213                }
26214                deserializer.deserialize_identifier(Visitor)
26215            }
26216        }
26217        struct Visitor;
26218        impl<'de> serde::de::Visitor<'de> for Visitor {
26219            type Value = ExportContext;
26220            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
26221                formatter.write_str("struct ExportContext")
26222            }
26223            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
26224            where
26225                A: serde::de::MapAccess<'de>,
26226            {
26227                #[allow(unused_imports)]
26228                use serde::de::Error;
26229                use std::option::Option::Some;
26230                let mut fields = std::collections::HashSet::new();
26231                let mut result = Self::Value::new();
26232                while let Some(tag) = map.next_key::<__FieldTag>()? {
26233                    #[allow(clippy::match_single_binding)]
26234                    match tag {
26235                        __FieldTag::__uri => {
26236                            if !fields.insert(__FieldTag::__uri) {
26237                                return std::result::Result::Err(A::Error::duplicate_field(
26238                                    "multiple values for uri",
26239                                ));
26240                            }
26241                            result.uri = map
26242                                .next_value::<std::option::Option<std::string::String>>()?
26243                                .unwrap_or_default();
26244                        }
26245                        __FieldTag::__databases => {
26246                            if !fields.insert(__FieldTag::__databases) {
26247                                return std::result::Result::Err(A::Error::duplicate_field(
26248                                    "multiple values for databases",
26249                                ));
26250                            }
26251                            result.databases = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
26252                        }
26253                        __FieldTag::__kind => {
26254                            if !fields.insert(__FieldTag::__kind) {
26255                                return std::result::Result::Err(A::Error::duplicate_field(
26256                                    "multiple values for kind",
26257                                ));
26258                            }
26259                            result.kind = map
26260                                .next_value::<std::option::Option<std::string::String>>()?
26261                                .unwrap_or_default();
26262                        }
26263                        __FieldTag::__sql_export_options => {
26264                            if !fields.insert(__FieldTag::__sql_export_options) {
26265                                return std::result::Result::Err(A::Error::duplicate_field(
26266                                    "multiple values for sql_export_options",
26267                                ));
26268                            }
26269                            result.sql_export_options = map.next_value::<std::option::Option<
26270                                crate::model::export_context::SqlExportOptions,
26271                            >>()?;
26272                        }
26273                        __FieldTag::__csv_export_options => {
26274                            if !fields.insert(__FieldTag::__csv_export_options) {
26275                                return std::result::Result::Err(A::Error::duplicate_field(
26276                                    "multiple values for csv_export_options",
26277                                ));
26278                            }
26279                            result.csv_export_options = map.next_value::<std::option::Option<
26280                                crate::model::export_context::SqlCsvExportOptions,
26281                            >>()?;
26282                        }
26283                        __FieldTag::__file_type => {
26284                            if !fields.insert(__FieldTag::__file_type) {
26285                                return std::result::Result::Err(A::Error::duplicate_field(
26286                                    "multiple values for file_type",
26287                                ));
26288                            }
26289                            result.file_type = map
26290                                .next_value::<std::option::Option<crate::model::SqlFileType>>()?
26291                                .unwrap_or_default();
26292                        }
26293                        __FieldTag::__offload => {
26294                            if !fields.insert(__FieldTag::__offload) {
26295                                return std::result::Result::Err(A::Error::duplicate_field(
26296                                    "multiple values for offload",
26297                                ));
26298                            }
26299                            result.offload =
26300                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
26301                        }
26302                        __FieldTag::__bak_export_options => {
26303                            if !fields.insert(__FieldTag::__bak_export_options) {
26304                                return std::result::Result::Err(A::Error::duplicate_field(
26305                                    "multiple values for bak_export_options",
26306                                ));
26307                            }
26308                            result.bak_export_options = map.next_value::<std::option::Option<
26309                                crate::model::export_context::SqlBakExportOptions,
26310                            >>()?;
26311                        }
26312                        __FieldTag::Unknown(key) => {
26313                            let value = map.next_value::<serde_json::Value>()?;
26314                            result._unknown_fields.insert(key, value);
26315                        }
26316                    }
26317                }
26318                std::result::Result::Ok(result)
26319            }
26320        }
26321        deserializer.deserialize_any(Visitor)
26322    }
26323}
26324
26325#[doc(hidden)]
26326impl serde::ser::Serialize for ExportContext {
26327    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26328    where
26329        S: serde::ser::Serializer,
26330    {
26331        use serde::ser::SerializeMap;
26332        #[allow(unused_imports)]
26333        use std::option::Option::Some;
26334        let mut state = serializer.serialize_map(std::option::Option::None)?;
26335        if !self.uri.is_empty() {
26336            state.serialize_entry("uri", &self.uri)?;
26337        }
26338        if !self.databases.is_empty() {
26339            state.serialize_entry("databases", &self.databases)?;
26340        }
26341        if !self.kind.is_empty() {
26342            state.serialize_entry("kind", &self.kind)?;
26343        }
26344        if self.sql_export_options.is_some() {
26345            state.serialize_entry("sqlExportOptions", &self.sql_export_options)?;
26346        }
26347        if self.csv_export_options.is_some() {
26348            state.serialize_entry("csvExportOptions", &self.csv_export_options)?;
26349        }
26350        if !wkt::internal::is_default(&self.file_type) {
26351            state.serialize_entry("fileType", &self.file_type)?;
26352        }
26353        if self.offload.is_some() {
26354            state.serialize_entry("offload", &self.offload)?;
26355        }
26356        if self.bak_export_options.is_some() {
26357            state.serialize_entry("bakExportOptions", &self.bak_export_options)?;
26358        }
26359        if !self._unknown_fields.is_empty() {
26360            for (key, value) in self._unknown_fields.iter() {
26361                state.serialize_entry(key, &value)?;
26362            }
26363        }
26364        state.end()
26365    }
26366}
26367
26368/// Defines additional types related to [ExportContext].
26369pub mod export_context {
26370    #[allow(unused_imports)]
26371    use super::*;
26372
26373    #[derive(Clone, Debug, Default, PartialEq)]
26374    #[non_exhaustive]
26375    pub struct SqlCsvExportOptions {
26376        /// The select query used to extract the data.
26377        pub select_query: std::string::String,
26378
26379        /// Specifies the character that should appear before a data character that
26380        /// needs to be escaped.
26381        pub escape_character: std::string::String,
26382
26383        /// Specifies the quoting character to be used when a data value is quoted.
26384        pub quote_character: std::string::String,
26385
26386        /// Specifies the character that separates columns within each row (line) of
26387        /// the file.
26388        pub fields_terminated_by: std::string::String,
26389
26390        /// This is used to separate lines. If a line does not contain all fields,
26391        /// the rest of the columns are set to their default values.
26392        pub lines_terminated_by: std::string::String,
26393
26394        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26395    }
26396
26397    impl SqlCsvExportOptions {
26398        pub fn new() -> Self {
26399            std::default::Default::default()
26400        }
26401
26402        /// Sets the value of [select_query][crate::model::export_context::SqlCsvExportOptions::select_query].
26403        pub fn set_select_query<T: std::convert::Into<std::string::String>>(
26404            mut self,
26405            v: T,
26406        ) -> Self {
26407            self.select_query = v.into();
26408            self
26409        }
26410
26411        /// Sets the value of [escape_character][crate::model::export_context::SqlCsvExportOptions::escape_character].
26412        pub fn set_escape_character<T: std::convert::Into<std::string::String>>(
26413            mut self,
26414            v: T,
26415        ) -> Self {
26416            self.escape_character = v.into();
26417            self
26418        }
26419
26420        /// Sets the value of [quote_character][crate::model::export_context::SqlCsvExportOptions::quote_character].
26421        pub fn set_quote_character<T: std::convert::Into<std::string::String>>(
26422            mut self,
26423            v: T,
26424        ) -> Self {
26425            self.quote_character = v.into();
26426            self
26427        }
26428
26429        /// Sets the value of [fields_terminated_by][crate::model::export_context::SqlCsvExportOptions::fields_terminated_by].
26430        pub fn set_fields_terminated_by<T: std::convert::Into<std::string::String>>(
26431            mut self,
26432            v: T,
26433        ) -> Self {
26434            self.fields_terminated_by = v.into();
26435            self
26436        }
26437
26438        /// Sets the value of [lines_terminated_by][crate::model::export_context::SqlCsvExportOptions::lines_terminated_by].
26439        pub fn set_lines_terminated_by<T: std::convert::Into<std::string::String>>(
26440            mut self,
26441            v: T,
26442        ) -> Self {
26443            self.lines_terminated_by = v.into();
26444            self
26445        }
26446    }
26447
26448    impl wkt::message::Message for SqlCsvExportOptions {
26449        fn typename() -> &'static str {
26450            "type.googleapis.com/google.cloud.sql.v1.ExportContext.SqlCsvExportOptions"
26451        }
26452    }
26453
26454    #[doc(hidden)]
26455    impl<'de> serde::de::Deserialize<'de> for SqlCsvExportOptions {
26456        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26457        where
26458            D: serde::Deserializer<'de>,
26459        {
26460            #[allow(non_camel_case_types)]
26461            #[doc(hidden)]
26462            #[derive(PartialEq, Eq, Hash)]
26463            enum __FieldTag {
26464                __select_query,
26465                __escape_character,
26466                __quote_character,
26467                __fields_terminated_by,
26468                __lines_terminated_by,
26469                Unknown(std::string::String),
26470            }
26471            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
26472                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26473                where
26474                    D: serde::Deserializer<'de>,
26475                {
26476                    struct Visitor;
26477                    impl<'de> serde::de::Visitor<'de> for Visitor {
26478                        type Value = __FieldTag;
26479                        fn expecting(
26480                            &self,
26481                            formatter: &mut std::fmt::Formatter,
26482                        ) -> std::fmt::Result {
26483                            formatter.write_str("a field name for SqlCsvExportOptions")
26484                        }
26485                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
26486                        where
26487                            E: serde::de::Error,
26488                        {
26489                            use std::result::Result::Ok;
26490                            use std::string::ToString;
26491                            match value {
26492                                "selectQuery" => Ok(__FieldTag::__select_query),
26493                                "select_query" => Ok(__FieldTag::__select_query),
26494                                "escapeCharacter" => Ok(__FieldTag::__escape_character),
26495                                "escape_character" => Ok(__FieldTag::__escape_character),
26496                                "quoteCharacter" => Ok(__FieldTag::__quote_character),
26497                                "quote_character" => Ok(__FieldTag::__quote_character),
26498                                "fieldsTerminatedBy" => Ok(__FieldTag::__fields_terminated_by),
26499                                "fields_terminated_by" => Ok(__FieldTag::__fields_terminated_by),
26500                                "linesTerminatedBy" => Ok(__FieldTag::__lines_terminated_by),
26501                                "lines_terminated_by" => Ok(__FieldTag::__lines_terminated_by),
26502                                _ => Ok(__FieldTag::Unknown(value.to_string())),
26503                            }
26504                        }
26505                    }
26506                    deserializer.deserialize_identifier(Visitor)
26507                }
26508            }
26509            struct Visitor;
26510            impl<'de> serde::de::Visitor<'de> for Visitor {
26511                type Value = SqlCsvExportOptions;
26512                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
26513                    formatter.write_str("struct SqlCsvExportOptions")
26514                }
26515                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
26516                where
26517                    A: serde::de::MapAccess<'de>,
26518                {
26519                    #[allow(unused_imports)]
26520                    use serde::de::Error;
26521                    use std::option::Option::Some;
26522                    let mut fields = std::collections::HashSet::new();
26523                    let mut result = Self::Value::new();
26524                    while let Some(tag) = map.next_key::<__FieldTag>()? {
26525                        #[allow(clippy::match_single_binding)]
26526                        match tag {
26527                            __FieldTag::__select_query => {
26528                                if !fields.insert(__FieldTag::__select_query) {
26529                                    return std::result::Result::Err(A::Error::duplicate_field(
26530                                        "multiple values for select_query",
26531                                    ));
26532                                }
26533                                result.select_query = map
26534                                    .next_value::<std::option::Option<std::string::String>>()?
26535                                    .unwrap_or_default();
26536                            }
26537                            __FieldTag::__escape_character => {
26538                                if !fields.insert(__FieldTag::__escape_character) {
26539                                    return std::result::Result::Err(A::Error::duplicate_field(
26540                                        "multiple values for escape_character",
26541                                    ));
26542                                }
26543                                result.escape_character = map
26544                                    .next_value::<std::option::Option<std::string::String>>()?
26545                                    .unwrap_or_default();
26546                            }
26547                            __FieldTag::__quote_character => {
26548                                if !fields.insert(__FieldTag::__quote_character) {
26549                                    return std::result::Result::Err(A::Error::duplicate_field(
26550                                        "multiple values for quote_character",
26551                                    ));
26552                                }
26553                                result.quote_character = map
26554                                    .next_value::<std::option::Option<std::string::String>>()?
26555                                    .unwrap_or_default();
26556                            }
26557                            __FieldTag::__fields_terminated_by => {
26558                                if !fields.insert(__FieldTag::__fields_terminated_by) {
26559                                    return std::result::Result::Err(A::Error::duplicate_field(
26560                                        "multiple values for fields_terminated_by",
26561                                    ));
26562                                }
26563                                result.fields_terminated_by = map
26564                                    .next_value::<std::option::Option<std::string::String>>()?
26565                                    .unwrap_or_default();
26566                            }
26567                            __FieldTag::__lines_terminated_by => {
26568                                if !fields.insert(__FieldTag::__lines_terminated_by) {
26569                                    return std::result::Result::Err(A::Error::duplicate_field(
26570                                        "multiple values for lines_terminated_by",
26571                                    ));
26572                                }
26573                                result.lines_terminated_by = map
26574                                    .next_value::<std::option::Option<std::string::String>>()?
26575                                    .unwrap_or_default();
26576                            }
26577                            __FieldTag::Unknown(key) => {
26578                                let value = map.next_value::<serde_json::Value>()?;
26579                                result._unknown_fields.insert(key, value);
26580                            }
26581                        }
26582                    }
26583                    std::result::Result::Ok(result)
26584                }
26585            }
26586            deserializer.deserialize_any(Visitor)
26587        }
26588    }
26589
26590    #[doc(hidden)]
26591    impl serde::ser::Serialize for SqlCsvExportOptions {
26592        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26593        where
26594            S: serde::ser::Serializer,
26595        {
26596            use serde::ser::SerializeMap;
26597            #[allow(unused_imports)]
26598            use std::option::Option::Some;
26599            let mut state = serializer.serialize_map(std::option::Option::None)?;
26600            if !self.select_query.is_empty() {
26601                state.serialize_entry("selectQuery", &self.select_query)?;
26602            }
26603            if !self.escape_character.is_empty() {
26604                state.serialize_entry("escapeCharacter", &self.escape_character)?;
26605            }
26606            if !self.quote_character.is_empty() {
26607                state.serialize_entry("quoteCharacter", &self.quote_character)?;
26608            }
26609            if !self.fields_terminated_by.is_empty() {
26610                state.serialize_entry("fieldsTerminatedBy", &self.fields_terminated_by)?;
26611            }
26612            if !self.lines_terminated_by.is_empty() {
26613                state.serialize_entry("linesTerminatedBy", &self.lines_terminated_by)?;
26614            }
26615            if !self._unknown_fields.is_empty() {
26616                for (key, value) in self._unknown_fields.iter() {
26617                    state.serialize_entry(key, &value)?;
26618                }
26619            }
26620            state.end()
26621        }
26622    }
26623
26624    #[derive(Clone, Debug, Default, PartialEq)]
26625    #[non_exhaustive]
26626    pub struct SqlExportOptions {
26627        /// Tables to export, or that were exported, from the specified database. If
26628        /// you specify tables, specify one and only one database. For PostgreSQL
26629        /// instances, you can specify only one table.
26630        pub tables: std::vec::Vec<std::string::String>,
26631
26632        /// Export only schemas.
26633        pub schema_only: std::option::Option<wkt::BoolValue>,
26634
26635        pub mysql_export_options: std::option::Option<
26636            crate::model::export_context::sql_export_options::MysqlExportOptions,
26637        >,
26638
26639        /// Optional. The number of threads to use for parallel export.
26640        pub threads: std::option::Option<wkt::Int32Value>,
26641
26642        /// Optional. Whether or not the export should be parallel.
26643        pub parallel: std::option::Option<wkt::BoolValue>,
26644
26645        /// Optional. Options for exporting from a Cloud SQL for PostgreSQL instance.
26646        pub postgres_export_options: std::option::Option<
26647            crate::model::export_context::sql_export_options::PostgresExportOptions,
26648        >,
26649
26650        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26651    }
26652
26653    impl SqlExportOptions {
26654        pub fn new() -> Self {
26655            std::default::Default::default()
26656        }
26657
26658        /// Sets the value of [tables][crate::model::export_context::SqlExportOptions::tables].
26659        pub fn set_tables<T, V>(mut self, v: T) -> Self
26660        where
26661            T: std::iter::IntoIterator<Item = V>,
26662            V: std::convert::Into<std::string::String>,
26663        {
26664            use std::iter::Iterator;
26665            self.tables = v.into_iter().map(|i| i.into()).collect();
26666            self
26667        }
26668
26669        /// Sets the value of [schema_only][crate::model::export_context::SqlExportOptions::schema_only].
26670        pub fn set_schema_only<T>(mut self, v: T) -> Self
26671        where
26672            T: std::convert::Into<wkt::BoolValue>,
26673        {
26674            self.schema_only = std::option::Option::Some(v.into());
26675            self
26676        }
26677
26678        /// Sets or clears the value of [schema_only][crate::model::export_context::SqlExportOptions::schema_only].
26679        pub fn set_or_clear_schema_only<T>(mut self, v: std::option::Option<T>) -> Self
26680        where
26681            T: std::convert::Into<wkt::BoolValue>,
26682        {
26683            self.schema_only = v.map(|x| x.into());
26684            self
26685        }
26686
26687        /// Sets the value of [mysql_export_options][crate::model::export_context::SqlExportOptions::mysql_export_options].
26688        pub fn set_mysql_export_options<T>(mut self, v: T) -> Self
26689        where
26690            T: std::convert::Into<
26691                    crate::model::export_context::sql_export_options::MysqlExportOptions,
26692                >,
26693        {
26694            self.mysql_export_options = std::option::Option::Some(v.into());
26695            self
26696        }
26697
26698        /// Sets or clears the value of [mysql_export_options][crate::model::export_context::SqlExportOptions::mysql_export_options].
26699        pub fn set_or_clear_mysql_export_options<T>(mut self, v: std::option::Option<T>) -> Self
26700        where
26701            T: std::convert::Into<
26702                    crate::model::export_context::sql_export_options::MysqlExportOptions,
26703                >,
26704        {
26705            self.mysql_export_options = v.map(|x| x.into());
26706            self
26707        }
26708
26709        /// Sets the value of [threads][crate::model::export_context::SqlExportOptions::threads].
26710        pub fn set_threads<T>(mut self, v: T) -> Self
26711        where
26712            T: std::convert::Into<wkt::Int32Value>,
26713        {
26714            self.threads = std::option::Option::Some(v.into());
26715            self
26716        }
26717
26718        /// Sets or clears the value of [threads][crate::model::export_context::SqlExportOptions::threads].
26719        pub fn set_or_clear_threads<T>(mut self, v: std::option::Option<T>) -> Self
26720        where
26721            T: std::convert::Into<wkt::Int32Value>,
26722        {
26723            self.threads = v.map(|x| x.into());
26724            self
26725        }
26726
26727        /// Sets the value of [parallel][crate::model::export_context::SqlExportOptions::parallel].
26728        pub fn set_parallel<T>(mut self, v: T) -> Self
26729        where
26730            T: std::convert::Into<wkt::BoolValue>,
26731        {
26732            self.parallel = std::option::Option::Some(v.into());
26733            self
26734        }
26735
26736        /// Sets or clears the value of [parallel][crate::model::export_context::SqlExportOptions::parallel].
26737        pub fn set_or_clear_parallel<T>(mut self, v: std::option::Option<T>) -> Self
26738        where
26739            T: std::convert::Into<wkt::BoolValue>,
26740        {
26741            self.parallel = v.map(|x| x.into());
26742            self
26743        }
26744
26745        /// Sets the value of [postgres_export_options][crate::model::export_context::SqlExportOptions::postgres_export_options].
26746        pub fn set_postgres_export_options<T>(mut self, v: T) -> Self
26747        where
26748            T: std::convert::Into<
26749                    crate::model::export_context::sql_export_options::PostgresExportOptions,
26750                >,
26751        {
26752            self.postgres_export_options = std::option::Option::Some(v.into());
26753            self
26754        }
26755
26756        /// Sets or clears the value of [postgres_export_options][crate::model::export_context::SqlExportOptions::postgres_export_options].
26757        pub fn set_or_clear_postgres_export_options<T>(mut self, v: std::option::Option<T>) -> Self
26758        where
26759            T: std::convert::Into<
26760                    crate::model::export_context::sql_export_options::PostgresExportOptions,
26761                >,
26762        {
26763            self.postgres_export_options = v.map(|x| x.into());
26764            self
26765        }
26766    }
26767
26768    impl wkt::message::Message for SqlExportOptions {
26769        fn typename() -> &'static str {
26770            "type.googleapis.com/google.cloud.sql.v1.ExportContext.SqlExportOptions"
26771        }
26772    }
26773
26774    #[doc(hidden)]
26775    impl<'de> serde::de::Deserialize<'de> for SqlExportOptions {
26776        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26777        where
26778            D: serde::Deserializer<'de>,
26779        {
26780            #[allow(non_camel_case_types)]
26781            #[doc(hidden)]
26782            #[derive(PartialEq, Eq, Hash)]
26783            enum __FieldTag {
26784                __tables,
26785                __schema_only,
26786                __mysql_export_options,
26787                __threads,
26788                __parallel,
26789                __postgres_export_options,
26790                Unknown(std::string::String),
26791            }
26792            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
26793                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26794                where
26795                    D: serde::Deserializer<'de>,
26796                {
26797                    struct Visitor;
26798                    impl<'de> serde::de::Visitor<'de> for Visitor {
26799                        type Value = __FieldTag;
26800                        fn expecting(
26801                            &self,
26802                            formatter: &mut std::fmt::Formatter,
26803                        ) -> std::fmt::Result {
26804                            formatter.write_str("a field name for SqlExportOptions")
26805                        }
26806                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
26807                        where
26808                            E: serde::de::Error,
26809                        {
26810                            use std::result::Result::Ok;
26811                            use std::string::ToString;
26812                            match value {
26813                                "tables" => Ok(__FieldTag::__tables),
26814                                "schemaOnly" => Ok(__FieldTag::__schema_only),
26815                                "schema_only" => Ok(__FieldTag::__schema_only),
26816                                "mysqlExportOptions" => Ok(__FieldTag::__mysql_export_options),
26817                                "mysql_export_options" => Ok(__FieldTag::__mysql_export_options),
26818                                "threads" => Ok(__FieldTag::__threads),
26819                                "parallel" => Ok(__FieldTag::__parallel),
26820                                "postgresExportOptions" => {
26821                                    Ok(__FieldTag::__postgres_export_options)
26822                                }
26823                                "postgres_export_options" => {
26824                                    Ok(__FieldTag::__postgres_export_options)
26825                                }
26826                                _ => Ok(__FieldTag::Unknown(value.to_string())),
26827                            }
26828                        }
26829                    }
26830                    deserializer.deserialize_identifier(Visitor)
26831                }
26832            }
26833            struct Visitor;
26834            impl<'de> serde::de::Visitor<'de> for Visitor {
26835                type Value = SqlExportOptions;
26836                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
26837                    formatter.write_str("struct SqlExportOptions")
26838                }
26839                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
26840                where
26841                    A: serde::de::MapAccess<'de>,
26842                {
26843                    #[allow(unused_imports)]
26844                    use serde::de::Error;
26845                    use std::option::Option::Some;
26846                    let mut fields = std::collections::HashSet::new();
26847                    let mut result = Self::Value::new();
26848                    while let Some(tag) = map.next_key::<__FieldTag>()? {
26849                        #[allow(clippy::match_single_binding)]
26850                        match tag {
26851                            __FieldTag::__tables => {
26852                                if !fields.insert(__FieldTag::__tables) {
26853                                    return std::result::Result::Err(A::Error::duplicate_field(
26854                                        "multiple values for tables",
26855                                    ));
26856                                }
26857                                result.tables = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
26858                            }
26859                            __FieldTag::__schema_only => {
26860                                if !fields.insert(__FieldTag::__schema_only) {
26861                                    return std::result::Result::Err(A::Error::duplicate_field(
26862                                        "multiple values for schema_only",
26863                                    ));
26864                                }
26865                                result.schema_only =
26866                                    map.next_value::<std::option::Option<wkt::BoolValue>>()?;
26867                            }
26868                            __FieldTag::__mysql_export_options => {
26869                                if !fields.insert(__FieldTag::__mysql_export_options) {
26870                                    return std::result::Result::Err(A::Error::duplicate_field(
26871                                        "multiple values for mysql_export_options",
26872                                    ));
26873                                }
26874                                result.mysql_export_options = map.next_value::<std::option::Option<crate::model::export_context::sql_export_options::MysqlExportOptions>>()?
26875                                    ;
26876                            }
26877                            __FieldTag::__threads => {
26878                                if !fields.insert(__FieldTag::__threads) {
26879                                    return std::result::Result::Err(A::Error::duplicate_field(
26880                                        "multiple values for threads",
26881                                    ));
26882                                }
26883                                struct __With(std::option::Option<wkt::Int32Value>);
26884                                impl<'de> serde::de::Deserialize<'de> for __With {
26885                                    fn deserialize<D>(
26886                                        deserializer: D,
26887                                    ) -> std::result::Result<Self, D::Error>
26888                                    where
26889                                        D: serde::de::Deserializer<'de>,
26890                                    {
26891                                        serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
26892                                    }
26893                                }
26894                                result.threads = map.next_value::<__With>()?.0;
26895                            }
26896                            __FieldTag::__parallel => {
26897                                if !fields.insert(__FieldTag::__parallel) {
26898                                    return std::result::Result::Err(A::Error::duplicate_field(
26899                                        "multiple values for parallel",
26900                                    ));
26901                                }
26902                                result.parallel =
26903                                    map.next_value::<std::option::Option<wkt::BoolValue>>()?;
26904                            }
26905                            __FieldTag::__postgres_export_options => {
26906                                if !fields.insert(__FieldTag::__postgres_export_options) {
26907                                    return std::result::Result::Err(A::Error::duplicate_field(
26908                                        "multiple values for postgres_export_options",
26909                                    ));
26910                                }
26911                                result.postgres_export_options = map.next_value::<std::option::Option<crate::model::export_context::sql_export_options::PostgresExportOptions>>()?
26912                                    ;
26913                            }
26914                            __FieldTag::Unknown(key) => {
26915                                let value = map.next_value::<serde_json::Value>()?;
26916                                result._unknown_fields.insert(key, value);
26917                            }
26918                        }
26919                    }
26920                    std::result::Result::Ok(result)
26921                }
26922            }
26923            deserializer.deserialize_any(Visitor)
26924        }
26925    }
26926
26927    #[doc(hidden)]
26928    impl serde::ser::Serialize for SqlExportOptions {
26929        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26930        where
26931            S: serde::ser::Serializer,
26932        {
26933            use serde::ser::SerializeMap;
26934            #[allow(unused_imports)]
26935            use std::option::Option::Some;
26936            let mut state = serializer.serialize_map(std::option::Option::None)?;
26937            if !self.tables.is_empty() {
26938                state.serialize_entry("tables", &self.tables)?;
26939            }
26940            if self.schema_only.is_some() {
26941                state.serialize_entry("schemaOnly", &self.schema_only)?;
26942            }
26943            if self.mysql_export_options.is_some() {
26944                state.serialize_entry("mysqlExportOptions", &self.mysql_export_options)?;
26945            }
26946            if self.threads.is_some() {
26947                struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
26948                impl<'a> serde::ser::Serialize for __With<'a> {
26949                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26950                    where
26951                        S: serde::ser::Serializer,
26952                    {
26953                        serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
26954                            self.0, serializer,
26955                        )
26956                    }
26957                }
26958                state.serialize_entry("threads", &__With(&self.threads))?;
26959            }
26960            if self.parallel.is_some() {
26961                state.serialize_entry("parallel", &self.parallel)?;
26962            }
26963            if self.postgres_export_options.is_some() {
26964                state.serialize_entry("postgresExportOptions", &self.postgres_export_options)?;
26965            }
26966            if !self._unknown_fields.is_empty() {
26967                for (key, value) in self._unknown_fields.iter() {
26968                    state.serialize_entry(key, &value)?;
26969                }
26970            }
26971            state.end()
26972        }
26973    }
26974
26975    /// Defines additional types related to [SqlExportOptions].
26976    pub mod sql_export_options {
26977        #[allow(unused_imports)]
26978        use super::*;
26979
26980        /// Options for exporting from MySQL.
26981        #[derive(Clone, Debug, Default, PartialEq)]
26982        #[non_exhaustive]
26983        pub struct MysqlExportOptions {
26984            /// Option to include SQL statement required to set up replication. If set
26985            /// to `1`, the dump file includes a CHANGE MASTER TO statement with the
26986            /// binary log coordinates, and --set-gtid-purged is set to ON. If set to
26987            /// `2`, the CHANGE MASTER TO statement is written as a SQL comment and
26988            /// has no effect. If set to any value other than `1`, --set-gtid-purged
26989            /// is set to OFF.
26990            pub master_data: std::option::Option<wkt::Int32Value>,
26991
26992            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26993        }
26994
26995        impl MysqlExportOptions {
26996            pub fn new() -> Self {
26997                std::default::Default::default()
26998            }
26999
27000            /// Sets the value of [master_data][crate::model::export_context::sql_export_options::MysqlExportOptions::master_data].
27001            pub fn set_master_data<T>(mut self, v: T) -> Self
27002            where
27003                T: std::convert::Into<wkt::Int32Value>,
27004            {
27005                self.master_data = std::option::Option::Some(v.into());
27006                self
27007            }
27008
27009            /// Sets or clears the value of [master_data][crate::model::export_context::sql_export_options::MysqlExportOptions::master_data].
27010            pub fn set_or_clear_master_data<T>(mut self, v: std::option::Option<T>) -> Self
27011            where
27012                T: std::convert::Into<wkt::Int32Value>,
27013            {
27014                self.master_data = v.map(|x| x.into());
27015                self
27016            }
27017        }
27018
27019        impl wkt::message::Message for MysqlExportOptions {
27020            fn typename() -> &'static str {
27021                "type.googleapis.com/google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions"
27022            }
27023        }
27024
27025        #[doc(hidden)]
27026        impl<'de> serde::de::Deserialize<'de> for MysqlExportOptions {
27027            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27028            where
27029                D: serde::Deserializer<'de>,
27030            {
27031                #[allow(non_camel_case_types)]
27032                #[doc(hidden)]
27033                #[derive(PartialEq, Eq, Hash)]
27034                enum __FieldTag {
27035                    __master_data,
27036                    Unknown(std::string::String),
27037                }
27038                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
27039                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27040                    where
27041                        D: serde::Deserializer<'de>,
27042                    {
27043                        struct Visitor;
27044                        impl<'de> serde::de::Visitor<'de> for Visitor {
27045                            type Value = __FieldTag;
27046                            fn expecting(
27047                                &self,
27048                                formatter: &mut std::fmt::Formatter,
27049                            ) -> std::fmt::Result {
27050                                formatter.write_str("a field name for MysqlExportOptions")
27051                            }
27052                            fn visit_str<E>(
27053                                self,
27054                                value: &str,
27055                            ) -> std::result::Result<Self::Value, E>
27056                            where
27057                                E: serde::de::Error,
27058                            {
27059                                use std::result::Result::Ok;
27060                                use std::string::ToString;
27061                                match value {
27062                                    "masterData" => Ok(__FieldTag::__master_data),
27063                                    "master_data" => Ok(__FieldTag::__master_data),
27064                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
27065                                }
27066                            }
27067                        }
27068                        deserializer.deserialize_identifier(Visitor)
27069                    }
27070                }
27071                struct Visitor;
27072                impl<'de> serde::de::Visitor<'de> for Visitor {
27073                    type Value = MysqlExportOptions;
27074                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
27075                        formatter.write_str("struct MysqlExportOptions")
27076                    }
27077                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
27078                    where
27079                        A: serde::de::MapAccess<'de>,
27080                    {
27081                        #[allow(unused_imports)]
27082                        use serde::de::Error;
27083                        use std::option::Option::Some;
27084                        let mut fields = std::collections::HashSet::new();
27085                        let mut result = Self::Value::new();
27086                        while let Some(tag) = map.next_key::<__FieldTag>()? {
27087                            #[allow(clippy::match_single_binding)]
27088                            match tag {
27089                                __FieldTag::__master_data => {
27090                                    if !fields.insert(__FieldTag::__master_data) {
27091                                        return std::result::Result::Err(
27092                                            A::Error::duplicate_field(
27093                                                "multiple values for master_data",
27094                                            ),
27095                                        );
27096                                    }
27097                                    struct __With(std::option::Option<wkt::Int32Value>);
27098                                    impl<'de> serde::de::Deserialize<'de> for __With {
27099                                        fn deserialize<D>(
27100                                            deserializer: D,
27101                                        ) -> std::result::Result<Self, D::Error>
27102                                        where
27103                                            D: serde::de::Deserializer<'de>,
27104                                        {
27105                                            serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
27106                                        }
27107                                    }
27108                                    result.master_data = map.next_value::<__With>()?.0;
27109                                }
27110                                __FieldTag::Unknown(key) => {
27111                                    let value = map.next_value::<serde_json::Value>()?;
27112                                    result._unknown_fields.insert(key, value);
27113                                }
27114                            }
27115                        }
27116                        std::result::Result::Ok(result)
27117                    }
27118                }
27119                deserializer.deserialize_any(Visitor)
27120            }
27121        }
27122
27123        #[doc(hidden)]
27124        impl serde::ser::Serialize for MysqlExportOptions {
27125            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27126            where
27127                S: serde::ser::Serializer,
27128            {
27129                use serde::ser::SerializeMap;
27130                #[allow(unused_imports)]
27131                use std::option::Option::Some;
27132                let mut state = serializer.serialize_map(std::option::Option::None)?;
27133                if self.master_data.is_some() {
27134                    struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
27135                    impl<'a> serde::ser::Serialize for __With<'a> {
27136                        fn serialize<S>(
27137                            &self,
27138                            serializer: S,
27139                        ) -> std::result::Result<S::Ok, S::Error>
27140                        where
27141                            S: serde::ser::Serializer,
27142                        {
27143                            serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
27144                                self.0, serializer,
27145                            )
27146                        }
27147                    }
27148                    state.serialize_entry("masterData", &__With(&self.master_data))?;
27149                }
27150                if !self._unknown_fields.is_empty() {
27151                    for (key, value) in self._unknown_fields.iter() {
27152                        state.serialize_entry(key, &value)?;
27153                    }
27154                }
27155                state.end()
27156            }
27157        }
27158
27159        /// Options for exporting from a Cloud SQL for PostgreSQL instance.
27160        #[derive(Clone, Debug, Default, PartialEq)]
27161        #[non_exhaustive]
27162        pub struct PostgresExportOptions {
27163            /// Optional. Use this option to include DROP \<object\> SQL statements.
27164            /// These statements are used to delete database objects before running the
27165            /// import operation.
27166            pub clean: std::option::Option<wkt::BoolValue>,
27167
27168            /// Optional. Option to include an IF EXISTS SQL statement with each DROP
27169            /// statement produced by clean.
27170            pub if_exists: std::option::Option<wkt::BoolValue>,
27171
27172            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27173        }
27174
27175        impl PostgresExportOptions {
27176            pub fn new() -> Self {
27177                std::default::Default::default()
27178            }
27179
27180            /// Sets the value of [clean][crate::model::export_context::sql_export_options::PostgresExportOptions::clean].
27181            pub fn set_clean<T>(mut self, v: T) -> Self
27182            where
27183                T: std::convert::Into<wkt::BoolValue>,
27184            {
27185                self.clean = std::option::Option::Some(v.into());
27186                self
27187            }
27188
27189            /// Sets or clears the value of [clean][crate::model::export_context::sql_export_options::PostgresExportOptions::clean].
27190            pub fn set_or_clear_clean<T>(mut self, v: std::option::Option<T>) -> Self
27191            where
27192                T: std::convert::Into<wkt::BoolValue>,
27193            {
27194                self.clean = v.map(|x| x.into());
27195                self
27196            }
27197
27198            /// Sets the value of [if_exists][crate::model::export_context::sql_export_options::PostgresExportOptions::if_exists].
27199            pub fn set_if_exists<T>(mut self, v: T) -> Self
27200            where
27201                T: std::convert::Into<wkt::BoolValue>,
27202            {
27203                self.if_exists = std::option::Option::Some(v.into());
27204                self
27205            }
27206
27207            /// Sets or clears the value of [if_exists][crate::model::export_context::sql_export_options::PostgresExportOptions::if_exists].
27208            pub fn set_or_clear_if_exists<T>(mut self, v: std::option::Option<T>) -> Self
27209            where
27210                T: std::convert::Into<wkt::BoolValue>,
27211            {
27212                self.if_exists = v.map(|x| x.into());
27213                self
27214            }
27215        }
27216
27217        impl wkt::message::Message for PostgresExportOptions {
27218            fn typename() -> &'static str {
27219                "type.googleapis.com/google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions"
27220            }
27221        }
27222
27223        #[doc(hidden)]
27224        impl<'de> serde::de::Deserialize<'de> for PostgresExportOptions {
27225            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27226            where
27227                D: serde::Deserializer<'de>,
27228            {
27229                #[allow(non_camel_case_types)]
27230                #[doc(hidden)]
27231                #[derive(PartialEq, Eq, Hash)]
27232                enum __FieldTag {
27233                    __clean,
27234                    __if_exists,
27235                    Unknown(std::string::String),
27236                }
27237                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
27238                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27239                    where
27240                        D: serde::Deserializer<'de>,
27241                    {
27242                        struct Visitor;
27243                        impl<'de> serde::de::Visitor<'de> for Visitor {
27244                            type Value = __FieldTag;
27245                            fn expecting(
27246                                &self,
27247                                formatter: &mut std::fmt::Formatter,
27248                            ) -> std::fmt::Result {
27249                                formatter.write_str("a field name for PostgresExportOptions")
27250                            }
27251                            fn visit_str<E>(
27252                                self,
27253                                value: &str,
27254                            ) -> std::result::Result<Self::Value, E>
27255                            where
27256                                E: serde::de::Error,
27257                            {
27258                                use std::result::Result::Ok;
27259                                use std::string::ToString;
27260                                match value {
27261                                    "clean" => Ok(__FieldTag::__clean),
27262                                    "ifExists" => Ok(__FieldTag::__if_exists),
27263                                    "if_exists" => Ok(__FieldTag::__if_exists),
27264                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
27265                                }
27266                            }
27267                        }
27268                        deserializer.deserialize_identifier(Visitor)
27269                    }
27270                }
27271                struct Visitor;
27272                impl<'de> serde::de::Visitor<'de> for Visitor {
27273                    type Value = PostgresExportOptions;
27274                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
27275                        formatter.write_str("struct PostgresExportOptions")
27276                    }
27277                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
27278                    where
27279                        A: serde::de::MapAccess<'de>,
27280                    {
27281                        #[allow(unused_imports)]
27282                        use serde::de::Error;
27283                        use std::option::Option::Some;
27284                        let mut fields = std::collections::HashSet::new();
27285                        let mut result = Self::Value::new();
27286                        while let Some(tag) = map.next_key::<__FieldTag>()? {
27287                            #[allow(clippy::match_single_binding)]
27288                            match tag {
27289                                __FieldTag::__clean => {
27290                                    if !fields.insert(__FieldTag::__clean) {
27291                                        return std::result::Result::Err(
27292                                            A::Error::duplicate_field("multiple values for clean"),
27293                                        );
27294                                    }
27295                                    result.clean =
27296                                        map.next_value::<std::option::Option<wkt::BoolValue>>()?;
27297                                }
27298                                __FieldTag::__if_exists => {
27299                                    if !fields.insert(__FieldTag::__if_exists) {
27300                                        return std::result::Result::Err(
27301                                            A::Error::duplicate_field(
27302                                                "multiple values for if_exists",
27303                                            ),
27304                                        );
27305                                    }
27306                                    result.if_exists =
27307                                        map.next_value::<std::option::Option<wkt::BoolValue>>()?;
27308                                }
27309                                __FieldTag::Unknown(key) => {
27310                                    let value = map.next_value::<serde_json::Value>()?;
27311                                    result._unknown_fields.insert(key, value);
27312                                }
27313                            }
27314                        }
27315                        std::result::Result::Ok(result)
27316                    }
27317                }
27318                deserializer.deserialize_any(Visitor)
27319            }
27320        }
27321
27322        #[doc(hidden)]
27323        impl serde::ser::Serialize for PostgresExportOptions {
27324            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27325            where
27326                S: serde::ser::Serializer,
27327            {
27328                use serde::ser::SerializeMap;
27329                #[allow(unused_imports)]
27330                use std::option::Option::Some;
27331                let mut state = serializer.serialize_map(std::option::Option::None)?;
27332                if self.clean.is_some() {
27333                    state.serialize_entry("clean", &self.clean)?;
27334                }
27335                if self.if_exists.is_some() {
27336                    state.serialize_entry("ifExists", &self.if_exists)?;
27337                }
27338                if !self._unknown_fields.is_empty() {
27339                    for (key, value) in self._unknown_fields.iter() {
27340                        state.serialize_entry(key, &value)?;
27341                    }
27342                }
27343                state.end()
27344            }
27345        }
27346    }
27347
27348    /// Options for exporting BAK files (SQL Server-only)
27349    #[derive(Clone, Debug, Default, PartialEq)]
27350    #[non_exhaustive]
27351    pub struct SqlBakExportOptions {
27352        /// Whether or not the export should be striped.
27353        pub striped: std::option::Option<wkt::BoolValue>,
27354
27355        /// Option for specifying how many stripes to use for the export.
27356        /// If blank, and the value of the striped field is true,
27357        /// the number of stripes is automatically chosen.
27358        pub stripe_count: std::option::Option<wkt::Int32Value>,
27359
27360        /// Type of this bak file will be export, FULL or DIFF, SQL Server only
27361        pub bak_type: crate::model::BakType,
27362
27363        /// Deprecated: copy_only is deprecated. Use differential_base instead
27364        #[deprecated]
27365        pub copy_only: std::option::Option<wkt::BoolValue>,
27366
27367        /// Whether or not the backup can be used as a differential base
27368        /// copy_only backup can not be served as differential base
27369        pub differential_base: std::option::Option<wkt::BoolValue>,
27370
27371        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27372    }
27373
27374    impl SqlBakExportOptions {
27375        pub fn new() -> Self {
27376            std::default::Default::default()
27377        }
27378
27379        /// Sets the value of [striped][crate::model::export_context::SqlBakExportOptions::striped].
27380        pub fn set_striped<T>(mut self, v: T) -> Self
27381        where
27382            T: std::convert::Into<wkt::BoolValue>,
27383        {
27384            self.striped = std::option::Option::Some(v.into());
27385            self
27386        }
27387
27388        /// Sets or clears the value of [striped][crate::model::export_context::SqlBakExportOptions::striped].
27389        pub fn set_or_clear_striped<T>(mut self, v: std::option::Option<T>) -> Self
27390        where
27391            T: std::convert::Into<wkt::BoolValue>,
27392        {
27393            self.striped = v.map(|x| x.into());
27394            self
27395        }
27396
27397        /// Sets the value of [stripe_count][crate::model::export_context::SqlBakExportOptions::stripe_count].
27398        pub fn set_stripe_count<T>(mut self, v: T) -> Self
27399        where
27400            T: std::convert::Into<wkt::Int32Value>,
27401        {
27402            self.stripe_count = std::option::Option::Some(v.into());
27403            self
27404        }
27405
27406        /// Sets or clears the value of [stripe_count][crate::model::export_context::SqlBakExportOptions::stripe_count].
27407        pub fn set_or_clear_stripe_count<T>(mut self, v: std::option::Option<T>) -> Self
27408        where
27409            T: std::convert::Into<wkt::Int32Value>,
27410        {
27411            self.stripe_count = v.map(|x| x.into());
27412            self
27413        }
27414
27415        /// Sets the value of [bak_type][crate::model::export_context::SqlBakExportOptions::bak_type].
27416        pub fn set_bak_type<T: std::convert::Into<crate::model::BakType>>(mut self, v: T) -> Self {
27417            self.bak_type = v.into();
27418            self
27419        }
27420
27421        /// Sets the value of [copy_only][crate::model::export_context::SqlBakExportOptions::copy_only].
27422        #[deprecated]
27423        pub fn set_copy_only<T>(mut self, v: T) -> Self
27424        where
27425            T: std::convert::Into<wkt::BoolValue>,
27426        {
27427            self.copy_only = std::option::Option::Some(v.into());
27428            self
27429        }
27430
27431        /// Sets or clears the value of [copy_only][crate::model::export_context::SqlBakExportOptions::copy_only].
27432        #[deprecated]
27433        pub fn set_or_clear_copy_only<T>(mut self, v: std::option::Option<T>) -> Self
27434        where
27435            T: std::convert::Into<wkt::BoolValue>,
27436        {
27437            self.copy_only = v.map(|x| x.into());
27438            self
27439        }
27440
27441        /// Sets the value of [differential_base][crate::model::export_context::SqlBakExportOptions::differential_base].
27442        pub fn set_differential_base<T>(mut self, v: T) -> Self
27443        where
27444            T: std::convert::Into<wkt::BoolValue>,
27445        {
27446            self.differential_base = std::option::Option::Some(v.into());
27447            self
27448        }
27449
27450        /// Sets or clears the value of [differential_base][crate::model::export_context::SqlBakExportOptions::differential_base].
27451        pub fn set_or_clear_differential_base<T>(mut self, v: std::option::Option<T>) -> Self
27452        where
27453            T: std::convert::Into<wkt::BoolValue>,
27454        {
27455            self.differential_base = v.map(|x| x.into());
27456            self
27457        }
27458    }
27459
27460    impl wkt::message::Message for SqlBakExportOptions {
27461        fn typename() -> &'static str {
27462            "type.googleapis.com/google.cloud.sql.v1.ExportContext.SqlBakExportOptions"
27463        }
27464    }
27465
27466    #[doc(hidden)]
27467    impl<'de> serde::de::Deserialize<'de> for SqlBakExportOptions {
27468        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27469        where
27470            D: serde::Deserializer<'de>,
27471        {
27472            #[allow(non_camel_case_types)]
27473            #[doc(hidden)]
27474            #[derive(PartialEq, Eq, Hash)]
27475            enum __FieldTag {
27476                __striped,
27477                __stripe_count,
27478                __bak_type,
27479                __copy_only,
27480                __differential_base,
27481                Unknown(std::string::String),
27482            }
27483            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
27484                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27485                where
27486                    D: serde::Deserializer<'de>,
27487                {
27488                    struct Visitor;
27489                    impl<'de> serde::de::Visitor<'de> for Visitor {
27490                        type Value = __FieldTag;
27491                        fn expecting(
27492                            &self,
27493                            formatter: &mut std::fmt::Formatter,
27494                        ) -> std::fmt::Result {
27495                            formatter.write_str("a field name for SqlBakExportOptions")
27496                        }
27497                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
27498                        where
27499                            E: serde::de::Error,
27500                        {
27501                            use std::result::Result::Ok;
27502                            use std::string::ToString;
27503                            match value {
27504                                "striped" => Ok(__FieldTag::__striped),
27505                                "stripeCount" => Ok(__FieldTag::__stripe_count),
27506                                "stripe_count" => Ok(__FieldTag::__stripe_count),
27507                                "bakType" => Ok(__FieldTag::__bak_type),
27508                                "bak_type" => Ok(__FieldTag::__bak_type),
27509                                "copyOnly" => Ok(__FieldTag::__copy_only),
27510                                "copy_only" => Ok(__FieldTag::__copy_only),
27511                                "differentialBase" => Ok(__FieldTag::__differential_base),
27512                                "differential_base" => Ok(__FieldTag::__differential_base),
27513                                _ => Ok(__FieldTag::Unknown(value.to_string())),
27514                            }
27515                        }
27516                    }
27517                    deserializer.deserialize_identifier(Visitor)
27518                }
27519            }
27520            struct Visitor;
27521            impl<'de> serde::de::Visitor<'de> for Visitor {
27522                type Value = SqlBakExportOptions;
27523                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
27524                    formatter.write_str("struct SqlBakExportOptions")
27525                }
27526                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
27527                where
27528                    A: serde::de::MapAccess<'de>,
27529                {
27530                    #[allow(unused_imports)]
27531                    use serde::de::Error;
27532                    use std::option::Option::Some;
27533                    let mut fields = std::collections::HashSet::new();
27534                    let mut result = Self::Value::new();
27535                    while let Some(tag) = map.next_key::<__FieldTag>()? {
27536                        #[allow(clippy::match_single_binding)]
27537                        match tag {
27538                            __FieldTag::__striped => {
27539                                if !fields.insert(__FieldTag::__striped) {
27540                                    return std::result::Result::Err(A::Error::duplicate_field(
27541                                        "multiple values for striped",
27542                                    ));
27543                                }
27544                                result.striped =
27545                                    map.next_value::<std::option::Option<wkt::BoolValue>>()?;
27546                            }
27547                            __FieldTag::__stripe_count => {
27548                                if !fields.insert(__FieldTag::__stripe_count) {
27549                                    return std::result::Result::Err(A::Error::duplicate_field(
27550                                        "multiple values for stripe_count",
27551                                    ));
27552                                }
27553                                struct __With(std::option::Option<wkt::Int32Value>);
27554                                impl<'de> serde::de::Deserialize<'de> for __With {
27555                                    fn deserialize<D>(
27556                                        deserializer: D,
27557                                    ) -> std::result::Result<Self, D::Error>
27558                                    where
27559                                        D: serde::de::Deserializer<'de>,
27560                                    {
27561                                        serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
27562                                    }
27563                                }
27564                                result.stripe_count = map.next_value::<__With>()?.0;
27565                            }
27566                            __FieldTag::__bak_type => {
27567                                if !fields.insert(__FieldTag::__bak_type) {
27568                                    return std::result::Result::Err(A::Error::duplicate_field(
27569                                        "multiple values for bak_type",
27570                                    ));
27571                                }
27572                                result.bak_type = map
27573                                    .next_value::<std::option::Option<crate::model::BakType>>()?
27574                                    .unwrap_or_default();
27575                            }
27576                            __FieldTag::__copy_only => {
27577                                if !fields.insert(__FieldTag::__copy_only) {
27578                                    return std::result::Result::Err(A::Error::duplicate_field(
27579                                        "multiple values for copy_only",
27580                                    ));
27581                                }
27582                                result.copy_only =
27583                                    map.next_value::<std::option::Option<wkt::BoolValue>>()?;
27584                            }
27585                            __FieldTag::__differential_base => {
27586                                if !fields.insert(__FieldTag::__differential_base) {
27587                                    return std::result::Result::Err(A::Error::duplicate_field(
27588                                        "multiple values for differential_base",
27589                                    ));
27590                                }
27591                                result.differential_base =
27592                                    map.next_value::<std::option::Option<wkt::BoolValue>>()?;
27593                            }
27594                            __FieldTag::Unknown(key) => {
27595                                let value = map.next_value::<serde_json::Value>()?;
27596                                result._unknown_fields.insert(key, value);
27597                            }
27598                        }
27599                    }
27600                    std::result::Result::Ok(result)
27601                }
27602            }
27603            deserializer.deserialize_any(Visitor)
27604        }
27605    }
27606
27607    #[doc(hidden)]
27608    impl serde::ser::Serialize for SqlBakExportOptions {
27609        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27610        where
27611            S: serde::ser::Serializer,
27612        {
27613            use serde::ser::SerializeMap;
27614            #[allow(unused_imports)]
27615            use std::option::Option::Some;
27616            let mut state = serializer.serialize_map(std::option::Option::None)?;
27617            if self.striped.is_some() {
27618                state.serialize_entry("striped", &self.striped)?;
27619            }
27620            if self.stripe_count.is_some() {
27621                struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
27622                impl<'a> serde::ser::Serialize for __With<'a> {
27623                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27624                    where
27625                        S: serde::ser::Serializer,
27626                    {
27627                        serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
27628                            self.0, serializer,
27629                        )
27630                    }
27631                }
27632                state.serialize_entry("stripeCount", &__With(&self.stripe_count))?;
27633            }
27634            if !wkt::internal::is_default(&self.bak_type) {
27635                state.serialize_entry("bakType", &self.bak_type)?;
27636            }
27637            if self.copy_only.is_some() {
27638                state.serialize_entry("copyOnly", &self.copy_only)?;
27639            }
27640            if self.differential_base.is_some() {
27641                state.serialize_entry("differentialBase", &self.differential_base)?;
27642            }
27643            if !self._unknown_fields.is_empty() {
27644                for (key, value) in self._unknown_fields.iter() {
27645                    state.serialize_entry(key, &value)?;
27646                }
27647            }
27648            state.end()
27649        }
27650    }
27651}
27652
27653/// Database instance import context.
27654#[derive(Clone, Debug, Default, PartialEq)]
27655#[non_exhaustive]
27656pub struct ImportContext {
27657    /// Path to the import file in Cloud Storage, in the form
27658    /// `gs://bucketName/fileName`. Compressed gzip files (.gz) are supported
27659    /// when `fileType` is `SQL`. The instance must have
27660    /// write permissions to the bucket and read access to the file.
27661    pub uri: std::string::String,
27662
27663    /// The target database for the import. If `fileType` is `SQL`, this field
27664    /// is required only if the import file does not specify a database, and is
27665    /// overridden by any database specification in the import file. If
27666    /// `fileType` is `CSV`, one database must be specified.
27667    pub database: std::string::String,
27668
27669    /// This is always `sql#importContext`.
27670    pub kind: std::string::String,
27671
27672    /// The file type for the specified uri.\`SQL`: The file
27673    /// contains SQL statements. \`CSV`: The file contains CSV data.
27674    pub file_type: crate::model::SqlFileType,
27675
27676    /// Options for importing data as CSV.
27677    pub csv_import_options: std::option::Option<crate::model::import_context::SqlCsvImportOptions>,
27678
27679    /// The PostgreSQL user for this import operation. PostgreSQL instances only.
27680    pub import_user: std::string::String,
27681
27682    /// Import parameters specific to SQL Server .BAK files
27683    pub bak_import_options: std::option::Option<crate::model::import_context::SqlBakImportOptions>,
27684
27685    /// Optional. Options for importing data from SQL statements.
27686    pub sql_import_options: std::option::Option<crate::model::import_context::SqlImportOptions>,
27687
27688    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27689}
27690
27691impl ImportContext {
27692    pub fn new() -> Self {
27693        std::default::Default::default()
27694    }
27695
27696    /// Sets the value of [uri][crate::model::ImportContext::uri].
27697    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27698        self.uri = v.into();
27699        self
27700    }
27701
27702    /// Sets the value of [database][crate::model::ImportContext::database].
27703    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27704        self.database = v.into();
27705        self
27706    }
27707
27708    /// Sets the value of [kind][crate::model::ImportContext::kind].
27709    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27710        self.kind = v.into();
27711        self
27712    }
27713
27714    /// Sets the value of [file_type][crate::model::ImportContext::file_type].
27715    pub fn set_file_type<T: std::convert::Into<crate::model::SqlFileType>>(mut self, v: T) -> Self {
27716        self.file_type = v.into();
27717        self
27718    }
27719
27720    /// Sets the value of [csv_import_options][crate::model::ImportContext::csv_import_options].
27721    pub fn set_csv_import_options<T>(mut self, v: T) -> Self
27722    where
27723        T: std::convert::Into<crate::model::import_context::SqlCsvImportOptions>,
27724    {
27725        self.csv_import_options = std::option::Option::Some(v.into());
27726        self
27727    }
27728
27729    /// Sets or clears the value of [csv_import_options][crate::model::ImportContext::csv_import_options].
27730    pub fn set_or_clear_csv_import_options<T>(mut self, v: std::option::Option<T>) -> Self
27731    where
27732        T: std::convert::Into<crate::model::import_context::SqlCsvImportOptions>,
27733    {
27734        self.csv_import_options = v.map(|x| x.into());
27735        self
27736    }
27737
27738    /// Sets the value of [import_user][crate::model::ImportContext::import_user].
27739    pub fn set_import_user<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27740        self.import_user = v.into();
27741        self
27742    }
27743
27744    /// Sets the value of [bak_import_options][crate::model::ImportContext::bak_import_options].
27745    pub fn set_bak_import_options<T>(mut self, v: T) -> Self
27746    where
27747        T: std::convert::Into<crate::model::import_context::SqlBakImportOptions>,
27748    {
27749        self.bak_import_options = std::option::Option::Some(v.into());
27750        self
27751    }
27752
27753    /// Sets or clears the value of [bak_import_options][crate::model::ImportContext::bak_import_options].
27754    pub fn set_or_clear_bak_import_options<T>(mut self, v: std::option::Option<T>) -> Self
27755    where
27756        T: std::convert::Into<crate::model::import_context::SqlBakImportOptions>,
27757    {
27758        self.bak_import_options = v.map(|x| x.into());
27759        self
27760    }
27761
27762    /// Sets the value of [sql_import_options][crate::model::ImportContext::sql_import_options].
27763    pub fn set_sql_import_options<T>(mut self, v: T) -> Self
27764    where
27765        T: std::convert::Into<crate::model::import_context::SqlImportOptions>,
27766    {
27767        self.sql_import_options = std::option::Option::Some(v.into());
27768        self
27769    }
27770
27771    /// Sets or clears the value of [sql_import_options][crate::model::ImportContext::sql_import_options].
27772    pub fn set_or_clear_sql_import_options<T>(mut self, v: std::option::Option<T>) -> Self
27773    where
27774        T: std::convert::Into<crate::model::import_context::SqlImportOptions>,
27775    {
27776        self.sql_import_options = v.map(|x| x.into());
27777        self
27778    }
27779}
27780
27781impl wkt::message::Message for ImportContext {
27782    fn typename() -> &'static str {
27783        "type.googleapis.com/google.cloud.sql.v1.ImportContext"
27784    }
27785}
27786
27787#[doc(hidden)]
27788impl<'de> serde::de::Deserialize<'de> for ImportContext {
27789    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27790    where
27791        D: serde::Deserializer<'de>,
27792    {
27793        #[allow(non_camel_case_types)]
27794        #[doc(hidden)]
27795        #[derive(PartialEq, Eq, Hash)]
27796        enum __FieldTag {
27797            __uri,
27798            __database,
27799            __kind,
27800            __file_type,
27801            __csv_import_options,
27802            __import_user,
27803            __bak_import_options,
27804            __sql_import_options,
27805            Unknown(std::string::String),
27806        }
27807        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
27808            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27809            where
27810                D: serde::Deserializer<'de>,
27811            {
27812                struct Visitor;
27813                impl<'de> serde::de::Visitor<'de> for Visitor {
27814                    type Value = __FieldTag;
27815                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
27816                        formatter.write_str("a field name for ImportContext")
27817                    }
27818                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
27819                    where
27820                        E: serde::de::Error,
27821                    {
27822                        use std::result::Result::Ok;
27823                        use std::string::ToString;
27824                        match value {
27825                            "uri" => Ok(__FieldTag::__uri),
27826                            "database" => Ok(__FieldTag::__database),
27827                            "kind" => Ok(__FieldTag::__kind),
27828                            "fileType" => Ok(__FieldTag::__file_type),
27829                            "file_type" => Ok(__FieldTag::__file_type),
27830                            "csvImportOptions" => Ok(__FieldTag::__csv_import_options),
27831                            "csv_import_options" => Ok(__FieldTag::__csv_import_options),
27832                            "importUser" => Ok(__FieldTag::__import_user),
27833                            "import_user" => Ok(__FieldTag::__import_user),
27834                            "bakImportOptions" => Ok(__FieldTag::__bak_import_options),
27835                            "bak_import_options" => Ok(__FieldTag::__bak_import_options),
27836                            "sqlImportOptions" => Ok(__FieldTag::__sql_import_options),
27837                            "sql_import_options" => Ok(__FieldTag::__sql_import_options),
27838                            _ => Ok(__FieldTag::Unknown(value.to_string())),
27839                        }
27840                    }
27841                }
27842                deserializer.deserialize_identifier(Visitor)
27843            }
27844        }
27845        struct Visitor;
27846        impl<'de> serde::de::Visitor<'de> for Visitor {
27847            type Value = ImportContext;
27848            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
27849                formatter.write_str("struct ImportContext")
27850            }
27851            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
27852            where
27853                A: serde::de::MapAccess<'de>,
27854            {
27855                #[allow(unused_imports)]
27856                use serde::de::Error;
27857                use std::option::Option::Some;
27858                let mut fields = std::collections::HashSet::new();
27859                let mut result = Self::Value::new();
27860                while let Some(tag) = map.next_key::<__FieldTag>()? {
27861                    #[allow(clippy::match_single_binding)]
27862                    match tag {
27863                        __FieldTag::__uri => {
27864                            if !fields.insert(__FieldTag::__uri) {
27865                                return std::result::Result::Err(A::Error::duplicate_field(
27866                                    "multiple values for uri",
27867                                ));
27868                            }
27869                            result.uri = map
27870                                .next_value::<std::option::Option<std::string::String>>()?
27871                                .unwrap_or_default();
27872                        }
27873                        __FieldTag::__database => {
27874                            if !fields.insert(__FieldTag::__database) {
27875                                return std::result::Result::Err(A::Error::duplicate_field(
27876                                    "multiple values for database",
27877                                ));
27878                            }
27879                            result.database = map
27880                                .next_value::<std::option::Option<std::string::String>>()?
27881                                .unwrap_or_default();
27882                        }
27883                        __FieldTag::__kind => {
27884                            if !fields.insert(__FieldTag::__kind) {
27885                                return std::result::Result::Err(A::Error::duplicate_field(
27886                                    "multiple values for kind",
27887                                ));
27888                            }
27889                            result.kind = map
27890                                .next_value::<std::option::Option<std::string::String>>()?
27891                                .unwrap_or_default();
27892                        }
27893                        __FieldTag::__file_type => {
27894                            if !fields.insert(__FieldTag::__file_type) {
27895                                return std::result::Result::Err(A::Error::duplicate_field(
27896                                    "multiple values for file_type",
27897                                ));
27898                            }
27899                            result.file_type = map
27900                                .next_value::<std::option::Option<crate::model::SqlFileType>>()?
27901                                .unwrap_or_default();
27902                        }
27903                        __FieldTag::__csv_import_options => {
27904                            if !fields.insert(__FieldTag::__csv_import_options) {
27905                                return std::result::Result::Err(A::Error::duplicate_field(
27906                                    "multiple values for csv_import_options",
27907                                ));
27908                            }
27909                            result.csv_import_options = map.next_value::<std::option::Option<
27910                                crate::model::import_context::SqlCsvImportOptions,
27911                            >>()?;
27912                        }
27913                        __FieldTag::__import_user => {
27914                            if !fields.insert(__FieldTag::__import_user) {
27915                                return std::result::Result::Err(A::Error::duplicate_field(
27916                                    "multiple values for import_user",
27917                                ));
27918                            }
27919                            result.import_user = map
27920                                .next_value::<std::option::Option<std::string::String>>()?
27921                                .unwrap_or_default();
27922                        }
27923                        __FieldTag::__bak_import_options => {
27924                            if !fields.insert(__FieldTag::__bak_import_options) {
27925                                return std::result::Result::Err(A::Error::duplicate_field(
27926                                    "multiple values for bak_import_options",
27927                                ));
27928                            }
27929                            result.bak_import_options = map.next_value::<std::option::Option<
27930                                crate::model::import_context::SqlBakImportOptions,
27931                            >>()?;
27932                        }
27933                        __FieldTag::__sql_import_options => {
27934                            if !fields.insert(__FieldTag::__sql_import_options) {
27935                                return std::result::Result::Err(A::Error::duplicate_field(
27936                                    "multiple values for sql_import_options",
27937                                ));
27938                            }
27939                            result.sql_import_options = map.next_value::<std::option::Option<
27940                                crate::model::import_context::SqlImportOptions,
27941                            >>()?;
27942                        }
27943                        __FieldTag::Unknown(key) => {
27944                            let value = map.next_value::<serde_json::Value>()?;
27945                            result._unknown_fields.insert(key, value);
27946                        }
27947                    }
27948                }
27949                std::result::Result::Ok(result)
27950            }
27951        }
27952        deserializer.deserialize_any(Visitor)
27953    }
27954}
27955
27956#[doc(hidden)]
27957impl serde::ser::Serialize for ImportContext {
27958    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27959    where
27960        S: serde::ser::Serializer,
27961    {
27962        use serde::ser::SerializeMap;
27963        #[allow(unused_imports)]
27964        use std::option::Option::Some;
27965        let mut state = serializer.serialize_map(std::option::Option::None)?;
27966        if !self.uri.is_empty() {
27967            state.serialize_entry("uri", &self.uri)?;
27968        }
27969        if !self.database.is_empty() {
27970            state.serialize_entry("database", &self.database)?;
27971        }
27972        if !self.kind.is_empty() {
27973            state.serialize_entry("kind", &self.kind)?;
27974        }
27975        if !wkt::internal::is_default(&self.file_type) {
27976            state.serialize_entry("fileType", &self.file_type)?;
27977        }
27978        if self.csv_import_options.is_some() {
27979            state.serialize_entry("csvImportOptions", &self.csv_import_options)?;
27980        }
27981        if !self.import_user.is_empty() {
27982            state.serialize_entry("importUser", &self.import_user)?;
27983        }
27984        if self.bak_import_options.is_some() {
27985            state.serialize_entry("bakImportOptions", &self.bak_import_options)?;
27986        }
27987        if self.sql_import_options.is_some() {
27988            state.serialize_entry("sqlImportOptions", &self.sql_import_options)?;
27989        }
27990        if !self._unknown_fields.is_empty() {
27991            for (key, value) in self._unknown_fields.iter() {
27992                state.serialize_entry(key, &value)?;
27993            }
27994        }
27995        state.end()
27996    }
27997}
27998
27999/// Defines additional types related to [ImportContext].
28000pub mod import_context {
28001    #[allow(unused_imports)]
28002    use super::*;
28003
28004    #[derive(Clone, Debug, Default, PartialEq)]
28005    #[non_exhaustive]
28006    pub struct SqlImportOptions {
28007        /// Optional. The number of threads to use for parallel import.
28008        pub threads: std::option::Option<wkt::Int32Value>,
28009
28010        /// Optional. Whether or not the import should be parallel.
28011        pub parallel: std::option::Option<wkt::BoolValue>,
28012
28013        /// Optional. Options for importing from a Cloud SQL for PostgreSQL instance.
28014        pub postgres_import_options: std::option::Option<
28015            crate::model::import_context::sql_import_options::PostgresImportOptions,
28016        >,
28017
28018        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
28019    }
28020
28021    impl SqlImportOptions {
28022        pub fn new() -> Self {
28023            std::default::Default::default()
28024        }
28025
28026        /// Sets the value of [threads][crate::model::import_context::SqlImportOptions::threads].
28027        pub fn set_threads<T>(mut self, v: T) -> Self
28028        where
28029            T: std::convert::Into<wkt::Int32Value>,
28030        {
28031            self.threads = std::option::Option::Some(v.into());
28032            self
28033        }
28034
28035        /// Sets or clears the value of [threads][crate::model::import_context::SqlImportOptions::threads].
28036        pub fn set_or_clear_threads<T>(mut self, v: std::option::Option<T>) -> Self
28037        where
28038            T: std::convert::Into<wkt::Int32Value>,
28039        {
28040            self.threads = v.map(|x| x.into());
28041            self
28042        }
28043
28044        /// Sets the value of [parallel][crate::model::import_context::SqlImportOptions::parallel].
28045        pub fn set_parallel<T>(mut self, v: T) -> Self
28046        where
28047            T: std::convert::Into<wkt::BoolValue>,
28048        {
28049            self.parallel = std::option::Option::Some(v.into());
28050            self
28051        }
28052
28053        /// Sets or clears the value of [parallel][crate::model::import_context::SqlImportOptions::parallel].
28054        pub fn set_or_clear_parallel<T>(mut self, v: std::option::Option<T>) -> Self
28055        where
28056            T: std::convert::Into<wkt::BoolValue>,
28057        {
28058            self.parallel = v.map(|x| x.into());
28059            self
28060        }
28061
28062        /// Sets the value of [postgres_import_options][crate::model::import_context::SqlImportOptions::postgres_import_options].
28063        pub fn set_postgres_import_options<T>(mut self, v: T) -> Self
28064        where
28065            T: std::convert::Into<
28066                    crate::model::import_context::sql_import_options::PostgresImportOptions,
28067                >,
28068        {
28069            self.postgres_import_options = std::option::Option::Some(v.into());
28070            self
28071        }
28072
28073        /// Sets or clears the value of [postgres_import_options][crate::model::import_context::SqlImportOptions::postgres_import_options].
28074        pub fn set_or_clear_postgres_import_options<T>(mut self, v: std::option::Option<T>) -> Self
28075        where
28076            T: std::convert::Into<
28077                    crate::model::import_context::sql_import_options::PostgresImportOptions,
28078                >,
28079        {
28080            self.postgres_import_options = v.map(|x| x.into());
28081            self
28082        }
28083    }
28084
28085    impl wkt::message::Message for SqlImportOptions {
28086        fn typename() -> &'static str {
28087            "type.googleapis.com/google.cloud.sql.v1.ImportContext.SqlImportOptions"
28088        }
28089    }
28090
28091    #[doc(hidden)]
28092    impl<'de> serde::de::Deserialize<'de> for SqlImportOptions {
28093        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28094        where
28095            D: serde::Deserializer<'de>,
28096        {
28097            #[allow(non_camel_case_types)]
28098            #[doc(hidden)]
28099            #[derive(PartialEq, Eq, Hash)]
28100            enum __FieldTag {
28101                __threads,
28102                __parallel,
28103                __postgres_import_options,
28104                Unknown(std::string::String),
28105            }
28106            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
28107                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28108                where
28109                    D: serde::Deserializer<'de>,
28110                {
28111                    struct Visitor;
28112                    impl<'de> serde::de::Visitor<'de> for Visitor {
28113                        type Value = __FieldTag;
28114                        fn expecting(
28115                            &self,
28116                            formatter: &mut std::fmt::Formatter,
28117                        ) -> std::fmt::Result {
28118                            formatter.write_str("a field name for SqlImportOptions")
28119                        }
28120                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
28121                        where
28122                            E: serde::de::Error,
28123                        {
28124                            use std::result::Result::Ok;
28125                            use std::string::ToString;
28126                            match value {
28127                                "threads" => Ok(__FieldTag::__threads),
28128                                "parallel" => Ok(__FieldTag::__parallel),
28129                                "postgresImportOptions" => {
28130                                    Ok(__FieldTag::__postgres_import_options)
28131                                }
28132                                "postgres_import_options" => {
28133                                    Ok(__FieldTag::__postgres_import_options)
28134                                }
28135                                _ => Ok(__FieldTag::Unknown(value.to_string())),
28136                            }
28137                        }
28138                    }
28139                    deserializer.deserialize_identifier(Visitor)
28140                }
28141            }
28142            struct Visitor;
28143            impl<'de> serde::de::Visitor<'de> for Visitor {
28144                type Value = SqlImportOptions;
28145                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
28146                    formatter.write_str("struct SqlImportOptions")
28147                }
28148                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
28149                where
28150                    A: serde::de::MapAccess<'de>,
28151                {
28152                    #[allow(unused_imports)]
28153                    use serde::de::Error;
28154                    use std::option::Option::Some;
28155                    let mut fields = std::collections::HashSet::new();
28156                    let mut result = Self::Value::new();
28157                    while let Some(tag) = map.next_key::<__FieldTag>()? {
28158                        #[allow(clippy::match_single_binding)]
28159                        match tag {
28160                            __FieldTag::__threads => {
28161                                if !fields.insert(__FieldTag::__threads) {
28162                                    return std::result::Result::Err(A::Error::duplicate_field(
28163                                        "multiple values for threads",
28164                                    ));
28165                                }
28166                                struct __With(std::option::Option<wkt::Int32Value>);
28167                                impl<'de> serde::de::Deserialize<'de> for __With {
28168                                    fn deserialize<D>(
28169                                        deserializer: D,
28170                                    ) -> std::result::Result<Self, D::Error>
28171                                    where
28172                                        D: serde::de::Deserializer<'de>,
28173                                    {
28174                                        serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
28175                                    }
28176                                }
28177                                result.threads = map.next_value::<__With>()?.0;
28178                            }
28179                            __FieldTag::__parallel => {
28180                                if !fields.insert(__FieldTag::__parallel) {
28181                                    return std::result::Result::Err(A::Error::duplicate_field(
28182                                        "multiple values for parallel",
28183                                    ));
28184                                }
28185                                result.parallel =
28186                                    map.next_value::<std::option::Option<wkt::BoolValue>>()?;
28187                            }
28188                            __FieldTag::__postgres_import_options => {
28189                                if !fields.insert(__FieldTag::__postgres_import_options) {
28190                                    return std::result::Result::Err(A::Error::duplicate_field(
28191                                        "multiple values for postgres_import_options",
28192                                    ));
28193                                }
28194                                result.postgres_import_options = map.next_value::<std::option::Option<crate::model::import_context::sql_import_options::PostgresImportOptions>>()?
28195                                    ;
28196                            }
28197                            __FieldTag::Unknown(key) => {
28198                                let value = map.next_value::<serde_json::Value>()?;
28199                                result._unknown_fields.insert(key, value);
28200                            }
28201                        }
28202                    }
28203                    std::result::Result::Ok(result)
28204                }
28205            }
28206            deserializer.deserialize_any(Visitor)
28207        }
28208    }
28209
28210    #[doc(hidden)]
28211    impl serde::ser::Serialize for SqlImportOptions {
28212        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28213        where
28214            S: serde::ser::Serializer,
28215        {
28216            use serde::ser::SerializeMap;
28217            #[allow(unused_imports)]
28218            use std::option::Option::Some;
28219            let mut state = serializer.serialize_map(std::option::Option::None)?;
28220            if self.threads.is_some() {
28221                struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
28222                impl<'a> serde::ser::Serialize for __With<'a> {
28223                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28224                    where
28225                        S: serde::ser::Serializer,
28226                    {
28227                        serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
28228                            self.0, serializer,
28229                        )
28230                    }
28231                }
28232                state.serialize_entry("threads", &__With(&self.threads))?;
28233            }
28234            if self.parallel.is_some() {
28235                state.serialize_entry("parallel", &self.parallel)?;
28236            }
28237            if self.postgres_import_options.is_some() {
28238                state.serialize_entry("postgresImportOptions", &self.postgres_import_options)?;
28239            }
28240            if !self._unknown_fields.is_empty() {
28241                for (key, value) in self._unknown_fields.iter() {
28242                    state.serialize_entry(key, &value)?;
28243                }
28244            }
28245            state.end()
28246        }
28247    }
28248
28249    /// Defines additional types related to [SqlImportOptions].
28250    pub mod sql_import_options {
28251        #[allow(unused_imports)]
28252        use super::*;
28253
28254        #[derive(Clone, Debug, Default, PartialEq)]
28255        #[non_exhaustive]
28256        pub struct PostgresImportOptions {
28257            /// Optional. The --clean flag for the pg_restore utility. This flag
28258            /// applies only if you enabled Cloud SQL to import files in parallel.
28259            pub clean: std::option::Option<wkt::BoolValue>,
28260
28261            /// Optional. The --if-exists flag for the pg_restore utility. This flag
28262            /// applies only if you enabled Cloud SQL to import files in parallel.
28263            pub if_exists: std::option::Option<wkt::BoolValue>,
28264
28265            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
28266        }
28267
28268        impl PostgresImportOptions {
28269            pub fn new() -> Self {
28270                std::default::Default::default()
28271            }
28272
28273            /// Sets the value of [clean][crate::model::import_context::sql_import_options::PostgresImportOptions::clean].
28274            pub fn set_clean<T>(mut self, v: T) -> Self
28275            where
28276                T: std::convert::Into<wkt::BoolValue>,
28277            {
28278                self.clean = std::option::Option::Some(v.into());
28279                self
28280            }
28281
28282            /// Sets or clears the value of [clean][crate::model::import_context::sql_import_options::PostgresImportOptions::clean].
28283            pub fn set_or_clear_clean<T>(mut self, v: std::option::Option<T>) -> Self
28284            where
28285                T: std::convert::Into<wkt::BoolValue>,
28286            {
28287                self.clean = v.map(|x| x.into());
28288                self
28289            }
28290
28291            /// Sets the value of [if_exists][crate::model::import_context::sql_import_options::PostgresImportOptions::if_exists].
28292            pub fn set_if_exists<T>(mut self, v: T) -> Self
28293            where
28294                T: std::convert::Into<wkt::BoolValue>,
28295            {
28296                self.if_exists = std::option::Option::Some(v.into());
28297                self
28298            }
28299
28300            /// Sets or clears the value of [if_exists][crate::model::import_context::sql_import_options::PostgresImportOptions::if_exists].
28301            pub fn set_or_clear_if_exists<T>(mut self, v: std::option::Option<T>) -> Self
28302            where
28303                T: std::convert::Into<wkt::BoolValue>,
28304            {
28305                self.if_exists = v.map(|x| x.into());
28306                self
28307            }
28308        }
28309
28310        impl wkt::message::Message for PostgresImportOptions {
28311            fn typename() -> &'static str {
28312                "type.googleapis.com/google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions"
28313            }
28314        }
28315
28316        #[doc(hidden)]
28317        impl<'de> serde::de::Deserialize<'de> for PostgresImportOptions {
28318            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28319            where
28320                D: serde::Deserializer<'de>,
28321            {
28322                #[allow(non_camel_case_types)]
28323                #[doc(hidden)]
28324                #[derive(PartialEq, Eq, Hash)]
28325                enum __FieldTag {
28326                    __clean,
28327                    __if_exists,
28328                    Unknown(std::string::String),
28329                }
28330                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
28331                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28332                    where
28333                        D: serde::Deserializer<'de>,
28334                    {
28335                        struct Visitor;
28336                        impl<'de> serde::de::Visitor<'de> for Visitor {
28337                            type Value = __FieldTag;
28338                            fn expecting(
28339                                &self,
28340                                formatter: &mut std::fmt::Formatter,
28341                            ) -> std::fmt::Result {
28342                                formatter.write_str("a field name for PostgresImportOptions")
28343                            }
28344                            fn visit_str<E>(
28345                                self,
28346                                value: &str,
28347                            ) -> std::result::Result<Self::Value, E>
28348                            where
28349                                E: serde::de::Error,
28350                            {
28351                                use std::result::Result::Ok;
28352                                use std::string::ToString;
28353                                match value {
28354                                    "clean" => Ok(__FieldTag::__clean),
28355                                    "ifExists" => Ok(__FieldTag::__if_exists),
28356                                    "if_exists" => Ok(__FieldTag::__if_exists),
28357                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
28358                                }
28359                            }
28360                        }
28361                        deserializer.deserialize_identifier(Visitor)
28362                    }
28363                }
28364                struct Visitor;
28365                impl<'de> serde::de::Visitor<'de> for Visitor {
28366                    type Value = PostgresImportOptions;
28367                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
28368                        formatter.write_str("struct PostgresImportOptions")
28369                    }
28370                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
28371                    where
28372                        A: serde::de::MapAccess<'de>,
28373                    {
28374                        #[allow(unused_imports)]
28375                        use serde::de::Error;
28376                        use std::option::Option::Some;
28377                        let mut fields = std::collections::HashSet::new();
28378                        let mut result = Self::Value::new();
28379                        while let Some(tag) = map.next_key::<__FieldTag>()? {
28380                            #[allow(clippy::match_single_binding)]
28381                            match tag {
28382                                __FieldTag::__clean => {
28383                                    if !fields.insert(__FieldTag::__clean) {
28384                                        return std::result::Result::Err(
28385                                            A::Error::duplicate_field("multiple values for clean"),
28386                                        );
28387                                    }
28388                                    result.clean =
28389                                        map.next_value::<std::option::Option<wkt::BoolValue>>()?;
28390                                }
28391                                __FieldTag::__if_exists => {
28392                                    if !fields.insert(__FieldTag::__if_exists) {
28393                                        return std::result::Result::Err(
28394                                            A::Error::duplicate_field(
28395                                                "multiple values for if_exists",
28396                                            ),
28397                                        );
28398                                    }
28399                                    result.if_exists =
28400                                        map.next_value::<std::option::Option<wkt::BoolValue>>()?;
28401                                }
28402                                __FieldTag::Unknown(key) => {
28403                                    let value = map.next_value::<serde_json::Value>()?;
28404                                    result._unknown_fields.insert(key, value);
28405                                }
28406                            }
28407                        }
28408                        std::result::Result::Ok(result)
28409                    }
28410                }
28411                deserializer.deserialize_any(Visitor)
28412            }
28413        }
28414
28415        #[doc(hidden)]
28416        impl serde::ser::Serialize for PostgresImportOptions {
28417            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28418            where
28419                S: serde::ser::Serializer,
28420            {
28421                use serde::ser::SerializeMap;
28422                #[allow(unused_imports)]
28423                use std::option::Option::Some;
28424                let mut state = serializer.serialize_map(std::option::Option::None)?;
28425                if self.clean.is_some() {
28426                    state.serialize_entry("clean", &self.clean)?;
28427                }
28428                if self.if_exists.is_some() {
28429                    state.serialize_entry("ifExists", &self.if_exists)?;
28430                }
28431                if !self._unknown_fields.is_empty() {
28432                    for (key, value) in self._unknown_fields.iter() {
28433                        state.serialize_entry(key, &value)?;
28434                    }
28435                }
28436                state.end()
28437            }
28438        }
28439    }
28440
28441    #[derive(Clone, Debug, Default, PartialEq)]
28442    #[non_exhaustive]
28443    pub struct SqlCsvImportOptions {
28444        /// The table to which CSV data is imported.
28445        pub table: std::string::String,
28446
28447        /// The columns to which CSV data is imported. If not specified, all columns
28448        /// of the database table are loaded with CSV data.
28449        pub columns: std::vec::Vec<std::string::String>,
28450
28451        /// Specifies the character that should appear before a data character that
28452        /// needs to be escaped.
28453        pub escape_character: std::string::String,
28454
28455        /// Specifies the quoting character to be used when a data value is quoted.
28456        pub quote_character: std::string::String,
28457
28458        /// Specifies the character that separates columns within each row (line) of
28459        /// the file.
28460        pub fields_terminated_by: std::string::String,
28461
28462        /// This is used to separate lines. If a line does not contain all fields,
28463        /// the rest of the columns are set to their default values.
28464        pub lines_terminated_by: std::string::String,
28465
28466        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
28467    }
28468
28469    impl SqlCsvImportOptions {
28470        pub fn new() -> Self {
28471            std::default::Default::default()
28472        }
28473
28474        /// Sets the value of [table][crate::model::import_context::SqlCsvImportOptions::table].
28475        pub fn set_table<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
28476            self.table = v.into();
28477            self
28478        }
28479
28480        /// Sets the value of [columns][crate::model::import_context::SqlCsvImportOptions::columns].
28481        pub fn set_columns<T, V>(mut self, v: T) -> Self
28482        where
28483            T: std::iter::IntoIterator<Item = V>,
28484            V: std::convert::Into<std::string::String>,
28485        {
28486            use std::iter::Iterator;
28487            self.columns = v.into_iter().map(|i| i.into()).collect();
28488            self
28489        }
28490
28491        /// Sets the value of [escape_character][crate::model::import_context::SqlCsvImportOptions::escape_character].
28492        pub fn set_escape_character<T: std::convert::Into<std::string::String>>(
28493            mut self,
28494            v: T,
28495        ) -> Self {
28496            self.escape_character = v.into();
28497            self
28498        }
28499
28500        /// Sets the value of [quote_character][crate::model::import_context::SqlCsvImportOptions::quote_character].
28501        pub fn set_quote_character<T: std::convert::Into<std::string::String>>(
28502            mut self,
28503            v: T,
28504        ) -> Self {
28505            self.quote_character = v.into();
28506            self
28507        }
28508
28509        /// Sets the value of [fields_terminated_by][crate::model::import_context::SqlCsvImportOptions::fields_terminated_by].
28510        pub fn set_fields_terminated_by<T: std::convert::Into<std::string::String>>(
28511            mut self,
28512            v: T,
28513        ) -> Self {
28514            self.fields_terminated_by = v.into();
28515            self
28516        }
28517
28518        /// Sets the value of [lines_terminated_by][crate::model::import_context::SqlCsvImportOptions::lines_terminated_by].
28519        pub fn set_lines_terminated_by<T: std::convert::Into<std::string::String>>(
28520            mut self,
28521            v: T,
28522        ) -> Self {
28523            self.lines_terminated_by = v.into();
28524            self
28525        }
28526    }
28527
28528    impl wkt::message::Message for SqlCsvImportOptions {
28529        fn typename() -> &'static str {
28530            "type.googleapis.com/google.cloud.sql.v1.ImportContext.SqlCsvImportOptions"
28531        }
28532    }
28533
28534    #[doc(hidden)]
28535    impl<'de> serde::de::Deserialize<'de> for SqlCsvImportOptions {
28536        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28537        where
28538            D: serde::Deserializer<'de>,
28539        {
28540            #[allow(non_camel_case_types)]
28541            #[doc(hidden)]
28542            #[derive(PartialEq, Eq, Hash)]
28543            enum __FieldTag {
28544                __table,
28545                __columns,
28546                __escape_character,
28547                __quote_character,
28548                __fields_terminated_by,
28549                __lines_terminated_by,
28550                Unknown(std::string::String),
28551            }
28552            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
28553                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28554                where
28555                    D: serde::Deserializer<'de>,
28556                {
28557                    struct Visitor;
28558                    impl<'de> serde::de::Visitor<'de> for Visitor {
28559                        type Value = __FieldTag;
28560                        fn expecting(
28561                            &self,
28562                            formatter: &mut std::fmt::Formatter,
28563                        ) -> std::fmt::Result {
28564                            formatter.write_str("a field name for SqlCsvImportOptions")
28565                        }
28566                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
28567                        where
28568                            E: serde::de::Error,
28569                        {
28570                            use std::result::Result::Ok;
28571                            use std::string::ToString;
28572                            match value {
28573                                "table" => Ok(__FieldTag::__table),
28574                                "columns" => Ok(__FieldTag::__columns),
28575                                "escapeCharacter" => Ok(__FieldTag::__escape_character),
28576                                "escape_character" => Ok(__FieldTag::__escape_character),
28577                                "quoteCharacter" => Ok(__FieldTag::__quote_character),
28578                                "quote_character" => Ok(__FieldTag::__quote_character),
28579                                "fieldsTerminatedBy" => Ok(__FieldTag::__fields_terminated_by),
28580                                "fields_terminated_by" => Ok(__FieldTag::__fields_terminated_by),
28581                                "linesTerminatedBy" => Ok(__FieldTag::__lines_terminated_by),
28582                                "lines_terminated_by" => Ok(__FieldTag::__lines_terminated_by),
28583                                _ => Ok(__FieldTag::Unknown(value.to_string())),
28584                            }
28585                        }
28586                    }
28587                    deserializer.deserialize_identifier(Visitor)
28588                }
28589            }
28590            struct Visitor;
28591            impl<'de> serde::de::Visitor<'de> for Visitor {
28592                type Value = SqlCsvImportOptions;
28593                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
28594                    formatter.write_str("struct SqlCsvImportOptions")
28595                }
28596                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
28597                where
28598                    A: serde::de::MapAccess<'de>,
28599                {
28600                    #[allow(unused_imports)]
28601                    use serde::de::Error;
28602                    use std::option::Option::Some;
28603                    let mut fields = std::collections::HashSet::new();
28604                    let mut result = Self::Value::new();
28605                    while let Some(tag) = map.next_key::<__FieldTag>()? {
28606                        #[allow(clippy::match_single_binding)]
28607                        match tag {
28608                            __FieldTag::__table => {
28609                                if !fields.insert(__FieldTag::__table) {
28610                                    return std::result::Result::Err(A::Error::duplicate_field(
28611                                        "multiple values for table",
28612                                    ));
28613                                }
28614                                result.table = map
28615                                    .next_value::<std::option::Option<std::string::String>>()?
28616                                    .unwrap_or_default();
28617                            }
28618                            __FieldTag::__columns => {
28619                                if !fields.insert(__FieldTag::__columns) {
28620                                    return std::result::Result::Err(A::Error::duplicate_field(
28621                                        "multiple values for columns",
28622                                    ));
28623                                }
28624                                result.columns = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
28625                            }
28626                            __FieldTag::__escape_character => {
28627                                if !fields.insert(__FieldTag::__escape_character) {
28628                                    return std::result::Result::Err(A::Error::duplicate_field(
28629                                        "multiple values for escape_character",
28630                                    ));
28631                                }
28632                                result.escape_character = map
28633                                    .next_value::<std::option::Option<std::string::String>>()?
28634                                    .unwrap_or_default();
28635                            }
28636                            __FieldTag::__quote_character => {
28637                                if !fields.insert(__FieldTag::__quote_character) {
28638                                    return std::result::Result::Err(A::Error::duplicate_field(
28639                                        "multiple values for quote_character",
28640                                    ));
28641                                }
28642                                result.quote_character = map
28643                                    .next_value::<std::option::Option<std::string::String>>()?
28644                                    .unwrap_or_default();
28645                            }
28646                            __FieldTag::__fields_terminated_by => {
28647                                if !fields.insert(__FieldTag::__fields_terminated_by) {
28648                                    return std::result::Result::Err(A::Error::duplicate_field(
28649                                        "multiple values for fields_terminated_by",
28650                                    ));
28651                                }
28652                                result.fields_terminated_by = map
28653                                    .next_value::<std::option::Option<std::string::String>>()?
28654                                    .unwrap_or_default();
28655                            }
28656                            __FieldTag::__lines_terminated_by => {
28657                                if !fields.insert(__FieldTag::__lines_terminated_by) {
28658                                    return std::result::Result::Err(A::Error::duplicate_field(
28659                                        "multiple values for lines_terminated_by",
28660                                    ));
28661                                }
28662                                result.lines_terminated_by = map
28663                                    .next_value::<std::option::Option<std::string::String>>()?
28664                                    .unwrap_or_default();
28665                            }
28666                            __FieldTag::Unknown(key) => {
28667                                let value = map.next_value::<serde_json::Value>()?;
28668                                result._unknown_fields.insert(key, value);
28669                            }
28670                        }
28671                    }
28672                    std::result::Result::Ok(result)
28673                }
28674            }
28675            deserializer.deserialize_any(Visitor)
28676        }
28677    }
28678
28679    #[doc(hidden)]
28680    impl serde::ser::Serialize for SqlCsvImportOptions {
28681        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28682        where
28683            S: serde::ser::Serializer,
28684        {
28685            use serde::ser::SerializeMap;
28686            #[allow(unused_imports)]
28687            use std::option::Option::Some;
28688            let mut state = serializer.serialize_map(std::option::Option::None)?;
28689            if !self.table.is_empty() {
28690                state.serialize_entry("table", &self.table)?;
28691            }
28692            if !self.columns.is_empty() {
28693                state.serialize_entry("columns", &self.columns)?;
28694            }
28695            if !self.escape_character.is_empty() {
28696                state.serialize_entry("escapeCharacter", &self.escape_character)?;
28697            }
28698            if !self.quote_character.is_empty() {
28699                state.serialize_entry("quoteCharacter", &self.quote_character)?;
28700            }
28701            if !self.fields_terminated_by.is_empty() {
28702                state.serialize_entry("fieldsTerminatedBy", &self.fields_terminated_by)?;
28703            }
28704            if !self.lines_terminated_by.is_empty() {
28705                state.serialize_entry("linesTerminatedBy", &self.lines_terminated_by)?;
28706            }
28707            if !self._unknown_fields.is_empty() {
28708                for (key, value) in self._unknown_fields.iter() {
28709                    state.serialize_entry(key, &value)?;
28710                }
28711            }
28712            state.end()
28713        }
28714    }
28715
28716    #[derive(Clone, Debug, Default, PartialEq)]
28717    #[non_exhaustive]
28718    pub struct SqlBakImportOptions {
28719        pub encryption_options: std::option::Option<
28720            crate::model::import_context::sql_bak_import_options::EncryptionOptions,
28721        >,
28722
28723        /// Whether or not the backup set being restored is striped.
28724        /// Applies only to Cloud SQL for SQL Server.
28725        pub striped: std::option::Option<wkt::BoolValue>,
28726
28727        /// Whether or not the backup importing will restore database
28728        /// with NORECOVERY option
28729        /// Applies only to Cloud SQL for SQL Server.
28730        pub no_recovery: std::option::Option<wkt::BoolValue>,
28731
28732        /// Whether or not the backup importing request will just bring database
28733        /// online without downloading Bak content only one of "no_recovery" and
28734        /// "recovery_only" can be true otherwise error will return. Applies only to
28735        /// Cloud SQL for SQL Server.
28736        pub recovery_only: std::option::Option<wkt::BoolValue>,
28737
28738        /// Type of the bak content, FULL or DIFF
28739        pub bak_type: crate::model::BakType,
28740
28741        /// Optional. The timestamp when the import should stop. This timestamp is in
28742        /// the [RFC 3339](https://tools.ietf.org/html/rfc3339) format (for example,
28743        /// `2023-10-01T16:19:00.094`). This field is equivalent to the STOPAT
28744        /// keyword and applies to Cloud SQL for SQL Server only.
28745        pub stop_at: std::option::Option<wkt::Timestamp>,
28746
28747        /// Optional. The marked transaction where the import should stop. This field
28748        /// is equivalent to the STOPATMARK keyword and applies to Cloud SQL for SQL
28749        /// Server only.
28750        pub stop_at_mark: std::string::String,
28751
28752        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
28753    }
28754
28755    impl SqlBakImportOptions {
28756        pub fn new() -> Self {
28757            std::default::Default::default()
28758        }
28759
28760        /// Sets the value of [encryption_options][crate::model::import_context::SqlBakImportOptions::encryption_options].
28761        pub fn set_encryption_options<T>(mut self, v: T) -> Self
28762        where
28763            T: std::convert::Into<
28764                    crate::model::import_context::sql_bak_import_options::EncryptionOptions,
28765                >,
28766        {
28767            self.encryption_options = std::option::Option::Some(v.into());
28768            self
28769        }
28770
28771        /// Sets or clears the value of [encryption_options][crate::model::import_context::SqlBakImportOptions::encryption_options].
28772        pub fn set_or_clear_encryption_options<T>(mut self, v: std::option::Option<T>) -> Self
28773        where
28774            T: std::convert::Into<
28775                    crate::model::import_context::sql_bak_import_options::EncryptionOptions,
28776                >,
28777        {
28778            self.encryption_options = v.map(|x| x.into());
28779            self
28780        }
28781
28782        /// Sets the value of [striped][crate::model::import_context::SqlBakImportOptions::striped].
28783        pub fn set_striped<T>(mut self, v: T) -> Self
28784        where
28785            T: std::convert::Into<wkt::BoolValue>,
28786        {
28787            self.striped = std::option::Option::Some(v.into());
28788            self
28789        }
28790
28791        /// Sets or clears the value of [striped][crate::model::import_context::SqlBakImportOptions::striped].
28792        pub fn set_or_clear_striped<T>(mut self, v: std::option::Option<T>) -> Self
28793        where
28794            T: std::convert::Into<wkt::BoolValue>,
28795        {
28796            self.striped = v.map(|x| x.into());
28797            self
28798        }
28799
28800        /// Sets the value of [no_recovery][crate::model::import_context::SqlBakImportOptions::no_recovery].
28801        pub fn set_no_recovery<T>(mut self, v: T) -> Self
28802        where
28803            T: std::convert::Into<wkt::BoolValue>,
28804        {
28805            self.no_recovery = std::option::Option::Some(v.into());
28806            self
28807        }
28808
28809        /// Sets or clears the value of [no_recovery][crate::model::import_context::SqlBakImportOptions::no_recovery].
28810        pub fn set_or_clear_no_recovery<T>(mut self, v: std::option::Option<T>) -> Self
28811        where
28812            T: std::convert::Into<wkt::BoolValue>,
28813        {
28814            self.no_recovery = v.map(|x| x.into());
28815            self
28816        }
28817
28818        /// Sets the value of [recovery_only][crate::model::import_context::SqlBakImportOptions::recovery_only].
28819        pub fn set_recovery_only<T>(mut self, v: T) -> Self
28820        where
28821            T: std::convert::Into<wkt::BoolValue>,
28822        {
28823            self.recovery_only = std::option::Option::Some(v.into());
28824            self
28825        }
28826
28827        /// Sets or clears the value of [recovery_only][crate::model::import_context::SqlBakImportOptions::recovery_only].
28828        pub fn set_or_clear_recovery_only<T>(mut self, v: std::option::Option<T>) -> Self
28829        where
28830            T: std::convert::Into<wkt::BoolValue>,
28831        {
28832            self.recovery_only = v.map(|x| x.into());
28833            self
28834        }
28835
28836        /// Sets the value of [bak_type][crate::model::import_context::SqlBakImportOptions::bak_type].
28837        pub fn set_bak_type<T: std::convert::Into<crate::model::BakType>>(mut self, v: T) -> Self {
28838            self.bak_type = v.into();
28839            self
28840        }
28841
28842        /// Sets the value of [stop_at][crate::model::import_context::SqlBakImportOptions::stop_at].
28843        pub fn set_stop_at<T>(mut self, v: T) -> Self
28844        where
28845            T: std::convert::Into<wkt::Timestamp>,
28846        {
28847            self.stop_at = std::option::Option::Some(v.into());
28848            self
28849        }
28850
28851        /// Sets or clears the value of [stop_at][crate::model::import_context::SqlBakImportOptions::stop_at].
28852        pub fn set_or_clear_stop_at<T>(mut self, v: std::option::Option<T>) -> Self
28853        where
28854            T: std::convert::Into<wkt::Timestamp>,
28855        {
28856            self.stop_at = v.map(|x| x.into());
28857            self
28858        }
28859
28860        /// Sets the value of [stop_at_mark][crate::model::import_context::SqlBakImportOptions::stop_at_mark].
28861        pub fn set_stop_at_mark<T: std::convert::Into<std::string::String>>(
28862            mut self,
28863            v: T,
28864        ) -> Self {
28865            self.stop_at_mark = v.into();
28866            self
28867        }
28868    }
28869
28870    impl wkt::message::Message for SqlBakImportOptions {
28871        fn typename() -> &'static str {
28872            "type.googleapis.com/google.cloud.sql.v1.ImportContext.SqlBakImportOptions"
28873        }
28874    }
28875
28876    #[doc(hidden)]
28877    impl<'de> serde::de::Deserialize<'de> for SqlBakImportOptions {
28878        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28879        where
28880            D: serde::Deserializer<'de>,
28881        {
28882            #[allow(non_camel_case_types)]
28883            #[doc(hidden)]
28884            #[derive(PartialEq, Eq, Hash)]
28885            enum __FieldTag {
28886                __encryption_options,
28887                __striped,
28888                __no_recovery,
28889                __recovery_only,
28890                __bak_type,
28891                __stop_at,
28892                __stop_at_mark,
28893                Unknown(std::string::String),
28894            }
28895            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
28896                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28897                where
28898                    D: serde::Deserializer<'de>,
28899                {
28900                    struct Visitor;
28901                    impl<'de> serde::de::Visitor<'de> for Visitor {
28902                        type Value = __FieldTag;
28903                        fn expecting(
28904                            &self,
28905                            formatter: &mut std::fmt::Formatter,
28906                        ) -> std::fmt::Result {
28907                            formatter.write_str("a field name for SqlBakImportOptions")
28908                        }
28909                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
28910                        where
28911                            E: serde::de::Error,
28912                        {
28913                            use std::result::Result::Ok;
28914                            use std::string::ToString;
28915                            match value {
28916                                "encryptionOptions" => Ok(__FieldTag::__encryption_options),
28917                                "encryption_options" => Ok(__FieldTag::__encryption_options),
28918                                "striped" => Ok(__FieldTag::__striped),
28919                                "noRecovery" => Ok(__FieldTag::__no_recovery),
28920                                "no_recovery" => Ok(__FieldTag::__no_recovery),
28921                                "recoveryOnly" => Ok(__FieldTag::__recovery_only),
28922                                "recovery_only" => Ok(__FieldTag::__recovery_only),
28923                                "bakType" => Ok(__FieldTag::__bak_type),
28924                                "bak_type" => Ok(__FieldTag::__bak_type),
28925                                "stopAt" => Ok(__FieldTag::__stop_at),
28926                                "stop_at" => Ok(__FieldTag::__stop_at),
28927                                "stopAtMark" => Ok(__FieldTag::__stop_at_mark),
28928                                "stop_at_mark" => Ok(__FieldTag::__stop_at_mark),
28929                                _ => Ok(__FieldTag::Unknown(value.to_string())),
28930                            }
28931                        }
28932                    }
28933                    deserializer.deserialize_identifier(Visitor)
28934                }
28935            }
28936            struct Visitor;
28937            impl<'de> serde::de::Visitor<'de> for Visitor {
28938                type Value = SqlBakImportOptions;
28939                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
28940                    formatter.write_str("struct SqlBakImportOptions")
28941                }
28942                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
28943                where
28944                    A: serde::de::MapAccess<'de>,
28945                {
28946                    #[allow(unused_imports)]
28947                    use serde::de::Error;
28948                    use std::option::Option::Some;
28949                    let mut fields = std::collections::HashSet::new();
28950                    let mut result = Self::Value::new();
28951                    while let Some(tag) = map.next_key::<__FieldTag>()? {
28952                        #[allow(clippy::match_single_binding)]
28953                        match tag {
28954                            __FieldTag::__encryption_options => {
28955                                if !fields.insert(__FieldTag::__encryption_options) {
28956                                    return std::result::Result::Err(A::Error::duplicate_field(
28957                                        "multiple values for encryption_options",
28958                                    ));
28959                                }
28960                                result.encryption_options = map.next_value::<std::option::Option<crate::model::import_context::sql_bak_import_options::EncryptionOptions>>()?
28961                                    ;
28962                            }
28963                            __FieldTag::__striped => {
28964                                if !fields.insert(__FieldTag::__striped) {
28965                                    return std::result::Result::Err(A::Error::duplicate_field(
28966                                        "multiple values for striped",
28967                                    ));
28968                                }
28969                                result.striped =
28970                                    map.next_value::<std::option::Option<wkt::BoolValue>>()?;
28971                            }
28972                            __FieldTag::__no_recovery => {
28973                                if !fields.insert(__FieldTag::__no_recovery) {
28974                                    return std::result::Result::Err(A::Error::duplicate_field(
28975                                        "multiple values for no_recovery",
28976                                    ));
28977                                }
28978                                result.no_recovery =
28979                                    map.next_value::<std::option::Option<wkt::BoolValue>>()?;
28980                            }
28981                            __FieldTag::__recovery_only => {
28982                                if !fields.insert(__FieldTag::__recovery_only) {
28983                                    return std::result::Result::Err(A::Error::duplicate_field(
28984                                        "multiple values for recovery_only",
28985                                    ));
28986                                }
28987                                result.recovery_only =
28988                                    map.next_value::<std::option::Option<wkt::BoolValue>>()?;
28989                            }
28990                            __FieldTag::__bak_type => {
28991                                if !fields.insert(__FieldTag::__bak_type) {
28992                                    return std::result::Result::Err(A::Error::duplicate_field(
28993                                        "multiple values for bak_type",
28994                                    ));
28995                                }
28996                                result.bak_type = map
28997                                    .next_value::<std::option::Option<crate::model::BakType>>()?
28998                                    .unwrap_or_default();
28999                            }
29000                            __FieldTag::__stop_at => {
29001                                if !fields.insert(__FieldTag::__stop_at) {
29002                                    return std::result::Result::Err(A::Error::duplicate_field(
29003                                        "multiple values for stop_at",
29004                                    ));
29005                                }
29006                                result.stop_at =
29007                                    map.next_value::<std::option::Option<wkt::Timestamp>>()?;
29008                            }
29009                            __FieldTag::__stop_at_mark => {
29010                                if !fields.insert(__FieldTag::__stop_at_mark) {
29011                                    return std::result::Result::Err(A::Error::duplicate_field(
29012                                        "multiple values for stop_at_mark",
29013                                    ));
29014                                }
29015                                result.stop_at_mark = map
29016                                    .next_value::<std::option::Option<std::string::String>>()?
29017                                    .unwrap_or_default();
29018                            }
29019                            __FieldTag::Unknown(key) => {
29020                                let value = map.next_value::<serde_json::Value>()?;
29021                                result._unknown_fields.insert(key, value);
29022                            }
29023                        }
29024                    }
29025                    std::result::Result::Ok(result)
29026                }
29027            }
29028            deserializer.deserialize_any(Visitor)
29029        }
29030    }
29031
29032    #[doc(hidden)]
29033    impl serde::ser::Serialize for SqlBakImportOptions {
29034        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
29035        where
29036            S: serde::ser::Serializer,
29037        {
29038            use serde::ser::SerializeMap;
29039            #[allow(unused_imports)]
29040            use std::option::Option::Some;
29041            let mut state = serializer.serialize_map(std::option::Option::None)?;
29042            if self.encryption_options.is_some() {
29043                state.serialize_entry("encryptionOptions", &self.encryption_options)?;
29044            }
29045            if self.striped.is_some() {
29046                state.serialize_entry("striped", &self.striped)?;
29047            }
29048            if self.no_recovery.is_some() {
29049                state.serialize_entry("noRecovery", &self.no_recovery)?;
29050            }
29051            if self.recovery_only.is_some() {
29052                state.serialize_entry("recoveryOnly", &self.recovery_only)?;
29053            }
29054            if !wkt::internal::is_default(&self.bak_type) {
29055                state.serialize_entry("bakType", &self.bak_type)?;
29056            }
29057            if self.stop_at.is_some() {
29058                state.serialize_entry("stopAt", &self.stop_at)?;
29059            }
29060            if !self.stop_at_mark.is_empty() {
29061                state.serialize_entry("stopAtMark", &self.stop_at_mark)?;
29062            }
29063            if !self._unknown_fields.is_empty() {
29064                for (key, value) in self._unknown_fields.iter() {
29065                    state.serialize_entry(key, &value)?;
29066                }
29067            }
29068            state.end()
29069        }
29070    }
29071
29072    /// Defines additional types related to [SqlBakImportOptions].
29073    pub mod sql_bak_import_options {
29074        #[allow(unused_imports)]
29075        use super::*;
29076
29077        #[derive(Clone, Debug, Default, PartialEq)]
29078        #[non_exhaustive]
29079        pub struct EncryptionOptions {
29080            /// Path to the Certificate (.cer) in Cloud Storage, in the form
29081            /// `gs://bucketName/fileName`. The instance must have
29082            /// write permissions to the bucket and read access to the file.
29083            pub cert_path: std::string::String,
29084
29085            /// Path to the Certificate Private Key (.pvk)  in Cloud Storage, in the
29086            /// form `gs://bucketName/fileName`. The instance must have
29087            /// write permissions to the bucket and read access to the file.
29088            pub pvk_path: std::string::String,
29089
29090            /// Password that encrypts the private key
29091            pub pvk_password: std::string::String,
29092
29093            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
29094        }
29095
29096        impl EncryptionOptions {
29097            pub fn new() -> Self {
29098                std::default::Default::default()
29099            }
29100
29101            /// Sets the value of [cert_path][crate::model::import_context::sql_bak_import_options::EncryptionOptions::cert_path].
29102            pub fn set_cert_path<T: std::convert::Into<std::string::String>>(
29103                mut self,
29104                v: T,
29105            ) -> Self {
29106                self.cert_path = v.into();
29107                self
29108            }
29109
29110            /// Sets the value of [pvk_path][crate::model::import_context::sql_bak_import_options::EncryptionOptions::pvk_path].
29111            pub fn set_pvk_path<T: std::convert::Into<std::string::String>>(
29112                mut self,
29113                v: T,
29114            ) -> Self {
29115                self.pvk_path = v.into();
29116                self
29117            }
29118
29119            /// Sets the value of [pvk_password][crate::model::import_context::sql_bak_import_options::EncryptionOptions::pvk_password].
29120            pub fn set_pvk_password<T: std::convert::Into<std::string::String>>(
29121                mut self,
29122                v: T,
29123            ) -> Self {
29124                self.pvk_password = v.into();
29125                self
29126            }
29127        }
29128
29129        impl wkt::message::Message for EncryptionOptions {
29130            fn typename() -> &'static str {
29131                "type.googleapis.com/google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions"
29132            }
29133        }
29134
29135        #[doc(hidden)]
29136        impl<'de> serde::de::Deserialize<'de> for EncryptionOptions {
29137            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
29138            where
29139                D: serde::Deserializer<'de>,
29140            {
29141                #[allow(non_camel_case_types)]
29142                #[doc(hidden)]
29143                #[derive(PartialEq, Eq, Hash)]
29144                enum __FieldTag {
29145                    __cert_path,
29146                    __pvk_path,
29147                    __pvk_password,
29148                    Unknown(std::string::String),
29149                }
29150                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
29151                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
29152                    where
29153                        D: serde::Deserializer<'de>,
29154                    {
29155                        struct Visitor;
29156                        impl<'de> serde::de::Visitor<'de> for Visitor {
29157                            type Value = __FieldTag;
29158                            fn expecting(
29159                                &self,
29160                                formatter: &mut std::fmt::Formatter,
29161                            ) -> std::fmt::Result {
29162                                formatter.write_str("a field name for EncryptionOptions")
29163                            }
29164                            fn visit_str<E>(
29165                                self,
29166                                value: &str,
29167                            ) -> std::result::Result<Self::Value, E>
29168                            where
29169                                E: serde::de::Error,
29170                            {
29171                                use std::result::Result::Ok;
29172                                use std::string::ToString;
29173                                match value {
29174                                    "certPath" => Ok(__FieldTag::__cert_path),
29175                                    "cert_path" => Ok(__FieldTag::__cert_path),
29176                                    "pvkPath" => Ok(__FieldTag::__pvk_path),
29177                                    "pvk_path" => Ok(__FieldTag::__pvk_path),
29178                                    "pvkPassword" => Ok(__FieldTag::__pvk_password),
29179                                    "pvk_password" => Ok(__FieldTag::__pvk_password),
29180                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
29181                                }
29182                            }
29183                        }
29184                        deserializer.deserialize_identifier(Visitor)
29185                    }
29186                }
29187                struct Visitor;
29188                impl<'de> serde::de::Visitor<'de> for Visitor {
29189                    type Value = EncryptionOptions;
29190                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
29191                        formatter.write_str("struct EncryptionOptions")
29192                    }
29193                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
29194                    where
29195                        A: serde::de::MapAccess<'de>,
29196                    {
29197                        #[allow(unused_imports)]
29198                        use serde::de::Error;
29199                        use std::option::Option::Some;
29200                        let mut fields = std::collections::HashSet::new();
29201                        let mut result = Self::Value::new();
29202                        while let Some(tag) = map.next_key::<__FieldTag>()? {
29203                            #[allow(clippy::match_single_binding)]
29204                            match tag {
29205                                __FieldTag::__cert_path => {
29206                                    if !fields.insert(__FieldTag::__cert_path) {
29207                                        return std::result::Result::Err(
29208                                            A::Error::duplicate_field(
29209                                                "multiple values for cert_path",
29210                                            ),
29211                                        );
29212                                    }
29213                                    result.cert_path = map
29214                                        .next_value::<std::option::Option<std::string::String>>()?
29215                                        .unwrap_or_default();
29216                                }
29217                                __FieldTag::__pvk_path => {
29218                                    if !fields.insert(__FieldTag::__pvk_path) {
29219                                        return std::result::Result::Err(
29220                                            A::Error::duplicate_field(
29221                                                "multiple values for pvk_path",
29222                                            ),
29223                                        );
29224                                    }
29225                                    result.pvk_path = map
29226                                        .next_value::<std::option::Option<std::string::String>>()?
29227                                        .unwrap_or_default();
29228                                }
29229                                __FieldTag::__pvk_password => {
29230                                    if !fields.insert(__FieldTag::__pvk_password) {
29231                                        return std::result::Result::Err(
29232                                            A::Error::duplicate_field(
29233                                                "multiple values for pvk_password",
29234                                            ),
29235                                        );
29236                                    }
29237                                    result.pvk_password = map
29238                                        .next_value::<std::option::Option<std::string::String>>()?
29239                                        .unwrap_or_default();
29240                                }
29241                                __FieldTag::Unknown(key) => {
29242                                    let value = map.next_value::<serde_json::Value>()?;
29243                                    result._unknown_fields.insert(key, value);
29244                                }
29245                            }
29246                        }
29247                        std::result::Result::Ok(result)
29248                    }
29249                }
29250                deserializer.deserialize_any(Visitor)
29251            }
29252        }
29253
29254        #[doc(hidden)]
29255        impl serde::ser::Serialize for EncryptionOptions {
29256            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
29257            where
29258                S: serde::ser::Serializer,
29259            {
29260                use serde::ser::SerializeMap;
29261                #[allow(unused_imports)]
29262                use std::option::Option::Some;
29263                let mut state = serializer.serialize_map(std::option::Option::None)?;
29264                if !self.cert_path.is_empty() {
29265                    state.serialize_entry("certPath", &self.cert_path)?;
29266                }
29267                if !self.pvk_path.is_empty() {
29268                    state.serialize_entry("pvkPath", &self.pvk_path)?;
29269                }
29270                if !self.pvk_password.is_empty() {
29271                    state.serialize_entry("pvkPassword", &self.pvk_password)?;
29272                }
29273                if !self._unknown_fields.is_empty() {
29274                    for (key, value) in self._unknown_fields.iter() {
29275                        state.serialize_entry(key, &value)?;
29276                    }
29277                }
29278                state.end()
29279            }
29280        }
29281    }
29282}
29283
29284/// IP Management configuration.
29285#[derive(Clone, Debug, Default, PartialEq)]
29286#[non_exhaustive]
29287pub struct IpConfiguration {
29288    /// Whether the instance is assigned a public IP address or not.
29289    pub ipv4_enabled: std::option::Option<wkt::BoolValue>,
29290
29291    /// The resource link for the VPC network from which the Cloud SQL instance is
29292    /// accessible for private IP. For example,
29293    /// `/projects/myProject/global/networks/default`. This setting can
29294    /// be updated, but it cannot be removed after it is set.
29295    pub private_network: std::string::String,
29296
29297    /// Use `ssl_mode` instead.
29298    ///
29299    /// Whether SSL/TLS connections over IP are enforced.
29300    /// If set to false, then allow both non-SSL/non-TLS and SSL/TLS connections.
29301    /// For SSL/TLS connections, the client certificate won't be verified. If
29302    /// set to true, then only allow connections encrypted with SSL/TLS and with
29303    /// valid client certificates. If you want to enforce SSL/TLS without enforcing
29304    /// the requirement for valid client certificates, then use the `ssl_mode` flag
29305    /// instead of the `require_ssl` flag.
29306    pub require_ssl: std::option::Option<wkt::BoolValue>,
29307
29308    /// The list of external networks that are allowed to connect to the instance
29309    /// using the IP. In 'CIDR' notation, also known as 'slash' notation (for
29310    /// example: `157.197.200.0/24`).
29311    pub authorized_networks: std::vec::Vec<crate::model::AclEntry>,
29312
29313    /// The name of the allocated ip range for the private ip Cloud SQL instance.
29314    /// For example: "google-managed-services-default". If set, the instance ip
29315    /// will be created in the allocated range. The range name must comply with
29316    /// [RFC 1035](https://tools.ietf.org/html/rfc1035). Specifically, the name
29317    /// must be 1-63 characters long and match the regular expression
29318    /// `[a-z]([-a-z0-9]*[a-z0-9])?.`
29319    pub allocated_ip_range: std::string::String,
29320
29321    /// Controls connectivity to private IP instances from Google services,
29322    /// such as BigQuery.
29323    pub enable_private_path_for_google_cloud_services: std::option::Option<wkt::BoolValue>,
29324
29325    /// Specify how SSL/TLS is enforced in database connections. If you must use
29326    /// the `require_ssl` flag for backward compatibility, then only the following
29327    /// value pairs are valid:
29328    ///
29329    /// For PostgreSQL and MySQL:
29330    ///
29331    /// * `ssl_mode=ALLOW_UNENCRYPTED_AND_ENCRYPTED` and `require_ssl=false`
29332    /// * `ssl_mode=ENCRYPTED_ONLY` and `require_ssl=false`
29333    /// * `ssl_mode=TRUSTED_CLIENT_CERTIFICATE_REQUIRED` and `require_ssl=true`
29334    ///
29335    /// For SQL Server:
29336    ///
29337    /// * `ssl_mode=ALLOW_UNENCRYPTED_AND_ENCRYPTED` and `require_ssl=false`
29338    /// * `ssl_mode=ENCRYPTED_ONLY` and `require_ssl=true`
29339    ///
29340    /// The value of `ssl_mode` has priority over the value of `require_ssl`.
29341    ///
29342    /// For example, for the pair `ssl_mode=ENCRYPTED_ONLY` and
29343    /// `require_ssl=false`, `ssl_mode=ENCRYPTED_ONLY` means accept only SSL
29344    /// connections, while `require_ssl=false` means accept both non-SSL
29345    /// and SSL connections. In this case, MySQL and PostgreSQL databases respect
29346    /// `ssl_mode` and accepts only SSL connections.
29347    pub ssl_mode: crate::model::ip_configuration::SslMode,
29348
29349    /// PSC settings for this instance.
29350    pub psc_config: std::option::Option<crate::model::PscConfig>,
29351
29352    /// Specify what type of CA is used for the server certificate.
29353    pub server_ca_mode: std::option::Option<crate::model::ip_configuration::CaMode>,
29354
29355    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
29356}
29357
29358impl IpConfiguration {
29359    pub fn new() -> Self {
29360        std::default::Default::default()
29361    }
29362
29363    /// Sets the value of [ipv4_enabled][crate::model::IpConfiguration::ipv4_enabled].
29364    pub fn set_ipv4_enabled<T>(mut self, v: T) -> Self
29365    where
29366        T: std::convert::Into<wkt::BoolValue>,
29367    {
29368        self.ipv4_enabled = std::option::Option::Some(v.into());
29369        self
29370    }
29371
29372    /// Sets or clears the value of [ipv4_enabled][crate::model::IpConfiguration::ipv4_enabled].
29373    pub fn set_or_clear_ipv4_enabled<T>(mut self, v: std::option::Option<T>) -> Self
29374    where
29375        T: std::convert::Into<wkt::BoolValue>,
29376    {
29377        self.ipv4_enabled = v.map(|x| x.into());
29378        self
29379    }
29380
29381    /// Sets the value of [private_network][crate::model::IpConfiguration::private_network].
29382    pub fn set_private_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
29383        self.private_network = v.into();
29384        self
29385    }
29386
29387    /// Sets the value of [require_ssl][crate::model::IpConfiguration::require_ssl].
29388    pub fn set_require_ssl<T>(mut self, v: T) -> Self
29389    where
29390        T: std::convert::Into<wkt::BoolValue>,
29391    {
29392        self.require_ssl = std::option::Option::Some(v.into());
29393        self
29394    }
29395
29396    /// Sets or clears the value of [require_ssl][crate::model::IpConfiguration::require_ssl].
29397    pub fn set_or_clear_require_ssl<T>(mut self, v: std::option::Option<T>) -> Self
29398    where
29399        T: std::convert::Into<wkt::BoolValue>,
29400    {
29401        self.require_ssl = v.map(|x| x.into());
29402        self
29403    }
29404
29405    /// Sets the value of [authorized_networks][crate::model::IpConfiguration::authorized_networks].
29406    pub fn set_authorized_networks<T, V>(mut self, v: T) -> Self
29407    where
29408        T: std::iter::IntoIterator<Item = V>,
29409        V: std::convert::Into<crate::model::AclEntry>,
29410    {
29411        use std::iter::Iterator;
29412        self.authorized_networks = v.into_iter().map(|i| i.into()).collect();
29413        self
29414    }
29415
29416    /// Sets the value of [allocated_ip_range][crate::model::IpConfiguration::allocated_ip_range].
29417    pub fn set_allocated_ip_range<T: std::convert::Into<std::string::String>>(
29418        mut self,
29419        v: T,
29420    ) -> Self {
29421        self.allocated_ip_range = v.into();
29422        self
29423    }
29424
29425    /// Sets the value of [enable_private_path_for_google_cloud_services][crate::model::IpConfiguration::enable_private_path_for_google_cloud_services].
29426    pub fn set_enable_private_path_for_google_cloud_services<T>(mut self, v: T) -> Self
29427    where
29428        T: std::convert::Into<wkt::BoolValue>,
29429    {
29430        self.enable_private_path_for_google_cloud_services = std::option::Option::Some(v.into());
29431        self
29432    }
29433
29434    /// Sets or clears the value of [enable_private_path_for_google_cloud_services][crate::model::IpConfiguration::enable_private_path_for_google_cloud_services].
29435    pub fn set_or_clear_enable_private_path_for_google_cloud_services<T>(
29436        mut self,
29437        v: std::option::Option<T>,
29438    ) -> Self
29439    where
29440        T: std::convert::Into<wkt::BoolValue>,
29441    {
29442        self.enable_private_path_for_google_cloud_services = v.map(|x| x.into());
29443        self
29444    }
29445
29446    /// Sets the value of [ssl_mode][crate::model::IpConfiguration::ssl_mode].
29447    pub fn set_ssl_mode<T: std::convert::Into<crate::model::ip_configuration::SslMode>>(
29448        mut self,
29449        v: T,
29450    ) -> Self {
29451        self.ssl_mode = v.into();
29452        self
29453    }
29454
29455    /// Sets the value of [psc_config][crate::model::IpConfiguration::psc_config].
29456    pub fn set_psc_config<T>(mut self, v: T) -> Self
29457    where
29458        T: std::convert::Into<crate::model::PscConfig>,
29459    {
29460        self.psc_config = std::option::Option::Some(v.into());
29461        self
29462    }
29463
29464    /// Sets or clears the value of [psc_config][crate::model::IpConfiguration::psc_config].
29465    pub fn set_or_clear_psc_config<T>(mut self, v: std::option::Option<T>) -> Self
29466    where
29467        T: std::convert::Into<crate::model::PscConfig>,
29468    {
29469        self.psc_config = v.map(|x| x.into());
29470        self
29471    }
29472
29473    /// Sets the value of [server_ca_mode][crate::model::IpConfiguration::server_ca_mode].
29474    pub fn set_server_ca_mode<T>(mut self, v: T) -> Self
29475    where
29476        T: std::convert::Into<crate::model::ip_configuration::CaMode>,
29477    {
29478        self.server_ca_mode = std::option::Option::Some(v.into());
29479        self
29480    }
29481
29482    /// Sets or clears the value of [server_ca_mode][crate::model::IpConfiguration::server_ca_mode].
29483    pub fn set_or_clear_server_ca_mode<T>(mut self, v: std::option::Option<T>) -> Self
29484    where
29485        T: std::convert::Into<crate::model::ip_configuration::CaMode>,
29486    {
29487        self.server_ca_mode = v.map(|x| x.into());
29488        self
29489    }
29490}
29491
29492impl wkt::message::Message for IpConfiguration {
29493    fn typename() -> &'static str {
29494        "type.googleapis.com/google.cloud.sql.v1.IpConfiguration"
29495    }
29496}
29497
29498#[doc(hidden)]
29499impl<'de> serde::de::Deserialize<'de> for IpConfiguration {
29500    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
29501    where
29502        D: serde::Deserializer<'de>,
29503    {
29504        #[allow(non_camel_case_types)]
29505        #[doc(hidden)]
29506        #[derive(PartialEq, Eq, Hash)]
29507        enum __FieldTag {
29508            __ipv4_enabled,
29509            __private_network,
29510            __require_ssl,
29511            __authorized_networks,
29512            __allocated_ip_range,
29513            __enable_private_path_for_google_cloud_services,
29514            __ssl_mode,
29515            __psc_config,
29516            __server_ca_mode,
29517            Unknown(std::string::String),
29518        }
29519        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
29520            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
29521            where
29522                D: serde::Deserializer<'de>,
29523            {
29524                struct Visitor;
29525                impl<'de> serde::de::Visitor<'de> for Visitor {
29526                    type Value = __FieldTag;
29527                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
29528                        formatter.write_str("a field name for IpConfiguration")
29529                    }
29530                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
29531                    where
29532                        E: serde::de::Error,
29533                    {
29534                        use std::result::Result::Ok;
29535                        use std::string::ToString;
29536                        match value {
29537                            "ipv4Enabled" => Ok(__FieldTag::__ipv4_enabled),
29538                            "ipv4_enabled" => Ok(__FieldTag::__ipv4_enabled),
29539                            "privateNetwork" => Ok(__FieldTag::__private_network),
29540                            "private_network" => Ok(__FieldTag::__private_network),
29541                            "requireSsl" => Ok(__FieldTag::__require_ssl),
29542                            "require_ssl" => Ok(__FieldTag::__require_ssl),
29543                            "authorizedNetworks" => Ok(__FieldTag::__authorized_networks),
29544                            "authorized_networks" => Ok(__FieldTag::__authorized_networks),
29545                            "allocatedIpRange" => Ok(__FieldTag::__allocated_ip_range),
29546                            "allocated_ip_range" => Ok(__FieldTag::__allocated_ip_range),
29547                            "enablePrivatePathForGoogleCloudServices" => {
29548                                Ok(__FieldTag::__enable_private_path_for_google_cloud_services)
29549                            }
29550                            "enable_private_path_for_google_cloud_services" => {
29551                                Ok(__FieldTag::__enable_private_path_for_google_cloud_services)
29552                            }
29553                            "sslMode" => Ok(__FieldTag::__ssl_mode),
29554                            "ssl_mode" => Ok(__FieldTag::__ssl_mode),
29555                            "pscConfig" => Ok(__FieldTag::__psc_config),
29556                            "psc_config" => Ok(__FieldTag::__psc_config),
29557                            "serverCaMode" => Ok(__FieldTag::__server_ca_mode),
29558                            "server_ca_mode" => Ok(__FieldTag::__server_ca_mode),
29559                            _ => Ok(__FieldTag::Unknown(value.to_string())),
29560                        }
29561                    }
29562                }
29563                deserializer.deserialize_identifier(Visitor)
29564            }
29565        }
29566        struct Visitor;
29567        impl<'de> serde::de::Visitor<'de> for Visitor {
29568            type Value = IpConfiguration;
29569            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
29570                formatter.write_str("struct IpConfiguration")
29571            }
29572            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
29573            where
29574                A: serde::de::MapAccess<'de>,
29575            {
29576                #[allow(unused_imports)]
29577                use serde::de::Error;
29578                use std::option::Option::Some;
29579                let mut fields = std::collections::HashSet::new();
29580                let mut result = Self::Value::new();
29581                while let Some(tag) = map.next_key::<__FieldTag>()? {
29582                    #[allow(clippy::match_single_binding)]
29583                    match tag {
29584                        __FieldTag::__ipv4_enabled => {
29585                            if !fields.insert(__FieldTag::__ipv4_enabled) {
29586                                return std::result::Result::Err(A::Error::duplicate_field(
29587                                    "multiple values for ipv4_enabled",
29588                                ));
29589                            }
29590                            result.ipv4_enabled =
29591                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
29592                        }
29593                        __FieldTag::__private_network => {
29594                            if !fields.insert(__FieldTag::__private_network) {
29595                                return std::result::Result::Err(A::Error::duplicate_field(
29596                                    "multiple values for private_network",
29597                                ));
29598                            }
29599                            result.private_network = map
29600                                .next_value::<std::option::Option<std::string::String>>()?
29601                                .unwrap_or_default();
29602                        }
29603                        __FieldTag::__require_ssl => {
29604                            if !fields.insert(__FieldTag::__require_ssl) {
29605                                return std::result::Result::Err(A::Error::duplicate_field(
29606                                    "multiple values for require_ssl",
29607                                ));
29608                            }
29609                            result.require_ssl =
29610                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
29611                        }
29612                        __FieldTag::__authorized_networks => {
29613                            if !fields.insert(__FieldTag::__authorized_networks) {
29614                                return std::result::Result::Err(A::Error::duplicate_field(
29615                                    "multiple values for authorized_networks",
29616                                ));
29617                            }
29618                            result.authorized_networks = map.next_value::<std::option::Option<std::vec::Vec<crate::model::AclEntry>>>()?.unwrap_or_default();
29619                        }
29620                        __FieldTag::__allocated_ip_range => {
29621                            if !fields.insert(__FieldTag::__allocated_ip_range) {
29622                                return std::result::Result::Err(A::Error::duplicate_field(
29623                                    "multiple values for allocated_ip_range",
29624                                ));
29625                            }
29626                            result.allocated_ip_range = map
29627                                .next_value::<std::option::Option<std::string::String>>()?
29628                                .unwrap_or_default();
29629                        }
29630                        __FieldTag::__enable_private_path_for_google_cloud_services => {
29631                            if !fields
29632                                .insert(__FieldTag::__enable_private_path_for_google_cloud_services)
29633                            {
29634                                return std::result::Result::Err(A::Error::duplicate_field(
29635                                    "multiple values for enable_private_path_for_google_cloud_services",
29636                                ));
29637                            }
29638                            result.enable_private_path_for_google_cloud_services =
29639                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
29640                        }
29641                        __FieldTag::__ssl_mode => {
29642                            if !fields.insert(__FieldTag::__ssl_mode) {
29643                                return std::result::Result::Err(A::Error::duplicate_field(
29644                                    "multiple values for ssl_mode",
29645                                ));
29646                            }
29647                            result.ssl_mode = map.next_value::<std::option::Option<crate::model::ip_configuration::SslMode>>()?.unwrap_or_default();
29648                        }
29649                        __FieldTag::__psc_config => {
29650                            if !fields.insert(__FieldTag::__psc_config) {
29651                                return std::result::Result::Err(A::Error::duplicate_field(
29652                                    "multiple values for psc_config",
29653                                ));
29654                            }
29655                            result.psc_config =
29656                                map.next_value::<std::option::Option<crate::model::PscConfig>>()?;
29657                        }
29658                        __FieldTag::__server_ca_mode => {
29659                            if !fields.insert(__FieldTag::__server_ca_mode) {
29660                                return std::result::Result::Err(A::Error::duplicate_field(
29661                                    "multiple values for server_ca_mode",
29662                                ));
29663                            }
29664                            result.server_ca_mode = map.next_value::<std::option::Option<crate::model::ip_configuration::CaMode>>()?
29665                                ;
29666                        }
29667                        __FieldTag::Unknown(key) => {
29668                            let value = map.next_value::<serde_json::Value>()?;
29669                            result._unknown_fields.insert(key, value);
29670                        }
29671                    }
29672                }
29673                std::result::Result::Ok(result)
29674            }
29675        }
29676        deserializer.deserialize_any(Visitor)
29677    }
29678}
29679
29680#[doc(hidden)]
29681impl serde::ser::Serialize for IpConfiguration {
29682    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
29683    where
29684        S: serde::ser::Serializer,
29685    {
29686        use serde::ser::SerializeMap;
29687        #[allow(unused_imports)]
29688        use std::option::Option::Some;
29689        let mut state = serializer.serialize_map(std::option::Option::None)?;
29690        if self.ipv4_enabled.is_some() {
29691            state.serialize_entry("ipv4Enabled", &self.ipv4_enabled)?;
29692        }
29693        if !self.private_network.is_empty() {
29694            state.serialize_entry("privateNetwork", &self.private_network)?;
29695        }
29696        if self.require_ssl.is_some() {
29697            state.serialize_entry("requireSsl", &self.require_ssl)?;
29698        }
29699        if !self.authorized_networks.is_empty() {
29700            state.serialize_entry("authorizedNetworks", &self.authorized_networks)?;
29701        }
29702        if !self.allocated_ip_range.is_empty() {
29703            state.serialize_entry("allocatedIpRange", &self.allocated_ip_range)?;
29704        }
29705        if self.enable_private_path_for_google_cloud_services.is_some() {
29706            state.serialize_entry(
29707                "enablePrivatePathForGoogleCloudServices",
29708                &self.enable_private_path_for_google_cloud_services,
29709            )?;
29710        }
29711        if !wkt::internal::is_default(&self.ssl_mode) {
29712            state.serialize_entry("sslMode", &self.ssl_mode)?;
29713        }
29714        if self.psc_config.is_some() {
29715            state.serialize_entry("pscConfig", &self.psc_config)?;
29716        }
29717        if self.server_ca_mode.is_some() {
29718            state.serialize_entry("serverCaMode", &self.server_ca_mode)?;
29719        }
29720        if !self._unknown_fields.is_empty() {
29721            for (key, value) in self._unknown_fields.iter() {
29722                state.serialize_entry(key, &value)?;
29723            }
29724        }
29725        state.end()
29726    }
29727}
29728
29729/// Defines additional types related to [IpConfiguration].
29730pub mod ip_configuration {
29731    #[allow(unused_imports)]
29732    use super::*;
29733
29734    /// The SSL options for database connections.
29735    ///
29736    /// # Working with unknown values
29737    ///
29738    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
29739    /// additional enum variants at any time. Adding new variants is not considered
29740    /// a breaking change. Applications should write their code in anticipation of:
29741    ///
29742    /// - New values appearing in future releases of the client library, **and**
29743    /// - New values received dynamically, without application changes.
29744    ///
29745    /// Please consult the [Working with enums] section in the user guide for some
29746    /// guidelines.
29747    ///
29748    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
29749    #[derive(Clone, Debug, PartialEq)]
29750    #[non_exhaustive]
29751    pub enum SslMode {
29752        /// The SSL mode is unknown.
29753        Unspecified,
29754        /// Allow non-SSL/non-TLS and SSL/TLS connections.
29755        /// For SSL connections to MySQL and PostgreSQL, the client certificate
29756        /// isn't verified.
29757        ///
29758        /// When this value is used, the legacy `require_ssl` flag must be false or
29759        /// cleared to avoid a conflict between the values of the two flags.
29760        AllowUnencryptedAndEncrypted,
29761        /// Only allow connections encrypted with SSL/TLS.
29762        /// For SSL connections to MySQL and PostgreSQL, the client certificate
29763        /// isn't verified.
29764        ///
29765        /// When this value is used, the legacy `require_ssl` flag must be false or
29766        /// cleared to avoid a conflict between the values of the two flags.
29767        EncryptedOnly,
29768        /// Only allow connections encrypted with SSL/TLS and with valid
29769        /// client certificates.
29770        ///
29771        /// When this value is used, the legacy `require_ssl` flag must be true or
29772        /// cleared to avoid the conflict between values of two flags.
29773        /// PostgreSQL clients or users that connect using IAM database
29774        /// authentication must use either the
29775        /// [Cloud SQL Auth
29776        /// Proxy](https://cloud.google.com/sql/docs/postgres/connect-auth-proxy) or
29777        /// [Cloud SQL
29778        /// Connectors](https://cloud.google.com/sql/docs/postgres/connect-connectors)
29779        /// to enforce client identity verification.
29780        ///
29781        /// Only applicable to MySQL and PostgreSQL. Not applicable to SQL Server.
29782        TrustedClientCertificateRequired,
29783        /// If set, the enum was initialized with an unknown value.
29784        ///
29785        /// Applications can examine the value using [SslMode::value] or
29786        /// [SslMode::name].
29787        UnknownValue(ssl_mode::UnknownValue),
29788    }
29789
29790    #[doc(hidden)]
29791    pub mod ssl_mode {
29792        #[allow(unused_imports)]
29793        use super::*;
29794        #[derive(Clone, Debug, PartialEq)]
29795        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
29796    }
29797
29798    impl SslMode {
29799        /// Gets the enum value.
29800        ///
29801        /// Returns `None` if the enum contains an unknown value deserialized from
29802        /// the string representation of enums.
29803        pub fn value(&self) -> std::option::Option<i32> {
29804            match self {
29805                Self::Unspecified => std::option::Option::Some(0),
29806                Self::AllowUnencryptedAndEncrypted => std::option::Option::Some(1),
29807                Self::EncryptedOnly => std::option::Option::Some(2),
29808                Self::TrustedClientCertificateRequired => std::option::Option::Some(3),
29809                Self::UnknownValue(u) => u.0.value(),
29810            }
29811        }
29812
29813        /// Gets the enum value as a string.
29814        ///
29815        /// Returns `None` if the enum contains an unknown value deserialized from
29816        /// the integer representation of enums.
29817        pub fn name(&self) -> std::option::Option<&str> {
29818            match self {
29819                Self::Unspecified => std::option::Option::Some("SSL_MODE_UNSPECIFIED"),
29820                Self::AllowUnencryptedAndEncrypted => {
29821                    std::option::Option::Some("ALLOW_UNENCRYPTED_AND_ENCRYPTED")
29822                }
29823                Self::EncryptedOnly => std::option::Option::Some("ENCRYPTED_ONLY"),
29824                Self::TrustedClientCertificateRequired => {
29825                    std::option::Option::Some("TRUSTED_CLIENT_CERTIFICATE_REQUIRED")
29826                }
29827                Self::UnknownValue(u) => u.0.name(),
29828            }
29829        }
29830    }
29831
29832    impl std::default::Default for SslMode {
29833        fn default() -> Self {
29834            use std::convert::From;
29835            Self::from(0)
29836        }
29837    }
29838
29839    impl std::fmt::Display for SslMode {
29840        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
29841            wkt::internal::display_enum(f, self.name(), self.value())
29842        }
29843    }
29844
29845    impl std::convert::From<i32> for SslMode {
29846        fn from(value: i32) -> Self {
29847            match value {
29848                0 => Self::Unspecified,
29849                1 => Self::AllowUnencryptedAndEncrypted,
29850                2 => Self::EncryptedOnly,
29851                3 => Self::TrustedClientCertificateRequired,
29852                _ => Self::UnknownValue(ssl_mode::UnknownValue(
29853                    wkt::internal::UnknownEnumValue::Integer(value),
29854                )),
29855            }
29856        }
29857    }
29858
29859    impl std::convert::From<&str> for SslMode {
29860        fn from(value: &str) -> Self {
29861            use std::string::ToString;
29862            match value {
29863                "SSL_MODE_UNSPECIFIED" => Self::Unspecified,
29864                "ALLOW_UNENCRYPTED_AND_ENCRYPTED" => Self::AllowUnencryptedAndEncrypted,
29865                "ENCRYPTED_ONLY" => Self::EncryptedOnly,
29866                "TRUSTED_CLIENT_CERTIFICATE_REQUIRED" => Self::TrustedClientCertificateRequired,
29867                _ => Self::UnknownValue(ssl_mode::UnknownValue(
29868                    wkt::internal::UnknownEnumValue::String(value.to_string()),
29869                )),
29870            }
29871        }
29872    }
29873
29874    impl serde::ser::Serialize for SslMode {
29875        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
29876        where
29877            S: serde::Serializer,
29878        {
29879            match self {
29880                Self::Unspecified => serializer.serialize_i32(0),
29881                Self::AllowUnencryptedAndEncrypted => serializer.serialize_i32(1),
29882                Self::EncryptedOnly => serializer.serialize_i32(2),
29883                Self::TrustedClientCertificateRequired => serializer.serialize_i32(3),
29884                Self::UnknownValue(u) => u.0.serialize(serializer),
29885            }
29886        }
29887    }
29888
29889    impl<'de> serde::de::Deserialize<'de> for SslMode {
29890        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
29891        where
29892            D: serde::Deserializer<'de>,
29893        {
29894            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SslMode>::new(
29895                ".google.cloud.sql.v1.IpConfiguration.SslMode",
29896            ))
29897        }
29898    }
29899
29900    /// Various Certificate Authority (CA) modes for certificate signing.
29901    ///
29902    /// # Working with unknown values
29903    ///
29904    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
29905    /// additional enum variants at any time. Adding new variants is not considered
29906    /// a breaking change. Applications should write their code in anticipation of:
29907    ///
29908    /// - New values appearing in future releases of the client library, **and**
29909    /// - New values received dynamically, without application changes.
29910    ///
29911    /// Please consult the [Working with enums] section in the user guide for some
29912    /// guidelines.
29913    ///
29914    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
29915    #[derive(Clone, Debug, PartialEq)]
29916    #[non_exhaustive]
29917    pub enum CaMode {
29918        /// CA mode is unknown.
29919        Unspecified,
29920        /// Google-managed self-signed internal CA.
29921        GoogleManagedInternalCa,
29922        /// Google-managed regional CA part of root CA hierarchy hosted on Google
29923        /// Cloud's Certificate Authority Service (CAS).
29924        GoogleManagedCasCa,
29925        /// If set, the enum was initialized with an unknown value.
29926        ///
29927        /// Applications can examine the value using [CaMode::value] or
29928        /// [CaMode::name].
29929        UnknownValue(ca_mode::UnknownValue),
29930    }
29931
29932    #[doc(hidden)]
29933    pub mod ca_mode {
29934        #[allow(unused_imports)]
29935        use super::*;
29936        #[derive(Clone, Debug, PartialEq)]
29937        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
29938    }
29939
29940    impl CaMode {
29941        /// Gets the enum value.
29942        ///
29943        /// Returns `None` if the enum contains an unknown value deserialized from
29944        /// the string representation of enums.
29945        pub fn value(&self) -> std::option::Option<i32> {
29946            match self {
29947                Self::Unspecified => std::option::Option::Some(0),
29948                Self::GoogleManagedInternalCa => std::option::Option::Some(1),
29949                Self::GoogleManagedCasCa => std::option::Option::Some(2),
29950                Self::UnknownValue(u) => u.0.value(),
29951            }
29952        }
29953
29954        /// Gets the enum value as a string.
29955        ///
29956        /// Returns `None` if the enum contains an unknown value deserialized from
29957        /// the integer representation of enums.
29958        pub fn name(&self) -> std::option::Option<&str> {
29959            match self {
29960                Self::Unspecified => std::option::Option::Some("CA_MODE_UNSPECIFIED"),
29961                Self::GoogleManagedInternalCa => {
29962                    std::option::Option::Some("GOOGLE_MANAGED_INTERNAL_CA")
29963                }
29964                Self::GoogleManagedCasCa => std::option::Option::Some("GOOGLE_MANAGED_CAS_CA"),
29965                Self::UnknownValue(u) => u.0.name(),
29966            }
29967        }
29968    }
29969
29970    impl std::default::Default for CaMode {
29971        fn default() -> Self {
29972            use std::convert::From;
29973            Self::from(0)
29974        }
29975    }
29976
29977    impl std::fmt::Display for CaMode {
29978        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
29979            wkt::internal::display_enum(f, self.name(), self.value())
29980        }
29981    }
29982
29983    impl std::convert::From<i32> for CaMode {
29984        fn from(value: i32) -> Self {
29985            match value {
29986                0 => Self::Unspecified,
29987                1 => Self::GoogleManagedInternalCa,
29988                2 => Self::GoogleManagedCasCa,
29989                _ => Self::UnknownValue(ca_mode::UnknownValue(
29990                    wkt::internal::UnknownEnumValue::Integer(value),
29991                )),
29992            }
29993        }
29994    }
29995
29996    impl std::convert::From<&str> for CaMode {
29997        fn from(value: &str) -> Self {
29998            use std::string::ToString;
29999            match value {
30000                "CA_MODE_UNSPECIFIED" => Self::Unspecified,
30001                "GOOGLE_MANAGED_INTERNAL_CA" => Self::GoogleManagedInternalCa,
30002                "GOOGLE_MANAGED_CAS_CA" => Self::GoogleManagedCasCa,
30003                _ => Self::UnknownValue(ca_mode::UnknownValue(
30004                    wkt::internal::UnknownEnumValue::String(value.to_string()),
30005                )),
30006            }
30007        }
30008    }
30009
30010    impl serde::ser::Serialize for CaMode {
30011        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
30012        where
30013            S: serde::Serializer,
30014        {
30015            match self {
30016                Self::Unspecified => serializer.serialize_i32(0),
30017                Self::GoogleManagedInternalCa => serializer.serialize_i32(1),
30018                Self::GoogleManagedCasCa => serializer.serialize_i32(2),
30019                Self::UnknownValue(u) => u.0.serialize(serializer),
30020            }
30021        }
30022    }
30023
30024    impl<'de> serde::de::Deserialize<'de> for CaMode {
30025        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30026        where
30027            D: serde::Deserializer<'de>,
30028        {
30029            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CaMode>::new(
30030                ".google.cloud.sql.v1.IpConfiguration.CaMode",
30031            ))
30032        }
30033    }
30034}
30035
30036/// PSC settings for a Cloud SQL instance.
30037#[derive(Clone, Debug, Default, PartialEq)]
30038#[non_exhaustive]
30039pub struct PscConfig {
30040    /// Whether PSC connectivity is enabled for this instance.
30041    pub psc_enabled: std::option::Option<bool>,
30042
30043    /// Optional. The list of consumer projects that are allow-listed for PSC
30044    /// connections to this instance. This instance can be connected to with PSC
30045    /// from any network in these projects.
30046    ///
30047    /// Each consumer project in this list may be represented by a project number
30048    /// (numeric) or by a project id (alphanumeric).
30049    pub allowed_consumer_projects: std::vec::Vec<std::string::String>,
30050
30051    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
30052}
30053
30054impl PscConfig {
30055    pub fn new() -> Self {
30056        std::default::Default::default()
30057    }
30058
30059    /// Sets the value of [psc_enabled][crate::model::PscConfig::psc_enabled].
30060    pub fn set_psc_enabled<T>(mut self, v: T) -> Self
30061    where
30062        T: std::convert::Into<bool>,
30063    {
30064        self.psc_enabled = std::option::Option::Some(v.into());
30065        self
30066    }
30067
30068    /// Sets or clears the value of [psc_enabled][crate::model::PscConfig::psc_enabled].
30069    pub fn set_or_clear_psc_enabled<T>(mut self, v: std::option::Option<T>) -> Self
30070    where
30071        T: std::convert::Into<bool>,
30072    {
30073        self.psc_enabled = v.map(|x| x.into());
30074        self
30075    }
30076
30077    /// Sets the value of [allowed_consumer_projects][crate::model::PscConfig::allowed_consumer_projects].
30078    pub fn set_allowed_consumer_projects<T, V>(mut self, v: T) -> Self
30079    where
30080        T: std::iter::IntoIterator<Item = V>,
30081        V: std::convert::Into<std::string::String>,
30082    {
30083        use std::iter::Iterator;
30084        self.allowed_consumer_projects = v.into_iter().map(|i| i.into()).collect();
30085        self
30086    }
30087}
30088
30089impl wkt::message::Message for PscConfig {
30090    fn typename() -> &'static str {
30091        "type.googleapis.com/google.cloud.sql.v1.PscConfig"
30092    }
30093}
30094
30095#[doc(hidden)]
30096impl<'de> serde::de::Deserialize<'de> for PscConfig {
30097    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30098    where
30099        D: serde::Deserializer<'de>,
30100    {
30101        #[allow(non_camel_case_types)]
30102        #[doc(hidden)]
30103        #[derive(PartialEq, Eq, Hash)]
30104        enum __FieldTag {
30105            __psc_enabled,
30106            __allowed_consumer_projects,
30107            Unknown(std::string::String),
30108        }
30109        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
30110            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30111            where
30112                D: serde::Deserializer<'de>,
30113            {
30114                struct Visitor;
30115                impl<'de> serde::de::Visitor<'de> for Visitor {
30116                    type Value = __FieldTag;
30117                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
30118                        formatter.write_str("a field name for PscConfig")
30119                    }
30120                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
30121                    where
30122                        E: serde::de::Error,
30123                    {
30124                        use std::result::Result::Ok;
30125                        use std::string::ToString;
30126                        match value {
30127                            "pscEnabled" => Ok(__FieldTag::__psc_enabled),
30128                            "psc_enabled" => Ok(__FieldTag::__psc_enabled),
30129                            "allowedConsumerProjects" => {
30130                                Ok(__FieldTag::__allowed_consumer_projects)
30131                            }
30132                            "allowed_consumer_projects" => {
30133                                Ok(__FieldTag::__allowed_consumer_projects)
30134                            }
30135                            _ => Ok(__FieldTag::Unknown(value.to_string())),
30136                        }
30137                    }
30138                }
30139                deserializer.deserialize_identifier(Visitor)
30140            }
30141        }
30142        struct Visitor;
30143        impl<'de> serde::de::Visitor<'de> for Visitor {
30144            type Value = PscConfig;
30145            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
30146                formatter.write_str("struct PscConfig")
30147            }
30148            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
30149            where
30150                A: serde::de::MapAccess<'de>,
30151            {
30152                #[allow(unused_imports)]
30153                use serde::de::Error;
30154                use std::option::Option::Some;
30155                let mut fields = std::collections::HashSet::new();
30156                let mut result = Self::Value::new();
30157                while let Some(tag) = map.next_key::<__FieldTag>()? {
30158                    #[allow(clippy::match_single_binding)]
30159                    match tag {
30160                        __FieldTag::__psc_enabled => {
30161                            if !fields.insert(__FieldTag::__psc_enabled) {
30162                                return std::result::Result::Err(A::Error::duplicate_field(
30163                                    "multiple values for psc_enabled",
30164                                ));
30165                            }
30166                            result.psc_enabled = map.next_value::<std::option::Option<bool>>()?;
30167                        }
30168                        __FieldTag::__allowed_consumer_projects => {
30169                            if !fields.insert(__FieldTag::__allowed_consumer_projects) {
30170                                return std::result::Result::Err(A::Error::duplicate_field(
30171                                    "multiple values for allowed_consumer_projects",
30172                                ));
30173                            }
30174                            result.allowed_consumer_projects = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
30175                        }
30176                        __FieldTag::Unknown(key) => {
30177                            let value = map.next_value::<serde_json::Value>()?;
30178                            result._unknown_fields.insert(key, value);
30179                        }
30180                    }
30181                }
30182                std::result::Result::Ok(result)
30183            }
30184        }
30185        deserializer.deserialize_any(Visitor)
30186    }
30187}
30188
30189#[doc(hidden)]
30190impl serde::ser::Serialize for PscConfig {
30191    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
30192    where
30193        S: serde::ser::Serializer,
30194    {
30195        use serde::ser::SerializeMap;
30196        #[allow(unused_imports)]
30197        use std::option::Option::Some;
30198        let mut state = serializer.serialize_map(std::option::Option::None)?;
30199        if self.psc_enabled.is_some() {
30200            state.serialize_entry("pscEnabled", &self.psc_enabled)?;
30201        }
30202        if !self.allowed_consumer_projects.is_empty() {
30203            state.serialize_entry("allowedConsumerProjects", &self.allowed_consumer_projects)?;
30204        }
30205        if !self._unknown_fields.is_empty() {
30206            for (key, value) in self._unknown_fields.iter() {
30207                state.serialize_entry(key, &value)?;
30208            }
30209        }
30210        state.end()
30211    }
30212}
30213
30214/// Preferred location. This specifies where a Cloud SQL instance is located.
30215/// Note that if the preferred location is not available, the instance will be
30216/// located as close as possible within the region. Only one location may be
30217/// specified.
30218#[derive(Clone, Debug, Default, PartialEq)]
30219#[non_exhaustive]
30220pub struct LocationPreference {
30221    /// The App Engine application to follow, it must be in the same region as the
30222    /// Cloud SQL instance. WARNING: Changing this might restart the instance.
30223    #[deprecated]
30224    pub follow_gae_application: std::string::String,
30225
30226    /// The preferred Compute Engine zone (for example: us-central1-a,
30227    /// us-central1-b, etc.). WARNING: Changing this might restart the instance.
30228    pub zone: std::string::String,
30229
30230    /// The preferred Compute Engine zone for the secondary/failover
30231    /// (for example: us-central1-a, us-central1-b, etc.).
30232    /// To disable this field, set it to 'no_secondary_zone'.
30233    pub secondary_zone: std::string::String,
30234
30235    /// This is always `sql#locationPreference`.
30236    pub kind: std::string::String,
30237
30238    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
30239}
30240
30241impl LocationPreference {
30242    pub fn new() -> Self {
30243        std::default::Default::default()
30244    }
30245
30246    /// Sets the value of [follow_gae_application][crate::model::LocationPreference::follow_gae_application].
30247    #[deprecated]
30248    pub fn set_follow_gae_application<T: std::convert::Into<std::string::String>>(
30249        mut self,
30250        v: T,
30251    ) -> Self {
30252        self.follow_gae_application = v.into();
30253        self
30254    }
30255
30256    /// Sets the value of [zone][crate::model::LocationPreference::zone].
30257    pub fn set_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
30258        self.zone = v.into();
30259        self
30260    }
30261
30262    /// Sets the value of [secondary_zone][crate::model::LocationPreference::secondary_zone].
30263    pub fn set_secondary_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
30264        self.secondary_zone = v.into();
30265        self
30266    }
30267
30268    /// Sets the value of [kind][crate::model::LocationPreference::kind].
30269    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
30270        self.kind = v.into();
30271        self
30272    }
30273}
30274
30275impl wkt::message::Message for LocationPreference {
30276    fn typename() -> &'static str {
30277        "type.googleapis.com/google.cloud.sql.v1.LocationPreference"
30278    }
30279}
30280
30281#[doc(hidden)]
30282impl<'de> serde::de::Deserialize<'de> for LocationPreference {
30283    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30284    where
30285        D: serde::Deserializer<'de>,
30286    {
30287        #[allow(non_camel_case_types)]
30288        #[doc(hidden)]
30289        #[derive(PartialEq, Eq, Hash)]
30290        enum __FieldTag {
30291            __follow_gae_application,
30292            __zone,
30293            __secondary_zone,
30294            __kind,
30295            Unknown(std::string::String),
30296        }
30297        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
30298            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30299            where
30300                D: serde::Deserializer<'de>,
30301            {
30302                struct Visitor;
30303                impl<'de> serde::de::Visitor<'de> for Visitor {
30304                    type Value = __FieldTag;
30305                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
30306                        formatter.write_str("a field name for LocationPreference")
30307                    }
30308                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
30309                    where
30310                        E: serde::de::Error,
30311                    {
30312                        use std::result::Result::Ok;
30313                        use std::string::ToString;
30314                        match value {
30315                            "followGaeApplication" => Ok(__FieldTag::__follow_gae_application),
30316                            "follow_gae_application" => Ok(__FieldTag::__follow_gae_application),
30317                            "zone" => Ok(__FieldTag::__zone),
30318                            "secondaryZone" => Ok(__FieldTag::__secondary_zone),
30319                            "secondary_zone" => Ok(__FieldTag::__secondary_zone),
30320                            "kind" => Ok(__FieldTag::__kind),
30321                            _ => Ok(__FieldTag::Unknown(value.to_string())),
30322                        }
30323                    }
30324                }
30325                deserializer.deserialize_identifier(Visitor)
30326            }
30327        }
30328        struct Visitor;
30329        impl<'de> serde::de::Visitor<'de> for Visitor {
30330            type Value = LocationPreference;
30331            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
30332                formatter.write_str("struct LocationPreference")
30333            }
30334            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
30335            where
30336                A: serde::de::MapAccess<'de>,
30337            {
30338                #[allow(unused_imports)]
30339                use serde::de::Error;
30340                use std::option::Option::Some;
30341                let mut fields = std::collections::HashSet::new();
30342                let mut result = Self::Value::new();
30343                while let Some(tag) = map.next_key::<__FieldTag>()? {
30344                    #[allow(clippy::match_single_binding)]
30345                    match tag {
30346                        __FieldTag::__follow_gae_application => {
30347                            if !fields.insert(__FieldTag::__follow_gae_application) {
30348                                return std::result::Result::Err(A::Error::duplicate_field(
30349                                    "multiple values for follow_gae_application",
30350                                ));
30351                            }
30352                            result.follow_gae_application = map
30353                                .next_value::<std::option::Option<std::string::String>>()?
30354                                .unwrap_or_default();
30355                        }
30356                        __FieldTag::__zone => {
30357                            if !fields.insert(__FieldTag::__zone) {
30358                                return std::result::Result::Err(A::Error::duplicate_field(
30359                                    "multiple values for zone",
30360                                ));
30361                            }
30362                            result.zone = map
30363                                .next_value::<std::option::Option<std::string::String>>()?
30364                                .unwrap_or_default();
30365                        }
30366                        __FieldTag::__secondary_zone => {
30367                            if !fields.insert(__FieldTag::__secondary_zone) {
30368                                return std::result::Result::Err(A::Error::duplicate_field(
30369                                    "multiple values for secondary_zone",
30370                                ));
30371                            }
30372                            result.secondary_zone = map
30373                                .next_value::<std::option::Option<std::string::String>>()?
30374                                .unwrap_or_default();
30375                        }
30376                        __FieldTag::__kind => {
30377                            if !fields.insert(__FieldTag::__kind) {
30378                                return std::result::Result::Err(A::Error::duplicate_field(
30379                                    "multiple values for kind",
30380                                ));
30381                            }
30382                            result.kind = map
30383                                .next_value::<std::option::Option<std::string::String>>()?
30384                                .unwrap_or_default();
30385                        }
30386                        __FieldTag::Unknown(key) => {
30387                            let value = map.next_value::<serde_json::Value>()?;
30388                            result._unknown_fields.insert(key, value);
30389                        }
30390                    }
30391                }
30392                std::result::Result::Ok(result)
30393            }
30394        }
30395        deserializer.deserialize_any(Visitor)
30396    }
30397}
30398
30399#[doc(hidden)]
30400impl serde::ser::Serialize for LocationPreference {
30401    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
30402    where
30403        S: serde::ser::Serializer,
30404    {
30405        use serde::ser::SerializeMap;
30406        #[allow(unused_imports)]
30407        use std::option::Option::Some;
30408        let mut state = serializer.serialize_map(std::option::Option::None)?;
30409        if !self.follow_gae_application.is_empty() {
30410            state.serialize_entry("followGaeApplication", &self.follow_gae_application)?;
30411        }
30412        if !self.zone.is_empty() {
30413            state.serialize_entry("zone", &self.zone)?;
30414        }
30415        if !self.secondary_zone.is_empty() {
30416            state.serialize_entry("secondaryZone", &self.secondary_zone)?;
30417        }
30418        if !self.kind.is_empty() {
30419            state.serialize_entry("kind", &self.kind)?;
30420        }
30421        if !self._unknown_fields.is_empty() {
30422            for (key, value) in self._unknown_fields.iter() {
30423                state.serialize_entry(key, &value)?;
30424            }
30425        }
30426        state.end()
30427    }
30428}
30429
30430/// Maintenance window. This specifies when a Cloud SQL instance is
30431/// restarted for system maintenance purposes.
30432#[derive(Clone, Debug, Default, PartialEq)]
30433#[non_exhaustive]
30434pub struct MaintenanceWindow {
30435    /// Hour of day - 0 to 23. Specify in the UTC time zone.
30436    pub hour: std::option::Option<wkt::Int32Value>,
30437
30438    /// Day of week - `MONDAY`, `TUESDAY`, `WEDNESDAY`, `THURSDAY`, `FRIDAY`,
30439    /// `SATURDAY`, or `SUNDAY`. Specify in the UTC time zone.
30440    /// Returned in output as an integer, 1 to 7, where `1` equals Monday.
30441    pub day: std::option::Option<wkt::Int32Value>,
30442
30443    /// Maintenance timing settings: `canary`, `stable`, or `week5`.
30444    /// For more information, see [About maintenance on Cloud SQL
30445    /// instances](https://cloud.google.com/sql/docs/mysql/maintenance).
30446    pub update_track: crate::model::SqlUpdateTrack,
30447
30448    /// This is always `sql#maintenanceWindow`.
30449    pub kind: std::string::String,
30450
30451    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
30452}
30453
30454impl MaintenanceWindow {
30455    pub fn new() -> Self {
30456        std::default::Default::default()
30457    }
30458
30459    /// Sets the value of [hour][crate::model::MaintenanceWindow::hour].
30460    pub fn set_hour<T>(mut self, v: T) -> Self
30461    where
30462        T: std::convert::Into<wkt::Int32Value>,
30463    {
30464        self.hour = std::option::Option::Some(v.into());
30465        self
30466    }
30467
30468    /// Sets or clears the value of [hour][crate::model::MaintenanceWindow::hour].
30469    pub fn set_or_clear_hour<T>(mut self, v: std::option::Option<T>) -> Self
30470    where
30471        T: std::convert::Into<wkt::Int32Value>,
30472    {
30473        self.hour = v.map(|x| x.into());
30474        self
30475    }
30476
30477    /// Sets the value of [day][crate::model::MaintenanceWindow::day].
30478    pub fn set_day<T>(mut self, v: T) -> Self
30479    where
30480        T: std::convert::Into<wkt::Int32Value>,
30481    {
30482        self.day = std::option::Option::Some(v.into());
30483        self
30484    }
30485
30486    /// Sets or clears the value of [day][crate::model::MaintenanceWindow::day].
30487    pub fn set_or_clear_day<T>(mut self, v: std::option::Option<T>) -> Self
30488    where
30489        T: std::convert::Into<wkt::Int32Value>,
30490    {
30491        self.day = v.map(|x| x.into());
30492        self
30493    }
30494
30495    /// Sets the value of [update_track][crate::model::MaintenanceWindow::update_track].
30496    pub fn set_update_track<T: std::convert::Into<crate::model::SqlUpdateTrack>>(
30497        mut self,
30498        v: T,
30499    ) -> Self {
30500        self.update_track = v.into();
30501        self
30502    }
30503
30504    /// Sets the value of [kind][crate::model::MaintenanceWindow::kind].
30505    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
30506        self.kind = v.into();
30507        self
30508    }
30509}
30510
30511impl wkt::message::Message for MaintenanceWindow {
30512    fn typename() -> &'static str {
30513        "type.googleapis.com/google.cloud.sql.v1.MaintenanceWindow"
30514    }
30515}
30516
30517#[doc(hidden)]
30518impl<'de> serde::de::Deserialize<'de> for MaintenanceWindow {
30519    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30520    where
30521        D: serde::Deserializer<'de>,
30522    {
30523        #[allow(non_camel_case_types)]
30524        #[doc(hidden)]
30525        #[derive(PartialEq, Eq, Hash)]
30526        enum __FieldTag {
30527            __hour,
30528            __day,
30529            __update_track,
30530            __kind,
30531            Unknown(std::string::String),
30532        }
30533        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
30534            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30535            where
30536                D: serde::Deserializer<'de>,
30537            {
30538                struct Visitor;
30539                impl<'de> serde::de::Visitor<'de> for Visitor {
30540                    type Value = __FieldTag;
30541                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
30542                        formatter.write_str("a field name for MaintenanceWindow")
30543                    }
30544                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
30545                    where
30546                        E: serde::de::Error,
30547                    {
30548                        use std::result::Result::Ok;
30549                        use std::string::ToString;
30550                        match value {
30551                            "hour" => Ok(__FieldTag::__hour),
30552                            "day" => Ok(__FieldTag::__day),
30553                            "updateTrack" => Ok(__FieldTag::__update_track),
30554                            "update_track" => Ok(__FieldTag::__update_track),
30555                            "kind" => Ok(__FieldTag::__kind),
30556                            _ => Ok(__FieldTag::Unknown(value.to_string())),
30557                        }
30558                    }
30559                }
30560                deserializer.deserialize_identifier(Visitor)
30561            }
30562        }
30563        struct Visitor;
30564        impl<'de> serde::de::Visitor<'de> for Visitor {
30565            type Value = MaintenanceWindow;
30566            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
30567                formatter.write_str("struct MaintenanceWindow")
30568            }
30569            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
30570            where
30571                A: serde::de::MapAccess<'de>,
30572            {
30573                #[allow(unused_imports)]
30574                use serde::de::Error;
30575                use std::option::Option::Some;
30576                let mut fields = std::collections::HashSet::new();
30577                let mut result = Self::Value::new();
30578                while let Some(tag) = map.next_key::<__FieldTag>()? {
30579                    #[allow(clippy::match_single_binding)]
30580                    match tag {
30581                        __FieldTag::__hour => {
30582                            if !fields.insert(__FieldTag::__hour) {
30583                                return std::result::Result::Err(A::Error::duplicate_field(
30584                                    "multiple values for hour",
30585                                ));
30586                            }
30587                            struct __With(std::option::Option<wkt::Int32Value>);
30588                            impl<'de> serde::de::Deserialize<'de> for __With {
30589                                fn deserialize<D>(
30590                                    deserializer: D,
30591                                ) -> std::result::Result<Self, D::Error>
30592                                where
30593                                    D: serde::de::Deserializer<'de>,
30594                                {
30595                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
30596                                }
30597                            }
30598                            result.hour = map.next_value::<__With>()?.0;
30599                        }
30600                        __FieldTag::__day => {
30601                            if !fields.insert(__FieldTag::__day) {
30602                                return std::result::Result::Err(A::Error::duplicate_field(
30603                                    "multiple values for day",
30604                                ));
30605                            }
30606                            struct __With(std::option::Option<wkt::Int32Value>);
30607                            impl<'de> serde::de::Deserialize<'de> for __With {
30608                                fn deserialize<D>(
30609                                    deserializer: D,
30610                                ) -> std::result::Result<Self, D::Error>
30611                                where
30612                                    D: serde::de::Deserializer<'de>,
30613                                {
30614                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
30615                                }
30616                            }
30617                            result.day = map.next_value::<__With>()?.0;
30618                        }
30619                        __FieldTag::__update_track => {
30620                            if !fields.insert(__FieldTag::__update_track) {
30621                                return std::result::Result::Err(A::Error::duplicate_field(
30622                                    "multiple values for update_track",
30623                                ));
30624                            }
30625                            result.update_track = map
30626                                .next_value::<std::option::Option<crate::model::SqlUpdateTrack>>()?
30627                                .unwrap_or_default();
30628                        }
30629                        __FieldTag::__kind => {
30630                            if !fields.insert(__FieldTag::__kind) {
30631                                return std::result::Result::Err(A::Error::duplicate_field(
30632                                    "multiple values for kind",
30633                                ));
30634                            }
30635                            result.kind = map
30636                                .next_value::<std::option::Option<std::string::String>>()?
30637                                .unwrap_or_default();
30638                        }
30639                        __FieldTag::Unknown(key) => {
30640                            let value = map.next_value::<serde_json::Value>()?;
30641                            result._unknown_fields.insert(key, value);
30642                        }
30643                    }
30644                }
30645                std::result::Result::Ok(result)
30646            }
30647        }
30648        deserializer.deserialize_any(Visitor)
30649    }
30650}
30651
30652#[doc(hidden)]
30653impl serde::ser::Serialize for MaintenanceWindow {
30654    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
30655    where
30656        S: serde::ser::Serializer,
30657    {
30658        use serde::ser::SerializeMap;
30659        #[allow(unused_imports)]
30660        use std::option::Option::Some;
30661        let mut state = serializer.serialize_map(std::option::Option::None)?;
30662        if self.hour.is_some() {
30663            struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
30664            impl<'a> serde::ser::Serialize for __With<'a> {
30665                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
30666                where
30667                    S: serde::ser::Serializer,
30668                {
30669                    serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
30670                        self.0, serializer,
30671                    )
30672                }
30673            }
30674            state.serialize_entry("hour", &__With(&self.hour))?;
30675        }
30676        if self.day.is_some() {
30677            struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
30678            impl<'a> serde::ser::Serialize for __With<'a> {
30679                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
30680                where
30681                    S: serde::ser::Serializer,
30682                {
30683                    serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
30684                        self.0, serializer,
30685                    )
30686                }
30687            }
30688            state.serialize_entry("day", &__With(&self.day))?;
30689        }
30690        if !wkt::internal::is_default(&self.update_track) {
30691            state.serialize_entry("updateTrack", &self.update_track)?;
30692        }
30693        if !self.kind.is_empty() {
30694            state.serialize_entry("kind", &self.kind)?;
30695        }
30696        if !self._unknown_fields.is_empty() {
30697            for (key, value) in self._unknown_fields.iter() {
30698                state.serialize_entry(key, &value)?;
30699            }
30700        }
30701        state.end()
30702    }
30703}
30704
30705/// Deny maintenance Periods. This specifies a date range during when all CSA
30706/// rollout will be denied.
30707#[derive(Clone, Debug, Default, PartialEq)]
30708#[non_exhaustive]
30709pub struct DenyMaintenancePeriod {
30710    /// "deny maintenance period" start date. If the year of the start date is
30711    /// empty, the year of the end date also must be empty. In this case, it means
30712    /// the deny maintenance period recurs every year. The date is in format
30713    /// yyyy-mm-dd i.e., 2020-11-01, or mm-dd, i.e., 11-01
30714    pub start_date: std::string::String,
30715
30716    /// "deny maintenance period" end date. If the year of the end date is empty,
30717    /// the year of the start date also must be empty. In this case, it means the
30718    /// no maintenance interval recurs every year. The date is in format yyyy-mm-dd
30719    /// i.e., 2020-11-01, or mm-dd, i.e., 11-01
30720    pub end_date: std::string::String,
30721
30722    /// Time in UTC when the "deny maintenance period" starts on start_date and
30723    /// ends on end_date. The time is in format: HH:mm:SS, i.e., 00:00:00
30724    pub time: std::string::String,
30725
30726    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
30727}
30728
30729impl DenyMaintenancePeriod {
30730    pub fn new() -> Self {
30731        std::default::Default::default()
30732    }
30733
30734    /// Sets the value of [start_date][crate::model::DenyMaintenancePeriod::start_date].
30735    pub fn set_start_date<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
30736        self.start_date = v.into();
30737        self
30738    }
30739
30740    /// Sets the value of [end_date][crate::model::DenyMaintenancePeriod::end_date].
30741    pub fn set_end_date<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
30742        self.end_date = v.into();
30743        self
30744    }
30745
30746    /// Sets the value of [time][crate::model::DenyMaintenancePeriod::time].
30747    pub fn set_time<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
30748        self.time = v.into();
30749        self
30750    }
30751}
30752
30753impl wkt::message::Message for DenyMaintenancePeriod {
30754    fn typename() -> &'static str {
30755        "type.googleapis.com/google.cloud.sql.v1.DenyMaintenancePeriod"
30756    }
30757}
30758
30759#[doc(hidden)]
30760impl<'de> serde::de::Deserialize<'de> for DenyMaintenancePeriod {
30761    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30762    where
30763        D: serde::Deserializer<'de>,
30764    {
30765        #[allow(non_camel_case_types)]
30766        #[doc(hidden)]
30767        #[derive(PartialEq, Eq, Hash)]
30768        enum __FieldTag {
30769            __start_date,
30770            __end_date,
30771            __time,
30772            Unknown(std::string::String),
30773        }
30774        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
30775            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30776            where
30777                D: serde::Deserializer<'de>,
30778            {
30779                struct Visitor;
30780                impl<'de> serde::de::Visitor<'de> for Visitor {
30781                    type Value = __FieldTag;
30782                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
30783                        formatter.write_str("a field name for DenyMaintenancePeriod")
30784                    }
30785                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
30786                    where
30787                        E: serde::de::Error,
30788                    {
30789                        use std::result::Result::Ok;
30790                        use std::string::ToString;
30791                        match value {
30792                            "startDate" => Ok(__FieldTag::__start_date),
30793                            "start_date" => Ok(__FieldTag::__start_date),
30794                            "endDate" => Ok(__FieldTag::__end_date),
30795                            "end_date" => Ok(__FieldTag::__end_date),
30796                            "time" => Ok(__FieldTag::__time),
30797                            _ => Ok(__FieldTag::Unknown(value.to_string())),
30798                        }
30799                    }
30800                }
30801                deserializer.deserialize_identifier(Visitor)
30802            }
30803        }
30804        struct Visitor;
30805        impl<'de> serde::de::Visitor<'de> for Visitor {
30806            type Value = DenyMaintenancePeriod;
30807            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
30808                formatter.write_str("struct DenyMaintenancePeriod")
30809            }
30810            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
30811            where
30812                A: serde::de::MapAccess<'de>,
30813            {
30814                #[allow(unused_imports)]
30815                use serde::de::Error;
30816                use std::option::Option::Some;
30817                let mut fields = std::collections::HashSet::new();
30818                let mut result = Self::Value::new();
30819                while let Some(tag) = map.next_key::<__FieldTag>()? {
30820                    #[allow(clippy::match_single_binding)]
30821                    match tag {
30822                        __FieldTag::__start_date => {
30823                            if !fields.insert(__FieldTag::__start_date) {
30824                                return std::result::Result::Err(A::Error::duplicate_field(
30825                                    "multiple values for start_date",
30826                                ));
30827                            }
30828                            result.start_date = map
30829                                .next_value::<std::option::Option<std::string::String>>()?
30830                                .unwrap_or_default();
30831                        }
30832                        __FieldTag::__end_date => {
30833                            if !fields.insert(__FieldTag::__end_date) {
30834                                return std::result::Result::Err(A::Error::duplicate_field(
30835                                    "multiple values for end_date",
30836                                ));
30837                            }
30838                            result.end_date = map
30839                                .next_value::<std::option::Option<std::string::String>>()?
30840                                .unwrap_or_default();
30841                        }
30842                        __FieldTag::__time => {
30843                            if !fields.insert(__FieldTag::__time) {
30844                                return std::result::Result::Err(A::Error::duplicate_field(
30845                                    "multiple values for time",
30846                                ));
30847                            }
30848                            result.time = map
30849                                .next_value::<std::option::Option<std::string::String>>()?
30850                                .unwrap_or_default();
30851                        }
30852                        __FieldTag::Unknown(key) => {
30853                            let value = map.next_value::<serde_json::Value>()?;
30854                            result._unknown_fields.insert(key, value);
30855                        }
30856                    }
30857                }
30858                std::result::Result::Ok(result)
30859            }
30860        }
30861        deserializer.deserialize_any(Visitor)
30862    }
30863}
30864
30865#[doc(hidden)]
30866impl serde::ser::Serialize for DenyMaintenancePeriod {
30867    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
30868    where
30869        S: serde::ser::Serializer,
30870    {
30871        use serde::ser::SerializeMap;
30872        #[allow(unused_imports)]
30873        use std::option::Option::Some;
30874        let mut state = serializer.serialize_map(std::option::Option::None)?;
30875        if !self.start_date.is_empty() {
30876            state.serialize_entry("startDate", &self.start_date)?;
30877        }
30878        if !self.end_date.is_empty() {
30879            state.serialize_entry("endDate", &self.end_date)?;
30880        }
30881        if !self.time.is_empty() {
30882            state.serialize_entry("time", &self.time)?;
30883        }
30884        if !self._unknown_fields.is_empty() {
30885            for (key, value) in self._unknown_fields.iter() {
30886                state.serialize_entry(key, &value)?;
30887            }
30888        }
30889        state.end()
30890    }
30891}
30892
30893/// Insights configuration. This specifies when Cloud SQL Insights feature is
30894/// enabled and optional configuration.
30895#[derive(Clone, Debug, Default, PartialEq)]
30896#[non_exhaustive]
30897pub struct InsightsConfig {
30898    /// Whether Query Insights feature is enabled.
30899    pub query_insights_enabled: bool,
30900
30901    /// Whether Query Insights will record client address when enabled.
30902    pub record_client_address: bool,
30903
30904    /// Whether Query Insights will record application tags from query when
30905    /// enabled.
30906    pub record_application_tags: bool,
30907
30908    /// Maximum query length stored in bytes. Default value: 1024 bytes.
30909    /// Range: 256-4500 bytes. Query length more than this field value will be
30910    /// truncated to this value. When unset, query length will be the default
30911    /// value. Changing query length will restart the database.
30912    pub query_string_length: std::option::Option<wkt::Int32Value>,
30913
30914    /// Number of query execution plans captured by Insights per minute
30915    /// for all queries combined. Default is 5.
30916    pub query_plans_per_minute: std::option::Option<wkt::Int32Value>,
30917
30918    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
30919}
30920
30921impl InsightsConfig {
30922    pub fn new() -> Self {
30923        std::default::Default::default()
30924    }
30925
30926    /// Sets the value of [query_insights_enabled][crate::model::InsightsConfig::query_insights_enabled].
30927    pub fn set_query_insights_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
30928        self.query_insights_enabled = v.into();
30929        self
30930    }
30931
30932    /// Sets the value of [record_client_address][crate::model::InsightsConfig::record_client_address].
30933    pub fn set_record_client_address<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
30934        self.record_client_address = v.into();
30935        self
30936    }
30937
30938    /// Sets the value of [record_application_tags][crate::model::InsightsConfig::record_application_tags].
30939    pub fn set_record_application_tags<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
30940        self.record_application_tags = v.into();
30941        self
30942    }
30943
30944    /// Sets the value of [query_string_length][crate::model::InsightsConfig::query_string_length].
30945    pub fn set_query_string_length<T>(mut self, v: T) -> Self
30946    where
30947        T: std::convert::Into<wkt::Int32Value>,
30948    {
30949        self.query_string_length = std::option::Option::Some(v.into());
30950        self
30951    }
30952
30953    /// Sets or clears the value of [query_string_length][crate::model::InsightsConfig::query_string_length].
30954    pub fn set_or_clear_query_string_length<T>(mut self, v: std::option::Option<T>) -> Self
30955    where
30956        T: std::convert::Into<wkt::Int32Value>,
30957    {
30958        self.query_string_length = v.map(|x| x.into());
30959        self
30960    }
30961
30962    /// Sets the value of [query_plans_per_minute][crate::model::InsightsConfig::query_plans_per_minute].
30963    pub fn set_query_plans_per_minute<T>(mut self, v: T) -> Self
30964    where
30965        T: std::convert::Into<wkt::Int32Value>,
30966    {
30967        self.query_plans_per_minute = std::option::Option::Some(v.into());
30968        self
30969    }
30970
30971    /// Sets or clears the value of [query_plans_per_minute][crate::model::InsightsConfig::query_plans_per_minute].
30972    pub fn set_or_clear_query_plans_per_minute<T>(mut self, v: std::option::Option<T>) -> Self
30973    where
30974        T: std::convert::Into<wkt::Int32Value>,
30975    {
30976        self.query_plans_per_minute = v.map(|x| x.into());
30977        self
30978    }
30979}
30980
30981impl wkt::message::Message for InsightsConfig {
30982    fn typename() -> &'static str {
30983        "type.googleapis.com/google.cloud.sql.v1.InsightsConfig"
30984    }
30985}
30986
30987#[doc(hidden)]
30988impl<'de> serde::de::Deserialize<'de> for InsightsConfig {
30989    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30990    where
30991        D: serde::Deserializer<'de>,
30992    {
30993        #[allow(non_camel_case_types)]
30994        #[doc(hidden)]
30995        #[derive(PartialEq, Eq, Hash)]
30996        enum __FieldTag {
30997            __query_insights_enabled,
30998            __record_client_address,
30999            __record_application_tags,
31000            __query_string_length,
31001            __query_plans_per_minute,
31002            Unknown(std::string::String),
31003        }
31004        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
31005            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
31006            where
31007                D: serde::Deserializer<'de>,
31008            {
31009                struct Visitor;
31010                impl<'de> serde::de::Visitor<'de> for Visitor {
31011                    type Value = __FieldTag;
31012                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
31013                        formatter.write_str("a field name for InsightsConfig")
31014                    }
31015                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
31016                    where
31017                        E: serde::de::Error,
31018                    {
31019                        use std::result::Result::Ok;
31020                        use std::string::ToString;
31021                        match value {
31022                            "queryInsightsEnabled" => Ok(__FieldTag::__query_insights_enabled),
31023                            "query_insights_enabled" => Ok(__FieldTag::__query_insights_enabled),
31024                            "recordClientAddress" => Ok(__FieldTag::__record_client_address),
31025                            "record_client_address" => Ok(__FieldTag::__record_client_address),
31026                            "recordApplicationTags" => Ok(__FieldTag::__record_application_tags),
31027                            "record_application_tags" => Ok(__FieldTag::__record_application_tags),
31028                            "queryStringLength" => Ok(__FieldTag::__query_string_length),
31029                            "query_string_length" => Ok(__FieldTag::__query_string_length),
31030                            "queryPlansPerMinute" => Ok(__FieldTag::__query_plans_per_minute),
31031                            "query_plans_per_minute" => Ok(__FieldTag::__query_plans_per_minute),
31032                            _ => Ok(__FieldTag::Unknown(value.to_string())),
31033                        }
31034                    }
31035                }
31036                deserializer.deserialize_identifier(Visitor)
31037            }
31038        }
31039        struct Visitor;
31040        impl<'de> serde::de::Visitor<'de> for Visitor {
31041            type Value = InsightsConfig;
31042            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
31043                formatter.write_str("struct InsightsConfig")
31044            }
31045            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
31046            where
31047                A: serde::de::MapAccess<'de>,
31048            {
31049                #[allow(unused_imports)]
31050                use serde::de::Error;
31051                use std::option::Option::Some;
31052                let mut fields = std::collections::HashSet::new();
31053                let mut result = Self::Value::new();
31054                while let Some(tag) = map.next_key::<__FieldTag>()? {
31055                    #[allow(clippy::match_single_binding)]
31056                    match tag {
31057                        __FieldTag::__query_insights_enabled => {
31058                            if !fields.insert(__FieldTag::__query_insights_enabled) {
31059                                return std::result::Result::Err(A::Error::duplicate_field(
31060                                    "multiple values for query_insights_enabled",
31061                                ));
31062                            }
31063                            result.query_insights_enabled = map
31064                                .next_value::<std::option::Option<bool>>()?
31065                                .unwrap_or_default();
31066                        }
31067                        __FieldTag::__record_client_address => {
31068                            if !fields.insert(__FieldTag::__record_client_address) {
31069                                return std::result::Result::Err(A::Error::duplicate_field(
31070                                    "multiple values for record_client_address",
31071                                ));
31072                            }
31073                            result.record_client_address = map
31074                                .next_value::<std::option::Option<bool>>()?
31075                                .unwrap_or_default();
31076                        }
31077                        __FieldTag::__record_application_tags => {
31078                            if !fields.insert(__FieldTag::__record_application_tags) {
31079                                return std::result::Result::Err(A::Error::duplicate_field(
31080                                    "multiple values for record_application_tags",
31081                                ));
31082                            }
31083                            result.record_application_tags = map
31084                                .next_value::<std::option::Option<bool>>()?
31085                                .unwrap_or_default();
31086                        }
31087                        __FieldTag::__query_string_length => {
31088                            if !fields.insert(__FieldTag::__query_string_length) {
31089                                return std::result::Result::Err(A::Error::duplicate_field(
31090                                    "multiple values for query_string_length",
31091                                ));
31092                            }
31093                            struct __With(std::option::Option<wkt::Int32Value>);
31094                            impl<'de> serde::de::Deserialize<'de> for __With {
31095                                fn deserialize<D>(
31096                                    deserializer: D,
31097                                ) -> std::result::Result<Self, D::Error>
31098                                where
31099                                    D: serde::de::Deserializer<'de>,
31100                                {
31101                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
31102                                }
31103                            }
31104                            result.query_string_length = map.next_value::<__With>()?.0;
31105                        }
31106                        __FieldTag::__query_plans_per_minute => {
31107                            if !fields.insert(__FieldTag::__query_plans_per_minute) {
31108                                return std::result::Result::Err(A::Error::duplicate_field(
31109                                    "multiple values for query_plans_per_minute",
31110                                ));
31111                            }
31112                            struct __With(std::option::Option<wkt::Int32Value>);
31113                            impl<'de> serde::de::Deserialize<'de> for __With {
31114                                fn deserialize<D>(
31115                                    deserializer: D,
31116                                ) -> std::result::Result<Self, D::Error>
31117                                where
31118                                    D: serde::de::Deserializer<'de>,
31119                                {
31120                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
31121                                }
31122                            }
31123                            result.query_plans_per_minute = map.next_value::<__With>()?.0;
31124                        }
31125                        __FieldTag::Unknown(key) => {
31126                            let value = map.next_value::<serde_json::Value>()?;
31127                            result._unknown_fields.insert(key, value);
31128                        }
31129                    }
31130                }
31131                std::result::Result::Ok(result)
31132            }
31133        }
31134        deserializer.deserialize_any(Visitor)
31135    }
31136}
31137
31138#[doc(hidden)]
31139impl serde::ser::Serialize for InsightsConfig {
31140    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
31141    where
31142        S: serde::ser::Serializer,
31143    {
31144        use serde::ser::SerializeMap;
31145        #[allow(unused_imports)]
31146        use std::option::Option::Some;
31147        let mut state = serializer.serialize_map(std::option::Option::None)?;
31148        if !wkt::internal::is_default(&self.query_insights_enabled) {
31149            state.serialize_entry("queryInsightsEnabled", &self.query_insights_enabled)?;
31150        }
31151        if !wkt::internal::is_default(&self.record_client_address) {
31152            state.serialize_entry("recordClientAddress", &self.record_client_address)?;
31153        }
31154        if !wkt::internal::is_default(&self.record_application_tags) {
31155            state.serialize_entry("recordApplicationTags", &self.record_application_tags)?;
31156        }
31157        if self.query_string_length.is_some() {
31158            struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
31159            impl<'a> serde::ser::Serialize for __With<'a> {
31160                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
31161                where
31162                    S: serde::ser::Serializer,
31163                {
31164                    serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
31165                        self.0, serializer,
31166                    )
31167                }
31168            }
31169            state.serialize_entry("queryStringLength", &__With(&self.query_string_length))?;
31170        }
31171        if self.query_plans_per_minute.is_some() {
31172            struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
31173            impl<'a> serde::ser::Serialize for __With<'a> {
31174                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
31175                where
31176                    S: serde::ser::Serializer,
31177                {
31178                    serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
31179                        self.0, serializer,
31180                    )
31181                }
31182            }
31183            state.serialize_entry("queryPlansPerMinute", &__With(&self.query_plans_per_minute))?;
31184        }
31185        if !self._unknown_fields.is_empty() {
31186            for (key, value) in self._unknown_fields.iter() {
31187                state.serialize_entry(key, &value)?;
31188            }
31189        }
31190        state.end()
31191    }
31192}
31193
31194/// Read-replica configuration specific to MySQL databases.
31195#[derive(Clone, Debug, Default, PartialEq)]
31196#[non_exhaustive]
31197pub struct MySqlReplicaConfiguration {
31198    /// Path to a SQL dump file in Google Cloud Storage from which the replica
31199    /// instance is to be created. The URI is in the form gs://bucketName/fileName.
31200    /// Compressed gzip files (.gz) are also supported.
31201    /// Dumps have the binlog co-ordinates from which replication
31202    /// begins. This can be accomplished by setting --master-data to 1 when using
31203    /// mysqldump.
31204    pub dump_file_path: std::string::String,
31205
31206    /// The username for the replication connection.
31207    pub username: std::string::String,
31208
31209    /// The password for the replication connection.
31210    pub password: std::string::String,
31211
31212    /// Seconds to wait between connect retries. MySQL's default is 60 seconds.
31213    pub connect_retry_interval: std::option::Option<wkt::Int32Value>,
31214
31215    /// Interval in milliseconds between replication heartbeats.
31216    pub master_heartbeat_period: std::option::Option<wkt::Int64Value>,
31217
31218    /// PEM representation of the trusted CA's x509 certificate.
31219    pub ca_certificate: std::string::String,
31220
31221    /// PEM representation of the replica's x509 certificate.
31222    pub client_certificate: std::string::String,
31223
31224    /// PEM representation of the replica's private key. The corresponsing public
31225    /// key is encoded in the client's certificate.
31226    pub client_key: std::string::String,
31227
31228    /// A list of permissible ciphers to use for SSL encryption.
31229    pub ssl_cipher: std::string::String,
31230
31231    /// Whether or not to check the primary instance's Common Name value in the
31232    /// certificate that it sends during the SSL handshake.
31233    pub verify_server_certificate: std::option::Option<wkt::BoolValue>,
31234
31235    /// This is always `sql#mysqlReplicaConfiguration`.
31236    pub kind: std::string::String,
31237
31238    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
31239}
31240
31241impl MySqlReplicaConfiguration {
31242    pub fn new() -> Self {
31243        std::default::Default::default()
31244    }
31245
31246    /// Sets the value of [dump_file_path][crate::model::MySqlReplicaConfiguration::dump_file_path].
31247    pub fn set_dump_file_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
31248        self.dump_file_path = v.into();
31249        self
31250    }
31251
31252    /// Sets the value of [username][crate::model::MySqlReplicaConfiguration::username].
31253    pub fn set_username<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
31254        self.username = v.into();
31255        self
31256    }
31257
31258    /// Sets the value of [password][crate::model::MySqlReplicaConfiguration::password].
31259    pub fn set_password<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
31260        self.password = v.into();
31261        self
31262    }
31263
31264    /// Sets the value of [connect_retry_interval][crate::model::MySqlReplicaConfiguration::connect_retry_interval].
31265    pub fn set_connect_retry_interval<T>(mut self, v: T) -> Self
31266    where
31267        T: std::convert::Into<wkt::Int32Value>,
31268    {
31269        self.connect_retry_interval = std::option::Option::Some(v.into());
31270        self
31271    }
31272
31273    /// Sets or clears the value of [connect_retry_interval][crate::model::MySqlReplicaConfiguration::connect_retry_interval].
31274    pub fn set_or_clear_connect_retry_interval<T>(mut self, v: std::option::Option<T>) -> Self
31275    where
31276        T: std::convert::Into<wkt::Int32Value>,
31277    {
31278        self.connect_retry_interval = v.map(|x| x.into());
31279        self
31280    }
31281
31282    /// Sets the value of [master_heartbeat_period][crate::model::MySqlReplicaConfiguration::master_heartbeat_period].
31283    pub fn set_master_heartbeat_period<T>(mut self, v: T) -> Self
31284    where
31285        T: std::convert::Into<wkt::Int64Value>,
31286    {
31287        self.master_heartbeat_period = std::option::Option::Some(v.into());
31288        self
31289    }
31290
31291    /// Sets or clears the value of [master_heartbeat_period][crate::model::MySqlReplicaConfiguration::master_heartbeat_period].
31292    pub fn set_or_clear_master_heartbeat_period<T>(mut self, v: std::option::Option<T>) -> Self
31293    where
31294        T: std::convert::Into<wkt::Int64Value>,
31295    {
31296        self.master_heartbeat_period = v.map(|x| x.into());
31297        self
31298    }
31299
31300    /// Sets the value of [ca_certificate][crate::model::MySqlReplicaConfiguration::ca_certificate].
31301    pub fn set_ca_certificate<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
31302        self.ca_certificate = v.into();
31303        self
31304    }
31305
31306    /// Sets the value of [client_certificate][crate::model::MySqlReplicaConfiguration::client_certificate].
31307    pub fn set_client_certificate<T: std::convert::Into<std::string::String>>(
31308        mut self,
31309        v: T,
31310    ) -> Self {
31311        self.client_certificate = v.into();
31312        self
31313    }
31314
31315    /// Sets the value of [client_key][crate::model::MySqlReplicaConfiguration::client_key].
31316    pub fn set_client_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
31317        self.client_key = v.into();
31318        self
31319    }
31320
31321    /// Sets the value of [ssl_cipher][crate::model::MySqlReplicaConfiguration::ssl_cipher].
31322    pub fn set_ssl_cipher<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
31323        self.ssl_cipher = v.into();
31324        self
31325    }
31326
31327    /// Sets the value of [verify_server_certificate][crate::model::MySqlReplicaConfiguration::verify_server_certificate].
31328    pub fn set_verify_server_certificate<T>(mut self, v: T) -> Self
31329    where
31330        T: std::convert::Into<wkt::BoolValue>,
31331    {
31332        self.verify_server_certificate = std::option::Option::Some(v.into());
31333        self
31334    }
31335
31336    /// Sets or clears the value of [verify_server_certificate][crate::model::MySqlReplicaConfiguration::verify_server_certificate].
31337    pub fn set_or_clear_verify_server_certificate<T>(mut self, v: std::option::Option<T>) -> Self
31338    where
31339        T: std::convert::Into<wkt::BoolValue>,
31340    {
31341        self.verify_server_certificate = v.map(|x| x.into());
31342        self
31343    }
31344
31345    /// Sets the value of [kind][crate::model::MySqlReplicaConfiguration::kind].
31346    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
31347        self.kind = v.into();
31348        self
31349    }
31350}
31351
31352impl wkt::message::Message for MySqlReplicaConfiguration {
31353    fn typename() -> &'static str {
31354        "type.googleapis.com/google.cloud.sql.v1.MySqlReplicaConfiguration"
31355    }
31356}
31357
31358#[doc(hidden)]
31359impl<'de> serde::de::Deserialize<'de> for MySqlReplicaConfiguration {
31360    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
31361    where
31362        D: serde::Deserializer<'de>,
31363    {
31364        #[allow(non_camel_case_types)]
31365        #[doc(hidden)]
31366        #[derive(PartialEq, Eq, Hash)]
31367        enum __FieldTag {
31368            __dump_file_path,
31369            __username,
31370            __password,
31371            __connect_retry_interval,
31372            __master_heartbeat_period,
31373            __ca_certificate,
31374            __client_certificate,
31375            __client_key,
31376            __ssl_cipher,
31377            __verify_server_certificate,
31378            __kind,
31379            Unknown(std::string::String),
31380        }
31381        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
31382            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
31383            where
31384                D: serde::Deserializer<'de>,
31385            {
31386                struct Visitor;
31387                impl<'de> serde::de::Visitor<'de> for Visitor {
31388                    type Value = __FieldTag;
31389                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
31390                        formatter.write_str("a field name for MySqlReplicaConfiguration")
31391                    }
31392                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
31393                    where
31394                        E: serde::de::Error,
31395                    {
31396                        use std::result::Result::Ok;
31397                        use std::string::ToString;
31398                        match value {
31399                            "dumpFilePath" => Ok(__FieldTag::__dump_file_path),
31400                            "dump_file_path" => Ok(__FieldTag::__dump_file_path),
31401                            "username" => Ok(__FieldTag::__username),
31402                            "password" => Ok(__FieldTag::__password),
31403                            "connectRetryInterval" => Ok(__FieldTag::__connect_retry_interval),
31404                            "connect_retry_interval" => Ok(__FieldTag::__connect_retry_interval),
31405                            "masterHeartbeatPeriod" => Ok(__FieldTag::__master_heartbeat_period),
31406                            "master_heartbeat_period" => Ok(__FieldTag::__master_heartbeat_period),
31407                            "caCertificate" => Ok(__FieldTag::__ca_certificate),
31408                            "ca_certificate" => Ok(__FieldTag::__ca_certificate),
31409                            "clientCertificate" => Ok(__FieldTag::__client_certificate),
31410                            "client_certificate" => Ok(__FieldTag::__client_certificate),
31411                            "clientKey" => Ok(__FieldTag::__client_key),
31412                            "client_key" => Ok(__FieldTag::__client_key),
31413                            "sslCipher" => Ok(__FieldTag::__ssl_cipher),
31414                            "ssl_cipher" => Ok(__FieldTag::__ssl_cipher),
31415                            "verifyServerCertificate" => {
31416                                Ok(__FieldTag::__verify_server_certificate)
31417                            }
31418                            "verify_server_certificate" => {
31419                                Ok(__FieldTag::__verify_server_certificate)
31420                            }
31421                            "kind" => Ok(__FieldTag::__kind),
31422                            _ => Ok(__FieldTag::Unknown(value.to_string())),
31423                        }
31424                    }
31425                }
31426                deserializer.deserialize_identifier(Visitor)
31427            }
31428        }
31429        struct Visitor;
31430        impl<'de> serde::de::Visitor<'de> for Visitor {
31431            type Value = MySqlReplicaConfiguration;
31432            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
31433                formatter.write_str("struct MySqlReplicaConfiguration")
31434            }
31435            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
31436            where
31437                A: serde::de::MapAccess<'de>,
31438            {
31439                #[allow(unused_imports)]
31440                use serde::de::Error;
31441                use std::option::Option::Some;
31442                let mut fields = std::collections::HashSet::new();
31443                let mut result = Self::Value::new();
31444                while let Some(tag) = map.next_key::<__FieldTag>()? {
31445                    #[allow(clippy::match_single_binding)]
31446                    match tag {
31447                        __FieldTag::__dump_file_path => {
31448                            if !fields.insert(__FieldTag::__dump_file_path) {
31449                                return std::result::Result::Err(A::Error::duplicate_field(
31450                                    "multiple values for dump_file_path",
31451                                ));
31452                            }
31453                            result.dump_file_path = map
31454                                .next_value::<std::option::Option<std::string::String>>()?
31455                                .unwrap_or_default();
31456                        }
31457                        __FieldTag::__username => {
31458                            if !fields.insert(__FieldTag::__username) {
31459                                return std::result::Result::Err(A::Error::duplicate_field(
31460                                    "multiple values for username",
31461                                ));
31462                            }
31463                            result.username = map
31464                                .next_value::<std::option::Option<std::string::String>>()?
31465                                .unwrap_or_default();
31466                        }
31467                        __FieldTag::__password => {
31468                            if !fields.insert(__FieldTag::__password) {
31469                                return std::result::Result::Err(A::Error::duplicate_field(
31470                                    "multiple values for password",
31471                                ));
31472                            }
31473                            result.password = map
31474                                .next_value::<std::option::Option<std::string::String>>()?
31475                                .unwrap_or_default();
31476                        }
31477                        __FieldTag::__connect_retry_interval => {
31478                            if !fields.insert(__FieldTag::__connect_retry_interval) {
31479                                return std::result::Result::Err(A::Error::duplicate_field(
31480                                    "multiple values for connect_retry_interval",
31481                                ));
31482                            }
31483                            struct __With(std::option::Option<wkt::Int32Value>);
31484                            impl<'de> serde::de::Deserialize<'de> for __With {
31485                                fn deserialize<D>(
31486                                    deserializer: D,
31487                                ) -> std::result::Result<Self, D::Error>
31488                                where
31489                                    D: serde::de::Deserializer<'de>,
31490                                {
31491                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
31492                                }
31493                            }
31494                            result.connect_retry_interval = map.next_value::<__With>()?.0;
31495                        }
31496                        __FieldTag::__master_heartbeat_period => {
31497                            if !fields.insert(__FieldTag::__master_heartbeat_period) {
31498                                return std::result::Result::Err(A::Error::duplicate_field(
31499                                    "multiple values for master_heartbeat_period",
31500                                ));
31501                            }
31502                            struct __With(std::option::Option<wkt::Int64Value>);
31503                            impl<'de> serde::de::Deserialize<'de> for __With {
31504                                fn deserialize<D>(
31505                                    deserializer: D,
31506                                ) -> std::result::Result<Self, D::Error>
31507                                where
31508                                    D: serde::de::Deserializer<'de>,
31509                                {
31510                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
31511                                }
31512                            }
31513                            result.master_heartbeat_period = map.next_value::<__With>()?.0;
31514                        }
31515                        __FieldTag::__ca_certificate => {
31516                            if !fields.insert(__FieldTag::__ca_certificate) {
31517                                return std::result::Result::Err(A::Error::duplicate_field(
31518                                    "multiple values for ca_certificate",
31519                                ));
31520                            }
31521                            result.ca_certificate = map
31522                                .next_value::<std::option::Option<std::string::String>>()?
31523                                .unwrap_or_default();
31524                        }
31525                        __FieldTag::__client_certificate => {
31526                            if !fields.insert(__FieldTag::__client_certificate) {
31527                                return std::result::Result::Err(A::Error::duplicate_field(
31528                                    "multiple values for client_certificate",
31529                                ));
31530                            }
31531                            result.client_certificate = map
31532                                .next_value::<std::option::Option<std::string::String>>()?
31533                                .unwrap_or_default();
31534                        }
31535                        __FieldTag::__client_key => {
31536                            if !fields.insert(__FieldTag::__client_key) {
31537                                return std::result::Result::Err(A::Error::duplicate_field(
31538                                    "multiple values for client_key",
31539                                ));
31540                            }
31541                            result.client_key = map
31542                                .next_value::<std::option::Option<std::string::String>>()?
31543                                .unwrap_or_default();
31544                        }
31545                        __FieldTag::__ssl_cipher => {
31546                            if !fields.insert(__FieldTag::__ssl_cipher) {
31547                                return std::result::Result::Err(A::Error::duplicate_field(
31548                                    "multiple values for ssl_cipher",
31549                                ));
31550                            }
31551                            result.ssl_cipher = map
31552                                .next_value::<std::option::Option<std::string::String>>()?
31553                                .unwrap_or_default();
31554                        }
31555                        __FieldTag::__verify_server_certificate => {
31556                            if !fields.insert(__FieldTag::__verify_server_certificate) {
31557                                return std::result::Result::Err(A::Error::duplicate_field(
31558                                    "multiple values for verify_server_certificate",
31559                                ));
31560                            }
31561                            result.verify_server_certificate =
31562                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
31563                        }
31564                        __FieldTag::__kind => {
31565                            if !fields.insert(__FieldTag::__kind) {
31566                                return std::result::Result::Err(A::Error::duplicate_field(
31567                                    "multiple values for kind",
31568                                ));
31569                            }
31570                            result.kind = map
31571                                .next_value::<std::option::Option<std::string::String>>()?
31572                                .unwrap_or_default();
31573                        }
31574                        __FieldTag::Unknown(key) => {
31575                            let value = map.next_value::<serde_json::Value>()?;
31576                            result._unknown_fields.insert(key, value);
31577                        }
31578                    }
31579                }
31580                std::result::Result::Ok(result)
31581            }
31582        }
31583        deserializer.deserialize_any(Visitor)
31584    }
31585}
31586
31587#[doc(hidden)]
31588impl serde::ser::Serialize for MySqlReplicaConfiguration {
31589    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
31590    where
31591        S: serde::ser::Serializer,
31592    {
31593        use serde::ser::SerializeMap;
31594        #[allow(unused_imports)]
31595        use std::option::Option::Some;
31596        let mut state = serializer.serialize_map(std::option::Option::None)?;
31597        if !self.dump_file_path.is_empty() {
31598            state.serialize_entry("dumpFilePath", &self.dump_file_path)?;
31599        }
31600        if !self.username.is_empty() {
31601            state.serialize_entry("username", &self.username)?;
31602        }
31603        if !self.password.is_empty() {
31604            state.serialize_entry("password", &self.password)?;
31605        }
31606        if self.connect_retry_interval.is_some() {
31607            struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
31608            impl<'a> serde::ser::Serialize for __With<'a> {
31609                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
31610                where
31611                    S: serde::ser::Serializer,
31612                {
31613                    serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
31614                        self.0, serializer,
31615                    )
31616                }
31617            }
31618            state.serialize_entry(
31619                "connectRetryInterval",
31620                &__With(&self.connect_retry_interval),
31621            )?;
31622        }
31623        if self.master_heartbeat_period.is_some() {
31624            struct __With<'a>(&'a std::option::Option<wkt::Int64Value>);
31625            impl<'a> serde::ser::Serialize for __With<'a> {
31626                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
31627                where
31628                    S: serde::ser::Serializer,
31629                {
31630                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
31631                        self.0, serializer,
31632                    )
31633                }
31634            }
31635            state.serialize_entry(
31636                "masterHeartbeatPeriod",
31637                &__With(&self.master_heartbeat_period),
31638            )?;
31639        }
31640        if !self.ca_certificate.is_empty() {
31641            state.serialize_entry("caCertificate", &self.ca_certificate)?;
31642        }
31643        if !self.client_certificate.is_empty() {
31644            state.serialize_entry("clientCertificate", &self.client_certificate)?;
31645        }
31646        if !self.client_key.is_empty() {
31647            state.serialize_entry("clientKey", &self.client_key)?;
31648        }
31649        if !self.ssl_cipher.is_empty() {
31650            state.serialize_entry("sslCipher", &self.ssl_cipher)?;
31651        }
31652        if self.verify_server_certificate.is_some() {
31653            state.serialize_entry("verifyServerCertificate", &self.verify_server_certificate)?;
31654        }
31655        if !self.kind.is_empty() {
31656            state.serialize_entry("kind", &self.kind)?;
31657        }
31658        if !self._unknown_fields.is_empty() {
31659            for (key, value) in self._unknown_fields.iter() {
31660                state.serialize_entry(key, &value)?;
31661            }
31662        }
31663        state.end()
31664    }
31665}
31666
31667/// Disk encryption configuration for an instance.
31668#[derive(Clone, Debug, Default, PartialEq)]
31669#[non_exhaustive]
31670pub struct DiskEncryptionConfiguration {
31671    /// Resource name of KMS key for disk encryption
31672    pub kms_key_name: std::string::String,
31673
31674    /// This is always `sql#diskEncryptionConfiguration`.
31675    pub kind: std::string::String,
31676
31677    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
31678}
31679
31680impl DiskEncryptionConfiguration {
31681    pub fn new() -> Self {
31682        std::default::Default::default()
31683    }
31684
31685    /// Sets the value of [kms_key_name][crate::model::DiskEncryptionConfiguration::kms_key_name].
31686    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
31687        self.kms_key_name = v.into();
31688        self
31689    }
31690
31691    /// Sets the value of [kind][crate::model::DiskEncryptionConfiguration::kind].
31692    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
31693        self.kind = v.into();
31694        self
31695    }
31696}
31697
31698impl wkt::message::Message for DiskEncryptionConfiguration {
31699    fn typename() -> &'static str {
31700        "type.googleapis.com/google.cloud.sql.v1.DiskEncryptionConfiguration"
31701    }
31702}
31703
31704#[doc(hidden)]
31705impl<'de> serde::de::Deserialize<'de> for DiskEncryptionConfiguration {
31706    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
31707    where
31708        D: serde::Deserializer<'de>,
31709    {
31710        #[allow(non_camel_case_types)]
31711        #[doc(hidden)]
31712        #[derive(PartialEq, Eq, Hash)]
31713        enum __FieldTag {
31714            __kms_key_name,
31715            __kind,
31716            Unknown(std::string::String),
31717        }
31718        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
31719            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
31720            where
31721                D: serde::Deserializer<'de>,
31722            {
31723                struct Visitor;
31724                impl<'de> serde::de::Visitor<'de> for Visitor {
31725                    type Value = __FieldTag;
31726                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
31727                        formatter.write_str("a field name for DiskEncryptionConfiguration")
31728                    }
31729                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
31730                    where
31731                        E: serde::de::Error,
31732                    {
31733                        use std::result::Result::Ok;
31734                        use std::string::ToString;
31735                        match value {
31736                            "kmsKeyName" => Ok(__FieldTag::__kms_key_name),
31737                            "kms_key_name" => Ok(__FieldTag::__kms_key_name),
31738                            "kind" => Ok(__FieldTag::__kind),
31739                            _ => Ok(__FieldTag::Unknown(value.to_string())),
31740                        }
31741                    }
31742                }
31743                deserializer.deserialize_identifier(Visitor)
31744            }
31745        }
31746        struct Visitor;
31747        impl<'de> serde::de::Visitor<'de> for Visitor {
31748            type Value = DiskEncryptionConfiguration;
31749            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
31750                formatter.write_str("struct DiskEncryptionConfiguration")
31751            }
31752            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
31753            where
31754                A: serde::de::MapAccess<'de>,
31755            {
31756                #[allow(unused_imports)]
31757                use serde::de::Error;
31758                use std::option::Option::Some;
31759                let mut fields = std::collections::HashSet::new();
31760                let mut result = Self::Value::new();
31761                while let Some(tag) = map.next_key::<__FieldTag>()? {
31762                    #[allow(clippy::match_single_binding)]
31763                    match tag {
31764                        __FieldTag::__kms_key_name => {
31765                            if !fields.insert(__FieldTag::__kms_key_name) {
31766                                return std::result::Result::Err(A::Error::duplicate_field(
31767                                    "multiple values for kms_key_name",
31768                                ));
31769                            }
31770                            result.kms_key_name = map
31771                                .next_value::<std::option::Option<std::string::String>>()?
31772                                .unwrap_or_default();
31773                        }
31774                        __FieldTag::__kind => {
31775                            if !fields.insert(__FieldTag::__kind) {
31776                                return std::result::Result::Err(A::Error::duplicate_field(
31777                                    "multiple values for kind",
31778                                ));
31779                            }
31780                            result.kind = map
31781                                .next_value::<std::option::Option<std::string::String>>()?
31782                                .unwrap_or_default();
31783                        }
31784                        __FieldTag::Unknown(key) => {
31785                            let value = map.next_value::<serde_json::Value>()?;
31786                            result._unknown_fields.insert(key, value);
31787                        }
31788                    }
31789                }
31790                std::result::Result::Ok(result)
31791            }
31792        }
31793        deserializer.deserialize_any(Visitor)
31794    }
31795}
31796
31797#[doc(hidden)]
31798impl serde::ser::Serialize for DiskEncryptionConfiguration {
31799    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
31800    where
31801        S: serde::ser::Serializer,
31802    {
31803        use serde::ser::SerializeMap;
31804        #[allow(unused_imports)]
31805        use std::option::Option::Some;
31806        let mut state = serializer.serialize_map(std::option::Option::None)?;
31807        if !self.kms_key_name.is_empty() {
31808            state.serialize_entry("kmsKeyName", &self.kms_key_name)?;
31809        }
31810        if !self.kind.is_empty() {
31811            state.serialize_entry("kind", &self.kind)?;
31812        }
31813        if !self._unknown_fields.is_empty() {
31814            for (key, value) in self._unknown_fields.iter() {
31815                state.serialize_entry(key, &value)?;
31816            }
31817        }
31818        state.end()
31819    }
31820}
31821
31822/// Disk encryption status for an instance.
31823#[derive(Clone, Debug, Default, PartialEq)]
31824#[non_exhaustive]
31825pub struct DiskEncryptionStatus {
31826    /// KMS key version used to encrypt the Cloud SQL instance resource
31827    pub kms_key_version_name: std::string::String,
31828
31829    /// This is always `sql#diskEncryptionStatus`.
31830    pub kind: std::string::String,
31831
31832    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
31833}
31834
31835impl DiskEncryptionStatus {
31836    pub fn new() -> Self {
31837        std::default::Default::default()
31838    }
31839
31840    /// Sets the value of [kms_key_version_name][crate::model::DiskEncryptionStatus::kms_key_version_name].
31841    pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
31842        mut self,
31843        v: T,
31844    ) -> Self {
31845        self.kms_key_version_name = v.into();
31846        self
31847    }
31848
31849    /// Sets the value of [kind][crate::model::DiskEncryptionStatus::kind].
31850    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
31851        self.kind = v.into();
31852        self
31853    }
31854}
31855
31856impl wkt::message::Message for DiskEncryptionStatus {
31857    fn typename() -> &'static str {
31858        "type.googleapis.com/google.cloud.sql.v1.DiskEncryptionStatus"
31859    }
31860}
31861
31862#[doc(hidden)]
31863impl<'de> serde::de::Deserialize<'de> for DiskEncryptionStatus {
31864    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
31865    where
31866        D: serde::Deserializer<'de>,
31867    {
31868        #[allow(non_camel_case_types)]
31869        #[doc(hidden)]
31870        #[derive(PartialEq, Eq, Hash)]
31871        enum __FieldTag {
31872            __kms_key_version_name,
31873            __kind,
31874            Unknown(std::string::String),
31875        }
31876        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
31877            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
31878            where
31879                D: serde::Deserializer<'de>,
31880            {
31881                struct Visitor;
31882                impl<'de> serde::de::Visitor<'de> for Visitor {
31883                    type Value = __FieldTag;
31884                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
31885                        formatter.write_str("a field name for DiskEncryptionStatus")
31886                    }
31887                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
31888                    where
31889                        E: serde::de::Error,
31890                    {
31891                        use std::result::Result::Ok;
31892                        use std::string::ToString;
31893                        match value {
31894                            "kmsKeyVersionName" => Ok(__FieldTag::__kms_key_version_name),
31895                            "kms_key_version_name" => Ok(__FieldTag::__kms_key_version_name),
31896                            "kind" => Ok(__FieldTag::__kind),
31897                            _ => Ok(__FieldTag::Unknown(value.to_string())),
31898                        }
31899                    }
31900                }
31901                deserializer.deserialize_identifier(Visitor)
31902            }
31903        }
31904        struct Visitor;
31905        impl<'de> serde::de::Visitor<'de> for Visitor {
31906            type Value = DiskEncryptionStatus;
31907            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
31908                formatter.write_str("struct DiskEncryptionStatus")
31909            }
31910            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
31911            where
31912                A: serde::de::MapAccess<'de>,
31913            {
31914                #[allow(unused_imports)]
31915                use serde::de::Error;
31916                use std::option::Option::Some;
31917                let mut fields = std::collections::HashSet::new();
31918                let mut result = Self::Value::new();
31919                while let Some(tag) = map.next_key::<__FieldTag>()? {
31920                    #[allow(clippy::match_single_binding)]
31921                    match tag {
31922                        __FieldTag::__kms_key_version_name => {
31923                            if !fields.insert(__FieldTag::__kms_key_version_name) {
31924                                return std::result::Result::Err(A::Error::duplicate_field(
31925                                    "multiple values for kms_key_version_name",
31926                                ));
31927                            }
31928                            result.kms_key_version_name = map
31929                                .next_value::<std::option::Option<std::string::String>>()?
31930                                .unwrap_or_default();
31931                        }
31932                        __FieldTag::__kind => {
31933                            if !fields.insert(__FieldTag::__kind) {
31934                                return std::result::Result::Err(A::Error::duplicate_field(
31935                                    "multiple values for kind",
31936                                ));
31937                            }
31938                            result.kind = map
31939                                .next_value::<std::option::Option<std::string::String>>()?
31940                                .unwrap_or_default();
31941                        }
31942                        __FieldTag::Unknown(key) => {
31943                            let value = map.next_value::<serde_json::Value>()?;
31944                            result._unknown_fields.insert(key, value);
31945                        }
31946                    }
31947                }
31948                std::result::Result::Ok(result)
31949            }
31950        }
31951        deserializer.deserialize_any(Visitor)
31952    }
31953}
31954
31955#[doc(hidden)]
31956impl serde::ser::Serialize for DiskEncryptionStatus {
31957    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
31958    where
31959        S: serde::ser::Serializer,
31960    {
31961        use serde::ser::SerializeMap;
31962        #[allow(unused_imports)]
31963        use std::option::Option::Some;
31964        let mut state = serializer.serialize_map(std::option::Option::None)?;
31965        if !self.kms_key_version_name.is_empty() {
31966            state.serialize_entry("kmsKeyVersionName", &self.kms_key_version_name)?;
31967        }
31968        if !self.kind.is_empty() {
31969            state.serialize_entry("kind", &self.kind)?;
31970        }
31971        if !self._unknown_fields.is_empty() {
31972            for (key, value) in self._unknown_fields.iter() {
31973                state.serialize_entry(key, &value)?;
31974            }
31975        }
31976        state.end()
31977    }
31978}
31979
31980/// Database instance IP mapping
31981#[derive(Clone, Debug, Default, PartialEq)]
31982#[non_exhaustive]
31983pub struct IpMapping {
31984    /// The type of this IP address. A `PRIMARY` address is a public address that
31985    /// can accept incoming connections. A `PRIVATE` address is a private address
31986    /// that can accept incoming connections. An `OUTGOING` address is the source
31987    /// address of connections originating from the instance, if supported.
31988    pub r#type: crate::model::SqlIpAddressType,
31989
31990    /// The IP address assigned.
31991    pub ip_address: std::string::String,
31992
31993    /// The due time for this IP to be retired in
31994    /// [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example
31995    /// `2012-11-15T16:19:00.094Z`. This field is only available when
31996    /// the IP is scheduled to be retired.
31997    pub time_to_retire: std::option::Option<wkt::Timestamp>,
31998
31999    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
32000}
32001
32002impl IpMapping {
32003    pub fn new() -> Self {
32004        std::default::Default::default()
32005    }
32006
32007    /// Sets the value of [r#type][crate::model::IpMapping::type].
32008    pub fn set_type<T: std::convert::Into<crate::model::SqlIpAddressType>>(mut self, v: T) -> Self {
32009        self.r#type = v.into();
32010        self
32011    }
32012
32013    /// Sets the value of [ip_address][crate::model::IpMapping::ip_address].
32014    pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
32015        self.ip_address = v.into();
32016        self
32017    }
32018
32019    /// Sets the value of [time_to_retire][crate::model::IpMapping::time_to_retire].
32020    pub fn set_time_to_retire<T>(mut self, v: T) -> Self
32021    where
32022        T: std::convert::Into<wkt::Timestamp>,
32023    {
32024        self.time_to_retire = std::option::Option::Some(v.into());
32025        self
32026    }
32027
32028    /// Sets or clears the value of [time_to_retire][crate::model::IpMapping::time_to_retire].
32029    pub fn set_or_clear_time_to_retire<T>(mut self, v: std::option::Option<T>) -> Self
32030    where
32031        T: std::convert::Into<wkt::Timestamp>,
32032    {
32033        self.time_to_retire = v.map(|x| x.into());
32034        self
32035    }
32036}
32037
32038impl wkt::message::Message for IpMapping {
32039    fn typename() -> &'static str {
32040        "type.googleapis.com/google.cloud.sql.v1.IpMapping"
32041    }
32042}
32043
32044#[doc(hidden)]
32045impl<'de> serde::de::Deserialize<'de> for IpMapping {
32046    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
32047    where
32048        D: serde::Deserializer<'de>,
32049    {
32050        #[allow(non_camel_case_types)]
32051        #[doc(hidden)]
32052        #[derive(PartialEq, Eq, Hash)]
32053        enum __FieldTag {
32054            __type,
32055            __ip_address,
32056            __time_to_retire,
32057            Unknown(std::string::String),
32058        }
32059        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
32060            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
32061            where
32062                D: serde::Deserializer<'de>,
32063            {
32064                struct Visitor;
32065                impl<'de> serde::de::Visitor<'de> for Visitor {
32066                    type Value = __FieldTag;
32067                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
32068                        formatter.write_str("a field name for IpMapping")
32069                    }
32070                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
32071                    where
32072                        E: serde::de::Error,
32073                    {
32074                        use std::result::Result::Ok;
32075                        use std::string::ToString;
32076                        match value {
32077                            "type" => Ok(__FieldTag::__type),
32078                            "ipAddress" => Ok(__FieldTag::__ip_address),
32079                            "ip_address" => Ok(__FieldTag::__ip_address),
32080                            "timeToRetire" => Ok(__FieldTag::__time_to_retire),
32081                            "time_to_retire" => Ok(__FieldTag::__time_to_retire),
32082                            _ => Ok(__FieldTag::Unknown(value.to_string())),
32083                        }
32084                    }
32085                }
32086                deserializer.deserialize_identifier(Visitor)
32087            }
32088        }
32089        struct Visitor;
32090        impl<'de> serde::de::Visitor<'de> for Visitor {
32091            type Value = IpMapping;
32092            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
32093                formatter.write_str("struct IpMapping")
32094            }
32095            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
32096            where
32097                A: serde::de::MapAccess<'de>,
32098            {
32099                #[allow(unused_imports)]
32100                use serde::de::Error;
32101                use std::option::Option::Some;
32102                let mut fields = std::collections::HashSet::new();
32103                let mut result = Self::Value::new();
32104                while let Some(tag) = map.next_key::<__FieldTag>()? {
32105                    #[allow(clippy::match_single_binding)]
32106                    match tag {
32107                        __FieldTag::__type => {
32108                            if !fields.insert(__FieldTag::__type) {
32109                                return std::result::Result::Err(A::Error::duplicate_field(
32110                                    "multiple values for type",
32111                                ));
32112                            }
32113                            result.r#type = map
32114                                .next_value::<std::option::Option<crate::model::SqlIpAddressType>>(
32115                                )?
32116                                .unwrap_or_default();
32117                        }
32118                        __FieldTag::__ip_address => {
32119                            if !fields.insert(__FieldTag::__ip_address) {
32120                                return std::result::Result::Err(A::Error::duplicate_field(
32121                                    "multiple values for ip_address",
32122                                ));
32123                            }
32124                            result.ip_address = map
32125                                .next_value::<std::option::Option<std::string::String>>()?
32126                                .unwrap_or_default();
32127                        }
32128                        __FieldTag::__time_to_retire => {
32129                            if !fields.insert(__FieldTag::__time_to_retire) {
32130                                return std::result::Result::Err(A::Error::duplicate_field(
32131                                    "multiple values for time_to_retire",
32132                                ));
32133                            }
32134                            result.time_to_retire =
32135                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
32136                        }
32137                        __FieldTag::Unknown(key) => {
32138                            let value = map.next_value::<serde_json::Value>()?;
32139                            result._unknown_fields.insert(key, value);
32140                        }
32141                    }
32142                }
32143                std::result::Result::Ok(result)
32144            }
32145        }
32146        deserializer.deserialize_any(Visitor)
32147    }
32148}
32149
32150#[doc(hidden)]
32151impl serde::ser::Serialize for IpMapping {
32152    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
32153    where
32154        S: serde::ser::Serializer,
32155    {
32156        use serde::ser::SerializeMap;
32157        #[allow(unused_imports)]
32158        use std::option::Option::Some;
32159        let mut state = serializer.serialize_map(std::option::Option::None)?;
32160        if !wkt::internal::is_default(&self.r#type) {
32161            state.serialize_entry("type", &self.r#type)?;
32162        }
32163        if !self.ip_address.is_empty() {
32164            state.serialize_entry("ipAddress", &self.ip_address)?;
32165        }
32166        if self.time_to_retire.is_some() {
32167            state.serialize_entry("timeToRetire", &self.time_to_retire)?;
32168        }
32169        if !self._unknown_fields.is_empty() {
32170            for (key, value) in self._unknown_fields.iter() {
32171                state.serialize_entry(key, &value)?;
32172            }
32173        }
32174        state.end()
32175    }
32176}
32177
32178/// An Operation resource.&nbsp;For successful operations that return an
32179/// Operation resource, only the fields relevant to the operation are populated
32180/// in the resource.
32181#[derive(Clone, Debug, Default, PartialEq)]
32182#[non_exhaustive]
32183pub struct Operation {
32184    /// This is always `sql#operation`.
32185    pub kind: std::string::String,
32186
32187    pub target_link: std::string::String,
32188
32189    /// The status of an operation.
32190    pub status: crate::model::operation::SqlOperationStatus,
32191
32192    /// The email address of the user who initiated this operation.
32193    pub user: std::string::String,
32194
32195    /// The time this operation was enqueued in UTC timezone in [RFC
32196    /// 3339](https://tools.ietf.org/html/rfc3339) format, for example
32197    /// `2012-11-15T16:19:00.094Z`.
32198    pub insert_time: std::option::Option<wkt::Timestamp>,
32199
32200    /// The time this operation actually started in UTC timezone in [RFC
32201    /// 3339](https://tools.ietf.org/html/rfc3339) format, for example
32202    /// `2012-11-15T16:19:00.094Z`.
32203    pub start_time: std::option::Option<wkt::Timestamp>,
32204
32205    /// The time this operation finished in UTC timezone in [RFC
32206    /// 3339](https://tools.ietf.org/html/rfc3339) format, for example
32207    /// `2012-11-15T16:19:00.094Z`.
32208    pub end_time: std::option::Option<wkt::Timestamp>,
32209
32210    /// If errors occurred during processing of this operation, this field will be
32211    /// populated.
32212    pub error: std::option::Option<crate::model::OperationErrors>,
32213
32214    /// An Admin API warning message.
32215    pub api_warning: std::option::Option<crate::model::ApiWarning>,
32216
32217    /// The type of the operation. Valid values are:
32218    ///
32219    /// * `CREATE`
32220    /// * `DELETE`
32221    /// * `UPDATE`
32222    /// * `RESTART`
32223    /// * `IMPORT`
32224    /// * `EXPORT`
32225    /// * `BACKUP_VOLUME`
32226    /// * `RESTORE_VOLUME`
32227    /// * `CREATE_USER`
32228    /// * `DELETE_USER`
32229    /// * `CREATE_DATABASE`
32230    /// * `DELETE_DATABASE`
32231    pub operation_type: crate::model::operation::SqlOperationType,
32232
32233    /// The context for import operation, if applicable.
32234    pub import_context: std::option::Option<crate::model::ImportContext>,
32235
32236    /// The context for export operation, if applicable.
32237    pub export_context: std::option::Option<crate::model::ExportContext>,
32238
32239    /// The context for backup operation, if applicable.
32240    pub backup_context: std::option::Option<crate::model::BackupContext>,
32241
32242    /// An identifier that uniquely identifies the operation. You can use this
32243    /// identifier to retrieve the Operations resource that has information about
32244    /// the operation.
32245    pub name: std::string::String,
32246
32247    /// Name of the database instance related to this operation.
32248    pub target_id: std::string::String,
32249
32250    /// The URI of this resource.
32251    pub self_link: std::string::String,
32252
32253    /// The project ID of the target instance related to this operation.
32254    pub target_project: std::string::String,
32255
32256    /// The context for acquire SSRS lease operation, if applicable.
32257    pub acquire_ssrs_lease_context: std::option::Option<crate::model::AcquireSsrsLeaseContext>,
32258
32259    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
32260}
32261
32262impl Operation {
32263    pub fn new() -> Self {
32264        std::default::Default::default()
32265    }
32266
32267    /// Sets the value of [kind][crate::model::Operation::kind].
32268    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
32269        self.kind = v.into();
32270        self
32271    }
32272
32273    /// Sets the value of [target_link][crate::model::Operation::target_link].
32274    pub fn set_target_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
32275        self.target_link = v.into();
32276        self
32277    }
32278
32279    /// Sets the value of [status][crate::model::Operation::status].
32280    pub fn set_status<T: std::convert::Into<crate::model::operation::SqlOperationStatus>>(
32281        mut self,
32282        v: T,
32283    ) -> Self {
32284        self.status = v.into();
32285        self
32286    }
32287
32288    /// Sets the value of [user][crate::model::Operation::user].
32289    pub fn set_user<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
32290        self.user = v.into();
32291        self
32292    }
32293
32294    /// Sets the value of [insert_time][crate::model::Operation::insert_time].
32295    pub fn set_insert_time<T>(mut self, v: T) -> Self
32296    where
32297        T: std::convert::Into<wkt::Timestamp>,
32298    {
32299        self.insert_time = std::option::Option::Some(v.into());
32300        self
32301    }
32302
32303    /// Sets or clears the value of [insert_time][crate::model::Operation::insert_time].
32304    pub fn set_or_clear_insert_time<T>(mut self, v: std::option::Option<T>) -> Self
32305    where
32306        T: std::convert::Into<wkt::Timestamp>,
32307    {
32308        self.insert_time = v.map(|x| x.into());
32309        self
32310    }
32311
32312    /// Sets the value of [start_time][crate::model::Operation::start_time].
32313    pub fn set_start_time<T>(mut self, v: T) -> Self
32314    where
32315        T: std::convert::Into<wkt::Timestamp>,
32316    {
32317        self.start_time = std::option::Option::Some(v.into());
32318        self
32319    }
32320
32321    /// Sets or clears the value of [start_time][crate::model::Operation::start_time].
32322    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
32323    where
32324        T: std::convert::Into<wkt::Timestamp>,
32325    {
32326        self.start_time = v.map(|x| x.into());
32327        self
32328    }
32329
32330    /// Sets the value of [end_time][crate::model::Operation::end_time].
32331    pub fn set_end_time<T>(mut self, v: T) -> Self
32332    where
32333        T: std::convert::Into<wkt::Timestamp>,
32334    {
32335        self.end_time = std::option::Option::Some(v.into());
32336        self
32337    }
32338
32339    /// Sets or clears the value of [end_time][crate::model::Operation::end_time].
32340    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
32341    where
32342        T: std::convert::Into<wkt::Timestamp>,
32343    {
32344        self.end_time = v.map(|x| x.into());
32345        self
32346    }
32347
32348    /// Sets the value of [error][crate::model::Operation::error].
32349    pub fn set_error<T>(mut self, v: T) -> Self
32350    where
32351        T: std::convert::Into<crate::model::OperationErrors>,
32352    {
32353        self.error = std::option::Option::Some(v.into());
32354        self
32355    }
32356
32357    /// Sets or clears the value of [error][crate::model::Operation::error].
32358    pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
32359    where
32360        T: std::convert::Into<crate::model::OperationErrors>,
32361    {
32362        self.error = v.map(|x| x.into());
32363        self
32364    }
32365
32366    /// Sets the value of [api_warning][crate::model::Operation::api_warning].
32367    pub fn set_api_warning<T>(mut self, v: T) -> Self
32368    where
32369        T: std::convert::Into<crate::model::ApiWarning>,
32370    {
32371        self.api_warning = std::option::Option::Some(v.into());
32372        self
32373    }
32374
32375    /// Sets or clears the value of [api_warning][crate::model::Operation::api_warning].
32376    pub fn set_or_clear_api_warning<T>(mut self, v: std::option::Option<T>) -> Self
32377    where
32378        T: std::convert::Into<crate::model::ApiWarning>,
32379    {
32380        self.api_warning = v.map(|x| x.into());
32381        self
32382    }
32383
32384    /// Sets the value of [operation_type][crate::model::Operation::operation_type].
32385    pub fn set_operation_type<T: std::convert::Into<crate::model::operation::SqlOperationType>>(
32386        mut self,
32387        v: T,
32388    ) -> Self {
32389        self.operation_type = v.into();
32390        self
32391    }
32392
32393    /// Sets the value of [import_context][crate::model::Operation::import_context].
32394    pub fn set_import_context<T>(mut self, v: T) -> Self
32395    where
32396        T: std::convert::Into<crate::model::ImportContext>,
32397    {
32398        self.import_context = std::option::Option::Some(v.into());
32399        self
32400    }
32401
32402    /// Sets or clears the value of [import_context][crate::model::Operation::import_context].
32403    pub fn set_or_clear_import_context<T>(mut self, v: std::option::Option<T>) -> Self
32404    where
32405        T: std::convert::Into<crate::model::ImportContext>,
32406    {
32407        self.import_context = v.map(|x| x.into());
32408        self
32409    }
32410
32411    /// Sets the value of [export_context][crate::model::Operation::export_context].
32412    pub fn set_export_context<T>(mut self, v: T) -> Self
32413    where
32414        T: std::convert::Into<crate::model::ExportContext>,
32415    {
32416        self.export_context = std::option::Option::Some(v.into());
32417        self
32418    }
32419
32420    /// Sets or clears the value of [export_context][crate::model::Operation::export_context].
32421    pub fn set_or_clear_export_context<T>(mut self, v: std::option::Option<T>) -> Self
32422    where
32423        T: std::convert::Into<crate::model::ExportContext>,
32424    {
32425        self.export_context = v.map(|x| x.into());
32426        self
32427    }
32428
32429    /// Sets the value of [backup_context][crate::model::Operation::backup_context].
32430    pub fn set_backup_context<T>(mut self, v: T) -> Self
32431    where
32432        T: std::convert::Into<crate::model::BackupContext>,
32433    {
32434        self.backup_context = std::option::Option::Some(v.into());
32435        self
32436    }
32437
32438    /// Sets or clears the value of [backup_context][crate::model::Operation::backup_context].
32439    pub fn set_or_clear_backup_context<T>(mut self, v: std::option::Option<T>) -> Self
32440    where
32441        T: std::convert::Into<crate::model::BackupContext>,
32442    {
32443        self.backup_context = v.map(|x| x.into());
32444        self
32445    }
32446
32447    /// Sets the value of [name][crate::model::Operation::name].
32448    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
32449        self.name = v.into();
32450        self
32451    }
32452
32453    /// Sets the value of [target_id][crate::model::Operation::target_id].
32454    pub fn set_target_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
32455        self.target_id = v.into();
32456        self
32457    }
32458
32459    /// Sets the value of [self_link][crate::model::Operation::self_link].
32460    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
32461        self.self_link = v.into();
32462        self
32463    }
32464
32465    /// Sets the value of [target_project][crate::model::Operation::target_project].
32466    pub fn set_target_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
32467        self.target_project = v.into();
32468        self
32469    }
32470
32471    /// Sets the value of [acquire_ssrs_lease_context][crate::model::Operation::acquire_ssrs_lease_context].
32472    pub fn set_acquire_ssrs_lease_context<T>(mut self, v: T) -> Self
32473    where
32474        T: std::convert::Into<crate::model::AcquireSsrsLeaseContext>,
32475    {
32476        self.acquire_ssrs_lease_context = std::option::Option::Some(v.into());
32477        self
32478    }
32479
32480    /// Sets or clears the value of [acquire_ssrs_lease_context][crate::model::Operation::acquire_ssrs_lease_context].
32481    pub fn set_or_clear_acquire_ssrs_lease_context<T>(mut self, v: std::option::Option<T>) -> Self
32482    where
32483        T: std::convert::Into<crate::model::AcquireSsrsLeaseContext>,
32484    {
32485        self.acquire_ssrs_lease_context = v.map(|x| x.into());
32486        self
32487    }
32488}
32489
32490impl wkt::message::Message for Operation {
32491    fn typename() -> &'static str {
32492        "type.googleapis.com/google.cloud.sql.v1.Operation"
32493    }
32494}
32495
32496#[doc(hidden)]
32497impl<'de> serde::de::Deserialize<'de> for Operation {
32498    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
32499    where
32500        D: serde::Deserializer<'de>,
32501    {
32502        #[allow(non_camel_case_types)]
32503        #[doc(hidden)]
32504        #[derive(PartialEq, Eq, Hash)]
32505        enum __FieldTag {
32506            __kind,
32507            __target_link,
32508            __status,
32509            __user,
32510            __insert_time,
32511            __start_time,
32512            __end_time,
32513            __error,
32514            __api_warning,
32515            __operation_type,
32516            __import_context,
32517            __export_context,
32518            __backup_context,
32519            __name,
32520            __target_id,
32521            __self_link,
32522            __target_project,
32523            __acquire_ssrs_lease_context,
32524            Unknown(std::string::String),
32525        }
32526        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
32527            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
32528            where
32529                D: serde::Deserializer<'de>,
32530            {
32531                struct Visitor;
32532                impl<'de> serde::de::Visitor<'de> for Visitor {
32533                    type Value = __FieldTag;
32534                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
32535                        formatter.write_str("a field name for Operation")
32536                    }
32537                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
32538                    where
32539                        E: serde::de::Error,
32540                    {
32541                        use std::result::Result::Ok;
32542                        use std::string::ToString;
32543                        match value {
32544                            "kind" => Ok(__FieldTag::__kind),
32545                            "targetLink" => Ok(__FieldTag::__target_link),
32546                            "target_link" => Ok(__FieldTag::__target_link),
32547                            "status" => Ok(__FieldTag::__status),
32548                            "user" => Ok(__FieldTag::__user),
32549                            "insertTime" => Ok(__FieldTag::__insert_time),
32550                            "insert_time" => Ok(__FieldTag::__insert_time),
32551                            "startTime" => Ok(__FieldTag::__start_time),
32552                            "start_time" => Ok(__FieldTag::__start_time),
32553                            "endTime" => Ok(__FieldTag::__end_time),
32554                            "end_time" => Ok(__FieldTag::__end_time),
32555                            "error" => Ok(__FieldTag::__error),
32556                            "apiWarning" => Ok(__FieldTag::__api_warning),
32557                            "api_warning" => Ok(__FieldTag::__api_warning),
32558                            "operationType" => Ok(__FieldTag::__operation_type),
32559                            "operation_type" => Ok(__FieldTag::__operation_type),
32560                            "importContext" => Ok(__FieldTag::__import_context),
32561                            "import_context" => Ok(__FieldTag::__import_context),
32562                            "exportContext" => Ok(__FieldTag::__export_context),
32563                            "export_context" => Ok(__FieldTag::__export_context),
32564                            "backupContext" => Ok(__FieldTag::__backup_context),
32565                            "backup_context" => Ok(__FieldTag::__backup_context),
32566                            "name" => Ok(__FieldTag::__name),
32567                            "targetId" => Ok(__FieldTag::__target_id),
32568                            "target_id" => Ok(__FieldTag::__target_id),
32569                            "selfLink" => Ok(__FieldTag::__self_link),
32570                            "self_link" => Ok(__FieldTag::__self_link),
32571                            "targetProject" => Ok(__FieldTag::__target_project),
32572                            "target_project" => Ok(__FieldTag::__target_project),
32573                            "acquireSsrsLeaseContext" => {
32574                                Ok(__FieldTag::__acquire_ssrs_lease_context)
32575                            }
32576                            "acquire_ssrs_lease_context" => {
32577                                Ok(__FieldTag::__acquire_ssrs_lease_context)
32578                            }
32579                            _ => Ok(__FieldTag::Unknown(value.to_string())),
32580                        }
32581                    }
32582                }
32583                deserializer.deserialize_identifier(Visitor)
32584            }
32585        }
32586        struct Visitor;
32587        impl<'de> serde::de::Visitor<'de> for Visitor {
32588            type Value = Operation;
32589            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
32590                formatter.write_str("struct Operation")
32591            }
32592            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
32593            where
32594                A: serde::de::MapAccess<'de>,
32595            {
32596                #[allow(unused_imports)]
32597                use serde::de::Error;
32598                use std::option::Option::Some;
32599                let mut fields = std::collections::HashSet::new();
32600                let mut result = Self::Value::new();
32601                while let Some(tag) = map.next_key::<__FieldTag>()? {
32602                    #[allow(clippy::match_single_binding)]
32603                    match tag {
32604                        __FieldTag::__kind => {
32605                            if !fields.insert(__FieldTag::__kind) {
32606                                return std::result::Result::Err(A::Error::duplicate_field(
32607                                    "multiple values for kind",
32608                                ));
32609                            }
32610                            result.kind = map
32611                                .next_value::<std::option::Option<std::string::String>>()?
32612                                .unwrap_or_default();
32613                        }
32614                        __FieldTag::__target_link => {
32615                            if !fields.insert(__FieldTag::__target_link) {
32616                                return std::result::Result::Err(A::Error::duplicate_field(
32617                                    "multiple values for target_link",
32618                                ));
32619                            }
32620                            result.target_link = map
32621                                .next_value::<std::option::Option<std::string::String>>()?
32622                                .unwrap_or_default();
32623                        }
32624                        __FieldTag::__status => {
32625                            if !fields.insert(__FieldTag::__status) {
32626                                return std::result::Result::Err(A::Error::duplicate_field(
32627                                    "multiple values for status",
32628                                ));
32629                            }
32630                            result.status =
32631                                map.next_value::<std::option::Option<
32632                                    crate::model::operation::SqlOperationStatus,
32633                                >>()?
32634                                .unwrap_or_default();
32635                        }
32636                        __FieldTag::__user => {
32637                            if !fields.insert(__FieldTag::__user) {
32638                                return std::result::Result::Err(A::Error::duplicate_field(
32639                                    "multiple values for user",
32640                                ));
32641                            }
32642                            result.user = map
32643                                .next_value::<std::option::Option<std::string::String>>()?
32644                                .unwrap_or_default();
32645                        }
32646                        __FieldTag::__insert_time => {
32647                            if !fields.insert(__FieldTag::__insert_time) {
32648                                return std::result::Result::Err(A::Error::duplicate_field(
32649                                    "multiple values for insert_time",
32650                                ));
32651                            }
32652                            result.insert_time =
32653                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
32654                        }
32655                        __FieldTag::__start_time => {
32656                            if !fields.insert(__FieldTag::__start_time) {
32657                                return std::result::Result::Err(A::Error::duplicate_field(
32658                                    "multiple values for start_time",
32659                                ));
32660                            }
32661                            result.start_time =
32662                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
32663                        }
32664                        __FieldTag::__end_time => {
32665                            if !fields.insert(__FieldTag::__end_time) {
32666                                return std::result::Result::Err(A::Error::duplicate_field(
32667                                    "multiple values for end_time",
32668                                ));
32669                            }
32670                            result.end_time =
32671                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
32672                        }
32673                        __FieldTag::__error => {
32674                            if !fields.insert(__FieldTag::__error) {
32675                                return std::result::Result::Err(A::Error::duplicate_field(
32676                                    "multiple values for error",
32677                                ));
32678                            }
32679                            result.error = map
32680                                .next_value::<std::option::Option<crate::model::OperationErrors>>(
32681                                )?;
32682                        }
32683                        __FieldTag::__api_warning => {
32684                            if !fields.insert(__FieldTag::__api_warning) {
32685                                return std::result::Result::Err(A::Error::duplicate_field(
32686                                    "multiple values for api_warning",
32687                                ));
32688                            }
32689                            result.api_warning =
32690                                map.next_value::<std::option::Option<crate::model::ApiWarning>>()?;
32691                        }
32692                        __FieldTag::__operation_type => {
32693                            if !fields.insert(__FieldTag::__operation_type) {
32694                                return std::result::Result::Err(A::Error::duplicate_field(
32695                                    "multiple values for operation_type",
32696                                ));
32697                            }
32698                            result.operation_type = map.next_value::<std::option::Option<crate::model::operation::SqlOperationType>>()?.unwrap_or_default();
32699                        }
32700                        __FieldTag::__import_context => {
32701                            if !fields.insert(__FieldTag::__import_context) {
32702                                return std::result::Result::Err(A::Error::duplicate_field(
32703                                    "multiple values for import_context",
32704                                ));
32705                            }
32706                            result.import_context = map
32707                                .next_value::<std::option::Option<crate::model::ImportContext>>()?;
32708                        }
32709                        __FieldTag::__export_context => {
32710                            if !fields.insert(__FieldTag::__export_context) {
32711                                return std::result::Result::Err(A::Error::duplicate_field(
32712                                    "multiple values for export_context",
32713                                ));
32714                            }
32715                            result.export_context = map
32716                                .next_value::<std::option::Option<crate::model::ExportContext>>()?;
32717                        }
32718                        __FieldTag::__backup_context => {
32719                            if !fields.insert(__FieldTag::__backup_context) {
32720                                return std::result::Result::Err(A::Error::duplicate_field(
32721                                    "multiple values for backup_context",
32722                                ));
32723                            }
32724                            result.backup_context = map
32725                                .next_value::<std::option::Option<crate::model::BackupContext>>()?;
32726                        }
32727                        __FieldTag::__name => {
32728                            if !fields.insert(__FieldTag::__name) {
32729                                return std::result::Result::Err(A::Error::duplicate_field(
32730                                    "multiple values for name",
32731                                ));
32732                            }
32733                            result.name = map
32734                                .next_value::<std::option::Option<std::string::String>>()?
32735                                .unwrap_or_default();
32736                        }
32737                        __FieldTag::__target_id => {
32738                            if !fields.insert(__FieldTag::__target_id) {
32739                                return std::result::Result::Err(A::Error::duplicate_field(
32740                                    "multiple values for target_id",
32741                                ));
32742                            }
32743                            result.target_id = map
32744                                .next_value::<std::option::Option<std::string::String>>()?
32745                                .unwrap_or_default();
32746                        }
32747                        __FieldTag::__self_link => {
32748                            if !fields.insert(__FieldTag::__self_link) {
32749                                return std::result::Result::Err(A::Error::duplicate_field(
32750                                    "multiple values for self_link",
32751                                ));
32752                            }
32753                            result.self_link = map
32754                                .next_value::<std::option::Option<std::string::String>>()?
32755                                .unwrap_or_default();
32756                        }
32757                        __FieldTag::__target_project => {
32758                            if !fields.insert(__FieldTag::__target_project) {
32759                                return std::result::Result::Err(A::Error::duplicate_field(
32760                                    "multiple values for target_project",
32761                                ));
32762                            }
32763                            result.target_project = map
32764                                .next_value::<std::option::Option<std::string::String>>()?
32765                                .unwrap_or_default();
32766                        }
32767                        __FieldTag::__acquire_ssrs_lease_context => {
32768                            if !fields.insert(__FieldTag::__acquire_ssrs_lease_context) {
32769                                return std::result::Result::Err(A::Error::duplicate_field(
32770                                    "multiple values for acquire_ssrs_lease_context",
32771                                ));
32772                            }
32773                            result.acquire_ssrs_lease_context = map.next_value::<std::option::Option<crate::model::AcquireSsrsLeaseContext>>()?
32774                                ;
32775                        }
32776                        __FieldTag::Unknown(key) => {
32777                            let value = map.next_value::<serde_json::Value>()?;
32778                            result._unknown_fields.insert(key, value);
32779                        }
32780                    }
32781                }
32782                std::result::Result::Ok(result)
32783            }
32784        }
32785        deserializer.deserialize_any(Visitor)
32786    }
32787}
32788
32789#[doc(hidden)]
32790impl serde::ser::Serialize for Operation {
32791    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
32792    where
32793        S: serde::ser::Serializer,
32794    {
32795        use serde::ser::SerializeMap;
32796        #[allow(unused_imports)]
32797        use std::option::Option::Some;
32798        let mut state = serializer.serialize_map(std::option::Option::None)?;
32799        if !self.kind.is_empty() {
32800            state.serialize_entry("kind", &self.kind)?;
32801        }
32802        if !self.target_link.is_empty() {
32803            state.serialize_entry("targetLink", &self.target_link)?;
32804        }
32805        if !wkt::internal::is_default(&self.status) {
32806            state.serialize_entry("status", &self.status)?;
32807        }
32808        if !self.user.is_empty() {
32809            state.serialize_entry("user", &self.user)?;
32810        }
32811        if self.insert_time.is_some() {
32812            state.serialize_entry("insertTime", &self.insert_time)?;
32813        }
32814        if self.start_time.is_some() {
32815            state.serialize_entry("startTime", &self.start_time)?;
32816        }
32817        if self.end_time.is_some() {
32818            state.serialize_entry("endTime", &self.end_time)?;
32819        }
32820        if self.error.is_some() {
32821            state.serialize_entry("error", &self.error)?;
32822        }
32823        if self.api_warning.is_some() {
32824            state.serialize_entry("apiWarning", &self.api_warning)?;
32825        }
32826        if !wkt::internal::is_default(&self.operation_type) {
32827            state.serialize_entry("operationType", &self.operation_type)?;
32828        }
32829        if self.import_context.is_some() {
32830            state.serialize_entry("importContext", &self.import_context)?;
32831        }
32832        if self.export_context.is_some() {
32833            state.serialize_entry("exportContext", &self.export_context)?;
32834        }
32835        if self.backup_context.is_some() {
32836            state.serialize_entry("backupContext", &self.backup_context)?;
32837        }
32838        if !self.name.is_empty() {
32839            state.serialize_entry("name", &self.name)?;
32840        }
32841        if !self.target_id.is_empty() {
32842            state.serialize_entry("targetId", &self.target_id)?;
32843        }
32844        if !self.self_link.is_empty() {
32845            state.serialize_entry("selfLink", &self.self_link)?;
32846        }
32847        if !self.target_project.is_empty() {
32848            state.serialize_entry("targetProject", &self.target_project)?;
32849        }
32850        if self.acquire_ssrs_lease_context.is_some() {
32851            state.serialize_entry("acquireSsrsLeaseContext", &self.acquire_ssrs_lease_context)?;
32852        }
32853        if !self._unknown_fields.is_empty() {
32854            for (key, value) in self._unknown_fields.iter() {
32855                state.serialize_entry(key, &value)?;
32856            }
32857        }
32858        state.end()
32859    }
32860}
32861
32862/// Defines additional types related to [Operation].
32863pub mod operation {
32864    #[allow(unused_imports)]
32865    use super::*;
32866
32867    /// The type of Cloud SQL operation.
32868    ///
32869    /// # Working with unknown values
32870    ///
32871    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
32872    /// additional enum variants at any time. Adding new variants is not considered
32873    /// a breaking change. Applications should write their code in anticipation of:
32874    ///
32875    /// - New values appearing in future releases of the client library, **and**
32876    /// - New values received dynamically, without application changes.
32877    ///
32878    /// Please consult the [Working with enums] section in the user guide for some
32879    /// guidelines.
32880    ///
32881    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
32882    #[derive(Clone, Debug, PartialEq)]
32883    #[non_exhaustive]
32884    pub enum SqlOperationType {
32885        /// Unknown operation type.
32886        Unspecified,
32887        /// Imports data into a Cloud SQL instance.
32888        Import,
32889        /// Exports data from a Cloud SQL instance to a Cloud Storage
32890        /// bucket.
32891        Export,
32892        /// Creates a new Cloud SQL instance.
32893        Create,
32894        /// Updates the settings of a Cloud SQL instance.
32895        Update,
32896        /// Deletes a Cloud SQL instance.
32897        Delete,
32898        /// Restarts the Cloud SQL instance.
32899        Restart,
32900        #[deprecated]
32901        Backup,
32902        #[deprecated]
32903        Snapshot,
32904        /// Performs instance backup.
32905        BackupVolume,
32906        /// Deletes an instance backup.
32907        DeleteVolume,
32908        /// Restores an instance backup.
32909        RestoreVolume,
32910        /// Injects a privileged user in mysql for MOB instances.
32911        InjectUser,
32912        /// Clones a Cloud SQL instance.
32913        Clone,
32914        /// Stops replication on a Cloud SQL read replica instance.
32915        StopReplica,
32916        /// Starts replication on a Cloud SQL read replica instance.
32917        StartReplica,
32918        /// Promotes a Cloud SQL replica instance.
32919        PromoteReplica,
32920        /// Creates a Cloud SQL replica instance.
32921        CreateReplica,
32922        /// Creates a new user in a Cloud SQL instance.
32923        CreateUser,
32924        /// Deletes a user from a Cloud SQL instance.
32925        DeleteUser,
32926        /// Updates an existing user in a Cloud SQL instance.
32927        UpdateUser,
32928        /// Creates a database in the Cloud SQL instance.
32929        CreateDatabase,
32930        /// Deletes a database in the Cloud SQL instance.
32931        DeleteDatabase,
32932        /// Updates a database in the Cloud SQL instance.
32933        UpdateDatabase,
32934        /// Performs failover of an HA-enabled Cloud SQL
32935        /// failover replica.
32936        Failover,
32937        /// Deletes the backup taken by a backup run.
32938        DeleteBackup,
32939        RecreateReplica,
32940        /// Truncates a general or slow log table in MySQL.
32941        TruncateLog,
32942        /// Demotes the stand-alone instance to be a Cloud SQL
32943        /// read replica for an external database server.
32944        DemoteMaster,
32945        /// Indicates that the instance is currently in maintenance. Maintenance
32946        /// typically causes the instance to be unavailable for 1-3 minutes.
32947        Maintenance,
32948        /// This field is deprecated, and will be removed in future version of API.
32949        #[deprecated]
32950        EnablePrivateIp,
32951        #[deprecated]
32952        DeferMaintenance,
32953        /// Creates clone instance.
32954        #[deprecated]
32955        CreateClone,
32956        /// Reschedule maintenance to another time.
32957        RescheduleMaintenance,
32958        /// Starts external sync of a Cloud SQL EM replica to an external primary
32959        /// instance.
32960        StartExternalSync,
32961        /// Recovers logs from an instance's old data disk.
32962        LogCleanup,
32963        /// Performs auto-restart of an HA-enabled Cloud SQL database for auto
32964        /// recovery.
32965        AutoRestart,
32966        /// Re-encrypts CMEK instances with latest key version.
32967        Reencrypt,
32968        /// Switches the roles of the primary and replica pair. The target instance
32969        /// should be the replica.
32970        Switchover,
32971        /// Acquire a lease for the setup of SQL Server Reporting Services (SSRS).
32972        AcquireSsrsLease,
32973        /// Release a lease for the setup of SQL Server Reporting Services (SSRS).
32974        ReleaseSsrsLease,
32975        /// Reconfigures old primary after a promote replica operation. Effect of a
32976        /// promote operation to the old primary is executed in this operation,
32977        /// asynchronously from the promote replica operation executed to the
32978        /// replica.
32979        ReconfigureOldPrimary,
32980        /// Indicates that the instance, its read replicas, and its cascading
32981        /// replicas are in maintenance. Maintenance typically gets initiated on
32982        /// groups of replicas first, followed by the primary instance. For each
32983        /// instance, maintenance typically causes the instance to be unavailable for
32984        /// 1-3 minutes.
32985        ClusterMaintenance,
32986        /// Indicates that the instance (and any of its replicas) are currently in
32987        /// maintenance. This is initiated as a self-service request by using SSM.
32988        /// Maintenance typically causes the instance to be unavailable for 1-3
32989        /// minutes.
32990        SelfServiceMaintenance,
32991        /// Switches a primary instance to a replica. This operation runs as part of
32992        /// a switchover operation to the original primary instance.
32993        SwitchoverToReplica,
32994        /// Updates the major version of a Cloud SQL instance.
32995        MajorVersionUpgrade,
32996        /// If set, the enum was initialized with an unknown value.
32997        ///
32998        /// Applications can examine the value using [SqlOperationType::value] or
32999        /// [SqlOperationType::name].
33000        UnknownValue(sql_operation_type::UnknownValue),
33001    }
33002
33003    #[doc(hidden)]
33004    pub mod sql_operation_type {
33005        #[allow(unused_imports)]
33006        use super::*;
33007        #[derive(Clone, Debug, PartialEq)]
33008        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
33009    }
33010
33011    impl SqlOperationType {
33012        /// Gets the enum value.
33013        ///
33014        /// Returns `None` if the enum contains an unknown value deserialized from
33015        /// the string representation of enums.
33016        pub fn value(&self) -> std::option::Option<i32> {
33017            match self {
33018                Self::Unspecified => std::option::Option::Some(0),
33019                Self::Import => std::option::Option::Some(1),
33020                Self::Export => std::option::Option::Some(2),
33021                Self::Create => std::option::Option::Some(3),
33022                Self::Update => std::option::Option::Some(4),
33023                Self::Delete => std::option::Option::Some(5),
33024                Self::Restart => std::option::Option::Some(6),
33025                Self::Backup => std::option::Option::Some(7),
33026                Self::Snapshot => std::option::Option::Some(8),
33027                Self::BackupVolume => std::option::Option::Some(9),
33028                Self::DeleteVolume => std::option::Option::Some(10),
33029                Self::RestoreVolume => std::option::Option::Some(11),
33030                Self::InjectUser => std::option::Option::Some(12),
33031                Self::Clone => std::option::Option::Some(14),
33032                Self::StopReplica => std::option::Option::Some(15),
33033                Self::StartReplica => std::option::Option::Some(16),
33034                Self::PromoteReplica => std::option::Option::Some(17),
33035                Self::CreateReplica => std::option::Option::Some(18),
33036                Self::CreateUser => std::option::Option::Some(19),
33037                Self::DeleteUser => std::option::Option::Some(20),
33038                Self::UpdateUser => std::option::Option::Some(21),
33039                Self::CreateDatabase => std::option::Option::Some(22),
33040                Self::DeleteDatabase => std::option::Option::Some(23),
33041                Self::UpdateDatabase => std::option::Option::Some(24),
33042                Self::Failover => std::option::Option::Some(25),
33043                Self::DeleteBackup => std::option::Option::Some(26),
33044                Self::RecreateReplica => std::option::Option::Some(27),
33045                Self::TruncateLog => std::option::Option::Some(28),
33046                Self::DemoteMaster => std::option::Option::Some(29),
33047                Self::Maintenance => std::option::Option::Some(30),
33048                Self::EnablePrivateIp => std::option::Option::Some(31),
33049                Self::DeferMaintenance => std::option::Option::Some(32),
33050                Self::CreateClone => std::option::Option::Some(33),
33051                Self::RescheduleMaintenance => std::option::Option::Some(34),
33052                Self::StartExternalSync => std::option::Option::Some(35),
33053                Self::LogCleanup => std::option::Option::Some(36),
33054                Self::AutoRestart => std::option::Option::Some(37),
33055                Self::Reencrypt => std::option::Option::Some(38),
33056                Self::Switchover => std::option::Option::Some(39),
33057                Self::AcquireSsrsLease => std::option::Option::Some(42),
33058                Self::ReleaseSsrsLease => std::option::Option::Some(43),
33059                Self::ReconfigureOldPrimary => std::option::Option::Some(44),
33060                Self::ClusterMaintenance => std::option::Option::Some(45),
33061                Self::SelfServiceMaintenance => std::option::Option::Some(46),
33062                Self::SwitchoverToReplica => std::option::Option::Some(47),
33063                Self::MajorVersionUpgrade => std::option::Option::Some(48),
33064                Self::UnknownValue(u) => u.0.value(),
33065            }
33066        }
33067
33068        /// Gets the enum value as a string.
33069        ///
33070        /// Returns `None` if the enum contains an unknown value deserialized from
33071        /// the integer representation of enums.
33072        pub fn name(&self) -> std::option::Option<&str> {
33073            match self {
33074                Self::Unspecified => std::option::Option::Some("SQL_OPERATION_TYPE_UNSPECIFIED"),
33075                Self::Import => std::option::Option::Some("IMPORT"),
33076                Self::Export => std::option::Option::Some("EXPORT"),
33077                Self::Create => std::option::Option::Some("CREATE"),
33078                Self::Update => std::option::Option::Some("UPDATE"),
33079                Self::Delete => std::option::Option::Some("DELETE"),
33080                Self::Restart => std::option::Option::Some("RESTART"),
33081                Self::Backup => std::option::Option::Some("BACKUP"),
33082                Self::Snapshot => std::option::Option::Some("SNAPSHOT"),
33083                Self::BackupVolume => std::option::Option::Some("BACKUP_VOLUME"),
33084                Self::DeleteVolume => std::option::Option::Some("DELETE_VOLUME"),
33085                Self::RestoreVolume => std::option::Option::Some("RESTORE_VOLUME"),
33086                Self::InjectUser => std::option::Option::Some("INJECT_USER"),
33087                Self::Clone => std::option::Option::Some("CLONE"),
33088                Self::StopReplica => std::option::Option::Some("STOP_REPLICA"),
33089                Self::StartReplica => std::option::Option::Some("START_REPLICA"),
33090                Self::PromoteReplica => std::option::Option::Some("PROMOTE_REPLICA"),
33091                Self::CreateReplica => std::option::Option::Some("CREATE_REPLICA"),
33092                Self::CreateUser => std::option::Option::Some("CREATE_USER"),
33093                Self::DeleteUser => std::option::Option::Some("DELETE_USER"),
33094                Self::UpdateUser => std::option::Option::Some("UPDATE_USER"),
33095                Self::CreateDatabase => std::option::Option::Some("CREATE_DATABASE"),
33096                Self::DeleteDatabase => std::option::Option::Some("DELETE_DATABASE"),
33097                Self::UpdateDatabase => std::option::Option::Some("UPDATE_DATABASE"),
33098                Self::Failover => std::option::Option::Some("FAILOVER"),
33099                Self::DeleteBackup => std::option::Option::Some("DELETE_BACKUP"),
33100                Self::RecreateReplica => std::option::Option::Some("RECREATE_REPLICA"),
33101                Self::TruncateLog => std::option::Option::Some("TRUNCATE_LOG"),
33102                Self::DemoteMaster => std::option::Option::Some("DEMOTE_MASTER"),
33103                Self::Maintenance => std::option::Option::Some("MAINTENANCE"),
33104                Self::EnablePrivateIp => std::option::Option::Some("ENABLE_PRIVATE_IP"),
33105                Self::DeferMaintenance => std::option::Option::Some("DEFER_MAINTENANCE"),
33106                Self::CreateClone => std::option::Option::Some("CREATE_CLONE"),
33107                Self::RescheduleMaintenance => std::option::Option::Some("RESCHEDULE_MAINTENANCE"),
33108                Self::StartExternalSync => std::option::Option::Some("START_EXTERNAL_SYNC"),
33109                Self::LogCleanup => std::option::Option::Some("LOG_CLEANUP"),
33110                Self::AutoRestart => std::option::Option::Some("AUTO_RESTART"),
33111                Self::Reencrypt => std::option::Option::Some("REENCRYPT"),
33112                Self::Switchover => std::option::Option::Some("SWITCHOVER"),
33113                Self::AcquireSsrsLease => std::option::Option::Some("ACQUIRE_SSRS_LEASE"),
33114                Self::ReleaseSsrsLease => std::option::Option::Some("RELEASE_SSRS_LEASE"),
33115                Self::ReconfigureOldPrimary => std::option::Option::Some("RECONFIGURE_OLD_PRIMARY"),
33116                Self::ClusterMaintenance => std::option::Option::Some("CLUSTER_MAINTENANCE"),
33117                Self::SelfServiceMaintenance => {
33118                    std::option::Option::Some("SELF_SERVICE_MAINTENANCE")
33119                }
33120                Self::SwitchoverToReplica => std::option::Option::Some("SWITCHOVER_TO_REPLICA"),
33121                Self::MajorVersionUpgrade => std::option::Option::Some("MAJOR_VERSION_UPGRADE"),
33122                Self::UnknownValue(u) => u.0.name(),
33123            }
33124        }
33125    }
33126
33127    impl std::default::Default for SqlOperationType {
33128        fn default() -> Self {
33129            use std::convert::From;
33130            Self::from(0)
33131        }
33132    }
33133
33134    impl std::fmt::Display for SqlOperationType {
33135        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
33136            wkt::internal::display_enum(f, self.name(), self.value())
33137        }
33138    }
33139
33140    impl std::convert::From<i32> for SqlOperationType {
33141        fn from(value: i32) -> Self {
33142            match value {
33143                0 => Self::Unspecified,
33144                1 => Self::Import,
33145                2 => Self::Export,
33146                3 => Self::Create,
33147                4 => Self::Update,
33148                5 => Self::Delete,
33149                6 => Self::Restart,
33150                7 => Self::Backup,
33151                8 => Self::Snapshot,
33152                9 => Self::BackupVolume,
33153                10 => Self::DeleteVolume,
33154                11 => Self::RestoreVolume,
33155                12 => Self::InjectUser,
33156                14 => Self::Clone,
33157                15 => Self::StopReplica,
33158                16 => Self::StartReplica,
33159                17 => Self::PromoteReplica,
33160                18 => Self::CreateReplica,
33161                19 => Self::CreateUser,
33162                20 => Self::DeleteUser,
33163                21 => Self::UpdateUser,
33164                22 => Self::CreateDatabase,
33165                23 => Self::DeleteDatabase,
33166                24 => Self::UpdateDatabase,
33167                25 => Self::Failover,
33168                26 => Self::DeleteBackup,
33169                27 => Self::RecreateReplica,
33170                28 => Self::TruncateLog,
33171                29 => Self::DemoteMaster,
33172                30 => Self::Maintenance,
33173                31 => Self::EnablePrivateIp,
33174                32 => Self::DeferMaintenance,
33175                33 => Self::CreateClone,
33176                34 => Self::RescheduleMaintenance,
33177                35 => Self::StartExternalSync,
33178                36 => Self::LogCleanup,
33179                37 => Self::AutoRestart,
33180                38 => Self::Reencrypt,
33181                39 => Self::Switchover,
33182                42 => Self::AcquireSsrsLease,
33183                43 => Self::ReleaseSsrsLease,
33184                44 => Self::ReconfigureOldPrimary,
33185                45 => Self::ClusterMaintenance,
33186                46 => Self::SelfServiceMaintenance,
33187                47 => Self::SwitchoverToReplica,
33188                48 => Self::MajorVersionUpgrade,
33189                _ => Self::UnknownValue(sql_operation_type::UnknownValue(
33190                    wkt::internal::UnknownEnumValue::Integer(value),
33191                )),
33192            }
33193        }
33194    }
33195
33196    impl std::convert::From<&str> for SqlOperationType {
33197        fn from(value: &str) -> Self {
33198            use std::string::ToString;
33199            match value {
33200                "SQL_OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
33201                "IMPORT" => Self::Import,
33202                "EXPORT" => Self::Export,
33203                "CREATE" => Self::Create,
33204                "UPDATE" => Self::Update,
33205                "DELETE" => Self::Delete,
33206                "RESTART" => Self::Restart,
33207                "BACKUP" => Self::Backup,
33208                "SNAPSHOT" => Self::Snapshot,
33209                "BACKUP_VOLUME" => Self::BackupVolume,
33210                "DELETE_VOLUME" => Self::DeleteVolume,
33211                "RESTORE_VOLUME" => Self::RestoreVolume,
33212                "INJECT_USER" => Self::InjectUser,
33213                "CLONE" => Self::Clone,
33214                "STOP_REPLICA" => Self::StopReplica,
33215                "START_REPLICA" => Self::StartReplica,
33216                "PROMOTE_REPLICA" => Self::PromoteReplica,
33217                "CREATE_REPLICA" => Self::CreateReplica,
33218                "CREATE_USER" => Self::CreateUser,
33219                "DELETE_USER" => Self::DeleteUser,
33220                "UPDATE_USER" => Self::UpdateUser,
33221                "CREATE_DATABASE" => Self::CreateDatabase,
33222                "DELETE_DATABASE" => Self::DeleteDatabase,
33223                "UPDATE_DATABASE" => Self::UpdateDatabase,
33224                "FAILOVER" => Self::Failover,
33225                "DELETE_BACKUP" => Self::DeleteBackup,
33226                "RECREATE_REPLICA" => Self::RecreateReplica,
33227                "TRUNCATE_LOG" => Self::TruncateLog,
33228                "DEMOTE_MASTER" => Self::DemoteMaster,
33229                "MAINTENANCE" => Self::Maintenance,
33230                "ENABLE_PRIVATE_IP" => Self::EnablePrivateIp,
33231                "DEFER_MAINTENANCE" => Self::DeferMaintenance,
33232                "CREATE_CLONE" => Self::CreateClone,
33233                "RESCHEDULE_MAINTENANCE" => Self::RescheduleMaintenance,
33234                "START_EXTERNAL_SYNC" => Self::StartExternalSync,
33235                "LOG_CLEANUP" => Self::LogCleanup,
33236                "AUTO_RESTART" => Self::AutoRestart,
33237                "REENCRYPT" => Self::Reencrypt,
33238                "SWITCHOVER" => Self::Switchover,
33239                "ACQUIRE_SSRS_LEASE" => Self::AcquireSsrsLease,
33240                "RELEASE_SSRS_LEASE" => Self::ReleaseSsrsLease,
33241                "RECONFIGURE_OLD_PRIMARY" => Self::ReconfigureOldPrimary,
33242                "CLUSTER_MAINTENANCE" => Self::ClusterMaintenance,
33243                "SELF_SERVICE_MAINTENANCE" => Self::SelfServiceMaintenance,
33244                "SWITCHOVER_TO_REPLICA" => Self::SwitchoverToReplica,
33245                "MAJOR_VERSION_UPGRADE" => Self::MajorVersionUpgrade,
33246                _ => Self::UnknownValue(sql_operation_type::UnknownValue(
33247                    wkt::internal::UnknownEnumValue::String(value.to_string()),
33248                )),
33249            }
33250        }
33251    }
33252
33253    impl serde::ser::Serialize for SqlOperationType {
33254        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
33255        where
33256            S: serde::Serializer,
33257        {
33258            match self {
33259                Self::Unspecified => serializer.serialize_i32(0),
33260                Self::Import => serializer.serialize_i32(1),
33261                Self::Export => serializer.serialize_i32(2),
33262                Self::Create => serializer.serialize_i32(3),
33263                Self::Update => serializer.serialize_i32(4),
33264                Self::Delete => serializer.serialize_i32(5),
33265                Self::Restart => serializer.serialize_i32(6),
33266                Self::Backup => serializer.serialize_i32(7),
33267                Self::Snapshot => serializer.serialize_i32(8),
33268                Self::BackupVolume => serializer.serialize_i32(9),
33269                Self::DeleteVolume => serializer.serialize_i32(10),
33270                Self::RestoreVolume => serializer.serialize_i32(11),
33271                Self::InjectUser => serializer.serialize_i32(12),
33272                Self::Clone => serializer.serialize_i32(14),
33273                Self::StopReplica => serializer.serialize_i32(15),
33274                Self::StartReplica => serializer.serialize_i32(16),
33275                Self::PromoteReplica => serializer.serialize_i32(17),
33276                Self::CreateReplica => serializer.serialize_i32(18),
33277                Self::CreateUser => serializer.serialize_i32(19),
33278                Self::DeleteUser => serializer.serialize_i32(20),
33279                Self::UpdateUser => serializer.serialize_i32(21),
33280                Self::CreateDatabase => serializer.serialize_i32(22),
33281                Self::DeleteDatabase => serializer.serialize_i32(23),
33282                Self::UpdateDatabase => serializer.serialize_i32(24),
33283                Self::Failover => serializer.serialize_i32(25),
33284                Self::DeleteBackup => serializer.serialize_i32(26),
33285                Self::RecreateReplica => serializer.serialize_i32(27),
33286                Self::TruncateLog => serializer.serialize_i32(28),
33287                Self::DemoteMaster => serializer.serialize_i32(29),
33288                Self::Maintenance => serializer.serialize_i32(30),
33289                Self::EnablePrivateIp => serializer.serialize_i32(31),
33290                Self::DeferMaintenance => serializer.serialize_i32(32),
33291                Self::CreateClone => serializer.serialize_i32(33),
33292                Self::RescheduleMaintenance => serializer.serialize_i32(34),
33293                Self::StartExternalSync => serializer.serialize_i32(35),
33294                Self::LogCleanup => serializer.serialize_i32(36),
33295                Self::AutoRestart => serializer.serialize_i32(37),
33296                Self::Reencrypt => serializer.serialize_i32(38),
33297                Self::Switchover => serializer.serialize_i32(39),
33298                Self::AcquireSsrsLease => serializer.serialize_i32(42),
33299                Self::ReleaseSsrsLease => serializer.serialize_i32(43),
33300                Self::ReconfigureOldPrimary => serializer.serialize_i32(44),
33301                Self::ClusterMaintenance => serializer.serialize_i32(45),
33302                Self::SelfServiceMaintenance => serializer.serialize_i32(46),
33303                Self::SwitchoverToReplica => serializer.serialize_i32(47),
33304                Self::MajorVersionUpgrade => serializer.serialize_i32(48),
33305                Self::UnknownValue(u) => u.0.serialize(serializer),
33306            }
33307        }
33308    }
33309
33310    impl<'de> serde::de::Deserialize<'de> for SqlOperationType {
33311        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
33312        where
33313            D: serde::Deserializer<'de>,
33314        {
33315            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlOperationType>::new(
33316                ".google.cloud.sql.v1.Operation.SqlOperationType",
33317            ))
33318        }
33319    }
33320
33321    /// The status of an operation.
33322    ///
33323    /// # Working with unknown values
33324    ///
33325    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
33326    /// additional enum variants at any time. Adding new variants is not considered
33327    /// a breaking change. Applications should write their code in anticipation of:
33328    ///
33329    /// - New values appearing in future releases of the client library, **and**
33330    /// - New values received dynamically, without application changes.
33331    ///
33332    /// Please consult the [Working with enums] section in the user guide for some
33333    /// guidelines.
33334    ///
33335    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
33336    #[derive(Clone, Debug, PartialEq)]
33337    #[non_exhaustive]
33338    pub enum SqlOperationStatus {
33339        /// The state of the operation is unknown.
33340        Unspecified,
33341        /// The operation has been queued, but has not started yet.
33342        Pending,
33343        /// The operation is running.
33344        Running,
33345        /// The operation completed.
33346        Done,
33347        /// If set, the enum was initialized with an unknown value.
33348        ///
33349        /// Applications can examine the value using [SqlOperationStatus::value] or
33350        /// [SqlOperationStatus::name].
33351        UnknownValue(sql_operation_status::UnknownValue),
33352    }
33353
33354    #[doc(hidden)]
33355    pub mod sql_operation_status {
33356        #[allow(unused_imports)]
33357        use super::*;
33358        #[derive(Clone, Debug, PartialEq)]
33359        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
33360    }
33361
33362    impl SqlOperationStatus {
33363        /// Gets the enum value.
33364        ///
33365        /// Returns `None` if the enum contains an unknown value deserialized from
33366        /// the string representation of enums.
33367        pub fn value(&self) -> std::option::Option<i32> {
33368            match self {
33369                Self::Unspecified => std::option::Option::Some(0),
33370                Self::Pending => std::option::Option::Some(1),
33371                Self::Running => std::option::Option::Some(2),
33372                Self::Done => std::option::Option::Some(3),
33373                Self::UnknownValue(u) => u.0.value(),
33374            }
33375        }
33376
33377        /// Gets the enum value as a string.
33378        ///
33379        /// Returns `None` if the enum contains an unknown value deserialized from
33380        /// the integer representation of enums.
33381        pub fn name(&self) -> std::option::Option<&str> {
33382            match self {
33383                Self::Unspecified => std::option::Option::Some("SQL_OPERATION_STATUS_UNSPECIFIED"),
33384                Self::Pending => std::option::Option::Some("PENDING"),
33385                Self::Running => std::option::Option::Some("RUNNING"),
33386                Self::Done => std::option::Option::Some("DONE"),
33387                Self::UnknownValue(u) => u.0.name(),
33388            }
33389        }
33390    }
33391
33392    impl std::default::Default for SqlOperationStatus {
33393        fn default() -> Self {
33394            use std::convert::From;
33395            Self::from(0)
33396        }
33397    }
33398
33399    impl std::fmt::Display for SqlOperationStatus {
33400        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
33401            wkt::internal::display_enum(f, self.name(), self.value())
33402        }
33403    }
33404
33405    impl std::convert::From<i32> for SqlOperationStatus {
33406        fn from(value: i32) -> Self {
33407            match value {
33408                0 => Self::Unspecified,
33409                1 => Self::Pending,
33410                2 => Self::Running,
33411                3 => Self::Done,
33412                _ => Self::UnknownValue(sql_operation_status::UnknownValue(
33413                    wkt::internal::UnknownEnumValue::Integer(value),
33414                )),
33415            }
33416        }
33417    }
33418
33419    impl std::convert::From<&str> for SqlOperationStatus {
33420        fn from(value: &str) -> Self {
33421            use std::string::ToString;
33422            match value {
33423                "SQL_OPERATION_STATUS_UNSPECIFIED" => Self::Unspecified,
33424                "PENDING" => Self::Pending,
33425                "RUNNING" => Self::Running,
33426                "DONE" => Self::Done,
33427                _ => Self::UnknownValue(sql_operation_status::UnknownValue(
33428                    wkt::internal::UnknownEnumValue::String(value.to_string()),
33429                )),
33430            }
33431        }
33432    }
33433
33434    impl serde::ser::Serialize for SqlOperationStatus {
33435        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
33436        where
33437            S: serde::Serializer,
33438        {
33439            match self {
33440                Self::Unspecified => serializer.serialize_i32(0),
33441                Self::Pending => serializer.serialize_i32(1),
33442                Self::Running => serializer.serialize_i32(2),
33443                Self::Done => serializer.serialize_i32(3),
33444                Self::UnknownValue(u) => u.0.serialize(serializer),
33445            }
33446        }
33447    }
33448
33449    impl<'de> serde::de::Deserialize<'de> for SqlOperationStatus {
33450        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
33451        where
33452            D: serde::Deserializer<'de>,
33453        {
33454            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlOperationStatus>::new(
33455                ".google.cloud.sql.v1.Operation.SqlOperationStatus",
33456            ))
33457        }
33458    }
33459}
33460
33461/// Database instance operation error.
33462#[derive(Clone, Debug, Default, PartialEq)]
33463#[non_exhaustive]
33464pub struct OperationError {
33465    /// This is always `sql#operationError`.
33466    pub kind: std::string::String,
33467
33468    /// Identifies the specific error that occurred.
33469    pub code: std::string::String,
33470
33471    /// Additional information about the error encountered.
33472    pub message: std::string::String,
33473
33474    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
33475}
33476
33477impl OperationError {
33478    pub fn new() -> Self {
33479        std::default::Default::default()
33480    }
33481
33482    /// Sets the value of [kind][crate::model::OperationError::kind].
33483    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
33484        self.kind = v.into();
33485        self
33486    }
33487
33488    /// Sets the value of [code][crate::model::OperationError::code].
33489    pub fn set_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
33490        self.code = v.into();
33491        self
33492    }
33493
33494    /// Sets the value of [message][crate::model::OperationError::message].
33495    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
33496        self.message = v.into();
33497        self
33498    }
33499}
33500
33501impl wkt::message::Message for OperationError {
33502    fn typename() -> &'static str {
33503        "type.googleapis.com/google.cloud.sql.v1.OperationError"
33504    }
33505}
33506
33507#[doc(hidden)]
33508impl<'de> serde::de::Deserialize<'de> for OperationError {
33509    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
33510    where
33511        D: serde::Deserializer<'de>,
33512    {
33513        #[allow(non_camel_case_types)]
33514        #[doc(hidden)]
33515        #[derive(PartialEq, Eq, Hash)]
33516        enum __FieldTag {
33517            __kind,
33518            __code,
33519            __message,
33520            Unknown(std::string::String),
33521        }
33522        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
33523            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
33524            where
33525                D: serde::Deserializer<'de>,
33526            {
33527                struct Visitor;
33528                impl<'de> serde::de::Visitor<'de> for Visitor {
33529                    type Value = __FieldTag;
33530                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
33531                        formatter.write_str("a field name for OperationError")
33532                    }
33533                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
33534                    where
33535                        E: serde::de::Error,
33536                    {
33537                        use std::result::Result::Ok;
33538                        use std::string::ToString;
33539                        match value {
33540                            "kind" => Ok(__FieldTag::__kind),
33541                            "code" => Ok(__FieldTag::__code),
33542                            "message" => Ok(__FieldTag::__message),
33543                            _ => Ok(__FieldTag::Unknown(value.to_string())),
33544                        }
33545                    }
33546                }
33547                deserializer.deserialize_identifier(Visitor)
33548            }
33549        }
33550        struct Visitor;
33551        impl<'de> serde::de::Visitor<'de> for Visitor {
33552            type Value = OperationError;
33553            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
33554                formatter.write_str("struct OperationError")
33555            }
33556            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
33557            where
33558                A: serde::de::MapAccess<'de>,
33559            {
33560                #[allow(unused_imports)]
33561                use serde::de::Error;
33562                use std::option::Option::Some;
33563                let mut fields = std::collections::HashSet::new();
33564                let mut result = Self::Value::new();
33565                while let Some(tag) = map.next_key::<__FieldTag>()? {
33566                    #[allow(clippy::match_single_binding)]
33567                    match tag {
33568                        __FieldTag::__kind => {
33569                            if !fields.insert(__FieldTag::__kind) {
33570                                return std::result::Result::Err(A::Error::duplicate_field(
33571                                    "multiple values for kind",
33572                                ));
33573                            }
33574                            result.kind = map
33575                                .next_value::<std::option::Option<std::string::String>>()?
33576                                .unwrap_or_default();
33577                        }
33578                        __FieldTag::__code => {
33579                            if !fields.insert(__FieldTag::__code) {
33580                                return std::result::Result::Err(A::Error::duplicate_field(
33581                                    "multiple values for code",
33582                                ));
33583                            }
33584                            result.code = map
33585                                .next_value::<std::option::Option<std::string::String>>()?
33586                                .unwrap_or_default();
33587                        }
33588                        __FieldTag::__message => {
33589                            if !fields.insert(__FieldTag::__message) {
33590                                return std::result::Result::Err(A::Error::duplicate_field(
33591                                    "multiple values for message",
33592                                ));
33593                            }
33594                            result.message = map
33595                                .next_value::<std::option::Option<std::string::String>>()?
33596                                .unwrap_or_default();
33597                        }
33598                        __FieldTag::Unknown(key) => {
33599                            let value = map.next_value::<serde_json::Value>()?;
33600                            result._unknown_fields.insert(key, value);
33601                        }
33602                    }
33603                }
33604                std::result::Result::Ok(result)
33605            }
33606        }
33607        deserializer.deserialize_any(Visitor)
33608    }
33609}
33610
33611#[doc(hidden)]
33612impl serde::ser::Serialize for OperationError {
33613    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
33614    where
33615        S: serde::ser::Serializer,
33616    {
33617        use serde::ser::SerializeMap;
33618        #[allow(unused_imports)]
33619        use std::option::Option::Some;
33620        let mut state = serializer.serialize_map(std::option::Option::None)?;
33621        if !self.kind.is_empty() {
33622            state.serialize_entry("kind", &self.kind)?;
33623        }
33624        if !self.code.is_empty() {
33625            state.serialize_entry("code", &self.code)?;
33626        }
33627        if !self.message.is_empty() {
33628            state.serialize_entry("message", &self.message)?;
33629        }
33630        if !self._unknown_fields.is_empty() {
33631            for (key, value) in self._unknown_fields.iter() {
33632                state.serialize_entry(key, &value)?;
33633            }
33634        }
33635        state.end()
33636    }
33637}
33638
33639/// Database instance operation errors list wrapper.
33640#[derive(Clone, Debug, Default, PartialEq)]
33641#[non_exhaustive]
33642pub struct OperationErrors {
33643    /// This is always `sql#operationErrors`.
33644    pub kind: std::string::String,
33645
33646    /// The list of errors encountered while processing this operation.
33647    pub errors: std::vec::Vec<crate::model::OperationError>,
33648
33649    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
33650}
33651
33652impl OperationErrors {
33653    pub fn new() -> Self {
33654        std::default::Default::default()
33655    }
33656
33657    /// Sets the value of [kind][crate::model::OperationErrors::kind].
33658    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
33659        self.kind = v.into();
33660        self
33661    }
33662
33663    /// Sets the value of [errors][crate::model::OperationErrors::errors].
33664    pub fn set_errors<T, V>(mut self, v: T) -> Self
33665    where
33666        T: std::iter::IntoIterator<Item = V>,
33667        V: std::convert::Into<crate::model::OperationError>,
33668    {
33669        use std::iter::Iterator;
33670        self.errors = v.into_iter().map(|i| i.into()).collect();
33671        self
33672    }
33673}
33674
33675impl wkt::message::Message for OperationErrors {
33676    fn typename() -> &'static str {
33677        "type.googleapis.com/google.cloud.sql.v1.OperationErrors"
33678    }
33679}
33680
33681#[doc(hidden)]
33682impl<'de> serde::de::Deserialize<'de> for OperationErrors {
33683    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
33684    where
33685        D: serde::Deserializer<'de>,
33686    {
33687        #[allow(non_camel_case_types)]
33688        #[doc(hidden)]
33689        #[derive(PartialEq, Eq, Hash)]
33690        enum __FieldTag {
33691            __kind,
33692            __errors,
33693            Unknown(std::string::String),
33694        }
33695        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
33696            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
33697            where
33698                D: serde::Deserializer<'de>,
33699            {
33700                struct Visitor;
33701                impl<'de> serde::de::Visitor<'de> for Visitor {
33702                    type Value = __FieldTag;
33703                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
33704                        formatter.write_str("a field name for OperationErrors")
33705                    }
33706                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
33707                    where
33708                        E: serde::de::Error,
33709                    {
33710                        use std::result::Result::Ok;
33711                        use std::string::ToString;
33712                        match value {
33713                            "kind" => Ok(__FieldTag::__kind),
33714                            "errors" => Ok(__FieldTag::__errors),
33715                            _ => Ok(__FieldTag::Unknown(value.to_string())),
33716                        }
33717                    }
33718                }
33719                deserializer.deserialize_identifier(Visitor)
33720            }
33721        }
33722        struct Visitor;
33723        impl<'de> serde::de::Visitor<'de> for Visitor {
33724            type Value = OperationErrors;
33725            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
33726                formatter.write_str("struct OperationErrors")
33727            }
33728            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
33729            where
33730                A: serde::de::MapAccess<'de>,
33731            {
33732                #[allow(unused_imports)]
33733                use serde::de::Error;
33734                use std::option::Option::Some;
33735                let mut fields = std::collections::HashSet::new();
33736                let mut result = Self::Value::new();
33737                while let Some(tag) = map.next_key::<__FieldTag>()? {
33738                    #[allow(clippy::match_single_binding)]
33739                    match tag {
33740                        __FieldTag::__kind => {
33741                            if !fields.insert(__FieldTag::__kind) {
33742                                return std::result::Result::Err(A::Error::duplicate_field(
33743                                    "multiple values for kind",
33744                                ));
33745                            }
33746                            result.kind = map
33747                                .next_value::<std::option::Option<std::string::String>>()?
33748                                .unwrap_or_default();
33749                        }
33750                        __FieldTag::__errors => {
33751                            if !fields.insert(__FieldTag::__errors) {
33752                                return std::result::Result::Err(A::Error::duplicate_field(
33753                                    "multiple values for errors",
33754                                ));
33755                            }
33756                            result.errors =
33757                                map.next_value::<std::option::Option<
33758                                    std::vec::Vec<crate::model::OperationError>,
33759                                >>()?
33760                                .unwrap_or_default();
33761                        }
33762                        __FieldTag::Unknown(key) => {
33763                            let value = map.next_value::<serde_json::Value>()?;
33764                            result._unknown_fields.insert(key, value);
33765                        }
33766                    }
33767                }
33768                std::result::Result::Ok(result)
33769            }
33770        }
33771        deserializer.deserialize_any(Visitor)
33772    }
33773}
33774
33775#[doc(hidden)]
33776impl serde::ser::Serialize for OperationErrors {
33777    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
33778    where
33779        S: serde::ser::Serializer,
33780    {
33781        use serde::ser::SerializeMap;
33782        #[allow(unused_imports)]
33783        use std::option::Option::Some;
33784        let mut state = serializer.serialize_map(std::option::Option::None)?;
33785        if !self.kind.is_empty() {
33786            state.serialize_entry("kind", &self.kind)?;
33787        }
33788        if !self.errors.is_empty() {
33789            state.serialize_entry("errors", &self.errors)?;
33790        }
33791        if !self._unknown_fields.is_empty() {
33792            for (key, value) in self._unknown_fields.iter() {
33793                state.serialize_entry(key, &value)?;
33794            }
33795        }
33796        state.end()
33797    }
33798}
33799
33800/// Database instance local user password validation policy
33801#[derive(Clone, Debug, Default, PartialEq)]
33802#[non_exhaustive]
33803pub struct PasswordValidationPolicy {
33804    /// Minimum number of characters allowed.
33805    pub min_length: std::option::Option<wkt::Int32Value>,
33806
33807    /// The complexity of the password.
33808    pub complexity: crate::model::password_validation_policy::Complexity,
33809
33810    /// Number of previous passwords that cannot be reused.
33811    pub reuse_interval: std::option::Option<wkt::Int32Value>,
33812
33813    /// Disallow username as a part of the password.
33814    pub disallow_username_substring: std::option::Option<wkt::BoolValue>,
33815
33816    /// Minimum interval after which the password can be changed. This flag is only
33817    /// supported for PostgreSQL.
33818    pub password_change_interval: std::option::Option<wkt::Duration>,
33819
33820    /// Whether the password policy is enabled or not.
33821    pub enable_password_policy: std::option::Option<wkt::BoolValue>,
33822
33823    /// This field is deprecated and will be removed in a future version of the
33824    /// API.
33825    #[deprecated]
33826    pub disallow_compromised_credentials: std::option::Option<wkt::BoolValue>,
33827
33828    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
33829}
33830
33831impl PasswordValidationPolicy {
33832    pub fn new() -> Self {
33833        std::default::Default::default()
33834    }
33835
33836    /// Sets the value of [min_length][crate::model::PasswordValidationPolicy::min_length].
33837    pub fn set_min_length<T>(mut self, v: T) -> Self
33838    where
33839        T: std::convert::Into<wkt::Int32Value>,
33840    {
33841        self.min_length = std::option::Option::Some(v.into());
33842        self
33843    }
33844
33845    /// Sets or clears the value of [min_length][crate::model::PasswordValidationPolicy::min_length].
33846    pub fn set_or_clear_min_length<T>(mut self, v: std::option::Option<T>) -> Self
33847    where
33848        T: std::convert::Into<wkt::Int32Value>,
33849    {
33850        self.min_length = v.map(|x| x.into());
33851        self
33852    }
33853
33854    /// Sets the value of [complexity][crate::model::PasswordValidationPolicy::complexity].
33855    pub fn set_complexity<
33856        T: std::convert::Into<crate::model::password_validation_policy::Complexity>,
33857    >(
33858        mut self,
33859        v: T,
33860    ) -> Self {
33861        self.complexity = v.into();
33862        self
33863    }
33864
33865    /// Sets the value of [reuse_interval][crate::model::PasswordValidationPolicy::reuse_interval].
33866    pub fn set_reuse_interval<T>(mut self, v: T) -> Self
33867    where
33868        T: std::convert::Into<wkt::Int32Value>,
33869    {
33870        self.reuse_interval = std::option::Option::Some(v.into());
33871        self
33872    }
33873
33874    /// Sets or clears the value of [reuse_interval][crate::model::PasswordValidationPolicy::reuse_interval].
33875    pub fn set_or_clear_reuse_interval<T>(mut self, v: std::option::Option<T>) -> Self
33876    where
33877        T: std::convert::Into<wkt::Int32Value>,
33878    {
33879        self.reuse_interval = v.map(|x| x.into());
33880        self
33881    }
33882
33883    /// Sets the value of [disallow_username_substring][crate::model::PasswordValidationPolicy::disallow_username_substring].
33884    pub fn set_disallow_username_substring<T>(mut self, v: T) -> Self
33885    where
33886        T: std::convert::Into<wkt::BoolValue>,
33887    {
33888        self.disallow_username_substring = std::option::Option::Some(v.into());
33889        self
33890    }
33891
33892    /// Sets or clears the value of [disallow_username_substring][crate::model::PasswordValidationPolicy::disallow_username_substring].
33893    pub fn set_or_clear_disallow_username_substring<T>(mut self, v: std::option::Option<T>) -> Self
33894    where
33895        T: std::convert::Into<wkt::BoolValue>,
33896    {
33897        self.disallow_username_substring = v.map(|x| x.into());
33898        self
33899    }
33900
33901    /// Sets the value of [password_change_interval][crate::model::PasswordValidationPolicy::password_change_interval].
33902    pub fn set_password_change_interval<T>(mut self, v: T) -> Self
33903    where
33904        T: std::convert::Into<wkt::Duration>,
33905    {
33906        self.password_change_interval = std::option::Option::Some(v.into());
33907        self
33908    }
33909
33910    /// Sets or clears the value of [password_change_interval][crate::model::PasswordValidationPolicy::password_change_interval].
33911    pub fn set_or_clear_password_change_interval<T>(mut self, v: std::option::Option<T>) -> Self
33912    where
33913        T: std::convert::Into<wkt::Duration>,
33914    {
33915        self.password_change_interval = v.map(|x| x.into());
33916        self
33917    }
33918
33919    /// Sets the value of [enable_password_policy][crate::model::PasswordValidationPolicy::enable_password_policy].
33920    pub fn set_enable_password_policy<T>(mut self, v: T) -> Self
33921    where
33922        T: std::convert::Into<wkt::BoolValue>,
33923    {
33924        self.enable_password_policy = std::option::Option::Some(v.into());
33925        self
33926    }
33927
33928    /// Sets or clears the value of [enable_password_policy][crate::model::PasswordValidationPolicy::enable_password_policy].
33929    pub fn set_or_clear_enable_password_policy<T>(mut self, v: std::option::Option<T>) -> Self
33930    where
33931        T: std::convert::Into<wkt::BoolValue>,
33932    {
33933        self.enable_password_policy = v.map(|x| x.into());
33934        self
33935    }
33936
33937    /// Sets the value of [disallow_compromised_credentials][crate::model::PasswordValidationPolicy::disallow_compromised_credentials].
33938    #[deprecated]
33939    pub fn set_disallow_compromised_credentials<T>(mut self, v: T) -> Self
33940    where
33941        T: std::convert::Into<wkt::BoolValue>,
33942    {
33943        self.disallow_compromised_credentials = std::option::Option::Some(v.into());
33944        self
33945    }
33946
33947    /// Sets or clears the value of [disallow_compromised_credentials][crate::model::PasswordValidationPolicy::disallow_compromised_credentials].
33948    #[deprecated]
33949    pub fn set_or_clear_disallow_compromised_credentials<T>(
33950        mut self,
33951        v: std::option::Option<T>,
33952    ) -> Self
33953    where
33954        T: std::convert::Into<wkt::BoolValue>,
33955    {
33956        self.disallow_compromised_credentials = v.map(|x| x.into());
33957        self
33958    }
33959}
33960
33961impl wkt::message::Message for PasswordValidationPolicy {
33962    fn typename() -> &'static str {
33963        "type.googleapis.com/google.cloud.sql.v1.PasswordValidationPolicy"
33964    }
33965}
33966
33967#[doc(hidden)]
33968impl<'de> serde::de::Deserialize<'de> for PasswordValidationPolicy {
33969    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
33970    where
33971        D: serde::Deserializer<'de>,
33972    {
33973        #[allow(non_camel_case_types)]
33974        #[doc(hidden)]
33975        #[derive(PartialEq, Eq, Hash)]
33976        enum __FieldTag {
33977            __min_length,
33978            __complexity,
33979            __reuse_interval,
33980            __disallow_username_substring,
33981            __password_change_interval,
33982            __enable_password_policy,
33983            __disallow_compromised_credentials,
33984            Unknown(std::string::String),
33985        }
33986        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
33987            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
33988            where
33989                D: serde::Deserializer<'de>,
33990            {
33991                struct Visitor;
33992                impl<'de> serde::de::Visitor<'de> for Visitor {
33993                    type Value = __FieldTag;
33994                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
33995                        formatter.write_str("a field name for PasswordValidationPolicy")
33996                    }
33997                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
33998                    where
33999                        E: serde::de::Error,
34000                    {
34001                        use std::result::Result::Ok;
34002                        use std::string::ToString;
34003                        match value {
34004                            "minLength" => Ok(__FieldTag::__min_length),
34005                            "min_length" => Ok(__FieldTag::__min_length),
34006                            "complexity" => Ok(__FieldTag::__complexity),
34007                            "reuseInterval" => Ok(__FieldTag::__reuse_interval),
34008                            "reuse_interval" => Ok(__FieldTag::__reuse_interval),
34009                            "disallowUsernameSubstring" => {
34010                                Ok(__FieldTag::__disallow_username_substring)
34011                            }
34012                            "disallow_username_substring" => {
34013                                Ok(__FieldTag::__disallow_username_substring)
34014                            }
34015                            "passwordChangeInterval" => Ok(__FieldTag::__password_change_interval),
34016                            "password_change_interval" => {
34017                                Ok(__FieldTag::__password_change_interval)
34018                            }
34019                            "enablePasswordPolicy" => Ok(__FieldTag::__enable_password_policy),
34020                            "enable_password_policy" => Ok(__FieldTag::__enable_password_policy),
34021                            "disallowCompromisedCredentials" => {
34022                                Ok(__FieldTag::__disallow_compromised_credentials)
34023                            }
34024                            "disallow_compromised_credentials" => {
34025                                Ok(__FieldTag::__disallow_compromised_credentials)
34026                            }
34027                            _ => Ok(__FieldTag::Unknown(value.to_string())),
34028                        }
34029                    }
34030                }
34031                deserializer.deserialize_identifier(Visitor)
34032            }
34033        }
34034        struct Visitor;
34035        impl<'de> serde::de::Visitor<'de> for Visitor {
34036            type Value = PasswordValidationPolicy;
34037            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
34038                formatter.write_str("struct PasswordValidationPolicy")
34039            }
34040            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
34041            where
34042                A: serde::de::MapAccess<'de>,
34043            {
34044                #[allow(unused_imports)]
34045                use serde::de::Error;
34046                use std::option::Option::Some;
34047                let mut fields = std::collections::HashSet::new();
34048                let mut result = Self::Value::new();
34049                while let Some(tag) = map.next_key::<__FieldTag>()? {
34050                    #[allow(clippy::match_single_binding)]
34051                    match tag {
34052                        __FieldTag::__min_length => {
34053                            if !fields.insert(__FieldTag::__min_length) {
34054                                return std::result::Result::Err(A::Error::duplicate_field(
34055                                    "multiple values for min_length",
34056                                ));
34057                            }
34058                            struct __With(std::option::Option<wkt::Int32Value>);
34059                            impl<'de> serde::de::Deserialize<'de> for __With {
34060                                fn deserialize<D>(
34061                                    deserializer: D,
34062                                ) -> std::result::Result<Self, D::Error>
34063                                where
34064                                    D: serde::de::Deserializer<'de>,
34065                                {
34066                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
34067                                }
34068                            }
34069                            result.min_length = map.next_value::<__With>()?.0;
34070                        }
34071                        __FieldTag::__complexity => {
34072                            if !fields.insert(__FieldTag::__complexity) {
34073                                return std::result::Result::Err(A::Error::duplicate_field(
34074                                    "multiple values for complexity",
34075                                ));
34076                            }
34077                            result.complexity = map
34078                                .next_value::<std::option::Option<
34079                                    crate::model::password_validation_policy::Complexity,
34080                                >>()?
34081                                .unwrap_or_default();
34082                        }
34083                        __FieldTag::__reuse_interval => {
34084                            if !fields.insert(__FieldTag::__reuse_interval) {
34085                                return std::result::Result::Err(A::Error::duplicate_field(
34086                                    "multiple values for reuse_interval",
34087                                ));
34088                            }
34089                            struct __With(std::option::Option<wkt::Int32Value>);
34090                            impl<'de> serde::de::Deserialize<'de> for __With {
34091                                fn deserialize<D>(
34092                                    deserializer: D,
34093                                ) -> std::result::Result<Self, D::Error>
34094                                where
34095                                    D: serde::de::Deserializer<'de>,
34096                                {
34097                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
34098                                }
34099                            }
34100                            result.reuse_interval = map.next_value::<__With>()?.0;
34101                        }
34102                        __FieldTag::__disallow_username_substring => {
34103                            if !fields.insert(__FieldTag::__disallow_username_substring) {
34104                                return std::result::Result::Err(A::Error::duplicate_field(
34105                                    "multiple values for disallow_username_substring",
34106                                ));
34107                            }
34108                            result.disallow_username_substring =
34109                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
34110                        }
34111                        __FieldTag::__password_change_interval => {
34112                            if !fields.insert(__FieldTag::__password_change_interval) {
34113                                return std::result::Result::Err(A::Error::duplicate_field(
34114                                    "multiple values for password_change_interval",
34115                                ));
34116                            }
34117                            result.password_change_interval =
34118                                map.next_value::<std::option::Option<wkt::Duration>>()?;
34119                        }
34120                        __FieldTag::__enable_password_policy => {
34121                            if !fields.insert(__FieldTag::__enable_password_policy) {
34122                                return std::result::Result::Err(A::Error::duplicate_field(
34123                                    "multiple values for enable_password_policy",
34124                                ));
34125                            }
34126                            result.enable_password_policy =
34127                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
34128                        }
34129                        __FieldTag::__disallow_compromised_credentials => {
34130                            if !fields.insert(__FieldTag::__disallow_compromised_credentials) {
34131                                return std::result::Result::Err(A::Error::duplicate_field(
34132                                    "multiple values for disallow_compromised_credentials",
34133                                ));
34134                            }
34135                            result.disallow_compromised_credentials =
34136                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
34137                        }
34138                        __FieldTag::Unknown(key) => {
34139                            let value = map.next_value::<serde_json::Value>()?;
34140                            result._unknown_fields.insert(key, value);
34141                        }
34142                    }
34143                }
34144                std::result::Result::Ok(result)
34145            }
34146        }
34147        deserializer.deserialize_any(Visitor)
34148    }
34149}
34150
34151#[doc(hidden)]
34152impl serde::ser::Serialize for PasswordValidationPolicy {
34153    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
34154    where
34155        S: serde::ser::Serializer,
34156    {
34157        use serde::ser::SerializeMap;
34158        #[allow(unused_imports)]
34159        use std::option::Option::Some;
34160        let mut state = serializer.serialize_map(std::option::Option::None)?;
34161        if self.min_length.is_some() {
34162            struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
34163            impl<'a> serde::ser::Serialize for __With<'a> {
34164                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
34165                where
34166                    S: serde::ser::Serializer,
34167                {
34168                    serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
34169                        self.0, serializer,
34170                    )
34171                }
34172            }
34173            state.serialize_entry("minLength", &__With(&self.min_length))?;
34174        }
34175        if !wkt::internal::is_default(&self.complexity) {
34176            state.serialize_entry("complexity", &self.complexity)?;
34177        }
34178        if self.reuse_interval.is_some() {
34179            struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
34180            impl<'a> serde::ser::Serialize for __With<'a> {
34181                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
34182                where
34183                    S: serde::ser::Serializer,
34184                {
34185                    serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
34186                        self.0, serializer,
34187                    )
34188                }
34189            }
34190            state.serialize_entry("reuseInterval", &__With(&self.reuse_interval))?;
34191        }
34192        if self.disallow_username_substring.is_some() {
34193            state.serialize_entry(
34194                "disallowUsernameSubstring",
34195                &self.disallow_username_substring,
34196            )?;
34197        }
34198        if self.password_change_interval.is_some() {
34199            state.serialize_entry("passwordChangeInterval", &self.password_change_interval)?;
34200        }
34201        if self.enable_password_policy.is_some() {
34202            state.serialize_entry("enablePasswordPolicy", &self.enable_password_policy)?;
34203        }
34204        if self.disallow_compromised_credentials.is_some() {
34205            state.serialize_entry(
34206                "disallowCompromisedCredentials",
34207                &self.disallow_compromised_credentials,
34208            )?;
34209        }
34210        if !self._unknown_fields.is_empty() {
34211            for (key, value) in self._unknown_fields.iter() {
34212                state.serialize_entry(key, &value)?;
34213            }
34214        }
34215        state.end()
34216    }
34217}
34218
34219/// Defines additional types related to [PasswordValidationPolicy].
34220pub mod password_validation_policy {
34221    #[allow(unused_imports)]
34222    use super::*;
34223
34224    /// The complexity choices of the password.
34225    ///
34226    /// # Working with unknown values
34227    ///
34228    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
34229    /// additional enum variants at any time. Adding new variants is not considered
34230    /// a breaking change. Applications should write their code in anticipation of:
34231    ///
34232    /// - New values appearing in future releases of the client library, **and**
34233    /// - New values received dynamically, without application changes.
34234    ///
34235    /// Please consult the [Working with enums] section in the user guide for some
34236    /// guidelines.
34237    ///
34238    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
34239    #[derive(Clone, Debug, PartialEq)]
34240    #[non_exhaustive]
34241    pub enum Complexity {
34242        /// Complexity check is not specified.
34243        Unspecified,
34244        /// A combination of lowercase, uppercase, numeric, and non-alphanumeric
34245        /// characters.
34246        Default,
34247        /// If set, the enum was initialized with an unknown value.
34248        ///
34249        /// Applications can examine the value using [Complexity::value] or
34250        /// [Complexity::name].
34251        UnknownValue(complexity::UnknownValue),
34252    }
34253
34254    #[doc(hidden)]
34255    pub mod complexity {
34256        #[allow(unused_imports)]
34257        use super::*;
34258        #[derive(Clone, Debug, PartialEq)]
34259        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
34260    }
34261
34262    impl Complexity {
34263        /// Gets the enum value.
34264        ///
34265        /// Returns `None` if the enum contains an unknown value deserialized from
34266        /// the string representation of enums.
34267        pub fn value(&self) -> std::option::Option<i32> {
34268            match self {
34269                Self::Unspecified => std::option::Option::Some(0),
34270                Self::Default => std::option::Option::Some(1),
34271                Self::UnknownValue(u) => u.0.value(),
34272            }
34273        }
34274
34275        /// Gets the enum value as a string.
34276        ///
34277        /// Returns `None` if the enum contains an unknown value deserialized from
34278        /// the integer representation of enums.
34279        pub fn name(&self) -> std::option::Option<&str> {
34280            match self {
34281                Self::Unspecified => std::option::Option::Some("COMPLEXITY_UNSPECIFIED"),
34282                Self::Default => std::option::Option::Some("COMPLEXITY_DEFAULT"),
34283                Self::UnknownValue(u) => u.0.name(),
34284            }
34285        }
34286    }
34287
34288    impl std::default::Default for Complexity {
34289        fn default() -> Self {
34290            use std::convert::From;
34291            Self::from(0)
34292        }
34293    }
34294
34295    impl std::fmt::Display for Complexity {
34296        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
34297            wkt::internal::display_enum(f, self.name(), self.value())
34298        }
34299    }
34300
34301    impl std::convert::From<i32> for Complexity {
34302        fn from(value: i32) -> Self {
34303            match value {
34304                0 => Self::Unspecified,
34305                1 => Self::Default,
34306                _ => Self::UnknownValue(complexity::UnknownValue(
34307                    wkt::internal::UnknownEnumValue::Integer(value),
34308                )),
34309            }
34310        }
34311    }
34312
34313    impl std::convert::From<&str> for Complexity {
34314        fn from(value: &str) -> Self {
34315            use std::string::ToString;
34316            match value {
34317                "COMPLEXITY_UNSPECIFIED" => Self::Unspecified,
34318                "COMPLEXITY_DEFAULT" => Self::Default,
34319                _ => Self::UnknownValue(complexity::UnknownValue(
34320                    wkt::internal::UnknownEnumValue::String(value.to_string()),
34321                )),
34322            }
34323        }
34324    }
34325
34326    impl serde::ser::Serialize for Complexity {
34327        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
34328        where
34329            S: serde::Serializer,
34330        {
34331            match self {
34332                Self::Unspecified => serializer.serialize_i32(0),
34333                Self::Default => serializer.serialize_i32(1),
34334                Self::UnknownValue(u) => u.0.serialize(serializer),
34335            }
34336        }
34337    }
34338
34339    impl<'de> serde::de::Deserialize<'de> for Complexity {
34340        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
34341        where
34342            D: serde::Deserializer<'de>,
34343        {
34344            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Complexity>::new(
34345                ".google.cloud.sql.v1.PasswordValidationPolicy.Complexity",
34346            ))
34347        }
34348    }
34349}
34350
34351/// Data cache configurations.
34352#[derive(Clone, Debug, Default, PartialEq)]
34353#[non_exhaustive]
34354pub struct DataCacheConfig {
34355    /// Whether data cache is enabled for the instance.
34356    pub data_cache_enabled: bool,
34357
34358    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
34359}
34360
34361impl DataCacheConfig {
34362    pub fn new() -> Self {
34363        std::default::Default::default()
34364    }
34365
34366    /// Sets the value of [data_cache_enabled][crate::model::DataCacheConfig::data_cache_enabled].
34367    pub fn set_data_cache_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
34368        self.data_cache_enabled = v.into();
34369        self
34370    }
34371}
34372
34373impl wkt::message::Message for DataCacheConfig {
34374    fn typename() -> &'static str {
34375        "type.googleapis.com/google.cloud.sql.v1.DataCacheConfig"
34376    }
34377}
34378
34379#[doc(hidden)]
34380impl<'de> serde::de::Deserialize<'de> for DataCacheConfig {
34381    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
34382    where
34383        D: serde::Deserializer<'de>,
34384    {
34385        #[allow(non_camel_case_types)]
34386        #[doc(hidden)]
34387        #[derive(PartialEq, Eq, Hash)]
34388        enum __FieldTag {
34389            __data_cache_enabled,
34390            Unknown(std::string::String),
34391        }
34392        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
34393            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
34394            where
34395                D: serde::Deserializer<'de>,
34396            {
34397                struct Visitor;
34398                impl<'de> serde::de::Visitor<'de> for Visitor {
34399                    type Value = __FieldTag;
34400                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
34401                        formatter.write_str("a field name for DataCacheConfig")
34402                    }
34403                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
34404                    where
34405                        E: serde::de::Error,
34406                    {
34407                        use std::result::Result::Ok;
34408                        use std::string::ToString;
34409                        match value {
34410                            "dataCacheEnabled" => Ok(__FieldTag::__data_cache_enabled),
34411                            "data_cache_enabled" => Ok(__FieldTag::__data_cache_enabled),
34412                            _ => Ok(__FieldTag::Unknown(value.to_string())),
34413                        }
34414                    }
34415                }
34416                deserializer.deserialize_identifier(Visitor)
34417            }
34418        }
34419        struct Visitor;
34420        impl<'de> serde::de::Visitor<'de> for Visitor {
34421            type Value = DataCacheConfig;
34422            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
34423                formatter.write_str("struct DataCacheConfig")
34424            }
34425            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
34426            where
34427                A: serde::de::MapAccess<'de>,
34428            {
34429                #[allow(unused_imports)]
34430                use serde::de::Error;
34431                use std::option::Option::Some;
34432                let mut fields = std::collections::HashSet::new();
34433                let mut result = Self::Value::new();
34434                while let Some(tag) = map.next_key::<__FieldTag>()? {
34435                    #[allow(clippy::match_single_binding)]
34436                    match tag {
34437                        __FieldTag::__data_cache_enabled => {
34438                            if !fields.insert(__FieldTag::__data_cache_enabled) {
34439                                return std::result::Result::Err(A::Error::duplicate_field(
34440                                    "multiple values for data_cache_enabled",
34441                                ));
34442                            }
34443                            result.data_cache_enabled = map
34444                                .next_value::<std::option::Option<bool>>()?
34445                                .unwrap_or_default();
34446                        }
34447                        __FieldTag::Unknown(key) => {
34448                            let value = map.next_value::<serde_json::Value>()?;
34449                            result._unknown_fields.insert(key, value);
34450                        }
34451                    }
34452                }
34453                std::result::Result::Ok(result)
34454            }
34455        }
34456        deserializer.deserialize_any(Visitor)
34457    }
34458}
34459
34460#[doc(hidden)]
34461impl serde::ser::Serialize for DataCacheConfig {
34462    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
34463    where
34464        S: serde::ser::Serializer,
34465    {
34466        use serde::ser::SerializeMap;
34467        #[allow(unused_imports)]
34468        use std::option::Option::Some;
34469        let mut state = serializer.serialize_map(std::option::Option::None)?;
34470        if !wkt::internal::is_default(&self.data_cache_enabled) {
34471            state.serialize_entry("dataCacheEnabled", &self.data_cache_enabled)?;
34472        }
34473        if !self._unknown_fields.is_empty() {
34474            for (key, value) in self._unknown_fields.iter() {
34475                state.serialize_entry(key, &value)?;
34476            }
34477        }
34478        state.end()
34479    }
34480}
34481
34482/// Database instance settings.
34483#[derive(Clone, Debug, Default, PartialEq)]
34484#[non_exhaustive]
34485pub struct Settings {
34486    /// The version of instance settings. This is a required field for update
34487    /// method to make sure concurrent updates are handled properly. During update,
34488    /// use the most recent settingsVersion value for this instance and do not try
34489    /// to update this value.
34490    pub settings_version: std::option::Option<wkt::Int64Value>,
34491
34492    /// The App Engine app IDs that can access this instance.
34493    /// (Deprecated) Applied to First Generation instances only.
34494    #[deprecated]
34495    pub authorized_gae_applications: std::vec::Vec<std::string::String>,
34496
34497    /// The tier (or machine type) for this instance, for example
34498    /// `db-custom-1-3840`. WARNING: Changing this restarts the instance.
34499    pub tier: std::string::String,
34500
34501    /// This is always `sql#settings`.
34502    pub kind: std::string::String,
34503
34504    /// User-provided labels, represented as a dictionary where each label is a
34505    /// single key value pair.
34506    pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
34507
34508    /// Availability type. Potential values:
34509    ///
34510    /// * `ZONAL`: The instance serves data from only one zone. Outages in that
34511    ///   zone affect data accessibility.
34512    /// * `REGIONAL`: The instance can serve data from more than one zone in a
34513    ///   region (it is highly available)./
34514    ///
34515    /// For more information, see [Overview of the High Availability
34516    /// Configuration](https://cloud.google.com/sql/docs/mysql/high-availability).
34517    pub availability_type: crate::model::SqlAvailabilityType,
34518
34519    /// The pricing plan for this instance. This can be either `PER_USE` or
34520    /// `PACKAGE`. Only `PER_USE` is supported for Second Generation instances.
34521    pub pricing_plan: crate::model::SqlPricingPlan,
34522
34523    /// The type of replication this instance uses. This can be either
34524    /// `ASYNCHRONOUS` or `SYNCHRONOUS`. (Deprecated) This property was only
34525    /// applicable to First Generation instances.
34526    #[deprecated]
34527    pub replication_type: crate::model::SqlReplicationType,
34528
34529    /// The maximum size to which storage capacity can be automatically increased.
34530    /// The default value is 0, which specifies that there is no limit.
34531    pub storage_auto_resize_limit: std::option::Option<wkt::Int64Value>,
34532
34533    /// The activation policy specifies when the instance is activated; it is
34534    /// applicable only when the instance state is RUNNABLE. Valid values:
34535    ///
34536    /// * `ALWAYS`: The instance is on, and remains so even in the absence of
34537    ///   connection requests.
34538    /// * `NEVER`: The instance is off; it is not activated, even if a
34539    ///   connection request arrives.
34540    pub activation_policy: crate::model::settings::SqlActivationPolicy,
34541
34542    /// The settings for IP Management. This allows to enable or disable the
34543    /// instance IP and manage which external networks can connect to the instance.
34544    /// The IPv4 address cannot be disabled for Second Generation instances.
34545    pub ip_configuration: std::option::Option<crate::model::IpConfiguration>,
34546
34547    /// Configuration to increase storage size automatically. The default value is
34548    /// true.
34549    pub storage_auto_resize: std::option::Option<wkt::BoolValue>,
34550
34551    /// The location preference settings. This allows the instance to be located as
34552    /// near as possible to either an App Engine app or Compute Engine zone for
34553    /// better performance. App Engine co-location was only applicable to First
34554    /// Generation instances.
34555    pub location_preference: std::option::Option<crate::model::LocationPreference>,
34556
34557    /// The database flags passed to the instance at startup.
34558    pub database_flags: std::vec::Vec<crate::model::DatabaseFlags>,
34559
34560    /// The type of data disk: `PD_SSD` (default) or `PD_HDD`. Not used for
34561    /// First Generation instances.
34562    pub data_disk_type: crate::model::SqlDataDiskType,
34563
34564    /// The maintenance window for this instance. This specifies when the instance
34565    /// can be restarted for maintenance purposes.
34566    pub maintenance_window: std::option::Option<crate::model::MaintenanceWindow>,
34567
34568    /// The daily backup configuration for the instance.
34569    pub backup_configuration: std::option::Option<crate::model::BackupConfiguration>,
34570
34571    /// Configuration specific to read replica instances. Indicates whether
34572    /// replication is enabled or not. WARNING: Changing this restarts the
34573    /// instance.
34574    pub database_replication_enabled: std::option::Option<wkt::BoolValue>,
34575
34576    /// Configuration specific to read replica instances. Indicates whether
34577    /// database flags for crash-safe replication are enabled. This property was
34578    /// only applicable to First Generation instances.
34579    #[deprecated]
34580    pub crash_safe_replication_enabled: std::option::Option<wkt::BoolValue>,
34581
34582    /// The size of data disk, in GB. The data disk size minimum is 10GB.
34583    pub data_disk_size_gb: std::option::Option<wkt::Int64Value>,
34584
34585    /// Active Directory configuration, relevant only for Cloud SQL for SQL Server.
34586    pub active_directory_config: std::option::Option<crate::model::SqlActiveDirectoryConfig>,
34587
34588    /// The name of server Instance collation.
34589    pub collation: std::string::String,
34590
34591    /// Deny maintenance periods
34592    pub deny_maintenance_periods: std::vec::Vec<crate::model::DenyMaintenancePeriod>,
34593
34594    /// Insights configuration, for now relevant only for Postgres.
34595    pub insights_config: std::option::Option<crate::model::InsightsConfig>,
34596
34597    /// The local user password validation policy of the instance.
34598    pub password_validation_policy: std::option::Option<crate::model::PasswordValidationPolicy>,
34599
34600    /// SQL Server specific audit configuration.
34601    pub sql_server_audit_config: std::option::Option<crate::model::SqlServerAuditConfig>,
34602
34603    /// Optional. The edition of the instance.
34604    pub edition: crate::model::settings::Edition,
34605
34606    /// Specifies if connections must use Cloud SQL connectors.
34607    /// Option values include the following: `NOT_REQUIRED` (Cloud SQL instances
34608    /// can be connected without Cloud SQL
34609    /// Connectors) and `REQUIRED` (Only allow connections that use Cloud SQL
34610    /// Connectors).
34611    ///
34612    /// Note that using REQUIRED disables all existing authorized networks. If
34613    /// this field is not specified when creating a new instance, NOT_REQUIRED is
34614    /// used. If this field is not specified when patching or updating an existing
34615    /// instance, it is left unchanged in the instance.
34616    pub connector_enforcement: crate::model::settings::ConnectorEnforcement,
34617
34618    /// Configuration to protect against accidental instance deletion.
34619    pub deletion_protection_enabled: std::option::Option<wkt::BoolValue>,
34620
34621    /// Server timezone, relevant only for Cloud SQL for SQL Server.
34622    pub time_zone: std::string::String,
34623
34624    /// Specifies advanced machine configuration for the instances relevant only
34625    /// for SQL Server.
34626    pub advanced_machine_features: std::option::Option<crate::model::AdvancedMachineFeatures>,
34627
34628    /// Configuration for data cache.
34629    pub data_cache_config: std::option::Option<crate::model::DataCacheConfig>,
34630
34631    /// Optional. When this parameter is set to true, Cloud SQL instances can
34632    /// connect to Vertex AI to pass requests for real-time predictions and
34633    /// insights to the AI. The default value is false. This applies only to Cloud
34634    /// SQL for PostgreSQL instances.
34635    pub enable_google_ml_integration: std::option::Option<wkt::BoolValue>,
34636
34637    /// Optional. By default, Cloud SQL instances have schema extraction disabled
34638    /// for Dataplex. When this parameter is set to true, schema extraction for
34639    /// Dataplex on Cloud SQL instances is activated.
34640    pub enable_dataplex_integration: std::option::Option<wkt::BoolValue>,
34641
34642    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
34643}
34644
34645impl Settings {
34646    pub fn new() -> Self {
34647        std::default::Default::default()
34648    }
34649
34650    /// Sets the value of [settings_version][crate::model::Settings::settings_version].
34651    pub fn set_settings_version<T>(mut self, v: T) -> Self
34652    where
34653        T: std::convert::Into<wkt::Int64Value>,
34654    {
34655        self.settings_version = std::option::Option::Some(v.into());
34656        self
34657    }
34658
34659    /// Sets or clears the value of [settings_version][crate::model::Settings::settings_version].
34660    pub fn set_or_clear_settings_version<T>(mut self, v: std::option::Option<T>) -> Self
34661    where
34662        T: std::convert::Into<wkt::Int64Value>,
34663    {
34664        self.settings_version = v.map(|x| x.into());
34665        self
34666    }
34667
34668    /// Sets the value of [authorized_gae_applications][crate::model::Settings::authorized_gae_applications].
34669    #[deprecated]
34670    pub fn set_authorized_gae_applications<T, V>(mut self, v: T) -> Self
34671    where
34672        T: std::iter::IntoIterator<Item = V>,
34673        V: std::convert::Into<std::string::String>,
34674    {
34675        use std::iter::Iterator;
34676        self.authorized_gae_applications = v.into_iter().map(|i| i.into()).collect();
34677        self
34678    }
34679
34680    /// Sets the value of [tier][crate::model::Settings::tier].
34681    pub fn set_tier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
34682        self.tier = v.into();
34683        self
34684    }
34685
34686    /// Sets the value of [kind][crate::model::Settings::kind].
34687    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
34688        self.kind = v.into();
34689        self
34690    }
34691
34692    /// Sets the value of [user_labels][crate::model::Settings::user_labels].
34693    pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
34694    where
34695        T: std::iter::IntoIterator<Item = (K, V)>,
34696        K: std::convert::Into<std::string::String>,
34697        V: std::convert::Into<std::string::String>,
34698    {
34699        use std::iter::Iterator;
34700        self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
34701        self
34702    }
34703
34704    /// Sets the value of [availability_type][crate::model::Settings::availability_type].
34705    pub fn set_availability_type<T: std::convert::Into<crate::model::SqlAvailabilityType>>(
34706        mut self,
34707        v: T,
34708    ) -> Self {
34709        self.availability_type = v.into();
34710        self
34711    }
34712
34713    /// Sets the value of [pricing_plan][crate::model::Settings::pricing_plan].
34714    pub fn set_pricing_plan<T: std::convert::Into<crate::model::SqlPricingPlan>>(
34715        mut self,
34716        v: T,
34717    ) -> Self {
34718        self.pricing_plan = v.into();
34719        self
34720    }
34721
34722    /// Sets the value of [replication_type][crate::model::Settings::replication_type].
34723    #[deprecated]
34724    pub fn set_replication_type<T: std::convert::Into<crate::model::SqlReplicationType>>(
34725        mut self,
34726        v: T,
34727    ) -> Self {
34728        self.replication_type = v.into();
34729        self
34730    }
34731
34732    /// Sets the value of [storage_auto_resize_limit][crate::model::Settings::storage_auto_resize_limit].
34733    pub fn set_storage_auto_resize_limit<T>(mut self, v: T) -> Self
34734    where
34735        T: std::convert::Into<wkt::Int64Value>,
34736    {
34737        self.storage_auto_resize_limit = std::option::Option::Some(v.into());
34738        self
34739    }
34740
34741    /// Sets or clears the value of [storage_auto_resize_limit][crate::model::Settings::storage_auto_resize_limit].
34742    pub fn set_or_clear_storage_auto_resize_limit<T>(mut self, v: std::option::Option<T>) -> Self
34743    where
34744        T: std::convert::Into<wkt::Int64Value>,
34745    {
34746        self.storage_auto_resize_limit = v.map(|x| x.into());
34747        self
34748    }
34749
34750    /// Sets the value of [activation_policy][crate::model::Settings::activation_policy].
34751    pub fn set_activation_policy<
34752        T: std::convert::Into<crate::model::settings::SqlActivationPolicy>,
34753    >(
34754        mut self,
34755        v: T,
34756    ) -> Self {
34757        self.activation_policy = v.into();
34758        self
34759    }
34760
34761    /// Sets the value of [ip_configuration][crate::model::Settings::ip_configuration].
34762    pub fn set_ip_configuration<T>(mut self, v: T) -> Self
34763    where
34764        T: std::convert::Into<crate::model::IpConfiguration>,
34765    {
34766        self.ip_configuration = std::option::Option::Some(v.into());
34767        self
34768    }
34769
34770    /// Sets or clears the value of [ip_configuration][crate::model::Settings::ip_configuration].
34771    pub fn set_or_clear_ip_configuration<T>(mut self, v: std::option::Option<T>) -> Self
34772    where
34773        T: std::convert::Into<crate::model::IpConfiguration>,
34774    {
34775        self.ip_configuration = v.map(|x| x.into());
34776        self
34777    }
34778
34779    /// Sets the value of [storage_auto_resize][crate::model::Settings::storage_auto_resize].
34780    pub fn set_storage_auto_resize<T>(mut self, v: T) -> Self
34781    where
34782        T: std::convert::Into<wkt::BoolValue>,
34783    {
34784        self.storage_auto_resize = std::option::Option::Some(v.into());
34785        self
34786    }
34787
34788    /// Sets or clears the value of [storage_auto_resize][crate::model::Settings::storage_auto_resize].
34789    pub fn set_or_clear_storage_auto_resize<T>(mut self, v: std::option::Option<T>) -> Self
34790    where
34791        T: std::convert::Into<wkt::BoolValue>,
34792    {
34793        self.storage_auto_resize = v.map(|x| x.into());
34794        self
34795    }
34796
34797    /// Sets the value of [location_preference][crate::model::Settings::location_preference].
34798    pub fn set_location_preference<T>(mut self, v: T) -> Self
34799    where
34800        T: std::convert::Into<crate::model::LocationPreference>,
34801    {
34802        self.location_preference = std::option::Option::Some(v.into());
34803        self
34804    }
34805
34806    /// Sets or clears the value of [location_preference][crate::model::Settings::location_preference].
34807    pub fn set_or_clear_location_preference<T>(mut self, v: std::option::Option<T>) -> Self
34808    where
34809        T: std::convert::Into<crate::model::LocationPreference>,
34810    {
34811        self.location_preference = v.map(|x| x.into());
34812        self
34813    }
34814
34815    /// Sets the value of [database_flags][crate::model::Settings::database_flags].
34816    pub fn set_database_flags<T, V>(mut self, v: T) -> Self
34817    where
34818        T: std::iter::IntoIterator<Item = V>,
34819        V: std::convert::Into<crate::model::DatabaseFlags>,
34820    {
34821        use std::iter::Iterator;
34822        self.database_flags = v.into_iter().map(|i| i.into()).collect();
34823        self
34824    }
34825
34826    /// Sets the value of [data_disk_type][crate::model::Settings::data_disk_type].
34827    pub fn set_data_disk_type<T: std::convert::Into<crate::model::SqlDataDiskType>>(
34828        mut self,
34829        v: T,
34830    ) -> Self {
34831        self.data_disk_type = v.into();
34832        self
34833    }
34834
34835    /// Sets the value of [maintenance_window][crate::model::Settings::maintenance_window].
34836    pub fn set_maintenance_window<T>(mut self, v: T) -> Self
34837    where
34838        T: std::convert::Into<crate::model::MaintenanceWindow>,
34839    {
34840        self.maintenance_window = std::option::Option::Some(v.into());
34841        self
34842    }
34843
34844    /// Sets or clears the value of [maintenance_window][crate::model::Settings::maintenance_window].
34845    pub fn set_or_clear_maintenance_window<T>(mut self, v: std::option::Option<T>) -> Self
34846    where
34847        T: std::convert::Into<crate::model::MaintenanceWindow>,
34848    {
34849        self.maintenance_window = v.map(|x| x.into());
34850        self
34851    }
34852
34853    /// Sets the value of [backup_configuration][crate::model::Settings::backup_configuration].
34854    pub fn set_backup_configuration<T>(mut self, v: T) -> Self
34855    where
34856        T: std::convert::Into<crate::model::BackupConfiguration>,
34857    {
34858        self.backup_configuration = std::option::Option::Some(v.into());
34859        self
34860    }
34861
34862    /// Sets or clears the value of [backup_configuration][crate::model::Settings::backup_configuration].
34863    pub fn set_or_clear_backup_configuration<T>(mut self, v: std::option::Option<T>) -> Self
34864    where
34865        T: std::convert::Into<crate::model::BackupConfiguration>,
34866    {
34867        self.backup_configuration = v.map(|x| x.into());
34868        self
34869    }
34870
34871    /// Sets the value of [database_replication_enabled][crate::model::Settings::database_replication_enabled].
34872    pub fn set_database_replication_enabled<T>(mut self, v: T) -> Self
34873    where
34874        T: std::convert::Into<wkt::BoolValue>,
34875    {
34876        self.database_replication_enabled = std::option::Option::Some(v.into());
34877        self
34878    }
34879
34880    /// Sets or clears the value of [database_replication_enabled][crate::model::Settings::database_replication_enabled].
34881    pub fn set_or_clear_database_replication_enabled<T>(mut self, v: std::option::Option<T>) -> Self
34882    where
34883        T: std::convert::Into<wkt::BoolValue>,
34884    {
34885        self.database_replication_enabled = v.map(|x| x.into());
34886        self
34887    }
34888
34889    /// Sets the value of [crash_safe_replication_enabled][crate::model::Settings::crash_safe_replication_enabled].
34890    #[deprecated]
34891    pub fn set_crash_safe_replication_enabled<T>(mut self, v: T) -> Self
34892    where
34893        T: std::convert::Into<wkt::BoolValue>,
34894    {
34895        self.crash_safe_replication_enabled = std::option::Option::Some(v.into());
34896        self
34897    }
34898
34899    /// Sets or clears the value of [crash_safe_replication_enabled][crate::model::Settings::crash_safe_replication_enabled].
34900    #[deprecated]
34901    pub fn set_or_clear_crash_safe_replication_enabled<T>(
34902        mut self,
34903        v: std::option::Option<T>,
34904    ) -> Self
34905    where
34906        T: std::convert::Into<wkt::BoolValue>,
34907    {
34908        self.crash_safe_replication_enabled = v.map(|x| x.into());
34909        self
34910    }
34911
34912    /// Sets the value of [data_disk_size_gb][crate::model::Settings::data_disk_size_gb].
34913    pub fn set_data_disk_size_gb<T>(mut self, v: T) -> Self
34914    where
34915        T: std::convert::Into<wkt::Int64Value>,
34916    {
34917        self.data_disk_size_gb = std::option::Option::Some(v.into());
34918        self
34919    }
34920
34921    /// Sets or clears the value of [data_disk_size_gb][crate::model::Settings::data_disk_size_gb].
34922    pub fn set_or_clear_data_disk_size_gb<T>(mut self, v: std::option::Option<T>) -> Self
34923    where
34924        T: std::convert::Into<wkt::Int64Value>,
34925    {
34926        self.data_disk_size_gb = v.map(|x| x.into());
34927        self
34928    }
34929
34930    /// Sets the value of [active_directory_config][crate::model::Settings::active_directory_config].
34931    pub fn set_active_directory_config<T>(mut self, v: T) -> Self
34932    where
34933        T: std::convert::Into<crate::model::SqlActiveDirectoryConfig>,
34934    {
34935        self.active_directory_config = std::option::Option::Some(v.into());
34936        self
34937    }
34938
34939    /// Sets or clears the value of [active_directory_config][crate::model::Settings::active_directory_config].
34940    pub fn set_or_clear_active_directory_config<T>(mut self, v: std::option::Option<T>) -> Self
34941    where
34942        T: std::convert::Into<crate::model::SqlActiveDirectoryConfig>,
34943    {
34944        self.active_directory_config = v.map(|x| x.into());
34945        self
34946    }
34947
34948    /// Sets the value of [collation][crate::model::Settings::collation].
34949    pub fn set_collation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
34950        self.collation = v.into();
34951        self
34952    }
34953
34954    /// Sets the value of [deny_maintenance_periods][crate::model::Settings::deny_maintenance_periods].
34955    pub fn set_deny_maintenance_periods<T, V>(mut self, v: T) -> Self
34956    where
34957        T: std::iter::IntoIterator<Item = V>,
34958        V: std::convert::Into<crate::model::DenyMaintenancePeriod>,
34959    {
34960        use std::iter::Iterator;
34961        self.deny_maintenance_periods = v.into_iter().map(|i| i.into()).collect();
34962        self
34963    }
34964
34965    /// Sets the value of [insights_config][crate::model::Settings::insights_config].
34966    pub fn set_insights_config<T>(mut self, v: T) -> Self
34967    where
34968        T: std::convert::Into<crate::model::InsightsConfig>,
34969    {
34970        self.insights_config = std::option::Option::Some(v.into());
34971        self
34972    }
34973
34974    /// Sets or clears the value of [insights_config][crate::model::Settings::insights_config].
34975    pub fn set_or_clear_insights_config<T>(mut self, v: std::option::Option<T>) -> Self
34976    where
34977        T: std::convert::Into<crate::model::InsightsConfig>,
34978    {
34979        self.insights_config = v.map(|x| x.into());
34980        self
34981    }
34982
34983    /// Sets the value of [password_validation_policy][crate::model::Settings::password_validation_policy].
34984    pub fn set_password_validation_policy<T>(mut self, v: T) -> Self
34985    where
34986        T: std::convert::Into<crate::model::PasswordValidationPolicy>,
34987    {
34988        self.password_validation_policy = std::option::Option::Some(v.into());
34989        self
34990    }
34991
34992    /// Sets or clears the value of [password_validation_policy][crate::model::Settings::password_validation_policy].
34993    pub fn set_or_clear_password_validation_policy<T>(mut self, v: std::option::Option<T>) -> Self
34994    where
34995        T: std::convert::Into<crate::model::PasswordValidationPolicy>,
34996    {
34997        self.password_validation_policy = v.map(|x| x.into());
34998        self
34999    }
35000
35001    /// Sets the value of [sql_server_audit_config][crate::model::Settings::sql_server_audit_config].
35002    pub fn set_sql_server_audit_config<T>(mut self, v: T) -> Self
35003    where
35004        T: std::convert::Into<crate::model::SqlServerAuditConfig>,
35005    {
35006        self.sql_server_audit_config = std::option::Option::Some(v.into());
35007        self
35008    }
35009
35010    /// Sets or clears the value of [sql_server_audit_config][crate::model::Settings::sql_server_audit_config].
35011    pub fn set_or_clear_sql_server_audit_config<T>(mut self, v: std::option::Option<T>) -> Self
35012    where
35013        T: std::convert::Into<crate::model::SqlServerAuditConfig>,
35014    {
35015        self.sql_server_audit_config = v.map(|x| x.into());
35016        self
35017    }
35018
35019    /// Sets the value of [edition][crate::model::Settings::edition].
35020    pub fn set_edition<T: std::convert::Into<crate::model::settings::Edition>>(
35021        mut self,
35022        v: T,
35023    ) -> Self {
35024        self.edition = v.into();
35025        self
35026    }
35027
35028    /// Sets the value of [connector_enforcement][crate::model::Settings::connector_enforcement].
35029    pub fn set_connector_enforcement<
35030        T: std::convert::Into<crate::model::settings::ConnectorEnforcement>,
35031    >(
35032        mut self,
35033        v: T,
35034    ) -> Self {
35035        self.connector_enforcement = v.into();
35036        self
35037    }
35038
35039    /// Sets the value of [deletion_protection_enabled][crate::model::Settings::deletion_protection_enabled].
35040    pub fn set_deletion_protection_enabled<T>(mut self, v: T) -> Self
35041    where
35042        T: std::convert::Into<wkt::BoolValue>,
35043    {
35044        self.deletion_protection_enabled = std::option::Option::Some(v.into());
35045        self
35046    }
35047
35048    /// Sets or clears the value of [deletion_protection_enabled][crate::model::Settings::deletion_protection_enabled].
35049    pub fn set_or_clear_deletion_protection_enabled<T>(mut self, v: std::option::Option<T>) -> Self
35050    where
35051        T: std::convert::Into<wkt::BoolValue>,
35052    {
35053        self.deletion_protection_enabled = v.map(|x| x.into());
35054        self
35055    }
35056
35057    /// Sets the value of [time_zone][crate::model::Settings::time_zone].
35058    pub fn set_time_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
35059        self.time_zone = v.into();
35060        self
35061    }
35062
35063    /// Sets the value of [advanced_machine_features][crate::model::Settings::advanced_machine_features].
35064    pub fn set_advanced_machine_features<T>(mut self, v: T) -> Self
35065    where
35066        T: std::convert::Into<crate::model::AdvancedMachineFeatures>,
35067    {
35068        self.advanced_machine_features = std::option::Option::Some(v.into());
35069        self
35070    }
35071
35072    /// Sets or clears the value of [advanced_machine_features][crate::model::Settings::advanced_machine_features].
35073    pub fn set_or_clear_advanced_machine_features<T>(mut self, v: std::option::Option<T>) -> Self
35074    where
35075        T: std::convert::Into<crate::model::AdvancedMachineFeatures>,
35076    {
35077        self.advanced_machine_features = v.map(|x| x.into());
35078        self
35079    }
35080
35081    /// Sets the value of [data_cache_config][crate::model::Settings::data_cache_config].
35082    pub fn set_data_cache_config<T>(mut self, v: T) -> Self
35083    where
35084        T: std::convert::Into<crate::model::DataCacheConfig>,
35085    {
35086        self.data_cache_config = std::option::Option::Some(v.into());
35087        self
35088    }
35089
35090    /// Sets or clears the value of [data_cache_config][crate::model::Settings::data_cache_config].
35091    pub fn set_or_clear_data_cache_config<T>(mut self, v: std::option::Option<T>) -> Self
35092    where
35093        T: std::convert::Into<crate::model::DataCacheConfig>,
35094    {
35095        self.data_cache_config = v.map(|x| x.into());
35096        self
35097    }
35098
35099    /// Sets the value of [enable_google_ml_integration][crate::model::Settings::enable_google_ml_integration].
35100    pub fn set_enable_google_ml_integration<T>(mut self, v: T) -> Self
35101    where
35102        T: std::convert::Into<wkt::BoolValue>,
35103    {
35104        self.enable_google_ml_integration = std::option::Option::Some(v.into());
35105        self
35106    }
35107
35108    /// Sets or clears the value of [enable_google_ml_integration][crate::model::Settings::enable_google_ml_integration].
35109    pub fn set_or_clear_enable_google_ml_integration<T>(mut self, v: std::option::Option<T>) -> Self
35110    where
35111        T: std::convert::Into<wkt::BoolValue>,
35112    {
35113        self.enable_google_ml_integration = v.map(|x| x.into());
35114        self
35115    }
35116
35117    /// Sets the value of [enable_dataplex_integration][crate::model::Settings::enable_dataplex_integration].
35118    pub fn set_enable_dataplex_integration<T>(mut self, v: T) -> Self
35119    where
35120        T: std::convert::Into<wkt::BoolValue>,
35121    {
35122        self.enable_dataplex_integration = std::option::Option::Some(v.into());
35123        self
35124    }
35125
35126    /// Sets or clears the value of [enable_dataplex_integration][crate::model::Settings::enable_dataplex_integration].
35127    pub fn set_or_clear_enable_dataplex_integration<T>(mut self, v: std::option::Option<T>) -> Self
35128    where
35129        T: std::convert::Into<wkt::BoolValue>,
35130    {
35131        self.enable_dataplex_integration = v.map(|x| x.into());
35132        self
35133    }
35134}
35135
35136impl wkt::message::Message for Settings {
35137    fn typename() -> &'static str {
35138        "type.googleapis.com/google.cloud.sql.v1.Settings"
35139    }
35140}
35141
35142#[doc(hidden)]
35143impl<'de> serde::de::Deserialize<'de> for Settings {
35144    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
35145    where
35146        D: serde::Deserializer<'de>,
35147    {
35148        #[allow(non_camel_case_types)]
35149        #[doc(hidden)]
35150        #[derive(PartialEq, Eq, Hash)]
35151        enum __FieldTag {
35152            __settings_version,
35153            __authorized_gae_applications,
35154            __tier,
35155            __kind,
35156            __user_labels,
35157            __availability_type,
35158            __pricing_plan,
35159            __replication_type,
35160            __storage_auto_resize_limit,
35161            __activation_policy,
35162            __ip_configuration,
35163            __storage_auto_resize,
35164            __location_preference,
35165            __database_flags,
35166            __data_disk_type,
35167            __maintenance_window,
35168            __backup_configuration,
35169            __database_replication_enabled,
35170            __crash_safe_replication_enabled,
35171            __data_disk_size_gb,
35172            __active_directory_config,
35173            __collation,
35174            __deny_maintenance_periods,
35175            __insights_config,
35176            __password_validation_policy,
35177            __sql_server_audit_config,
35178            __edition,
35179            __connector_enforcement,
35180            __deletion_protection_enabled,
35181            __time_zone,
35182            __advanced_machine_features,
35183            __data_cache_config,
35184            __enable_google_ml_integration,
35185            __enable_dataplex_integration,
35186            Unknown(std::string::String),
35187        }
35188        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
35189            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
35190            where
35191                D: serde::Deserializer<'de>,
35192            {
35193                struct Visitor;
35194                impl<'de> serde::de::Visitor<'de> for Visitor {
35195                    type Value = __FieldTag;
35196                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
35197                        formatter.write_str("a field name for Settings")
35198                    }
35199                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
35200                    where
35201                        E: serde::de::Error,
35202                    {
35203                        use std::result::Result::Ok;
35204                        use std::string::ToString;
35205                        match value {
35206                            "settingsVersion" => Ok(__FieldTag::__settings_version),
35207                            "settings_version" => Ok(__FieldTag::__settings_version),
35208                            "authorizedGaeApplications" => {
35209                                Ok(__FieldTag::__authorized_gae_applications)
35210                            }
35211                            "authorized_gae_applications" => {
35212                                Ok(__FieldTag::__authorized_gae_applications)
35213                            }
35214                            "tier" => Ok(__FieldTag::__tier),
35215                            "kind" => Ok(__FieldTag::__kind),
35216                            "userLabels" => Ok(__FieldTag::__user_labels),
35217                            "user_labels" => Ok(__FieldTag::__user_labels),
35218                            "availabilityType" => Ok(__FieldTag::__availability_type),
35219                            "availability_type" => Ok(__FieldTag::__availability_type),
35220                            "pricingPlan" => Ok(__FieldTag::__pricing_plan),
35221                            "pricing_plan" => Ok(__FieldTag::__pricing_plan),
35222                            "replicationType" => Ok(__FieldTag::__replication_type),
35223                            "replication_type" => Ok(__FieldTag::__replication_type),
35224                            "storageAutoResizeLimit" => Ok(__FieldTag::__storage_auto_resize_limit),
35225                            "storage_auto_resize_limit" => {
35226                                Ok(__FieldTag::__storage_auto_resize_limit)
35227                            }
35228                            "activationPolicy" => Ok(__FieldTag::__activation_policy),
35229                            "activation_policy" => Ok(__FieldTag::__activation_policy),
35230                            "ipConfiguration" => Ok(__FieldTag::__ip_configuration),
35231                            "ip_configuration" => Ok(__FieldTag::__ip_configuration),
35232                            "storageAutoResize" => Ok(__FieldTag::__storage_auto_resize),
35233                            "storage_auto_resize" => Ok(__FieldTag::__storage_auto_resize),
35234                            "locationPreference" => Ok(__FieldTag::__location_preference),
35235                            "location_preference" => Ok(__FieldTag::__location_preference),
35236                            "databaseFlags" => Ok(__FieldTag::__database_flags),
35237                            "database_flags" => Ok(__FieldTag::__database_flags),
35238                            "dataDiskType" => Ok(__FieldTag::__data_disk_type),
35239                            "data_disk_type" => Ok(__FieldTag::__data_disk_type),
35240                            "maintenanceWindow" => Ok(__FieldTag::__maintenance_window),
35241                            "maintenance_window" => Ok(__FieldTag::__maintenance_window),
35242                            "backupConfiguration" => Ok(__FieldTag::__backup_configuration),
35243                            "backup_configuration" => Ok(__FieldTag::__backup_configuration),
35244                            "databaseReplicationEnabled" => {
35245                                Ok(__FieldTag::__database_replication_enabled)
35246                            }
35247                            "database_replication_enabled" => {
35248                                Ok(__FieldTag::__database_replication_enabled)
35249                            }
35250                            "crashSafeReplicationEnabled" => {
35251                                Ok(__FieldTag::__crash_safe_replication_enabled)
35252                            }
35253                            "crash_safe_replication_enabled" => {
35254                                Ok(__FieldTag::__crash_safe_replication_enabled)
35255                            }
35256                            "dataDiskSizeGb" => Ok(__FieldTag::__data_disk_size_gb),
35257                            "data_disk_size_gb" => Ok(__FieldTag::__data_disk_size_gb),
35258                            "activeDirectoryConfig" => Ok(__FieldTag::__active_directory_config),
35259                            "active_directory_config" => Ok(__FieldTag::__active_directory_config),
35260                            "collation" => Ok(__FieldTag::__collation),
35261                            "denyMaintenancePeriods" => Ok(__FieldTag::__deny_maintenance_periods),
35262                            "deny_maintenance_periods" => {
35263                                Ok(__FieldTag::__deny_maintenance_periods)
35264                            }
35265                            "insightsConfig" => Ok(__FieldTag::__insights_config),
35266                            "insights_config" => Ok(__FieldTag::__insights_config),
35267                            "passwordValidationPolicy" => {
35268                                Ok(__FieldTag::__password_validation_policy)
35269                            }
35270                            "password_validation_policy" => {
35271                                Ok(__FieldTag::__password_validation_policy)
35272                            }
35273                            "sqlServerAuditConfig" => Ok(__FieldTag::__sql_server_audit_config),
35274                            "sql_server_audit_config" => Ok(__FieldTag::__sql_server_audit_config),
35275                            "edition" => Ok(__FieldTag::__edition),
35276                            "connectorEnforcement" => Ok(__FieldTag::__connector_enforcement),
35277                            "connector_enforcement" => Ok(__FieldTag::__connector_enforcement),
35278                            "deletionProtectionEnabled" => {
35279                                Ok(__FieldTag::__deletion_protection_enabled)
35280                            }
35281                            "deletion_protection_enabled" => {
35282                                Ok(__FieldTag::__deletion_protection_enabled)
35283                            }
35284                            "timeZone" => Ok(__FieldTag::__time_zone),
35285                            "time_zone" => Ok(__FieldTag::__time_zone),
35286                            "advancedMachineFeatures" => {
35287                                Ok(__FieldTag::__advanced_machine_features)
35288                            }
35289                            "advanced_machine_features" => {
35290                                Ok(__FieldTag::__advanced_machine_features)
35291                            }
35292                            "dataCacheConfig" => Ok(__FieldTag::__data_cache_config),
35293                            "data_cache_config" => Ok(__FieldTag::__data_cache_config),
35294                            "enableGoogleMlIntegration" => {
35295                                Ok(__FieldTag::__enable_google_ml_integration)
35296                            }
35297                            "enable_google_ml_integration" => {
35298                                Ok(__FieldTag::__enable_google_ml_integration)
35299                            }
35300                            "enableDataplexIntegration" => {
35301                                Ok(__FieldTag::__enable_dataplex_integration)
35302                            }
35303                            "enable_dataplex_integration" => {
35304                                Ok(__FieldTag::__enable_dataplex_integration)
35305                            }
35306                            _ => Ok(__FieldTag::Unknown(value.to_string())),
35307                        }
35308                    }
35309                }
35310                deserializer.deserialize_identifier(Visitor)
35311            }
35312        }
35313        struct Visitor;
35314        impl<'de> serde::de::Visitor<'de> for Visitor {
35315            type Value = Settings;
35316            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
35317                formatter.write_str("struct Settings")
35318            }
35319            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
35320            where
35321                A: serde::de::MapAccess<'de>,
35322            {
35323                #[allow(unused_imports)]
35324                use serde::de::Error;
35325                use std::option::Option::Some;
35326                let mut fields = std::collections::HashSet::new();
35327                let mut result = Self::Value::new();
35328                while let Some(tag) = map.next_key::<__FieldTag>()? {
35329                    #[allow(clippy::match_single_binding)]
35330                    match tag {
35331                        __FieldTag::__settings_version => {
35332                            if !fields.insert(__FieldTag::__settings_version) {
35333                                return std::result::Result::Err(A::Error::duplicate_field(
35334                                    "multiple values for settings_version",
35335                                ));
35336                            }
35337                            struct __With(std::option::Option<wkt::Int64Value>);
35338                            impl<'de> serde::de::Deserialize<'de> for __With {
35339                                fn deserialize<D>(
35340                                    deserializer: D,
35341                                ) -> std::result::Result<Self, D::Error>
35342                                where
35343                                    D: serde::de::Deserializer<'de>,
35344                                {
35345                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
35346                                }
35347                            }
35348                            result.settings_version = map.next_value::<__With>()?.0;
35349                        }
35350                        __FieldTag::__authorized_gae_applications => {
35351                            if !fields.insert(__FieldTag::__authorized_gae_applications) {
35352                                return std::result::Result::Err(A::Error::duplicate_field(
35353                                    "multiple values for authorized_gae_applications",
35354                                ));
35355                            }
35356                            result.authorized_gae_applications = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
35357                        }
35358                        __FieldTag::__tier => {
35359                            if !fields.insert(__FieldTag::__tier) {
35360                                return std::result::Result::Err(A::Error::duplicate_field(
35361                                    "multiple values for tier",
35362                                ));
35363                            }
35364                            result.tier = map
35365                                .next_value::<std::option::Option<std::string::String>>()?
35366                                .unwrap_or_default();
35367                        }
35368                        __FieldTag::__kind => {
35369                            if !fields.insert(__FieldTag::__kind) {
35370                                return std::result::Result::Err(A::Error::duplicate_field(
35371                                    "multiple values for kind",
35372                                ));
35373                            }
35374                            result.kind = map
35375                                .next_value::<std::option::Option<std::string::String>>()?
35376                                .unwrap_or_default();
35377                        }
35378                        __FieldTag::__user_labels => {
35379                            if !fields.insert(__FieldTag::__user_labels) {
35380                                return std::result::Result::Err(A::Error::duplicate_field(
35381                                    "multiple values for user_labels",
35382                                ));
35383                            }
35384                            result.user_labels = map
35385                                .next_value::<std::option::Option<
35386                                    std::collections::HashMap<
35387                                        std::string::String,
35388                                        std::string::String,
35389                                    >,
35390                                >>()?
35391                                .unwrap_or_default();
35392                        }
35393                        __FieldTag::__availability_type => {
35394                            if !fields.insert(__FieldTag::__availability_type) {
35395                                return std::result::Result::Err(A::Error::duplicate_field(
35396                                    "multiple values for availability_type",
35397                                ));
35398                            }
35399                            result.availability_type = map.next_value::<std::option::Option<crate::model::SqlAvailabilityType>>()?.unwrap_or_default();
35400                        }
35401                        __FieldTag::__pricing_plan => {
35402                            if !fields.insert(__FieldTag::__pricing_plan) {
35403                                return std::result::Result::Err(A::Error::duplicate_field(
35404                                    "multiple values for pricing_plan",
35405                                ));
35406                            }
35407                            result.pricing_plan = map
35408                                .next_value::<std::option::Option<crate::model::SqlPricingPlan>>()?
35409                                .unwrap_or_default();
35410                        }
35411                        __FieldTag::__replication_type => {
35412                            if !fields.insert(__FieldTag::__replication_type) {
35413                                return std::result::Result::Err(A::Error::duplicate_field(
35414                                    "multiple values for replication_type",
35415                                ));
35416                            }
35417                            result.replication_type = map.next_value::<std::option::Option<crate::model::SqlReplicationType>>()?.unwrap_or_default();
35418                        }
35419                        __FieldTag::__storage_auto_resize_limit => {
35420                            if !fields.insert(__FieldTag::__storage_auto_resize_limit) {
35421                                return std::result::Result::Err(A::Error::duplicate_field(
35422                                    "multiple values for storage_auto_resize_limit",
35423                                ));
35424                            }
35425                            struct __With(std::option::Option<wkt::Int64Value>);
35426                            impl<'de> serde::de::Deserialize<'de> for __With {
35427                                fn deserialize<D>(
35428                                    deserializer: D,
35429                                ) -> std::result::Result<Self, D::Error>
35430                                where
35431                                    D: serde::de::Deserializer<'de>,
35432                                {
35433                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
35434                                }
35435                            }
35436                            result.storage_auto_resize_limit = map.next_value::<__With>()?.0;
35437                        }
35438                        __FieldTag::__activation_policy => {
35439                            if !fields.insert(__FieldTag::__activation_policy) {
35440                                return std::result::Result::Err(A::Error::duplicate_field(
35441                                    "multiple values for activation_policy",
35442                                ));
35443                            }
35444                            result.activation_policy =
35445                                map.next_value::<std::option::Option<
35446                                    crate::model::settings::SqlActivationPolicy,
35447                                >>()?
35448                                .unwrap_or_default();
35449                        }
35450                        __FieldTag::__ip_configuration => {
35451                            if !fields.insert(__FieldTag::__ip_configuration) {
35452                                return std::result::Result::Err(A::Error::duplicate_field(
35453                                    "multiple values for ip_configuration",
35454                                ));
35455                            }
35456                            result.ip_configuration = map
35457                                .next_value::<std::option::Option<crate::model::IpConfiguration>>(
35458                                )?;
35459                        }
35460                        __FieldTag::__storage_auto_resize => {
35461                            if !fields.insert(__FieldTag::__storage_auto_resize) {
35462                                return std::result::Result::Err(A::Error::duplicate_field(
35463                                    "multiple values for storage_auto_resize",
35464                                ));
35465                            }
35466                            result.storage_auto_resize =
35467                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
35468                        }
35469                        __FieldTag::__location_preference => {
35470                            if !fields.insert(__FieldTag::__location_preference) {
35471                                return std::result::Result::Err(A::Error::duplicate_field(
35472                                    "multiple values for location_preference",
35473                                ));
35474                            }
35475                            result.location_preference = map.next_value::<std::option::Option<crate::model::LocationPreference>>()?
35476                                ;
35477                        }
35478                        __FieldTag::__database_flags => {
35479                            if !fields.insert(__FieldTag::__database_flags) {
35480                                return std::result::Result::Err(A::Error::duplicate_field(
35481                                    "multiple values for database_flags",
35482                                ));
35483                            }
35484                            result.database_flags = map.next_value::<std::option::Option<std::vec::Vec<crate::model::DatabaseFlags>>>()?.unwrap_or_default();
35485                        }
35486                        __FieldTag::__data_disk_type => {
35487                            if !fields.insert(__FieldTag::__data_disk_type) {
35488                                return std::result::Result::Err(A::Error::duplicate_field(
35489                                    "multiple values for data_disk_type",
35490                                ));
35491                            }
35492                            result.data_disk_type = map
35493                                .next_value::<std::option::Option<crate::model::SqlDataDiskType>>()?
35494                                .unwrap_or_default();
35495                        }
35496                        __FieldTag::__maintenance_window => {
35497                            if !fields.insert(__FieldTag::__maintenance_window) {
35498                                return std::result::Result::Err(A::Error::duplicate_field(
35499                                    "multiple values for maintenance_window",
35500                                ));
35501                            }
35502                            result.maintenance_window = map
35503                                .next_value::<std::option::Option<crate::model::MaintenanceWindow>>(
35504                                )?;
35505                        }
35506                        __FieldTag::__backup_configuration => {
35507                            if !fields.insert(__FieldTag::__backup_configuration) {
35508                                return std::result::Result::Err(A::Error::duplicate_field(
35509                                    "multiple values for backup_configuration",
35510                                ));
35511                            }
35512                            result.backup_configuration = map.next_value::<std::option::Option<crate::model::BackupConfiguration>>()?
35513                                ;
35514                        }
35515                        __FieldTag::__database_replication_enabled => {
35516                            if !fields.insert(__FieldTag::__database_replication_enabled) {
35517                                return std::result::Result::Err(A::Error::duplicate_field(
35518                                    "multiple values for database_replication_enabled",
35519                                ));
35520                            }
35521                            result.database_replication_enabled =
35522                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
35523                        }
35524                        __FieldTag::__crash_safe_replication_enabled => {
35525                            if !fields.insert(__FieldTag::__crash_safe_replication_enabled) {
35526                                return std::result::Result::Err(A::Error::duplicate_field(
35527                                    "multiple values for crash_safe_replication_enabled",
35528                                ));
35529                            }
35530                            result.crash_safe_replication_enabled =
35531                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
35532                        }
35533                        __FieldTag::__data_disk_size_gb => {
35534                            if !fields.insert(__FieldTag::__data_disk_size_gb) {
35535                                return std::result::Result::Err(A::Error::duplicate_field(
35536                                    "multiple values for data_disk_size_gb",
35537                                ));
35538                            }
35539                            struct __With(std::option::Option<wkt::Int64Value>);
35540                            impl<'de> serde::de::Deserialize<'de> for __With {
35541                                fn deserialize<D>(
35542                                    deserializer: D,
35543                                ) -> std::result::Result<Self, D::Error>
35544                                where
35545                                    D: serde::de::Deserializer<'de>,
35546                                {
35547                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
35548                                }
35549                            }
35550                            result.data_disk_size_gb = map.next_value::<__With>()?.0;
35551                        }
35552                        __FieldTag::__active_directory_config => {
35553                            if !fields.insert(__FieldTag::__active_directory_config) {
35554                                return std::result::Result::Err(A::Error::duplicate_field(
35555                                    "multiple values for active_directory_config",
35556                                ));
35557                            }
35558                            result.active_directory_config = map.next_value::<std::option::Option<crate::model::SqlActiveDirectoryConfig>>()?
35559                                ;
35560                        }
35561                        __FieldTag::__collation => {
35562                            if !fields.insert(__FieldTag::__collation) {
35563                                return std::result::Result::Err(A::Error::duplicate_field(
35564                                    "multiple values for collation",
35565                                ));
35566                            }
35567                            result.collation = map
35568                                .next_value::<std::option::Option<std::string::String>>()?
35569                                .unwrap_or_default();
35570                        }
35571                        __FieldTag::__deny_maintenance_periods => {
35572                            if !fields.insert(__FieldTag::__deny_maintenance_periods) {
35573                                return std::result::Result::Err(A::Error::duplicate_field(
35574                                    "multiple values for deny_maintenance_periods",
35575                                ));
35576                            }
35577                            result.deny_maintenance_periods = map
35578                                .next_value::<std::option::Option<
35579                                    std::vec::Vec<crate::model::DenyMaintenancePeriod>,
35580                                >>()?
35581                                .unwrap_or_default();
35582                        }
35583                        __FieldTag::__insights_config => {
35584                            if !fields.insert(__FieldTag::__insights_config) {
35585                                return std::result::Result::Err(A::Error::duplicate_field(
35586                                    "multiple values for insights_config",
35587                                ));
35588                            }
35589                            result.insights_config = map
35590                                .next_value::<std::option::Option<crate::model::InsightsConfig>>(
35591                                )?;
35592                        }
35593                        __FieldTag::__password_validation_policy => {
35594                            if !fields.insert(__FieldTag::__password_validation_policy) {
35595                                return std::result::Result::Err(A::Error::duplicate_field(
35596                                    "multiple values for password_validation_policy",
35597                                ));
35598                            }
35599                            result.password_validation_policy = map.next_value::<std::option::Option<crate::model::PasswordValidationPolicy>>()?
35600                                ;
35601                        }
35602                        __FieldTag::__sql_server_audit_config => {
35603                            if !fields.insert(__FieldTag::__sql_server_audit_config) {
35604                                return std::result::Result::Err(A::Error::duplicate_field(
35605                                    "multiple values for sql_server_audit_config",
35606                                ));
35607                            }
35608                            result.sql_server_audit_config = map.next_value::<std::option::Option<crate::model::SqlServerAuditConfig>>()?
35609                                ;
35610                        }
35611                        __FieldTag::__edition => {
35612                            if !fields.insert(__FieldTag::__edition) {
35613                                return std::result::Result::Err(A::Error::duplicate_field(
35614                                    "multiple values for edition",
35615                                ));
35616                            }
35617                            result.edition = map
35618                                .next_value::<std::option::Option<crate::model::settings::Edition>>(
35619                                )?
35620                                .unwrap_or_default();
35621                        }
35622                        __FieldTag::__connector_enforcement => {
35623                            if !fields.insert(__FieldTag::__connector_enforcement) {
35624                                return std::result::Result::Err(A::Error::duplicate_field(
35625                                    "multiple values for connector_enforcement",
35626                                ));
35627                            }
35628                            result.connector_enforcement =
35629                                map.next_value::<std::option::Option<
35630                                    crate::model::settings::ConnectorEnforcement,
35631                                >>()?
35632                                .unwrap_or_default();
35633                        }
35634                        __FieldTag::__deletion_protection_enabled => {
35635                            if !fields.insert(__FieldTag::__deletion_protection_enabled) {
35636                                return std::result::Result::Err(A::Error::duplicate_field(
35637                                    "multiple values for deletion_protection_enabled",
35638                                ));
35639                            }
35640                            result.deletion_protection_enabled =
35641                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
35642                        }
35643                        __FieldTag::__time_zone => {
35644                            if !fields.insert(__FieldTag::__time_zone) {
35645                                return std::result::Result::Err(A::Error::duplicate_field(
35646                                    "multiple values for time_zone",
35647                                ));
35648                            }
35649                            result.time_zone = map
35650                                .next_value::<std::option::Option<std::string::String>>()?
35651                                .unwrap_or_default();
35652                        }
35653                        __FieldTag::__advanced_machine_features => {
35654                            if !fields.insert(__FieldTag::__advanced_machine_features) {
35655                                return std::result::Result::Err(A::Error::duplicate_field(
35656                                    "multiple values for advanced_machine_features",
35657                                ));
35658                            }
35659                            result.advanced_machine_features = map.next_value::<std::option::Option<crate::model::AdvancedMachineFeatures>>()?
35660                                ;
35661                        }
35662                        __FieldTag::__data_cache_config => {
35663                            if !fields.insert(__FieldTag::__data_cache_config) {
35664                                return std::result::Result::Err(A::Error::duplicate_field(
35665                                    "multiple values for data_cache_config",
35666                                ));
35667                            }
35668                            result.data_cache_config = map
35669                                .next_value::<std::option::Option<crate::model::DataCacheConfig>>(
35670                                )?;
35671                        }
35672                        __FieldTag::__enable_google_ml_integration => {
35673                            if !fields.insert(__FieldTag::__enable_google_ml_integration) {
35674                                return std::result::Result::Err(A::Error::duplicate_field(
35675                                    "multiple values for enable_google_ml_integration",
35676                                ));
35677                            }
35678                            result.enable_google_ml_integration =
35679                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
35680                        }
35681                        __FieldTag::__enable_dataplex_integration => {
35682                            if !fields.insert(__FieldTag::__enable_dataplex_integration) {
35683                                return std::result::Result::Err(A::Error::duplicate_field(
35684                                    "multiple values for enable_dataplex_integration",
35685                                ));
35686                            }
35687                            result.enable_dataplex_integration =
35688                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
35689                        }
35690                        __FieldTag::Unknown(key) => {
35691                            let value = map.next_value::<serde_json::Value>()?;
35692                            result._unknown_fields.insert(key, value);
35693                        }
35694                    }
35695                }
35696                std::result::Result::Ok(result)
35697            }
35698        }
35699        deserializer.deserialize_any(Visitor)
35700    }
35701}
35702
35703#[doc(hidden)]
35704impl serde::ser::Serialize for Settings {
35705    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
35706    where
35707        S: serde::ser::Serializer,
35708    {
35709        use serde::ser::SerializeMap;
35710        #[allow(unused_imports)]
35711        use std::option::Option::Some;
35712        let mut state = serializer.serialize_map(std::option::Option::None)?;
35713        if self.settings_version.is_some() {
35714            struct __With<'a>(&'a std::option::Option<wkt::Int64Value>);
35715            impl<'a> serde::ser::Serialize for __With<'a> {
35716                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
35717                where
35718                    S: serde::ser::Serializer,
35719                {
35720                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
35721                        self.0, serializer,
35722                    )
35723                }
35724            }
35725            state.serialize_entry("settingsVersion", &__With(&self.settings_version))?;
35726        }
35727        if !self.authorized_gae_applications.is_empty() {
35728            state.serialize_entry(
35729                "authorizedGaeApplications",
35730                &self.authorized_gae_applications,
35731            )?;
35732        }
35733        if !self.tier.is_empty() {
35734            state.serialize_entry("tier", &self.tier)?;
35735        }
35736        if !self.kind.is_empty() {
35737            state.serialize_entry("kind", &self.kind)?;
35738        }
35739        if !self.user_labels.is_empty() {
35740            state.serialize_entry("userLabels", &self.user_labels)?;
35741        }
35742        if !wkt::internal::is_default(&self.availability_type) {
35743            state.serialize_entry("availabilityType", &self.availability_type)?;
35744        }
35745        if !wkt::internal::is_default(&self.pricing_plan) {
35746            state.serialize_entry("pricingPlan", &self.pricing_plan)?;
35747        }
35748        if !wkt::internal::is_default(&self.replication_type) {
35749            state.serialize_entry("replicationType", &self.replication_type)?;
35750        }
35751        if self.storage_auto_resize_limit.is_some() {
35752            struct __With<'a>(&'a std::option::Option<wkt::Int64Value>);
35753            impl<'a> serde::ser::Serialize for __With<'a> {
35754                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
35755                where
35756                    S: serde::ser::Serializer,
35757                {
35758                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
35759                        self.0, serializer,
35760                    )
35761                }
35762            }
35763            state.serialize_entry(
35764                "storageAutoResizeLimit",
35765                &__With(&self.storage_auto_resize_limit),
35766            )?;
35767        }
35768        if !wkt::internal::is_default(&self.activation_policy) {
35769            state.serialize_entry("activationPolicy", &self.activation_policy)?;
35770        }
35771        if self.ip_configuration.is_some() {
35772            state.serialize_entry("ipConfiguration", &self.ip_configuration)?;
35773        }
35774        if self.storage_auto_resize.is_some() {
35775            state.serialize_entry("storageAutoResize", &self.storage_auto_resize)?;
35776        }
35777        if self.location_preference.is_some() {
35778            state.serialize_entry("locationPreference", &self.location_preference)?;
35779        }
35780        if !self.database_flags.is_empty() {
35781            state.serialize_entry("databaseFlags", &self.database_flags)?;
35782        }
35783        if !wkt::internal::is_default(&self.data_disk_type) {
35784            state.serialize_entry("dataDiskType", &self.data_disk_type)?;
35785        }
35786        if self.maintenance_window.is_some() {
35787            state.serialize_entry("maintenanceWindow", &self.maintenance_window)?;
35788        }
35789        if self.backup_configuration.is_some() {
35790            state.serialize_entry("backupConfiguration", &self.backup_configuration)?;
35791        }
35792        if self.database_replication_enabled.is_some() {
35793            state.serialize_entry(
35794                "databaseReplicationEnabled",
35795                &self.database_replication_enabled,
35796            )?;
35797        }
35798        if self.crash_safe_replication_enabled.is_some() {
35799            state.serialize_entry(
35800                "crashSafeReplicationEnabled",
35801                &self.crash_safe_replication_enabled,
35802            )?;
35803        }
35804        if self.data_disk_size_gb.is_some() {
35805            struct __With<'a>(&'a std::option::Option<wkt::Int64Value>);
35806            impl<'a> serde::ser::Serialize for __With<'a> {
35807                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
35808                where
35809                    S: serde::ser::Serializer,
35810                {
35811                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
35812                        self.0, serializer,
35813                    )
35814                }
35815            }
35816            state.serialize_entry("dataDiskSizeGb", &__With(&self.data_disk_size_gb))?;
35817        }
35818        if self.active_directory_config.is_some() {
35819            state.serialize_entry("activeDirectoryConfig", &self.active_directory_config)?;
35820        }
35821        if !self.collation.is_empty() {
35822            state.serialize_entry("collation", &self.collation)?;
35823        }
35824        if !self.deny_maintenance_periods.is_empty() {
35825            state.serialize_entry("denyMaintenancePeriods", &self.deny_maintenance_periods)?;
35826        }
35827        if self.insights_config.is_some() {
35828            state.serialize_entry("insightsConfig", &self.insights_config)?;
35829        }
35830        if self.password_validation_policy.is_some() {
35831            state.serialize_entry("passwordValidationPolicy", &self.password_validation_policy)?;
35832        }
35833        if self.sql_server_audit_config.is_some() {
35834            state.serialize_entry("sqlServerAuditConfig", &self.sql_server_audit_config)?;
35835        }
35836        if !wkt::internal::is_default(&self.edition) {
35837            state.serialize_entry("edition", &self.edition)?;
35838        }
35839        if !wkt::internal::is_default(&self.connector_enforcement) {
35840            state.serialize_entry("connectorEnforcement", &self.connector_enforcement)?;
35841        }
35842        if self.deletion_protection_enabled.is_some() {
35843            state.serialize_entry(
35844                "deletionProtectionEnabled",
35845                &self.deletion_protection_enabled,
35846            )?;
35847        }
35848        if !self.time_zone.is_empty() {
35849            state.serialize_entry("timeZone", &self.time_zone)?;
35850        }
35851        if self.advanced_machine_features.is_some() {
35852            state.serialize_entry("advancedMachineFeatures", &self.advanced_machine_features)?;
35853        }
35854        if self.data_cache_config.is_some() {
35855            state.serialize_entry("dataCacheConfig", &self.data_cache_config)?;
35856        }
35857        if self.enable_google_ml_integration.is_some() {
35858            state.serialize_entry(
35859                "enableGoogleMlIntegration",
35860                &self.enable_google_ml_integration,
35861            )?;
35862        }
35863        if self.enable_dataplex_integration.is_some() {
35864            state.serialize_entry(
35865                "enableDataplexIntegration",
35866                &self.enable_dataplex_integration,
35867            )?;
35868        }
35869        if !self._unknown_fields.is_empty() {
35870            for (key, value) in self._unknown_fields.iter() {
35871                state.serialize_entry(key, &value)?;
35872            }
35873        }
35874        state.end()
35875    }
35876}
35877
35878/// Defines additional types related to [Settings].
35879pub mod settings {
35880    #[allow(unused_imports)]
35881    use super::*;
35882
35883    /// Specifies when the instance is activated.
35884    ///
35885    /// # Working with unknown values
35886    ///
35887    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
35888    /// additional enum variants at any time. Adding new variants is not considered
35889    /// a breaking change. Applications should write their code in anticipation of:
35890    ///
35891    /// - New values appearing in future releases of the client library, **and**
35892    /// - New values received dynamically, without application changes.
35893    ///
35894    /// Please consult the [Working with enums] section in the user guide for some
35895    /// guidelines.
35896    ///
35897    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
35898    #[derive(Clone, Debug, PartialEq)]
35899    #[non_exhaustive]
35900    pub enum SqlActivationPolicy {
35901        /// Unknown activation plan.
35902        Unspecified,
35903        /// The instance is always up and running.
35904        Always,
35905        /// The instance never starts.
35906        Never,
35907        /// The instance starts upon receiving requests.
35908        #[deprecated]
35909        OnDemand,
35910        /// If set, the enum was initialized with an unknown value.
35911        ///
35912        /// Applications can examine the value using [SqlActivationPolicy::value] or
35913        /// [SqlActivationPolicy::name].
35914        UnknownValue(sql_activation_policy::UnknownValue),
35915    }
35916
35917    #[doc(hidden)]
35918    pub mod sql_activation_policy {
35919        #[allow(unused_imports)]
35920        use super::*;
35921        #[derive(Clone, Debug, PartialEq)]
35922        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
35923    }
35924
35925    impl SqlActivationPolicy {
35926        /// Gets the enum value.
35927        ///
35928        /// Returns `None` if the enum contains an unknown value deserialized from
35929        /// the string representation of enums.
35930        pub fn value(&self) -> std::option::Option<i32> {
35931            match self {
35932                Self::Unspecified => std::option::Option::Some(0),
35933                Self::Always => std::option::Option::Some(1),
35934                Self::Never => std::option::Option::Some(2),
35935                Self::OnDemand => std::option::Option::Some(3),
35936                Self::UnknownValue(u) => u.0.value(),
35937            }
35938        }
35939
35940        /// Gets the enum value as a string.
35941        ///
35942        /// Returns `None` if the enum contains an unknown value deserialized from
35943        /// the integer representation of enums.
35944        pub fn name(&self) -> std::option::Option<&str> {
35945            match self {
35946                Self::Unspecified => std::option::Option::Some("SQL_ACTIVATION_POLICY_UNSPECIFIED"),
35947                Self::Always => std::option::Option::Some("ALWAYS"),
35948                Self::Never => std::option::Option::Some("NEVER"),
35949                Self::OnDemand => std::option::Option::Some("ON_DEMAND"),
35950                Self::UnknownValue(u) => u.0.name(),
35951            }
35952        }
35953    }
35954
35955    impl std::default::Default for SqlActivationPolicy {
35956        fn default() -> Self {
35957            use std::convert::From;
35958            Self::from(0)
35959        }
35960    }
35961
35962    impl std::fmt::Display for SqlActivationPolicy {
35963        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
35964            wkt::internal::display_enum(f, self.name(), self.value())
35965        }
35966    }
35967
35968    impl std::convert::From<i32> for SqlActivationPolicy {
35969        fn from(value: i32) -> Self {
35970            match value {
35971                0 => Self::Unspecified,
35972                1 => Self::Always,
35973                2 => Self::Never,
35974                3 => Self::OnDemand,
35975                _ => Self::UnknownValue(sql_activation_policy::UnknownValue(
35976                    wkt::internal::UnknownEnumValue::Integer(value),
35977                )),
35978            }
35979        }
35980    }
35981
35982    impl std::convert::From<&str> for SqlActivationPolicy {
35983        fn from(value: &str) -> Self {
35984            use std::string::ToString;
35985            match value {
35986                "SQL_ACTIVATION_POLICY_UNSPECIFIED" => Self::Unspecified,
35987                "ALWAYS" => Self::Always,
35988                "NEVER" => Self::Never,
35989                "ON_DEMAND" => Self::OnDemand,
35990                _ => Self::UnknownValue(sql_activation_policy::UnknownValue(
35991                    wkt::internal::UnknownEnumValue::String(value.to_string()),
35992                )),
35993            }
35994        }
35995    }
35996
35997    impl serde::ser::Serialize for SqlActivationPolicy {
35998        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
35999        where
36000            S: serde::Serializer,
36001        {
36002            match self {
36003                Self::Unspecified => serializer.serialize_i32(0),
36004                Self::Always => serializer.serialize_i32(1),
36005                Self::Never => serializer.serialize_i32(2),
36006                Self::OnDemand => serializer.serialize_i32(3),
36007                Self::UnknownValue(u) => u.0.serialize(serializer),
36008            }
36009        }
36010    }
36011
36012    impl<'de> serde::de::Deserialize<'de> for SqlActivationPolicy {
36013        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
36014        where
36015            D: serde::Deserializer<'de>,
36016        {
36017            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlActivationPolicy>::new(
36018                ".google.cloud.sql.v1.Settings.SqlActivationPolicy",
36019            ))
36020        }
36021    }
36022
36023    /// The edition of the instance, can be ENTERPRISE or ENTERPRISE_PLUS.
36024    ///
36025    /// # Working with unknown values
36026    ///
36027    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
36028    /// additional enum variants at any time. Adding new variants is not considered
36029    /// a breaking change. Applications should write their code in anticipation of:
36030    ///
36031    /// - New values appearing in future releases of the client library, **and**
36032    /// - New values received dynamically, without application changes.
36033    ///
36034    /// Please consult the [Working with enums] section in the user guide for some
36035    /// guidelines.
36036    ///
36037    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
36038    #[derive(Clone, Debug, PartialEq)]
36039    #[non_exhaustive]
36040    pub enum Edition {
36041        /// The instance did not specify the edition.
36042        Unspecified,
36043        /// The instance is an enterprise edition.
36044        Enterprise,
36045        /// The instance is an Enterprise Plus edition.
36046        EnterprisePlus,
36047        /// If set, the enum was initialized with an unknown value.
36048        ///
36049        /// Applications can examine the value using [Edition::value] or
36050        /// [Edition::name].
36051        UnknownValue(edition::UnknownValue),
36052    }
36053
36054    #[doc(hidden)]
36055    pub mod edition {
36056        #[allow(unused_imports)]
36057        use super::*;
36058        #[derive(Clone, Debug, PartialEq)]
36059        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
36060    }
36061
36062    impl Edition {
36063        /// Gets the enum value.
36064        ///
36065        /// Returns `None` if the enum contains an unknown value deserialized from
36066        /// the string representation of enums.
36067        pub fn value(&self) -> std::option::Option<i32> {
36068            match self {
36069                Self::Unspecified => std::option::Option::Some(0),
36070                Self::Enterprise => std::option::Option::Some(2),
36071                Self::EnterprisePlus => std::option::Option::Some(3),
36072                Self::UnknownValue(u) => u.0.value(),
36073            }
36074        }
36075
36076        /// Gets the enum value as a string.
36077        ///
36078        /// Returns `None` if the enum contains an unknown value deserialized from
36079        /// the integer representation of enums.
36080        pub fn name(&self) -> std::option::Option<&str> {
36081            match self {
36082                Self::Unspecified => std::option::Option::Some("EDITION_UNSPECIFIED"),
36083                Self::Enterprise => std::option::Option::Some("ENTERPRISE"),
36084                Self::EnterprisePlus => std::option::Option::Some("ENTERPRISE_PLUS"),
36085                Self::UnknownValue(u) => u.0.name(),
36086            }
36087        }
36088    }
36089
36090    impl std::default::Default for Edition {
36091        fn default() -> Self {
36092            use std::convert::From;
36093            Self::from(0)
36094        }
36095    }
36096
36097    impl std::fmt::Display for Edition {
36098        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
36099            wkt::internal::display_enum(f, self.name(), self.value())
36100        }
36101    }
36102
36103    impl std::convert::From<i32> for Edition {
36104        fn from(value: i32) -> Self {
36105            match value {
36106                0 => Self::Unspecified,
36107                2 => Self::Enterprise,
36108                3 => Self::EnterprisePlus,
36109                _ => Self::UnknownValue(edition::UnknownValue(
36110                    wkt::internal::UnknownEnumValue::Integer(value),
36111                )),
36112            }
36113        }
36114    }
36115
36116    impl std::convert::From<&str> for Edition {
36117        fn from(value: &str) -> Self {
36118            use std::string::ToString;
36119            match value {
36120                "EDITION_UNSPECIFIED" => Self::Unspecified,
36121                "ENTERPRISE" => Self::Enterprise,
36122                "ENTERPRISE_PLUS" => Self::EnterprisePlus,
36123                _ => Self::UnknownValue(edition::UnknownValue(
36124                    wkt::internal::UnknownEnumValue::String(value.to_string()),
36125                )),
36126            }
36127        }
36128    }
36129
36130    impl serde::ser::Serialize for Edition {
36131        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
36132        where
36133            S: serde::Serializer,
36134        {
36135            match self {
36136                Self::Unspecified => serializer.serialize_i32(0),
36137                Self::Enterprise => serializer.serialize_i32(2),
36138                Self::EnterprisePlus => serializer.serialize_i32(3),
36139                Self::UnknownValue(u) => u.0.serialize(serializer),
36140            }
36141        }
36142    }
36143
36144    impl<'de> serde::de::Deserialize<'de> for Edition {
36145        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
36146        where
36147            D: serde::Deserializer<'de>,
36148        {
36149            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Edition>::new(
36150                ".google.cloud.sql.v1.Settings.Edition",
36151            ))
36152        }
36153    }
36154
36155    /// The options for enforcing Cloud SQL connectors in the instance.
36156    ///
36157    /// # Working with unknown values
36158    ///
36159    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
36160    /// additional enum variants at any time. Adding new variants is not considered
36161    /// a breaking change. Applications should write their code in anticipation of:
36162    ///
36163    /// - New values appearing in future releases of the client library, **and**
36164    /// - New values received dynamically, without application changes.
36165    ///
36166    /// Please consult the [Working with enums] section in the user guide for some
36167    /// guidelines.
36168    ///
36169    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
36170    #[derive(Clone, Debug, PartialEq)]
36171    #[non_exhaustive]
36172    pub enum ConnectorEnforcement {
36173        /// The requirement for Cloud SQL connectors is unknown.
36174        Unspecified,
36175        /// Do not require Cloud SQL connectors.
36176        NotRequired,
36177        /// Require all connections to use Cloud SQL connectors, including the
36178        /// Cloud SQL Auth Proxy and Cloud SQL Java, Python, and Go connectors.
36179        /// Note: This disables all existing authorized networks.
36180        Required,
36181        /// If set, the enum was initialized with an unknown value.
36182        ///
36183        /// Applications can examine the value using [ConnectorEnforcement::value] or
36184        /// [ConnectorEnforcement::name].
36185        UnknownValue(connector_enforcement::UnknownValue),
36186    }
36187
36188    #[doc(hidden)]
36189    pub mod connector_enforcement {
36190        #[allow(unused_imports)]
36191        use super::*;
36192        #[derive(Clone, Debug, PartialEq)]
36193        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
36194    }
36195
36196    impl ConnectorEnforcement {
36197        /// Gets the enum value.
36198        ///
36199        /// Returns `None` if the enum contains an unknown value deserialized from
36200        /// the string representation of enums.
36201        pub fn value(&self) -> std::option::Option<i32> {
36202            match self {
36203                Self::Unspecified => std::option::Option::Some(0),
36204                Self::NotRequired => std::option::Option::Some(1),
36205                Self::Required => std::option::Option::Some(2),
36206                Self::UnknownValue(u) => u.0.value(),
36207            }
36208        }
36209
36210        /// Gets the enum value as a string.
36211        ///
36212        /// Returns `None` if the enum contains an unknown value deserialized from
36213        /// the integer representation of enums.
36214        pub fn name(&self) -> std::option::Option<&str> {
36215            match self {
36216                Self::Unspecified => std::option::Option::Some("CONNECTOR_ENFORCEMENT_UNSPECIFIED"),
36217                Self::NotRequired => std::option::Option::Some("NOT_REQUIRED"),
36218                Self::Required => std::option::Option::Some("REQUIRED"),
36219                Self::UnknownValue(u) => u.0.name(),
36220            }
36221        }
36222    }
36223
36224    impl std::default::Default for ConnectorEnforcement {
36225        fn default() -> Self {
36226            use std::convert::From;
36227            Self::from(0)
36228        }
36229    }
36230
36231    impl std::fmt::Display for ConnectorEnforcement {
36232        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
36233            wkt::internal::display_enum(f, self.name(), self.value())
36234        }
36235    }
36236
36237    impl std::convert::From<i32> for ConnectorEnforcement {
36238        fn from(value: i32) -> Self {
36239            match value {
36240                0 => Self::Unspecified,
36241                1 => Self::NotRequired,
36242                2 => Self::Required,
36243                _ => Self::UnknownValue(connector_enforcement::UnknownValue(
36244                    wkt::internal::UnknownEnumValue::Integer(value),
36245                )),
36246            }
36247        }
36248    }
36249
36250    impl std::convert::From<&str> for ConnectorEnforcement {
36251        fn from(value: &str) -> Self {
36252            use std::string::ToString;
36253            match value {
36254                "CONNECTOR_ENFORCEMENT_UNSPECIFIED" => Self::Unspecified,
36255                "NOT_REQUIRED" => Self::NotRequired,
36256                "REQUIRED" => Self::Required,
36257                _ => Self::UnknownValue(connector_enforcement::UnknownValue(
36258                    wkt::internal::UnknownEnumValue::String(value.to_string()),
36259                )),
36260            }
36261        }
36262    }
36263
36264    impl serde::ser::Serialize for ConnectorEnforcement {
36265        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
36266        where
36267            S: serde::Serializer,
36268        {
36269            match self {
36270                Self::Unspecified => serializer.serialize_i32(0),
36271                Self::NotRequired => serializer.serialize_i32(1),
36272                Self::Required => serializer.serialize_i32(2),
36273                Self::UnknownValue(u) => u.0.serialize(serializer),
36274            }
36275        }
36276    }
36277
36278    impl<'de> serde::de::Deserialize<'de> for ConnectorEnforcement {
36279        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
36280        where
36281            D: serde::Deserializer<'de>,
36282        {
36283            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ConnectorEnforcement>::new(
36284                ".google.cloud.sql.v1.Settings.ConnectorEnforcement",
36285            ))
36286        }
36287    }
36288}
36289
36290/// Specifies options for controlling advanced machine features.
36291#[derive(Clone, Debug, Default, PartialEq)]
36292#[non_exhaustive]
36293pub struct AdvancedMachineFeatures {
36294    /// The number of threads per physical core.
36295    pub threads_per_core: i32,
36296
36297    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
36298}
36299
36300impl AdvancedMachineFeatures {
36301    pub fn new() -> Self {
36302        std::default::Default::default()
36303    }
36304
36305    /// Sets the value of [threads_per_core][crate::model::AdvancedMachineFeatures::threads_per_core].
36306    pub fn set_threads_per_core<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
36307        self.threads_per_core = v.into();
36308        self
36309    }
36310}
36311
36312impl wkt::message::Message for AdvancedMachineFeatures {
36313    fn typename() -> &'static str {
36314        "type.googleapis.com/google.cloud.sql.v1.AdvancedMachineFeatures"
36315    }
36316}
36317
36318#[doc(hidden)]
36319impl<'de> serde::de::Deserialize<'de> for AdvancedMachineFeatures {
36320    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
36321    where
36322        D: serde::Deserializer<'de>,
36323    {
36324        #[allow(non_camel_case_types)]
36325        #[doc(hidden)]
36326        #[derive(PartialEq, Eq, Hash)]
36327        enum __FieldTag {
36328            __threads_per_core,
36329            Unknown(std::string::String),
36330        }
36331        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
36332            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
36333            where
36334                D: serde::Deserializer<'de>,
36335            {
36336                struct Visitor;
36337                impl<'de> serde::de::Visitor<'de> for Visitor {
36338                    type Value = __FieldTag;
36339                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
36340                        formatter.write_str("a field name for AdvancedMachineFeatures")
36341                    }
36342                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
36343                    where
36344                        E: serde::de::Error,
36345                    {
36346                        use std::result::Result::Ok;
36347                        use std::string::ToString;
36348                        match value {
36349                            "threadsPerCore" => Ok(__FieldTag::__threads_per_core),
36350                            "threads_per_core" => Ok(__FieldTag::__threads_per_core),
36351                            _ => Ok(__FieldTag::Unknown(value.to_string())),
36352                        }
36353                    }
36354                }
36355                deserializer.deserialize_identifier(Visitor)
36356            }
36357        }
36358        struct Visitor;
36359        impl<'de> serde::de::Visitor<'de> for Visitor {
36360            type Value = AdvancedMachineFeatures;
36361            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
36362                formatter.write_str("struct AdvancedMachineFeatures")
36363            }
36364            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
36365            where
36366                A: serde::de::MapAccess<'de>,
36367            {
36368                #[allow(unused_imports)]
36369                use serde::de::Error;
36370                use std::option::Option::Some;
36371                let mut fields = std::collections::HashSet::new();
36372                let mut result = Self::Value::new();
36373                while let Some(tag) = map.next_key::<__FieldTag>()? {
36374                    #[allow(clippy::match_single_binding)]
36375                    match tag {
36376                        __FieldTag::__threads_per_core => {
36377                            if !fields.insert(__FieldTag::__threads_per_core) {
36378                                return std::result::Result::Err(A::Error::duplicate_field(
36379                                    "multiple values for threads_per_core",
36380                                ));
36381                            }
36382                            struct __With(std::option::Option<i32>);
36383                            impl<'de> serde::de::Deserialize<'de> for __With {
36384                                fn deserialize<D>(
36385                                    deserializer: D,
36386                                ) -> std::result::Result<Self, D::Error>
36387                                where
36388                                    D: serde::de::Deserializer<'de>,
36389                                {
36390                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
36391                                }
36392                            }
36393                            result.threads_per_core =
36394                                map.next_value::<__With>()?.0.unwrap_or_default();
36395                        }
36396                        __FieldTag::Unknown(key) => {
36397                            let value = map.next_value::<serde_json::Value>()?;
36398                            result._unknown_fields.insert(key, value);
36399                        }
36400                    }
36401                }
36402                std::result::Result::Ok(result)
36403            }
36404        }
36405        deserializer.deserialize_any(Visitor)
36406    }
36407}
36408
36409#[doc(hidden)]
36410impl serde::ser::Serialize for AdvancedMachineFeatures {
36411    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
36412    where
36413        S: serde::ser::Serializer,
36414    {
36415        use serde::ser::SerializeMap;
36416        #[allow(unused_imports)]
36417        use std::option::Option::Some;
36418        let mut state = serializer.serialize_map(std::option::Option::None)?;
36419        if !wkt::internal::is_default(&self.threads_per_core) {
36420            struct __With<'a>(&'a i32);
36421            impl<'a> serde::ser::Serialize for __With<'a> {
36422                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
36423                where
36424                    S: serde::ser::Serializer,
36425                {
36426                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
36427                }
36428            }
36429            state.serialize_entry("threadsPerCore", &__With(&self.threads_per_core))?;
36430        }
36431        if !self._unknown_fields.is_empty() {
36432            for (key, value) in self._unknown_fields.iter() {
36433                state.serialize_entry(key, &value)?;
36434            }
36435        }
36436        state.end()
36437    }
36438}
36439
36440/// SslCerts Resource
36441#[derive(Clone, Debug, Default, PartialEq)]
36442#[non_exhaustive]
36443pub struct SslCert {
36444    /// This is always `sql#sslCert`.
36445    pub kind: std::string::String,
36446
36447    /// Serial number, as extracted from the certificate.
36448    pub cert_serial_number: std::string::String,
36449
36450    /// PEM representation.
36451    pub cert: std::string::String,
36452
36453    /// The time when the certificate was created in [RFC
36454    /// 3339](https://tools.ietf.org/html/rfc3339) format, for example
36455    /// `2012-11-15T16:19:00.094Z`
36456    pub create_time: std::option::Option<wkt::Timestamp>,
36457
36458    /// User supplied name.  Constrained to [a-zA-Z.-_ ]+.
36459    pub common_name: std::string::String,
36460
36461    /// The time when the certificate expires in [RFC
36462    /// 3339](https://tools.ietf.org/html/rfc3339) format, for example
36463    /// `2012-11-15T16:19:00.094Z`.
36464    pub expiration_time: std::option::Option<wkt::Timestamp>,
36465
36466    /// Sha1 Fingerprint.
36467    pub sha1_fingerprint: std::string::String,
36468
36469    /// Name of the database instance.
36470    pub instance: std::string::String,
36471
36472    /// The URI of this resource.
36473    pub self_link: std::string::String,
36474
36475    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
36476}
36477
36478impl SslCert {
36479    pub fn new() -> Self {
36480        std::default::Default::default()
36481    }
36482
36483    /// Sets the value of [kind][crate::model::SslCert::kind].
36484    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
36485        self.kind = v.into();
36486        self
36487    }
36488
36489    /// Sets the value of [cert_serial_number][crate::model::SslCert::cert_serial_number].
36490    pub fn set_cert_serial_number<T: std::convert::Into<std::string::String>>(
36491        mut self,
36492        v: T,
36493    ) -> Self {
36494        self.cert_serial_number = v.into();
36495        self
36496    }
36497
36498    /// Sets the value of [cert][crate::model::SslCert::cert].
36499    pub fn set_cert<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
36500        self.cert = v.into();
36501        self
36502    }
36503
36504    /// Sets the value of [create_time][crate::model::SslCert::create_time].
36505    pub fn set_create_time<T>(mut self, v: T) -> Self
36506    where
36507        T: std::convert::Into<wkt::Timestamp>,
36508    {
36509        self.create_time = std::option::Option::Some(v.into());
36510        self
36511    }
36512
36513    /// Sets or clears the value of [create_time][crate::model::SslCert::create_time].
36514    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
36515    where
36516        T: std::convert::Into<wkt::Timestamp>,
36517    {
36518        self.create_time = v.map(|x| x.into());
36519        self
36520    }
36521
36522    /// Sets the value of [common_name][crate::model::SslCert::common_name].
36523    pub fn set_common_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
36524        self.common_name = v.into();
36525        self
36526    }
36527
36528    /// Sets the value of [expiration_time][crate::model::SslCert::expiration_time].
36529    pub fn set_expiration_time<T>(mut self, v: T) -> Self
36530    where
36531        T: std::convert::Into<wkt::Timestamp>,
36532    {
36533        self.expiration_time = std::option::Option::Some(v.into());
36534        self
36535    }
36536
36537    /// Sets or clears the value of [expiration_time][crate::model::SslCert::expiration_time].
36538    pub fn set_or_clear_expiration_time<T>(mut self, v: std::option::Option<T>) -> Self
36539    where
36540        T: std::convert::Into<wkt::Timestamp>,
36541    {
36542        self.expiration_time = v.map(|x| x.into());
36543        self
36544    }
36545
36546    /// Sets the value of [sha1_fingerprint][crate::model::SslCert::sha1_fingerprint].
36547    pub fn set_sha1_fingerprint<T: std::convert::Into<std::string::String>>(
36548        mut self,
36549        v: T,
36550    ) -> Self {
36551        self.sha1_fingerprint = v.into();
36552        self
36553    }
36554
36555    /// Sets the value of [instance][crate::model::SslCert::instance].
36556    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
36557        self.instance = v.into();
36558        self
36559    }
36560
36561    /// Sets the value of [self_link][crate::model::SslCert::self_link].
36562    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
36563        self.self_link = v.into();
36564        self
36565    }
36566}
36567
36568impl wkt::message::Message for SslCert {
36569    fn typename() -> &'static str {
36570        "type.googleapis.com/google.cloud.sql.v1.SslCert"
36571    }
36572}
36573
36574#[doc(hidden)]
36575impl<'de> serde::de::Deserialize<'de> for SslCert {
36576    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
36577    where
36578        D: serde::Deserializer<'de>,
36579    {
36580        #[allow(non_camel_case_types)]
36581        #[doc(hidden)]
36582        #[derive(PartialEq, Eq, Hash)]
36583        enum __FieldTag {
36584            __kind,
36585            __cert_serial_number,
36586            __cert,
36587            __create_time,
36588            __common_name,
36589            __expiration_time,
36590            __sha1_fingerprint,
36591            __instance,
36592            __self_link,
36593            Unknown(std::string::String),
36594        }
36595        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
36596            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
36597            where
36598                D: serde::Deserializer<'de>,
36599            {
36600                struct Visitor;
36601                impl<'de> serde::de::Visitor<'de> for Visitor {
36602                    type Value = __FieldTag;
36603                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
36604                        formatter.write_str("a field name for SslCert")
36605                    }
36606                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
36607                    where
36608                        E: serde::de::Error,
36609                    {
36610                        use std::result::Result::Ok;
36611                        use std::string::ToString;
36612                        match value {
36613                            "kind" => Ok(__FieldTag::__kind),
36614                            "certSerialNumber" => Ok(__FieldTag::__cert_serial_number),
36615                            "cert_serial_number" => Ok(__FieldTag::__cert_serial_number),
36616                            "cert" => Ok(__FieldTag::__cert),
36617                            "createTime" => Ok(__FieldTag::__create_time),
36618                            "create_time" => Ok(__FieldTag::__create_time),
36619                            "commonName" => Ok(__FieldTag::__common_name),
36620                            "common_name" => Ok(__FieldTag::__common_name),
36621                            "expirationTime" => Ok(__FieldTag::__expiration_time),
36622                            "expiration_time" => Ok(__FieldTag::__expiration_time),
36623                            "sha1Fingerprint" => Ok(__FieldTag::__sha1_fingerprint),
36624                            "sha1_fingerprint" => Ok(__FieldTag::__sha1_fingerprint),
36625                            "instance" => Ok(__FieldTag::__instance),
36626                            "selfLink" => Ok(__FieldTag::__self_link),
36627                            "self_link" => Ok(__FieldTag::__self_link),
36628                            _ => Ok(__FieldTag::Unknown(value.to_string())),
36629                        }
36630                    }
36631                }
36632                deserializer.deserialize_identifier(Visitor)
36633            }
36634        }
36635        struct Visitor;
36636        impl<'de> serde::de::Visitor<'de> for Visitor {
36637            type Value = SslCert;
36638            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
36639                formatter.write_str("struct SslCert")
36640            }
36641            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
36642            where
36643                A: serde::de::MapAccess<'de>,
36644            {
36645                #[allow(unused_imports)]
36646                use serde::de::Error;
36647                use std::option::Option::Some;
36648                let mut fields = std::collections::HashSet::new();
36649                let mut result = Self::Value::new();
36650                while let Some(tag) = map.next_key::<__FieldTag>()? {
36651                    #[allow(clippy::match_single_binding)]
36652                    match tag {
36653                        __FieldTag::__kind => {
36654                            if !fields.insert(__FieldTag::__kind) {
36655                                return std::result::Result::Err(A::Error::duplicate_field(
36656                                    "multiple values for kind",
36657                                ));
36658                            }
36659                            result.kind = map
36660                                .next_value::<std::option::Option<std::string::String>>()?
36661                                .unwrap_or_default();
36662                        }
36663                        __FieldTag::__cert_serial_number => {
36664                            if !fields.insert(__FieldTag::__cert_serial_number) {
36665                                return std::result::Result::Err(A::Error::duplicate_field(
36666                                    "multiple values for cert_serial_number",
36667                                ));
36668                            }
36669                            result.cert_serial_number = map
36670                                .next_value::<std::option::Option<std::string::String>>()?
36671                                .unwrap_or_default();
36672                        }
36673                        __FieldTag::__cert => {
36674                            if !fields.insert(__FieldTag::__cert) {
36675                                return std::result::Result::Err(A::Error::duplicate_field(
36676                                    "multiple values for cert",
36677                                ));
36678                            }
36679                            result.cert = map
36680                                .next_value::<std::option::Option<std::string::String>>()?
36681                                .unwrap_or_default();
36682                        }
36683                        __FieldTag::__create_time => {
36684                            if !fields.insert(__FieldTag::__create_time) {
36685                                return std::result::Result::Err(A::Error::duplicate_field(
36686                                    "multiple values for create_time",
36687                                ));
36688                            }
36689                            result.create_time =
36690                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
36691                        }
36692                        __FieldTag::__common_name => {
36693                            if !fields.insert(__FieldTag::__common_name) {
36694                                return std::result::Result::Err(A::Error::duplicate_field(
36695                                    "multiple values for common_name",
36696                                ));
36697                            }
36698                            result.common_name = map
36699                                .next_value::<std::option::Option<std::string::String>>()?
36700                                .unwrap_or_default();
36701                        }
36702                        __FieldTag::__expiration_time => {
36703                            if !fields.insert(__FieldTag::__expiration_time) {
36704                                return std::result::Result::Err(A::Error::duplicate_field(
36705                                    "multiple values for expiration_time",
36706                                ));
36707                            }
36708                            result.expiration_time =
36709                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
36710                        }
36711                        __FieldTag::__sha1_fingerprint => {
36712                            if !fields.insert(__FieldTag::__sha1_fingerprint) {
36713                                return std::result::Result::Err(A::Error::duplicate_field(
36714                                    "multiple values for sha1_fingerprint",
36715                                ));
36716                            }
36717                            result.sha1_fingerprint = map
36718                                .next_value::<std::option::Option<std::string::String>>()?
36719                                .unwrap_or_default();
36720                        }
36721                        __FieldTag::__instance => {
36722                            if !fields.insert(__FieldTag::__instance) {
36723                                return std::result::Result::Err(A::Error::duplicate_field(
36724                                    "multiple values for instance",
36725                                ));
36726                            }
36727                            result.instance = map
36728                                .next_value::<std::option::Option<std::string::String>>()?
36729                                .unwrap_or_default();
36730                        }
36731                        __FieldTag::__self_link => {
36732                            if !fields.insert(__FieldTag::__self_link) {
36733                                return std::result::Result::Err(A::Error::duplicate_field(
36734                                    "multiple values for self_link",
36735                                ));
36736                            }
36737                            result.self_link = map
36738                                .next_value::<std::option::Option<std::string::String>>()?
36739                                .unwrap_or_default();
36740                        }
36741                        __FieldTag::Unknown(key) => {
36742                            let value = map.next_value::<serde_json::Value>()?;
36743                            result._unknown_fields.insert(key, value);
36744                        }
36745                    }
36746                }
36747                std::result::Result::Ok(result)
36748            }
36749        }
36750        deserializer.deserialize_any(Visitor)
36751    }
36752}
36753
36754#[doc(hidden)]
36755impl serde::ser::Serialize for SslCert {
36756    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
36757    where
36758        S: serde::ser::Serializer,
36759    {
36760        use serde::ser::SerializeMap;
36761        #[allow(unused_imports)]
36762        use std::option::Option::Some;
36763        let mut state = serializer.serialize_map(std::option::Option::None)?;
36764        if !self.kind.is_empty() {
36765            state.serialize_entry("kind", &self.kind)?;
36766        }
36767        if !self.cert_serial_number.is_empty() {
36768            state.serialize_entry("certSerialNumber", &self.cert_serial_number)?;
36769        }
36770        if !self.cert.is_empty() {
36771            state.serialize_entry("cert", &self.cert)?;
36772        }
36773        if self.create_time.is_some() {
36774            state.serialize_entry("createTime", &self.create_time)?;
36775        }
36776        if !self.common_name.is_empty() {
36777            state.serialize_entry("commonName", &self.common_name)?;
36778        }
36779        if self.expiration_time.is_some() {
36780            state.serialize_entry("expirationTime", &self.expiration_time)?;
36781        }
36782        if !self.sha1_fingerprint.is_empty() {
36783            state.serialize_entry("sha1Fingerprint", &self.sha1_fingerprint)?;
36784        }
36785        if !self.instance.is_empty() {
36786            state.serialize_entry("instance", &self.instance)?;
36787        }
36788        if !self.self_link.is_empty() {
36789            state.serialize_entry("selfLink", &self.self_link)?;
36790        }
36791        if !self._unknown_fields.is_empty() {
36792            for (key, value) in self._unknown_fields.iter() {
36793                state.serialize_entry(key, &value)?;
36794            }
36795        }
36796        state.end()
36797    }
36798}
36799
36800/// SslCertDetail.
36801#[derive(Clone, Debug, Default, PartialEq)]
36802#[non_exhaustive]
36803pub struct SslCertDetail {
36804    /// The public information about the cert.
36805    pub cert_info: std::option::Option<crate::model::SslCert>,
36806
36807    /// The private key for the client cert, in pem format.  Keep private in order
36808    /// to protect your security.
36809    pub cert_private_key: std::string::String,
36810
36811    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
36812}
36813
36814impl SslCertDetail {
36815    pub fn new() -> Self {
36816        std::default::Default::default()
36817    }
36818
36819    /// Sets the value of [cert_info][crate::model::SslCertDetail::cert_info].
36820    pub fn set_cert_info<T>(mut self, v: T) -> Self
36821    where
36822        T: std::convert::Into<crate::model::SslCert>,
36823    {
36824        self.cert_info = std::option::Option::Some(v.into());
36825        self
36826    }
36827
36828    /// Sets or clears the value of [cert_info][crate::model::SslCertDetail::cert_info].
36829    pub fn set_or_clear_cert_info<T>(mut self, v: std::option::Option<T>) -> Self
36830    where
36831        T: std::convert::Into<crate::model::SslCert>,
36832    {
36833        self.cert_info = v.map(|x| x.into());
36834        self
36835    }
36836
36837    /// Sets the value of [cert_private_key][crate::model::SslCertDetail::cert_private_key].
36838    pub fn set_cert_private_key<T: std::convert::Into<std::string::String>>(
36839        mut self,
36840        v: T,
36841    ) -> Self {
36842        self.cert_private_key = v.into();
36843        self
36844    }
36845}
36846
36847impl wkt::message::Message for SslCertDetail {
36848    fn typename() -> &'static str {
36849        "type.googleapis.com/google.cloud.sql.v1.SslCertDetail"
36850    }
36851}
36852
36853#[doc(hidden)]
36854impl<'de> serde::de::Deserialize<'de> for SslCertDetail {
36855    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
36856    where
36857        D: serde::Deserializer<'de>,
36858    {
36859        #[allow(non_camel_case_types)]
36860        #[doc(hidden)]
36861        #[derive(PartialEq, Eq, Hash)]
36862        enum __FieldTag {
36863            __cert_info,
36864            __cert_private_key,
36865            Unknown(std::string::String),
36866        }
36867        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
36868            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
36869            where
36870                D: serde::Deserializer<'de>,
36871            {
36872                struct Visitor;
36873                impl<'de> serde::de::Visitor<'de> for Visitor {
36874                    type Value = __FieldTag;
36875                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
36876                        formatter.write_str("a field name for SslCertDetail")
36877                    }
36878                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
36879                    where
36880                        E: serde::de::Error,
36881                    {
36882                        use std::result::Result::Ok;
36883                        use std::string::ToString;
36884                        match value {
36885                            "certInfo" => Ok(__FieldTag::__cert_info),
36886                            "cert_info" => Ok(__FieldTag::__cert_info),
36887                            "certPrivateKey" => Ok(__FieldTag::__cert_private_key),
36888                            "cert_private_key" => Ok(__FieldTag::__cert_private_key),
36889                            _ => Ok(__FieldTag::Unknown(value.to_string())),
36890                        }
36891                    }
36892                }
36893                deserializer.deserialize_identifier(Visitor)
36894            }
36895        }
36896        struct Visitor;
36897        impl<'de> serde::de::Visitor<'de> for Visitor {
36898            type Value = SslCertDetail;
36899            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
36900                formatter.write_str("struct SslCertDetail")
36901            }
36902            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
36903            where
36904                A: serde::de::MapAccess<'de>,
36905            {
36906                #[allow(unused_imports)]
36907                use serde::de::Error;
36908                use std::option::Option::Some;
36909                let mut fields = std::collections::HashSet::new();
36910                let mut result = Self::Value::new();
36911                while let Some(tag) = map.next_key::<__FieldTag>()? {
36912                    #[allow(clippy::match_single_binding)]
36913                    match tag {
36914                        __FieldTag::__cert_info => {
36915                            if !fields.insert(__FieldTag::__cert_info) {
36916                                return std::result::Result::Err(A::Error::duplicate_field(
36917                                    "multiple values for cert_info",
36918                                ));
36919                            }
36920                            result.cert_info =
36921                                map.next_value::<std::option::Option<crate::model::SslCert>>()?;
36922                        }
36923                        __FieldTag::__cert_private_key => {
36924                            if !fields.insert(__FieldTag::__cert_private_key) {
36925                                return std::result::Result::Err(A::Error::duplicate_field(
36926                                    "multiple values for cert_private_key",
36927                                ));
36928                            }
36929                            result.cert_private_key = map
36930                                .next_value::<std::option::Option<std::string::String>>()?
36931                                .unwrap_or_default();
36932                        }
36933                        __FieldTag::Unknown(key) => {
36934                            let value = map.next_value::<serde_json::Value>()?;
36935                            result._unknown_fields.insert(key, value);
36936                        }
36937                    }
36938                }
36939                std::result::Result::Ok(result)
36940            }
36941        }
36942        deserializer.deserialize_any(Visitor)
36943    }
36944}
36945
36946#[doc(hidden)]
36947impl serde::ser::Serialize for SslCertDetail {
36948    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
36949    where
36950        S: serde::ser::Serializer,
36951    {
36952        use serde::ser::SerializeMap;
36953        #[allow(unused_imports)]
36954        use std::option::Option::Some;
36955        let mut state = serializer.serialize_map(std::option::Option::None)?;
36956        if self.cert_info.is_some() {
36957            state.serialize_entry("certInfo", &self.cert_info)?;
36958        }
36959        if !self.cert_private_key.is_empty() {
36960            state.serialize_entry("certPrivateKey", &self.cert_private_key)?;
36961        }
36962        if !self._unknown_fields.is_empty() {
36963            for (key, value) in self._unknown_fields.iter() {
36964                state.serialize_entry(key, &value)?;
36965            }
36966        }
36967        state.end()
36968    }
36969}
36970
36971/// Active Directory configuration, relevant only for Cloud SQL for SQL Server.
36972#[derive(Clone, Debug, Default, PartialEq)]
36973#[non_exhaustive]
36974pub struct SqlActiveDirectoryConfig {
36975    /// This is always sql#activeDirectoryConfig.
36976    pub kind: std::string::String,
36977
36978    /// The name of the domain (e.g., mydomain.com).
36979    pub domain: std::string::String,
36980
36981    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
36982}
36983
36984impl SqlActiveDirectoryConfig {
36985    pub fn new() -> Self {
36986        std::default::Default::default()
36987    }
36988
36989    /// Sets the value of [kind][crate::model::SqlActiveDirectoryConfig::kind].
36990    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
36991        self.kind = v.into();
36992        self
36993    }
36994
36995    /// Sets the value of [domain][crate::model::SqlActiveDirectoryConfig::domain].
36996    pub fn set_domain<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
36997        self.domain = v.into();
36998        self
36999    }
37000}
37001
37002impl wkt::message::Message for SqlActiveDirectoryConfig {
37003    fn typename() -> &'static str {
37004        "type.googleapis.com/google.cloud.sql.v1.SqlActiveDirectoryConfig"
37005    }
37006}
37007
37008#[doc(hidden)]
37009impl<'de> serde::de::Deserialize<'de> for SqlActiveDirectoryConfig {
37010    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
37011    where
37012        D: serde::Deserializer<'de>,
37013    {
37014        #[allow(non_camel_case_types)]
37015        #[doc(hidden)]
37016        #[derive(PartialEq, Eq, Hash)]
37017        enum __FieldTag {
37018            __kind,
37019            __domain,
37020            Unknown(std::string::String),
37021        }
37022        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
37023            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
37024            where
37025                D: serde::Deserializer<'de>,
37026            {
37027                struct Visitor;
37028                impl<'de> serde::de::Visitor<'de> for Visitor {
37029                    type Value = __FieldTag;
37030                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
37031                        formatter.write_str("a field name for SqlActiveDirectoryConfig")
37032                    }
37033                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
37034                    where
37035                        E: serde::de::Error,
37036                    {
37037                        use std::result::Result::Ok;
37038                        use std::string::ToString;
37039                        match value {
37040                            "kind" => Ok(__FieldTag::__kind),
37041                            "domain" => Ok(__FieldTag::__domain),
37042                            _ => Ok(__FieldTag::Unknown(value.to_string())),
37043                        }
37044                    }
37045                }
37046                deserializer.deserialize_identifier(Visitor)
37047            }
37048        }
37049        struct Visitor;
37050        impl<'de> serde::de::Visitor<'de> for Visitor {
37051            type Value = SqlActiveDirectoryConfig;
37052            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
37053                formatter.write_str("struct SqlActiveDirectoryConfig")
37054            }
37055            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
37056            where
37057                A: serde::de::MapAccess<'de>,
37058            {
37059                #[allow(unused_imports)]
37060                use serde::de::Error;
37061                use std::option::Option::Some;
37062                let mut fields = std::collections::HashSet::new();
37063                let mut result = Self::Value::new();
37064                while let Some(tag) = map.next_key::<__FieldTag>()? {
37065                    #[allow(clippy::match_single_binding)]
37066                    match tag {
37067                        __FieldTag::__kind => {
37068                            if !fields.insert(__FieldTag::__kind) {
37069                                return std::result::Result::Err(A::Error::duplicate_field(
37070                                    "multiple values for kind",
37071                                ));
37072                            }
37073                            result.kind = map
37074                                .next_value::<std::option::Option<std::string::String>>()?
37075                                .unwrap_or_default();
37076                        }
37077                        __FieldTag::__domain => {
37078                            if !fields.insert(__FieldTag::__domain) {
37079                                return std::result::Result::Err(A::Error::duplicate_field(
37080                                    "multiple values for domain",
37081                                ));
37082                            }
37083                            result.domain = map
37084                                .next_value::<std::option::Option<std::string::String>>()?
37085                                .unwrap_or_default();
37086                        }
37087                        __FieldTag::Unknown(key) => {
37088                            let value = map.next_value::<serde_json::Value>()?;
37089                            result._unknown_fields.insert(key, value);
37090                        }
37091                    }
37092                }
37093                std::result::Result::Ok(result)
37094            }
37095        }
37096        deserializer.deserialize_any(Visitor)
37097    }
37098}
37099
37100#[doc(hidden)]
37101impl serde::ser::Serialize for SqlActiveDirectoryConfig {
37102    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
37103    where
37104        S: serde::ser::Serializer,
37105    {
37106        use serde::ser::SerializeMap;
37107        #[allow(unused_imports)]
37108        use std::option::Option::Some;
37109        let mut state = serializer.serialize_map(std::option::Option::None)?;
37110        if !self.kind.is_empty() {
37111            state.serialize_entry("kind", &self.kind)?;
37112        }
37113        if !self.domain.is_empty() {
37114            state.serialize_entry("domain", &self.domain)?;
37115        }
37116        if !self._unknown_fields.is_empty() {
37117            for (key, value) in self._unknown_fields.iter() {
37118                state.serialize_entry(key, &value)?;
37119            }
37120        }
37121        state.end()
37122    }
37123}
37124
37125/// SQL Server specific audit configuration.
37126#[derive(Clone, Debug, Default, PartialEq)]
37127#[non_exhaustive]
37128pub struct SqlServerAuditConfig {
37129    /// This is always sql#sqlServerAuditConfig
37130    pub kind: std::string::String,
37131
37132    /// The name of the destination bucket (e.g., gs://mybucket).
37133    pub bucket: std::string::String,
37134
37135    /// How long to keep generated audit files.
37136    pub retention_interval: std::option::Option<wkt::Duration>,
37137
37138    /// How often to upload generated audit files.
37139    pub upload_interval: std::option::Option<wkt::Duration>,
37140
37141    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
37142}
37143
37144impl SqlServerAuditConfig {
37145    pub fn new() -> Self {
37146        std::default::Default::default()
37147    }
37148
37149    /// Sets the value of [kind][crate::model::SqlServerAuditConfig::kind].
37150    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
37151        self.kind = v.into();
37152        self
37153    }
37154
37155    /// Sets the value of [bucket][crate::model::SqlServerAuditConfig::bucket].
37156    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
37157        self.bucket = v.into();
37158        self
37159    }
37160
37161    /// Sets the value of [retention_interval][crate::model::SqlServerAuditConfig::retention_interval].
37162    pub fn set_retention_interval<T>(mut self, v: T) -> Self
37163    where
37164        T: std::convert::Into<wkt::Duration>,
37165    {
37166        self.retention_interval = std::option::Option::Some(v.into());
37167        self
37168    }
37169
37170    /// Sets or clears the value of [retention_interval][crate::model::SqlServerAuditConfig::retention_interval].
37171    pub fn set_or_clear_retention_interval<T>(mut self, v: std::option::Option<T>) -> Self
37172    where
37173        T: std::convert::Into<wkt::Duration>,
37174    {
37175        self.retention_interval = v.map(|x| x.into());
37176        self
37177    }
37178
37179    /// Sets the value of [upload_interval][crate::model::SqlServerAuditConfig::upload_interval].
37180    pub fn set_upload_interval<T>(mut self, v: T) -> Self
37181    where
37182        T: std::convert::Into<wkt::Duration>,
37183    {
37184        self.upload_interval = std::option::Option::Some(v.into());
37185        self
37186    }
37187
37188    /// Sets or clears the value of [upload_interval][crate::model::SqlServerAuditConfig::upload_interval].
37189    pub fn set_or_clear_upload_interval<T>(mut self, v: std::option::Option<T>) -> Self
37190    where
37191        T: std::convert::Into<wkt::Duration>,
37192    {
37193        self.upload_interval = v.map(|x| x.into());
37194        self
37195    }
37196}
37197
37198impl wkt::message::Message for SqlServerAuditConfig {
37199    fn typename() -> &'static str {
37200        "type.googleapis.com/google.cloud.sql.v1.SqlServerAuditConfig"
37201    }
37202}
37203
37204#[doc(hidden)]
37205impl<'de> serde::de::Deserialize<'de> for SqlServerAuditConfig {
37206    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
37207    where
37208        D: serde::Deserializer<'de>,
37209    {
37210        #[allow(non_camel_case_types)]
37211        #[doc(hidden)]
37212        #[derive(PartialEq, Eq, Hash)]
37213        enum __FieldTag {
37214            __kind,
37215            __bucket,
37216            __retention_interval,
37217            __upload_interval,
37218            Unknown(std::string::String),
37219        }
37220        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
37221            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
37222            where
37223                D: serde::Deserializer<'de>,
37224            {
37225                struct Visitor;
37226                impl<'de> serde::de::Visitor<'de> for Visitor {
37227                    type Value = __FieldTag;
37228                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
37229                        formatter.write_str("a field name for SqlServerAuditConfig")
37230                    }
37231                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
37232                    where
37233                        E: serde::de::Error,
37234                    {
37235                        use std::result::Result::Ok;
37236                        use std::string::ToString;
37237                        match value {
37238                            "kind" => Ok(__FieldTag::__kind),
37239                            "bucket" => Ok(__FieldTag::__bucket),
37240                            "retentionInterval" => Ok(__FieldTag::__retention_interval),
37241                            "retention_interval" => Ok(__FieldTag::__retention_interval),
37242                            "uploadInterval" => Ok(__FieldTag::__upload_interval),
37243                            "upload_interval" => Ok(__FieldTag::__upload_interval),
37244                            _ => Ok(__FieldTag::Unknown(value.to_string())),
37245                        }
37246                    }
37247                }
37248                deserializer.deserialize_identifier(Visitor)
37249            }
37250        }
37251        struct Visitor;
37252        impl<'de> serde::de::Visitor<'de> for Visitor {
37253            type Value = SqlServerAuditConfig;
37254            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
37255                formatter.write_str("struct SqlServerAuditConfig")
37256            }
37257            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
37258            where
37259                A: serde::de::MapAccess<'de>,
37260            {
37261                #[allow(unused_imports)]
37262                use serde::de::Error;
37263                use std::option::Option::Some;
37264                let mut fields = std::collections::HashSet::new();
37265                let mut result = Self::Value::new();
37266                while let Some(tag) = map.next_key::<__FieldTag>()? {
37267                    #[allow(clippy::match_single_binding)]
37268                    match tag {
37269                        __FieldTag::__kind => {
37270                            if !fields.insert(__FieldTag::__kind) {
37271                                return std::result::Result::Err(A::Error::duplicate_field(
37272                                    "multiple values for kind",
37273                                ));
37274                            }
37275                            result.kind = map
37276                                .next_value::<std::option::Option<std::string::String>>()?
37277                                .unwrap_or_default();
37278                        }
37279                        __FieldTag::__bucket => {
37280                            if !fields.insert(__FieldTag::__bucket) {
37281                                return std::result::Result::Err(A::Error::duplicate_field(
37282                                    "multiple values for bucket",
37283                                ));
37284                            }
37285                            result.bucket = map
37286                                .next_value::<std::option::Option<std::string::String>>()?
37287                                .unwrap_or_default();
37288                        }
37289                        __FieldTag::__retention_interval => {
37290                            if !fields.insert(__FieldTag::__retention_interval) {
37291                                return std::result::Result::Err(A::Error::duplicate_field(
37292                                    "multiple values for retention_interval",
37293                                ));
37294                            }
37295                            result.retention_interval =
37296                                map.next_value::<std::option::Option<wkt::Duration>>()?;
37297                        }
37298                        __FieldTag::__upload_interval => {
37299                            if !fields.insert(__FieldTag::__upload_interval) {
37300                                return std::result::Result::Err(A::Error::duplicate_field(
37301                                    "multiple values for upload_interval",
37302                                ));
37303                            }
37304                            result.upload_interval =
37305                                map.next_value::<std::option::Option<wkt::Duration>>()?;
37306                        }
37307                        __FieldTag::Unknown(key) => {
37308                            let value = map.next_value::<serde_json::Value>()?;
37309                            result._unknown_fields.insert(key, value);
37310                        }
37311                    }
37312                }
37313                std::result::Result::Ok(result)
37314            }
37315        }
37316        deserializer.deserialize_any(Visitor)
37317    }
37318}
37319
37320#[doc(hidden)]
37321impl serde::ser::Serialize for SqlServerAuditConfig {
37322    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
37323    where
37324        S: serde::ser::Serializer,
37325    {
37326        use serde::ser::SerializeMap;
37327        #[allow(unused_imports)]
37328        use std::option::Option::Some;
37329        let mut state = serializer.serialize_map(std::option::Option::None)?;
37330        if !self.kind.is_empty() {
37331            state.serialize_entry("kind", &self.kind)?;
37332        }
37333        if !self.bucket.is_empty() {
37334            state.serialize_entry("bucket", &self.bucket)?;
37335        }
37336        if self.retention_interval.is_some() {
37337            state.serialize_entry("retentionInterval", &self.retention_interval)?;
37338        }
37339        if self.upload_interval.is_some() {
37340            state.serialize_entry("uploadInterval", &self.upload_interval)?;
37341        }
37342        if !self._unknown_fields.is_empty() {
37343            for (key, value) in self._unknown_fields.iter() {
37344                state.serialize_entry(key, &value)?;
37345            }
37346        }
37347        state.end()
37348    }
37349}
37350
37351/// Acquire SSRS lease context.
37352#[derive(Clone, Debug, Default, PartialEq)]
37353#[non_exhaustive]
37354pub struct AcquireSsrsLeaseContext {
37355    /// The username to be used as the setup login to connect to the database
37356    /// server for SSRS setup.
37357    pub setup_login: std::option::Option<std::string::String>,
37358
37359    /// The username to be used as the service login to connect to the report
37360    /// database for SSRS setup.
37361    pub service_login: std::option::Option<std::string::String>,
37362
37363    /// The report database to be used for SSRS setup.
37364    pub report_database: std::option::Option<std::string::String>,
37365
37366    /// Lease duration needed for SSRS setup.
37367    pub duration: std::option::Option<wkt::Duration>,
37368
37369    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
37370}
37371
37372impl AcquireSsrsLeaseContext {
37373    pub fn new() -> Self {
37374        std::default::Default::default()
37375    }
37376
37377    /// Sets the value of [setup_login][crate::model::AcquireSsrsLeaseContext::setup_login].
37378    pub fn set_setup_login<T>(mut self, v: T) -> Self
37379    where
37380        T: std::convert::Into<std::string::String>,
37381    {
37382        self.setup_login = std::option::Option::Some(v.into());
37383        self
37384    }
37385
37386    /// Sets or clears the value of [setup_login][crate::model::AcquireSsrsLeaseContext::setup_login].
37387    pub fn set_or_clear_setup_login<T>(mut self, v: std::option::Option<T>) -> Self
37388    where
37389        T: std::convert::Into<std::string::String>,
37390    {
37391        self.setup_login = v.map(|x| x.into());
37392        self
37393    }
37394
37395    /// Sets the value of [service_login][crate::model::AcquireSsrsLeaseContext::service_login].
37396    pub fn set_service_login<T>(mut self, v: T) -> Self
37397    where
37398        T: std::convert::Into<std::string::String>,
37399    {
37400        self.service_login = std::option::Option::Some(v.into());
37401        self
37402    }
37403
37404    /// Sets or clears the value of [service_login][crate::model::AcquireSsrsLeaseContext::service_login].
37405    pub fn set_or_clear_service_login<T>(mut self, v: std::option::Option<T>) -> Self
37406    where
37407        T: std::convert::Into<std::string::String>,
37408    {
37409        self.service_login = v.map(|x| x.into());
37410        self
37411    }
37412
37413    /// Sets the value of [report_database][crate::model::AcquireSsrsLeaseContext::report_database].
37414    pub fn set_report_database<T>(mut self, v: T) -> Self
37415    where
37416        T: std::convert::Into<std::string::String>,
37417    {
37418        self.report_database = std::option::Option::Some(v.into());
37419        self
37420    }
37421
37422    /// Sets or clears the value of [report_database][crate::model::AcquireSsrsLeaseContext::report_database].
37423    pub fn set_or_clear_report_database<T>(mut self, v: std::option::Option<T>) -> Self
37424    where
37425        T: std::convert::Into<std::string::String>,
37426    {
37427        self.report_database = v.map(|x| x.into());
37428        self
37429    }
37430
37431    /// Sets the value of [duration][crate::model::AcquireSsrsLeaseContext::duration].
37432    pub fn set_duration<T>(mut self, v: T) -> Self
37433    where
37434        T: std::convert::Into<wkt::Duration>,
37435    {
37436        self.duration = std::option::Option::Some(v.into());
37437        self
37438    }
37439
37440    /// Sets or clears the value of [duration][crate::model::AcquireSsrsLeaseContext::duration].
37441    pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
37442    where
37443        T: std::convert::Into<wkt::Duration>,
37444    {
37445        self.duration = v.map(|x| x.into());
37446        self
37447    }
37448}
37449
37450impl wkt::message::Message for AcquireSsrsLeaseContext {
37451    fn typename() -> &'static str {
37452        "type.googleapis.com/google.cloud.sql.v1.AcquireSsrsLeaseContext"
37453    }
37454}
37455
37456#[doc(hidden)]
37457impl<'de> serde::de::Deserialize<'de> for AcquireSsrsLeaseContext {
37458    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
37459    where
37460        D: serde::Deserializer<'de>,
37461    {
37462        #[allow(non_camel_case_types)]
37463        #[doc(hidden)]
37464        #[derive(PartialEq, Eq, Hash)]
37465        enum __FieldTag {
37466            __setup_login,
37467            __service_login,
37468            __report_database,
37469            __duration,
37470            Unknown(std::string::String),
37471        }
37472        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
37473            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
37474            where
37475                D: serde::Deserializer<'de>,
37476            {
37477                struct Visitor;
37478                impl<'de> serde::de::Visitor<'de> for Visitor {
37479                    type Value = __FieldTag;
37480                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
37481                        formatter.write_str("a field name for AcquireSsrsLeaseContext")
37482                    }
37483                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
37484                    where
37485                        E: serde::de::Error,
37486                    {
37487                        use std::result::Result::Ok;
37488                        use std::string::ToString;
37489                        match value {
37490                            "setupLogin" => Ok(__FieldTag::__setup_login),
37491                            "setup_login" => Ok(__FieldTag::__setup_login),
37492                            "serviceLogin" => Ok(__FieldTag::__service_login),
37493                            "service_login" => Ok(__FieldTag::__service_login),
37494                            "reportDatabase" => Ok(__FieldTag::__report_database),
37495                            "report_database" => Ok(__FieldTag::__report_database),
37496                            "duration" => Ok(__FieldTag::__duration),
37497                            _ => Ok(__FieldTag::Unknown(value.to_string())),
37498                        }
37499                    }
37500                }
37501                deserializer.deserialize_identifier(Visitor)
37502            }
37503        }
37504        struct Visitor;
37505        impl<'de> serde::de::Visitor<'de> for Visitor {
37506            type Value = AcquireSsrsLeaseContext;
37507            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
37508                formatter.write_str("struct AcquireSsrsLeaseContext")
37509            }
37510            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
37511            where
37512                A: serde::de::MapAccess<'de>,
37513            {
37514                #[allow(unused_imports)]
37515                use serde::de::Error;
37516                use std::option::Option::Some;
37517                let mut fields = std::collections::HashSet::new();
37518                let mut result = Self::Value::new();
37519                while let Some(tag) = map.next_key::<__FieldTag>()? {
37520                    #[allow(clippy::match_single_binding)]
37521                    match tag {
37522                        __FieldTag::__setup_login => {
37523                            if !fields.insert(__FieldTag::__setup_login) {
37524                                return std::result::Result::Err(A::Error::duplicate_field(
37525                                    "multiple values for setup_login",
37526                                ));
37527                            }
37528                            result.setup_login =
37529                                map.next_value::<std::option::Option<std::string::String>>()?;
37530                        }
37531                        __FieldTag::__service_login => {
37532                            if !fields.insert(__FieldTag::__service_login) {
37533                                return std::result::Result::Err(A::Error::duplicate_field(
37534                                    "multiple values for service_login",
37535                                ));
37536                            }
37537                            result.service_login =
37538                                map.next_value::<std::option::Option<std::string::String>>()?;
37539                        }
37540                        __FieldTag::__report_database => {
37541                            if !fields.insert(__FieldTag::__report_database) {
37542                                return std::result::Result::Err(A::Error::duplicate_field(
37543                                    "multiple values for report_database",
37544                                ));
37545                            }
37546                            result.report_database =
37547                                map.next_value::<std::option::Option<std::string::String>>()?;
37548                        }
37549                        __FieldTag::__duration => {
37550                            if !fields.insert(__FieldTag::__duration) {
37551                                return std::result::Result::Err(A::Error::duplicate_field(
37552                                    "multiple values for duration",
37553                                ));
37554                            }
37555                            result.duration =
37556                                map.next_value::<std::option::Option<wkt::Duration>>()?;
37557                        }
37558                        __FieldTag::Unknown(key) => {
37559                            let value = map.next_value::<serde_json::Value>()?;
37560                            result._unknown_fields.insert(key, value);
37561                        }
37562                    }
37563                }
37564                std::result::Result::Ok(result)
37565            }
37566        }
37567        deserializer.deserialize_any(Visitor)
37568    }
37569}
37570
37571#[doc(hidden)]
37572impl serde::ser::Serialize for AcquireSsrsLeaseContext {
37573    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
37574    where
37575        S: serde::ser::Serializer,
37576    {
37577        use serde::ser::SerializeMap;
37578        #[allow(unused_imports)]
37579        use std::option::Option::Some;
37580        let mut state = serializer.serialize_map(std::option::Option::None)?;
37581        if self.setup_login.is_some() {
37582            state.serialize_entry("setupLogin", &self.setup_login)?;
37583        }
37584        if self.service_login.is_some() {
37585            state.serialize_entry("serviceLogin", &self.service_login)?;
37586        }
37587        if self.report_database.is_some() {
37588            state.serialize_entry("reportDatabase", &self.report_database)?;
37589        }
37590        if self.duration.is_some() {
37591            state.serialize_entry("duration", &self.duration)?;
37592        }
37593        if !self._unknown_fields.is_empty() {
37594            for (key, value) in self._unknown_fields.iter() {
37595                state.serialize_entry(key, &value)?;
37596            }
37597        }
37598        state.end()
37599    }
37600}
37601
37602#[derive(Clone, Debug, Default, PartialEq)]
37603#[non_exhaustive]
37604pub struct SqlSslCertsDeleteRequest {
37605    /// Cloud SQL instance ID. This does not include the project ID.
37606    pub instance: std::string::String,
37607
37608    /// Project ID of the project that contains the instance.
37609    pub project: std::string::String,
37610
37611    /// Sha1 FingerPrint.
37612    pub sha1_fingerprint: std::string::String,
37613
37614    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
37615}
37616
37617impl SqlSslCertsDeleteRequest {
37618    pub fn new() -> Self {
37619        std::default::Default::default()
37620    }
37621
37622    /// Sets the value of [instance][crate::model::SqlSslCertsDeleteRequest::instance].
37623    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
37624        self.instance = v.into();
37625        self
37626    }
37627
37628    /// Sets the value of [project][crate::model::SqlSslCertsDeleteRequest::project].
37629    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
37630        self.project = v.into();
37631        self
37632    }
37633
37634    /// Sets the value of [sha1_fingerprint][crate::model::SqlSslCertsDeleteRequest::sha1_fingerprint].
37635    pub fn set_sha1_fingerprint<T: std::convert::Into<std::string::String>>(
37636        mut self,
37637        v: T,
37638    ) -> Self {
37639        self.sha1_fingerprint = v.into();
37640        self
37641    }
37642}
37643
37644impl wkt::message::Message for SqlSslCertsDeleteRequest {
37645    fn typename() -> &'static str {
37646        "type.googleapis.com/google.cloud.sql.v1.SqlSslCertsDeleteRequest"
37647    }
37648}
37649
37650#[doc(hidden)]
37651impl<'de> serde::de::Deserialize<'de> for SqlSslCertsDeleteRequest {
37652    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
37653    where
37654        D: serde::Deserializer<'de>,
37655    {
37656        #[allow(non_camel_case_types)]
37657        #[doc(hidden)]
37658        #[derive(PartialEq, Eq, Hash)]
37659        enum __FieldTag {
37660            __instance,
37661            __project,
37662            __sha1_fingerprint,
37663            Unknown(std::string::String),
37664        }
37665        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
37666            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
37667            where
37668                D: serde::Deserializer<'de>,
37669            {
37670                struct Visitor;
37671                impl<'de> serde::de::Visitor<'de> for Visitor {
37672                    type Value = __FieldTag;
37673                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
37674                        formatter.write_str("a field name for SqlSslCertsDeleteRequest")
37675                    }
37676                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
37677                    where
37678                        E: serde::de::Error,
37679                    {
37680                        use std::result::Result::Ok;
37681                        use std::string::ToString;
37682                        match value {
37683                            "instance" => Ok(__FieldTag::__instance),
37684                            "project" => Ok(__FieldTag::__project),
37685                            "sha1Fingerprint" => Ok(__FieldTag::__sha1_fingerprint),
37686                            "sha1_fingerprint" => Ok(__FieldTag::__sha1_fingerprint),
37687                            _ => Ok(__FieldTag::Unknown(value.to_string())),
37688                        }
37689                    }
37690                }
37691                deserializer.deserialize_identifier(Visitor)
37692            }
37693        }
37694        struct Visitor;
37695        impl<'de> serde::de::Visitor<'de> for Visitor {
37696            type Value = SqlSslCertsDeleteRequest;
37697            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
37698                formatter.write_str("struct SqlSslCertsDeleteRequest")
37699            }
37700            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
37701            where
37702                A: serde::de::MapAccess<'de>,
37703            {
37704                #[allow(unused_imports)]
37705                use serde::de::Error;
37706                use std::option::Option::Some;
37707                let mut fields = std::collections::HashSet::new();
37708                let mut result = Self::Value::new();
37709                while let Some(tag) = map.next_key::<__FieldTag>()? {
37710                    #[allow(clippy::match_single_binding)]
37711                    match tag {
37712                        __FieldTag::__instance => {
37713                            if !fields.insert(__FieldTag::__instance) {
37714                                return std::result::Result::Err(A::Error::duplicate_field(
37715                                    "multiple values for instance",
37716                                ));
37717                            }
37718                            result.instance = map
37719                                .next_value::<std::option::Option<std::string::String>>()?
37720                                .unwrap_or_default();
37721                        }
37722                        __FieldTag::__project => {
37723                            if !fields.insert(__FieldTag::__project) {
37724                                return std::result::Result::Err(A::Error::duplicate_field(
37725                                    "multiple values for project",
37726                                ));
37727                            }
37728                            result.project = map
37729                                .next_value::<std::option::Option<std::string::String>>()?
37730                                .unwrap_or_default();
37731                        }
37732                        __FieldTag::__sha1_fingerprint => {
37733                            if !fields.insert(__FieldTag::__sha1_fingerprint) {
37734                                return std::result::Result::Err(A::Error::duplicate_field(
37735                                    "multiple values for sha1_fingerprint",
37736                                ));
37737                            }
37738                            result.sha1_fingerprint = map
37739                                .next_value::<std::option::Option<std::string::String>>()?
37740                                .unwrap_or_default();
37741                        }
37742                        __FieldTag::Unknown(key) => {
37743                            let value = map.next_value::<serde_json::Value>()?;
37744                            result._unknown_fields.insert(key, value);
37745                        }
37746                    }
37747                }
37748                std::result::Result::Ok(result)
37749            }
37750        }
37751        deserializer.deserialize_any(Visitor)
37752    }
37753}
37754
37755#[doc(hidden)]
37756impl serde::ser::Serialize for SqlSslCertsDeleteRequest {
37757    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
37758    where
37759        S: serde::ser::Serializer,
37760    {
37761        use serde::ser::SerializeMap;
37762        #[allow(unused_imports)]
37763        use std::option::Option::Some;
37764        let mut state = serializer.serialize_map(std::option::Option::None)?;
37765        if !self.instance.is_empty() {
37766            state.serialize_entry("instance", &self.instance)?;
37767        }
37768        if !self.project.is_empty() {
37769            state.serialize_entry("project", &self.project)?;
37770        }
37771        if !self.sha1_fingerprint.is_empty() {
37772            state.serialize_entry("sha1Fingerprint", &self.sha1_fingerprint)?;
37773        }
37774        if !self._unknown_fields.is_empty() {
37775            for (key, value) in self._unknown_fields.iter() {
37776                state.serialize_entry(key, &value)?;
37777            }
37778        }
37779        state.end()
37780    }
37781}
37782
37783#[derive(Clone, Debug, Default, PartialEq)]
37784#[non_exhaustive]
37785pub struct SqlSslCertsGetRequest {
37786    /// Cloud SQL instance ID. This does not include the project ID.
37787    pub instance: std::string::String,
37788
37789    /// Project ID of the project that contains the instance.
37790    pub project: std::string::String,
37791
37792    /// Sha1 FingerPrint.
37793    pub sha1_fingerprint: std::string::String,
37794
37795    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
37796}
37797
37798impl SqlSslCertsGetRequest {
37799    pub fn new() -> Self {
37800        std::default::Default::default()
37801    }
37802
37803    /// Sets the value of [instance][crate::model::SqlSslCertsGetRequest::instance].
37804    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
37805        self.instance = v.into();
37806        self
37807    }
37808
37809    /// Sets the value of [project][crate::model::SqlSslCertsGetRequest::project].
37810    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
37811        self.project = v.into();
37812        self
37813    }
37814
37815    /// Sets the value of [sha1_fingerprint][crate::model::SqlSslCertsGetRequest::sha1_fingerprint].
37816    pub fn set_sha1_fingerprint<T: std::convert::Into<std::string::String>>(
37817        mut self,
37818        v: T,
37819    ) -> Self {
37820        self.sha1_fingerprint = v.into();
37821        self
37822    }
37823}
37824
37825impl wkt::message::Message for SqlSslCertsGetRequest {
37826    fn typename() -> &'static str {
37827        "type.googleapis.com/google.cloud.sql.v1.SqlSslCertsGetRequest"
37828    }
37829}
37830
37831#[doc(hidden)]
37832impl<'de> serde::de::Deserialize<'de> for SqlSslCertsGetRequest {
37833    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
37834    where
37835        D: serde::Deserializer<'de>,
37836    {
37837        #[allow(non_camel_case_types)]
37838        #[doc(hidden)]
37839        #[derive(PartialEq, Eq, Hash)]
37840        enum __FieldTag {
37841            __instance,
37842            __project,
37843            __sha1_fingerprint,
37844            Unknown(std::string::String),
37845        }
37846        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
37847            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
37848            where
37849                D: serde::Deserializer<'de>,
37850            {
37851                struct Visitor;
37852                impl<'de> serde::de::Visitor<'de> for Visitor {
37853                    type Value = __FieldTag;
37854                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
37855                        formatter.write_str("a field name for SqlSslCertsGetRequest")
37856                    }
37857                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
37858                    where
37859                        E: serde::de::Error,
37860                    {
37861                        use std::result::Result::Ok;
37862                        use std::string::ToString;
37863                        match value {
37864                            "instance" => Ok(__FieldTag::__instance),
37865                            "project" => Ok(__FieldTag::__project),
37866                            "sha1Fingerprint" => Ok(__FieldTag::__sha1_fingerprint),
37867                            "sha1_fingerprint" => Ok(__FieldTag::__sha1_fingerprint),
37868                            _ => Ok(__FieldTag::Unknown(value.to_string())),
37869                        }
37870                    }
37871                }
37872                deserializer.deserialize_identifier(Visitor)
37873            }
37874        }
37875        struct Visitor;
37876        impl<'de> serde::de::Visitor<'de> for Visitor {
37877            type Value = SqlSslCertsGetRequest;
37878            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
37879                formatter.write_str("struct SqlSslCertsGetRequest")
37880            }
37881            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
37882            where
37883                A: serde::de::MapAccess<'de>,
37884            {
37885                #[allow(unused_imports)]
37886                use serde::de::Error;
37887                use std::option::Option::Some;
37888                let mut fields = std::collections::HashSet::new();
37889                let mut result = Self::Value::new();
37890                while let Some(tag) = map.next_key::<__FieldTag>()? {
37891                    #[allow(clippy::match_single_binding)]
37892                    match tag {
37893                        __FieldTag::__instance => {
37894                            if !fields.insert(__FieldTag::__instance) {
37895                                return std::result::Result::Err(A::Error::duplicate_field(
37896                                    "multiple values for instance",
37897                                ));
37898                            }
37899                            result.instance = map
37900                                .next_value::<std::option::Option<std::string::String>>()?
37901                                .unwrap_or_default();
37902                        }
37903                        __FieldTag::__project => {
37904                            if !fields.insert(__FieldTag::__project) {
37905                                return std::result::Result::Err(A::Error::duplicate_field(
37906                                    "multiple values for project",
37907                                ));
37908                            }
37909                            result.project = map
37910                                .next_value::<std::option::Option<std::string::String>>()?
37911                                .unwrap_or_default();
37912                        }
37913                        __FieldTag::__sha1_fingerprint => {
37914                            if !fields.insert(__FieldTag::__sha1_fingerprint) {
37915                                return std::result::Result::Err(A::Error::duplicate_field(
37916                                    "multiple values for sha1_fingerprint",
37917                                ));
37918                            }
37919                            result.sha1_fingerprint = map
37920                                .next_value::<std::option::Option<std::string::String>>()?
37921                                .unwrap_or_default();
37922                        }
37923                        __FieldTag::Unknown(key) => {
37924                            let value = map.next_value::<serde_json::Value>()?;
37925                            result._unknown_fields.insert(key, value);
37926                        }
37927                    }
37928                }
37929                std::result::Result::Ok(result)
37930            }
37931        }
37932        deserializer.deserialize_any(Visitor)
37933    }
37934}
37935
37936#[doc(hidden)]
37937impl serde::ser::Serialize for SqlSslCertsGetRequest {
37938    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
37939    where
37940        S: serde::ser::Serializer,
37941    {
37942        use serde::ser::SerializeMap;
37943        #[allow(unused_imports)]
37944        use std::option::Option::Some;
37945        let mut state = serializer.serialize_map(std::option::Option::None)?;
37946        if !self.instance.is_empty() {
37947            state.serialize_entry("instance", &self.instance)?;
37948        }
37949        if !self.project.is_empty() {
37950            state.serialize_entry("project", &self.project)?;
37951        }
37952        if !self.sha1_fingerprint.is_empty() {
37953            state.serialize_entry("sha1Fingerprint", &self.sha1_fingerprint)?;
37954        }
37955        if !self._unknown_fields.is_empty() {
37956            for (key, value) in self._unknown_fields.iter() {
37957                state.serialize_entry(key, &value)?;
37958            }
37959        }
37960        state.end()
37961    }
37962}
37963
37964#[derive(Clone, Debug, Default, PartialEq)]
37965#[non_exhaustive]
37966pub struct SqlSslCertsInsertRequest {
37967    /// Cloud SQL instance ID. This does not include the project ID.
37968    pub instance: std::string::String,
37969
37970    /// Project ID of the project that contains the instance.
37971    pub project: std::string::String,
37972
37973    pub body: std::option::Option<crate::model::SslCertsInsertRequest>,
37974
37975    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
37976}
37977
37978impl SqlSslCertsInsertRequest {
37979    pub fn new() -> Self {
37980        std::default::Default::default()
37981    }
37982
37983    /// Sets the value of [instance][crate::model::SqlSslCertsInsertRequest::instance].
37984    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
37985        self.instance = v.into();
37986        self
37987    }
37988
37989    /// Sets the value of [project][crate::model::SqlSslCertsInsertRequest::project].
37990    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
37991        self.project = v.into();
37992        self
37993    }
37994
37995    /// Sets the value of [body][crate::model::SqlSslCertsInsertRequest::body].
37996    pub fn set_body<T>(mut self, v: T) -> Self
37997    where
37998        T: std::convert::Into<crate::model::SslCertsInsertRequest>,
37999    {
38000        self.body = std::option::Option::Some(v.into());
38001        self
38002    }
38003
38004    /// Sets or clears the value of [body][crate::model::SqlSslCertsInsertRequest::body].
38005    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
38006    where
38007        T: std::convert::Into<crate::model::SslCertsInsertRequest>,
38008    {
38009        self.body = v.map(|x| x.into());
38010        self
38011    }
38012}
38013
38014impl wkt::message::Message for SqlSslCertsInsertRequest {
38015    fn typename() -> &'static str {
38016        "type.googleapis.com/google.cloud.sql.v1.SqlSslCertsInsertRequest"
38017    }
38018}
38019
38020#[doc(hidden)]
38021impl<'de> serde::de::Deserialize<'de> for SqlSslCertsInsertRequest {
38022    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
38023    where
38024        D: serde::Deserializer<'de>,
38025    {
38026        #[allow(non_camel_case_types)]
38027        #[doc(hidden)]
38028        #[derive(PartialEq, Eq, Hash)]
38029        enum __FieldTag {
38030            __instance,
38031            __project,
38032            __body,
38033            Unknown(std::string::String),
38034        }
38035        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
38036            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
38037            where
38038                D: serde::Deserializer<'de>,
38039            {
38040                struct Visitor;
38041                impl<'de> serde::de::Visitor<'de> for Visitor {
38042                    type Value = __FieldTag;
38043                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
38044                        formatter.write_str("a field name for SqlSslCertsInsertRequest")
38045                    }
38046                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
38047                    where
38048                        E: serde::de::Error,
38049                    {
38050                        use std::result::Result::Ok;
38051                        use std::string::ToString;
38052                        match value {
38053                            "instance" => Ok(__FieldTag::__instance),
38054                            "project" => Ok(__FieldTag::__project),
38055                            "body" => Ok(__FieldTag::__body),
38056                            _ => Ok(__FieldTag::Unknown(value.to_string())),
38057                        }
38058                    }
38059                }
38060                deserializer.deserialize_identifier(Visitor)
38061            }
38062        }
38063        struct Visitor;
38064        impl<'de> serde::de::Visitor<'de> for Visitor {
38065            type Value = SqlSslCertsInsertRequest;
38066            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
38067                formatter.write_str("struct SqlSslCertsInsertRequest")
38068            }
38069            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
38070            where
38071                A: serde::de::MapAccess<'de>,
38072            {
38073                #[allow(unused_imports)]
38074                use serde::de::Error;
38075                use std::option::Option::Some;
38076                let mut fields = std::collections::HashSet::new();
38077                let mut result = Self::Value::new();
38078                while let Some(tag) = map.next_key::<__FieldTag>()? {
38079                    #[allow(clippy::match_single_binding)]
38080                    match tag {
38081                        __FieldTag::__instance => {
38082                            if !fields.insert(__FieldTag::__instance) {
38083                                return std::result::Result::Err(A::Error::duplicate_field(
38084                                    "multiple values for instance",
38085                                ));
38086                            }
38087                            result.instance = map
38088                                .next_value::<std::option::Option<std::string::String>>()?
38089                                .unwrap_or_default();
38090                        }
38091                        __FieldTag::__project => {
38092                            if !fields.insert(__FieldTag::__project) {
38093                                return std::result::Result::Err(A::Error::duplicate_field(
38094                                    "multiple values for project",
38095                                ));
38096                            }
38097                            result.project = map
38098                                .next_value::<std::option::Option<std::string::String>>()?
38099                                .unwrap_or_default();
38100                        }
38101                        __FieldTag::__body => {
38102                            if !fields.insert(__FieldTag::__body) {
38103                                return std::result::Result::Err(A::Error::duplicate_field(
38104                                    "multiple values for body",
38105                                ));
38106                            }
38107                            result.body = map.next_value::<std::option::Option<crate::model::SslCertsInsertRequest>>()?
38108                                ;
38109                        }
38110                        __FieldTag::Unknown(key) => {
38111                            let value = map.next_value::<serde_json::Value>()?;
38112                            result._unknown_fields.insert(key, value);
38113                        }
38114                    }
38115                }
38116                std::result::Result::Ok(result)
38117            }
38118        }
38119        deserializer.deserialize_any(Visitor)
38120    }
38121}
38122
38123#[doc(hidden)]
38124impl serde::ser::Serialize for SqlSslCertsInsertRequest {
38125    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
38126    where
38127        S: serde::ser::Serializer,
38128    {
38129        use serde::ser::SerializeMap;
38130        #[allow(unused_imports)]
38131        use std::option::Option::Some;
38132        let mut state = serializer.serialize_map(std::option::Option::None)?;
38133        if !self.instance.is_empty() {
38134            state.serialize_entry("instance", &self.instance)?;
38135        }
38136        if !self.project.is_empty() {
38137            state.serialize_entry("project", &self.project)?;
38138        }
38139        if self.body.is_some() {
38140            state.serialize_entry("body", &self.body)?;
38141        }
38142        if !self._unknown_fields.is_empty() {
38143            for (key, value) in self._unknown_fields.iter() {
38144                state.serialize_entry(key, &value)?;
38145            }
38146        }
38147        state.end()
38148    }
38149}
38150
38151#[derive(Clone, Debug, Default, PartialEq)]
38152#[non_exhaustive]
38153pub struct SqlSslCertsListRequest {
38154    /// Cloud SQL instance ID. This does not include the project ID.
38155    pub instance: std::string::String,
38156
38157    /// Project ID of the project that contains the instance.
38158    pub project: std::string::String,
38159
38160    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
38161}
38162
38163impl SqlSslCertsListRequest {
38164    pub fn new() -> Self {
38165        std::default::Default::default()
38166    }
38167
38168    /// Sets the value of [instance][crate::model::SqlSslCertsListRequest::instance].
38169    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
38170        self.instance = v.into();
38171        self
38172    }
38173
38174    /// Sets the value of [project][crate::model::SqlSslCertsListRequest::project].
38175    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
38176        self.project = v.into();
38177        self
38178    }
38179}
38180
38181impl wkt::message::Message for SqlSslCertsListRequest {
38182    fn typename() -> &'static str {
38183        "type.googleapis.com/google.cloud.sql.v1.SqlSslCertsListRequest"
38184    }
38185}
38186
38187#[doc(hidden)]
38188impl<'de> serde::de::Deserialize<'de> for SqlSslCertsListRequest {
38189    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
38190    where
38191        D: serde::Deserializer<'de>,
38192    {
38193        #[allow(non_camel_case_types)]
38194        #[doc(hidden)]
38195        #[derive(PartialEq, Eq, Hash)]
38196        enum __FieldTag {
38197            __instance,
38198            __project,
38199            Unknown(std::string::String),
38200        }
38201        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
38202            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
38203            where
38204                D: serde::Deserializer<'de>,
38205            {
38206                struct Visitor;
38207                impl<'de> serde::de::Visitor<'de> for Visitor {
38208                    type Value = __FieldTag;
38209                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
38210                        formatter.write_str("a field name for SqlSslCertsListRequest")
38211                    }
38212                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
38213                    where
38214                        E: serde::de::Error,
38215                    {
38216                        use std::result::Result::Ok;
38217                        use std::string::ToString;
38218                        match value {
38219                            "instance" => Ok(__FieldTag::__instance),
38220                            "project" => Ok(__FieldTag::__project),
38221                            _ => Ok(__FieldTag::Unknown(value.to_string())),
38222                        }
38223                    }
38224                }
38225                deserializer.deserialize_identifier(Visitor)
38226            }
38227        }
38228        struct Visitor;
38229        impl<'de> serde::de::Visitor<'de> for Visitor {
38230            type Value = SqlSslCertsListRequest;
38231            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
38232                formatter.write_str("struct SqlSslCertsListRequest")
38233            }
38234            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
38235            where
38236                A: serde::de::MapAccess<'de>,
38237            {
38238                #[allow(unused_imports)]
38239                use serde::de::Error;
38240                use std::option::Option::Some;
38241                let mut fields = std::collections::HashSet::new();
38242                let mut result = Self::Value::new();
38243                while let Some(tag) = map.next_key::<__FieldTag>()? {
38244                    #[allow(clippy::match_single_binding)]
38245                    match tag {
38246                        __FieldTag::__instance => {
38247                            if !fields.insert(__FieldTag::__instance) {
38248                                return std::result::Result::Err(A::Error::duplicate_field(
38249                                    "multiple values for instance",
38250                                ));
38251                            }
38252                            result.instance = map
38253                                .next_value::<std::option::Option<std::string::String>>()?
38254                                .unwrap_or_default();
38255                        }
38256                        __FieldTag::__project => {
38257                            if !fields.insert(__FieldTag::__project) {
38258                                return std::result::Result::Err(A::Error::duplicate_field(
38259                                    "multiple values for project",
38260                                ));
38261                            }
38262                            result.project = map
38263                                .next_value::<std::option::Option<std::string::String>>()?
38264                                .unwrap_or_default();
38265                        }
38266                        __FieldTag::Unknown(key) => {
38267                            let value = map.next_value::<serde_json::Value>()?;
38268                            result._unknown_fields.insert(key, value);
38269                        }
38270                    }
38271                }
38272                std::result::Result::Ok(result)
38273            }
38274        }
38275        deserializer.deserialize_any(Visitor)
38276    }
38277}
38278
38279#[doc(hidden)]
38280impl serde::ser::Serialize for SqlSslCertsListRequest {
38281    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
38282    where
38283        S: serde::ser::Serializer,
38284    {
38285        use serde::ser::SerializeMap;
38286        #[allow(unused_imports)]
38287        use std::option::Option::Some;
38288        let mut state = serializer.serialize_map(std::option::Option::None)?;
38289        if !self.instance.is_empty() {
38290            state.serialize_entry("instance", &self.instance)?;
38291        }
38292        if !self.project.is_empty() {
38293            state.serialize_entry("project", &self.project)?;
38294        }
38295        if !self._unknown_fields.is_empty() {
38296            for (key, value) in self._unknown_fields.iter() {
38297                state.serialize_entry(key, &value)?;
38298            }
38299        }
38300        state.end()
38301    }
38302}
38303
38304/// SslCerts insert request.
38305#[derive(Clone, Debug, Default, PartialEq)]
38306#[non_exhaustive]
38307pub struct SslCertsInsertRequest {
38308    /// User supplied name.  Must be a distinct name from the other certificates
38309    /// for this instance.
38310    pub common_name: std::string::String,
38311
38312    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
38313}
38314
38315impl SslCertsInsertRequest {
38316    pub fn new() -> Self {
38317        std::default::Default::default()
38318    }
38319
38320    /// Sets the value of [common_name][crate::model::SslCertsInsertRequest::common_name].
38321    pub fn set_common_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
38322        self.common_name = v.into();
38323        self
38324    }
38325}
38326
38327impl wkt::message::Message for SslCertsInsertRequest {
38328    fn typename() -> &'static str {
38329        "type.googleapis.com/google.cloud.sql.v1.SslCertsInsertRequest"
38330    }
38331}
38332
38333#[doc(hidden)]
38334impl<'de> serde::de::Deserialize<'de> for SslCertsInsertRequest {
38335    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
38336    where
38337        D: serde::Deserializer<'de>,
38338    {
38339        #[allow(non_camel_case_types)]
38340        #[doc(hidden)]
38341        #[derive(PartialEq, Eq, Hash)]
38342        enum __FieldTag {
38343            __common_name,
38344            Unknown(std::string::String),
38345        }
38346        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
38347            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
38348            where
38349                D: serde::Deserializer<'de>,
38350            {
38351                struct Visitor;
38352                impl<'de> serde::de::Visitor<'de> for Visitor {
38353                    type Value = __FieldTag;
38354                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
38355                        formatter.write_str("a field name for SslCertsInsertRequest")
38356                    }
38357                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
38358                    where
38359                        E: serde::de::Error,
38360                    {
38361                        use std::result::Result::Ok;
38362                        use std::string::ToString;
38363                        match value {
38364                            "commonName" => Ok(__FieldTag::__common_name),
38365                            "common_name" => Ok(__FieldTag::__common_name),
38366                            _ => Ok(__FieldTag::Unknown(value.to_string())),
38367                        }
38368                    }
38369                }
38370                deserializer.deserialize_identifier(Visitor)
38371            }
38372        }
38373        struct Visitor;
38374        impl<'de> serde::de::Visitor<'de> for Visitor {
38375            type Value = SslCertsInsertRequest;
38376            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
38377                formatter.write_str("struct SslCertsInsertRequest")
38378            }
38379            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
38380            where
38381                A: serde::de::MapAccess<'de>,
38382            {
38383                #[allow(unused_imports)]
38384                use serde::de::Error;
38385                use std::option::Option::Some;
38386                let mut fields = std::collections::HashSet::new();
38387                let mut result = Self::Value::new();
38388                while let Some(tag) = map.next_key::<__FieldTag>()? {
38389                    #[allow(clippy::match_single_binding)]
38390                    match tag {
38391                        __FieldTag::__common_name => {
38392                            if !fields.insert(__FieldTag::__common_name) {
38393                                return std::result::Result::Err(A::Error::duplicate_field(
38394                                    "multiple values for common_name",
38395                                ));
38396                            }
38397                            result.common_name = map
38398                                .next_value::<std::option::Option<std::string::String>>()?
38399                                .unwrap_or_default();
38400                        }
38401                        __FieldTag::Unknown(key) => {
38402                            let value = map.next_value::<serde_json::Value>()?;
38403                            result._unknown_fields.insert(key, value);
38404                        }
38405                    }
38406                }
38407                std::result::Result::Ok(result)
38408            }
38409        }
38410        deserializer.deserialize_any(Visitor)
38411    }
38412}
38413
38414#[doc(hidden)]
38415impl serde::ser::Serialize for SslCertsInsertRequest {
38416    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
38417    where
38418        S: serde::ser::Serializer,
38419    {
38420        use serde::ser::SerializeMap;
38421        #[allow(unused_imports)]
38422        use std::option::Option::Some;
38423        let mut state = serializer.serialize_map(std::option::Option::None)?;
38424        if !self.common_name.is_empty() {
38425            state.serialize_entry("commonName", &self.common_name)?;
38426        }
38427        if !self._unknown_fields.is_empty() {
38428            for (key, value) in self._unknown_fields.iter() {
38429                state.serialize_entry(key, &value)?;
38430            }
38431        }
38432        state.end()
38433    }
38434}
38435
38436/// SslCert insert response.
38437#[derive(Clone, Debug, Default, PartialEq)]
38438#[non_exhaustive]
38439pub struct SslCertsInsertResponse {
38440    /// This is always `sql#sslCertsInsert`.
38441    pub kind: std::string::String,
38442
38443    /// The operation to track the ssl certs insert request.
38444    pub operation: std::option::Option<crate::model::Operation>,
38445
38446    /// The server Certificate Authority's certificate.  If this is missing you can
38447    /// force a new one to be generated by calling resetSslConfig method on
38448    /// instances resource.
38449    pub server_ca_cert: std::option::Option<crate::model::SslCert>,
38450
38451    /// The new client certificate and private key.
38452    pub client_cert: std::option::Option<crate::model::SslCertDetail>,
38453
38454    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
38455}
38456
38457impl SslCertsInsertResponse {
38458    pub fn new() -> Self {
38459        std::default::Default::default()
38460    }
38461
38462    /// Sets the value of [kind][crate::model::SslCertsInsertResponse::kind].
38463    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
38464        self.kind = v.into();
38465        self
38466    }
38467
38468    /// Sets the value of [operation][crate::model::SslCertsInsertResponse::operation].
38469    pub fn set_operation<T>(mut self, v: T) -> Self
38470    where
38471        T: std::convert::Into<crate::model::Operation>,
38472    {
38473        self.operation = std::option::Option::Some(v.into());
38474        self
38475    }
38476
38477    /// Sets or clears the value of [operation][crate::model::SslCertsInsertResponse::operation].
38478    pub fn set_or_clear_operation<T>(mut self, v: std::option::Option<T>) -> Self
38479    where
38480        T: std::convert::Into<crate::model::Operation>,
38481    {
38482        self.operation = v.map(|x| x.into());
38483        self
38484    }
38485
38486    /// Sets the value of [server_ca_cert][crate::model::SslCertsInsertResponse::server_ca_cert].
38487    pub fn set_server_ca_cert<T>(mut self, v: T) -> Self
38488    where
38489        T: std::convert::Into<crate::model::SslCert>,
38490    {
38491        self.server_ca_cert = std::option::Option::Some(v.into());
38492        self
38493    }
38494
38495    /// Sets or clears the value of [server_ca_cert][crate::model::SslCertsInsertResponse::server_ca_cert].
38496    pub fn set_or_clear_server_ca_cert<T>(mut self, v: std::option::Option<T>) -> Self
38497    where
38498        T: std::convert::Into<crate::model::SslCert>,
38499    {
38500        self.server_ca_cert = v.map(|x| x.into());
38501        self
38502    }
38503
38504    /// Sets the value of [client_cert][crate::model::SslCertsInsertResponse::client_cert].
38505    pub fn set_client_cert<T>(mut self, v: T) -> Self
38506    where
38507        T: std::convert::Into<crate::model::SslCertDetail>,
38508    {
38509        self.client_cert = std::option::Option::Some(v.into());
38510        self
38511    }
38512
38513    /// Sets or clears the value of [client_cert][crate::model::SslCertsInsertResponse::client_cert].
38514    pub fn set_or_clear_client_cert<T>(mut self, v: std::option::Option<T>) -> Self
38515    where
38516        T: std::convert::Into<crate::model::SslCertDetail>,
38517    {
38518        self.client_cert = v.map(|x| x.into());
38519        self
38520    }
38521}
38522
38523impl wkt::message::Message for SslCertsInsertResponse {
38524    fn typename() -> &'static str {
38525        "type.googleapis.com/google.cloud.sql.v1.SslCertsInsertResponse"
38526    }
38527}
38528
38529#[doc(hidden)]
38530impl<'de> serde::de::Deserialize<'de> for SslCertsInsertResponse {
38531    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
38532    where
38533        D: serde::Deserializer<'de>,
38534    {
38535        #[allow(non_camel_case_types)]
38536        #[doc(hidden)]
38537        #[derive(PartialEq, Eq, Hash)]
38538        enum __FieldTag {
38539            __kind,
38540            __operation,
38541            __server_ca_cert,
38542            __client_cert,
38543            Unknown(std::string::String),
38544        }
38545        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
38546            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
38547            where
38548                D: serde::Deserializer<'de>,
38549            {
38550                struct Visitor;
38551                impl<'de> serde::de::Visitor<'de> for Visitor {
38552                    type Value = __FieldTag;
38553                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
38554                        formatter.write_str("a field name for SslCertsInsertResponse")
38555                    }
38556                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
38557                    where
38558                        E: serde::de::Error,
38559                    {
38560                        use std::result::Result::Ok;
38561                        use std::string::ToString;
38562                        match value {
38563                            "kind" => Ok(__FieldTag::__kind),
38564                            "operation" => Ok(__FieldTag::__operation),
38565                            "serverCaCert" => Ok(__FieldTag::__server_ca_cert),
38566                            "server_ca_cert" => Ok(__FieldTag::__server_ca_cert),
38567                            "clientCert" => Ok(__FieldTag::__client_cert),
38568                            "client_cert" => Ok(__FieldTag::__client_cert),
38569                            _ => Ok(__FieldTag::Unknown(value.to_string())),
38570                        }
38571                    }
38572                }
38573                deserializer.deserialize_identifier(Visitor)
38574            }
38575        }
38576        struct Visitor;
38577        impl<'de> serde::de::Visitor<'de> for Visitor {
38578            type Value = SslCertsInsertResponse;
38579            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
38580                formatter.write_str("struct SslCertsInsertResponse")
38581            }
38582            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
38583            where
38584                A: serde::de::MapAccess<'de>,
38585            {
38586                #[allow(unused_imports)]
38587                use serde::de::Error;
38588                use std::option::Option::Some;
38589                let mut fields = std::collections::HashSet::new();
38590                let mut result = Self::Value::new();
38591                while let Some(tag) = map.next_key::<__FieldTag>()? {
38592                    #[allow(clippy::match_single_binding)]
38593                    match tag {
38594                        __FieldTag::__kind => {
38595                            if !fields.insert(__FieldTag::__kind) {
38596                                return std::result::Result::Err(A::Error::duplicate_field(
38597                                    "multiple values for kind",
38598                                ));
38599                            }
38600                            result.kind = map
38601                                .next_value::<std::option::Option<std::string::String>>()?
38602                                .unwrap_or_default();
38603                        }
38604                        __FieldTag::__operation => {
38605                            if !fields.insert(__FieldTag::__operation) {
38606                                return std::result::Result::Err(A::Error::duplicate_field(
38607                                    "multiple values for operation",
38608                                ));
38609                            }
38610                            result.operation =
38611                                map.next_value::<std::option::Option<crate::model::Operation>>()?;
38612                        }
38613                        __FieldTag::__server_ca_cert => {
38614                            if !fields.insert(__FieldTag::__server_ca_cert) {
38615                                return std::result::Result::Err(A::Error::duplicate_field(
38616                                    "multiple values for server_ca_cert",
38617                                ));
38618                            }
38619                            result.server_ca_cert =
38620                                map.next_value::<std::option::Option<crate::model::SslCert>>()?;
38621                        }
38622                        __FieldTag::__client_cert => {
38623                            if !fields.insert(__FieldTag::__client_cert) {
38624                                return std::result::Result::Err(A::Error::duplicate_field(
38625                                    "multiple values for client_cert",
38626                                ));
38627                            }
38628                            result.client_cert = map
38629                                .next_value::<std::option::Option<crate::model::SslCertDetail>>()?;
38630                        }
38631                        __FieldTag::Unknown(key) => {
38632                            let value = map.next_value::<serde_json::Value>()?;
38633                            result._unknown_fields.insert(key, value);
38634                        }
38635                    }
38636                }
38637                std::result::Result::Ok(result)
38638            }
38639        }
38640        deserializer.deserialize_any(Visitor)
38641    }
38642}
38643
38644#[doc(hidden)]
38645impl serde::ser::Serialize for SslCertsInsertResponse {
38646    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
38647    where
38648        S: serde::ser::Serializer,
38649    {
38650        use serde::ser::SerializeMap;
38651        #[allow(unused_imports)]
38652        use std::option::Option::Some;
38653        let mut state = serializer.serialize_map(std::option::Option::None)?;
38654        if !self.kind.is_empty() {
38655            state.serialize_entry("kind", &self.kind)?;
38656        }
38657        if self.operation.is_some() {
38658            state.serialize_entry("operation", &self.operation)?;
38659        }
38660        if self.server_ca_cert.is_some() {
38661            state.serialize_entry("serverCaCert", &self.server_ca_cert)?;
38662        }
38663        if self.client_cert.is_some() {
38664            state.serialize_entry("clientCert", &self.client_cert)?;
38665        }
38666        if !self._unknown_fields.is_empty() {
38667            for (key, value) in self._unknown_fields.iter() {
38668                state.serialize_entry(key, &value)?;
38669            }
38670        }
38671        state.end()
38672    }
38673}
38674
38675/// SslCerts list response.
38676#[derive(Clone, Debug, Default, PartialEq)]
38677#[non_exhaustive]
38678pub struct SslCertsListResponse {
38679    /// This is always `sql#sslCertsList`.
38680    pub kind: std::string::String,
38681
38682    /// List of client certificates for the instance.
38683    pub items: std::vec::Vec<crate::model::SslCert>,
38684
38685    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
38686}
38687
38688impl SslCertsListResponse {
38689    pub fn new() -> Self {
38690        std::default::Default::default()
38691    }
38692
38693    /// Sets the value of [kind][crate::model::SslCertsListResponse::kind].
38694    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
38695        self.kind = v.into();
38696        self
38697    }
38698
38699    /// Sets the value of [items][crate::model::SslCertsListResponse::items].
38700    pub fn set_items<T, V>(mut self, v: T) -> Self
38701    where
38702        T: std::iter::IntoIterator<Item = V>,
38703        V: std::convert::Into<crate::model::SslCert>,
38704    {
38705        use std::iter::Iterator;
38706        self.items = v.into_iter().map(|i| i.into()).collect();
38707        self
38708    }
38709}
38710
38711impl wkt::message::Message for SslCertsListResponse {
38712    fn typename() -> &'static str {
38713        "type.googleapis.com/google.cloud.sql.v1.SslCertsListResponse"
38714    }
38715}
38716
38717#[doc(hidden)]
38718impl<'de> serde::de::Deserialize<'de> for SslCertsListResponse {
38719    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
38720    where
38721        D: serde::Deserializer<'de>,
38722    {
38723        #[allow(non_camel_case_types)]
38724        #[doc(hidden)]
38725        #[derive(PartialEq, Eq, Hash)]
38726        enum __FieldTag {
38727            __kind,
38728            __items,
38729            Unknown(std::string::String),
38730        }
38731        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
38732            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
38733            where
38734                D: serde::Deserializer<'de>,
38735            {
38736                struct Visitor;
38737                impl<'de> serde::de::Visitor<'de> for Visitor {
38738                    type Value = __FieldTag;
38739                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
38740                        formatter.write_str("a field name for SslCertsListResponse")
38741                    }
38742                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
38743                    where
38744                        E: serde::de::Error,
38745                    {
38746                        use std::result::Result::Ok;
38747                        use std::string::ToString;
38748                        match value {
38749                            "kind" => Ok(__FieldTag::__kind),
38750                            "items" => Ok(__FieldTag::__items),
38751                            _ => Ok(__FieldTag::Unknown(value.to_string())),
38752                        }
38753                    }
38754                }
38755                deserializer.deserialize_identifier(Visitor)
38756            }
38757        }
38758        struct Visitor;
38759        impl<'de> serde::de::Visitor<'de> for Visitor {
38760            type Value = SslCertsListResponse;
38761            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
38762                formatter.write_str("struct SslCertsListResponse")
38763            }
38764            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
38765            where
38766                A: serde::de::MapAccess<'de>,
38767            {
38768                #[allow(unused_imports)]
38769                use serde::de::Error;
38770                use std::option::Option::Some;
38771                let mut fields = std::collections::HashSet::new();
38772                let mut result = Self::Value::new();
38773                while let Some(tag) = map.next_key::<__FieldTag>()? {
38774                    #[allow(clippy::match_single_binding)]
38775                    match tag {
38776                        __FieldTag::__kind => {
38777                            if !fields.insert(__FieldTag::__kind) {
38778                                return std::result::Result::Err(A::Error::duplicate_field(
38779                                    "multiple values for kind",
38780                                ));
38781                            }
38782                            result.kind = map
38783                                .next_value::<std::option::Option<std::string::String>>()?
38784                                .unwrap_or_default();
38785                        }
38786                        __FieldTag::__items => {
38787                            if !fields.insert(__FieldTag::__items) {
38788                                return std::result::Result::Err(A::Error::duplicate_field(
38789                                    "multiple values for items",
38790                                ));
38791                            }
38792                            result.items = map.next_value::<std::option::Option<std::vec::Vec<crate::model::SslCert>>>()?.unwrap_or_default();
38793                        }
38794                        __FieldTag::Unknown(key) => {
38795                            let value = map.next_value::<serde_json::Value>()?;
38796                            result._unknown_fields.insert(key, value);
38797                        }
38798                    }
38799                }
38800                std::result::Result::Ok(result)
38801            }
38802        }
38803        deserializer.deserialize_any(Visitor)
38804    }
38805}
38806
38807#[doc(hidden)]
38808impl serde::ser::Serialize for SslCertsListResponse {
38809    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
38810    where
38811        S: serde::ser::Serializer,
38812    {
38813        use serde::ser::SerializeMap;
38814        #[allow(unused_imports)]
38815        use std::option::Option::Some;
38816        let mut state = serializer.serialize_map(std::option::Option::None)?;
38817        if !self.kind.is_empty() {
38818            state.serialize_entry("kind", &self.kind)?;
38819        }
38820        if !self.items.is_empty() {
38821            state.serialize_entry("items", &self.items)?;
38822        }
38823        if !self._unknown_fields.is_empty() {
38824            for (key, value) in self._unknown_fields.iter() {
38825                state.serialize_entry(key, &value)?;
38826            }
38827        }
38828        state.end()
38829    }
38830}
38831
38832/// Tiers list request.
38833#[derive(Clone, Debug, Default, PartialEq)]
38834#[non_exhaustive]
38835pub struct SqlTiersListRequest {
38836    /// Project ID of the project for which to list tiers.
38837    pub project: std::string::String,
38838
38839    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
38840}
38841
38842impl SqlTiersListRequest {
38843    pub fn new() -> Self {
38844        std::default::Default::default()
38845    }
38846
38847    /// Sets the value of [project][crate::model::SqlTiersListRequest::project].
38848    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
38849        self.project = v.into();
38850        self
38851    }
38852}
38853
38854impl wkt::message::Message for SqlTiersListRequest {
38855    fn typename() -> &'static str {
38856        "type.googleapis.com/google.cloud.sql.v1.SqlTiersListRequest"
38857    }
38858}
38859
38860#[doc(hidden)]
38861impl<'de> serde::de::Deserialize<'de> for SqlTiersListRequest {
38862    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
38863    where
38864        D: serde::Deserializer<'de>,
38865    {
38866        #[allow(non_camel_case_types)]
38867        #[doc(hidden)]
38868        #[derive(PartialEq, Eq, Hash)]
38869        enum __FieldTag {
38870            __project,
38871            Unknown(std::string::String),
38872        }
38873        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
38874            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
38875            where
38876                D: serde::Deserializer<'de>,
38877            {
38878                struct Visitor;
38879                impl<'de> serde::de::Visitor<'de> for Visitor {
38880                    type Value = __FieldTag;
38881                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
38882                        formatter.write_str("a field name for SqlTiersListRequest")
38883                    }
38884                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
38885                    where
38886                        E: serde::de::Error,
38887                    {
38888                        use std::result::Result::Ok;
38889                        use std::string::ToString;
38890                        match value {
38891                            "project" => Ok(__FieldTag::__project),
38892                            _ => Ok(__FieldTag::Unknown(value.to_string())),
38893                        }
38894                    }
38895                }
38896                deserializer.deserialize_identifier(Visitor)
38897            }
38898        }
38899        struct Visitor;
38900        impl<'de> serde::de::Visitor<'de> for Visitor {
38901            type Value = SqlTiersListRequest;
38902            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
38903                formatter.write_str("struct SqlTiersListRequest")
38904            }
38905            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
38906            where
38907                A: serde::de::MapAccess<'de>,
38908            {
38909                #[allow(unused_imports)]
38910                use serde::de::Error;
38911                use std::option::Option::Some;
38912                let mut fields = std::collections::HashSet::new();
38913                let mut result = Self::Value::new();
38914                while let Some(tag) = map.next_key::<__FieldTag>()? {
38915                    #[allow(clippy::match_single_binding)]
38916                    match tag {
38917                        __FieldTag::__project => {
38918                            if !fields.insert(__FieldTag::__project) {
38919                                return std::result::Result::Err(A::Error::duplicate_field(
38920                                    "multiple values for project",
38921                                ));
38922                            }
38923                            result.project = map
38924                                .next_value::<std::option::Option<std::string::String>>()?
38925                                .unwrap_or_default();
38926                        }
38927                        __FieldTag::Unknown(key) => {
38928                            let value = map.next_value::<serde_json::Value>()?;
38929                            result._unknown_fields.insert(key, value);
38930                        }
38931                    }
38932                }
38933                std::result::Result::Ok(result)
38934            }
38935        }
38936        deserializer.deserialize_any(Visitor)
38937    }
38938}
38939
38940#[doc(hidden)]
38941impl serde::ser::Serialize for SqlTiersListRequest {
38942    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
38943    where
38944        S: serde::ser::Serializer,
38945    {
38946        use serde::ser::SerializeMap;
38947        #[allow(unused_imports)]
38948        use std::option::Option::Some;
38949        let mut state = serializer.serialize_map(std::option::Option::None)?;
38950        if !self.project.is_empty() {
38951            state.serialize_entry("project", &self.project)?;
38952        }
38953        if !self._unknown_fields.is_empty() {
38954            for (key, value) in self._unknown_fields.iter() {
38955                state.serialize_entry(key, &value)?;
38956            }
38957        }
38958        state.end()
38959    }
38960}
38961
38962/// Tiers list response.
38963#[derive(Clone, Debug, Default, PartialEq)]
38964#[non_exhaustive]
38965pub struct TiersListResponse {
38966    /// This is always `sql#tiersList`.
38967    pub kind: std::string::String,
38968
38969    /// List of tiers.
38970    pub items: std::vec::Vec<crate::model::Tier>,
38971
38972    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
38973}
38974
38975impl TiersListResponse {
38976    pub fn new() -> Self {
38977        std::default::Default::default()
38978    }
38979
38980    /// Sets the value of [kind][crate::model::TiersListResponse::kind].
38981    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
38982        self.kind = v.into();
38983        self
38984    }
38985
38986    /// Sets the value of [items][crate::model::TiersListResponse::items].
38987    pub fn set_items<T, V>(mut self, v: T) -> Self
38988    where
38989        T: std::iter::IntoIterator<Item = V>,
38990        V: std::convert::Into<crate::model::Tier>,
38991    {
38992        use std::iter::Iterator;
38993        self.items = v.into_iter().map(|i| i.into()).collect();
38994        self
38995    }
38996}
38997
38998impl wkt::message::Message for TiersListResponse {
38999    fn typename() -> &'static str {
39000        "type.googleapis.com/google.cloud.sql.v1.TiersListResponse"
39001    }
39002}
39003
39004#[doc(hidden)]
39005impl<'de> serde::de::Deserialize<'de> for TiersListResponse {
39006    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
39007    where
39008        D: serde::Deserializer<'de>,
39009    {
39010        #[allow(non_camel_case_types)]
39011        #[doc(hidden)]
39012        #[derive(PartialEq, Eq, Hash)]
39013        enum __FieldTag {
39014            __kind,
39015            __items,
39016            Unknown(std::string::String),
39017        }
39018        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
39019            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
39020            where
39021                D: serde::Deserializer<'de>,
39022            {
39023                struct Visitor;
39024                impl<'de> serde::de::Visitor<'de> for Visitor {
39025                    type Value = __FieldTag;
39026                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
39027                        formatter.write_str("a field name for TiersListResponse")
39028                    }
39029                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
39030                    where
39031                        E: serde::de::Error,
39032                    {
39033                        use std::result::Result::Ok;
39034                        use std::string::ToString;
39035                        match value {
39036                            "kind" => Ok(__FieldTag::__kind),
39037                            "items" => Ok(__FieldTag::__items),
39038                            _ => Ok(__FieldTag::Unknown(value.to_string())),
39039                        }
39040                    }
39041                }
39042                deserializer.deserialize_identifier(Visitor)
39043            }
39044        }
39045        struct Visitor;
39046        impl<'de> serde::de::Visitor<'de> for Visitor {
39047            type Value = TiersListResponse;
39048            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
39049                formatter.write_str("struct TiersListResponse")
39050            }
39051            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
39052            where
39053                A: serde::de::MapAccess<'de>,
39054            {
39055                #[allow(unused_imports)]
39056                use serde::de::Error;
39057                use std::option::Option::Some;
39058                let mut fields = std::collections::HashSet::new();
39059                let mut result = Self::Value::new();
39060                while let Some(tag) = map.next_key::<__FieldTag>()? {
39061                    #[allow(clippy::match_single_binding)]
39062                    match tag {
39063                        __FieldTag::__kind => {
39064                            if !fields.insert(__FieldTag::__kind) {
39065                                return std::result::Result::Err(A::Error::duplicate_field(
39066                                    "multiple values for kind",
39067                                ));
39068                            }
39069                            result.kind = map
39070                                .next_value::<std::option::Option<std::string::String>>()?
39071                                .unwrap_or_default();
39072                        }
39073                        __FieldTag::__items => {
39074                            if !fields.insert(__FieldTag::__items) {
39075                                return std::result::Result::Err(A::Error::duplicate_field(
39076                                    "multiple values for items",
39077                                ));
39078                            }
39079                            result.items = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Tier>>>()?.unwrap_or_default();
39080                        }
39081                        __FieldTag::Unknown(key) => {
39082                            let value = map.next_value::<serde_json::Value>()?;
39083                            result._unknown_fields.insert(key, value);
39084                        }
39085                    }
39086                }
39087                std::result::Result::Ok(result)
39088            }
39089        }
39090        deserializer.deserialize_any(Visitor)
39091    }
39092}
39093
39094#[doc(hidden)]
39095impl serde::ser::Serialize for TiersListResponse {
39096    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
39097    where
39098        S: serde::ser::Serializer,
39099    {
39100        use serde::ser::SerializeMap;
39101        #[allow(unused_imports)]
39102        use std::option::Option::Some;
39103        let mut state = serializer.serialize_map(std::option::Option::None)?;
39104        if !self.kind.is_empty() {
39105            state.serialize_entry("kind", &self.kind)?;
39106        }
39107        if !self.items.is_empty() {
39108            state.serialize_entry("items", &self.items)?;
39109        }
39110        if !self._unknown_fields.is_empty() {
39111            for (key, value) in self._unknown_fields.iter() {
39112                state.serialize_entry(key, &value)?;
39113            }
39114        }
39115        state.end()
39116    }
39117}
39118
39119/// A Google Cloud SQL service tier resource.
39120#[derive(Clone, Debug, Default, PartialEq)]
39121#[non_exhaustive]
39122pub struct Tier {
39123    /// An identifier for the machine type, for example, `db-custom-1-3840`. For
39124    /// related information, see [Pricing](/sql/pricing).
39125    pub tier: std::string::String,
39126
39127    /// The maximum RAM usage of this tier in bytes.
39128    pub ram: i64,
39129
39130    /// This is always `sql#tier`.
39131    pub kind: std::string::String,
39132
39133    /// The maximum disk size of this tier in bytes.
39134    pub disk_quota: i64,
39135
39136    /// The applicable regions for this tier.
39137    pub region: std::vec::Vec<std::string::String>,
39138
39139    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
39140}
39141
39142impl Tier {
39143    pub fn new() -> Self {
39144        std::default::Default::default()
39145    }
39146
39147    /// Sets the value of [tier][crate::model::Tier::tier].
39148    pub fn set_tier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
39149        self.tier = v.into();
39150        self
39151    }
39152
39153    /// Sets the value of [ram][crate::model::Tier::ram].
39154    pub fn set_ram<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
39155        self.ram = v.into();
39156        self
39157    }
39158
39159    /// Sets the value of [kind][crate::model::Tier::kind].
39160    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
39161        self.kind = v.into();
39162        self
39163    }
39164
39165    /// Sets the value of [disk_quota][crate::model::Tier::disk_quota].
39166    pub fn set_disk_quota<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
39167        self.disk_quota = v.into();
39168        self
39169    }
39170
39171    /// Sets the value of [region][crate::model::Tier::region].
39172    pub fn set_region<T, V>(mut self, v: T) -> Self
39173    where
39174        T: std::iter::IntoIterator<Item = V>,
39175        V: std::convert::Into<std::string::String>,
39176    {
39177        use std::iter::Iterator;
39178        self.region = v.into_iter().map(|i| i.into()).collect();
39179        self
39180    }
39181}
39182
39183impl wkt::message::Message for Tier {
39184    fn typename() -> &'static str {
39185        "type.googleapis.com/google.cloud.sql.v1.Tier"
39186    }
39187}
39188
39189#[doc(hidden)]
39190impl<'de> serde::de::Deserialize<'de> for Tier {
39191    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
39192    where
39193        D: serde::Deserializer<'de>,
39194    {
39195        #[allow(non_camel_case_types)]
39196        #[doc(hidden)]
39197        #[derive(PartialEq, Eq, Hash)]
39198        enum __FieldTag {
39199            __tier,
39200            __ram,
39201            __kind,
39202            __disk_quota,
39203            __region,
39204            Unknown(std::string::String),
39205        }
39206        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
39207            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
39208            where
39209                D: serde::Deserializer<'de>,
39210            {
39211                struct Visitor;
39212                impl<'de> serde::de::Visitor<'de> for Visitor {
39213                    type Value = __FieldTag;
39214                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
39215                        formatter.write_str("a field name for Tier")
39216                    }
39217                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
39218                    where
39219                        E: serde::de::Error,
39220                    {
39221                        use std::result::Result::Ok;
39222                        use std::string::ToString;
39223                        match value {
39224                            "tier" => Ok(__FieldTag::__tier),
39225                            "RAM" => Ok(__FieldTag::__ram),
39226                            "kind" => Ok(__FieldTag::__kind),
39227                            "DiskQuota" => Ok(__FieldTag::__disk_quota),
39228                            "Disk_Quota" => Ok(__FieldTag::__disk_quota),
39229                            "region" => Ok(__FieldTag::__region),
39230                            _ => Ok(__FieldTag::Unknown(value.to_string())),
39231                        }
39232                    }
39233                }
39234                deserializer.deserialize_identifier(Visitor)
39235            }
39236        }
39237        struct Visitor;
39238        impl<'de> serde::de::Visitor<'de> for Visitor {
39239            type Value = Tier;
39240            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
39241                formatter.write_str("struct Tier")
39242            }
39243            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
39244            where
39245                A: serde::de::MapAccess<'de>,
39246            {
39247                #[allow(unused_imports)]
39248                use serde::de::Error;
39249                use std::option::Option::Some;
39250                let mut fields = std::collections::HashSet::new();
39251                let mut result = Self::Value::new();
39252                while let Some(tag) = map.next_key::<__FieldTag>()? {
39253                    #[allow(clippy::match_single_binding)]
39254                    match tag {
39255                        __FieldTag::__tier => {
39256                            if !fields.insert(__FieldTag::__tier) {
39257                                return std::result::Result::Err(A::Error::duplicate_field(
39258                                    "multiple values for tier",
39259                                ));
39260                            }
39261                            result.tier = map
39262                                .next_value::<std::option::Option<std::string::String>>()?
39263                                .unwrap_or_default();
39264                        }
39265                        __FieldTag::__ram => {
39266                            if !fields.insert(__FieldTag::__ram) {
39267                                return std::result::Result::Err(A::Error::duplicate_field(
39268                                    "multiple values for ram",
39269                                ));
39270                            }
39271                            struct __With(std::option::Option<i64>);
39272                            impl<'de> serde::de::Deserialize<'de> for __With {
39273                                fn deserialize<D>(
39274                                    deserializer: D,
39275                                ) -> std::result::Result<Self, D::Error>
39276                                where
39277                                    D: serde::de::Deserializer<'de>,
39278                                {
39279                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
39280                                }
39281                            }
39282                            result.ram = map.next_value::<__With>()?.0.unwrap_or_default();
39283                        }
39284                        __FieldTag::__kind => {
39285                            if !fields.insert(__FieldTag::__kind) {
39286                                return std::result::Result::Err(A::Error::duplicate_field(
39287                                    "multiple values for kind",
39288                                ));
39289                            }
39290                            result.kind = map
39291                                .next_value::<std::option::Option<std::string::String>>()?
39292                                .unwrap_or_default();
39293                        }
39294                        __FieldTag::__disk_quota => {
39295                            if !fields.insert(__FieldTag::__disk_quota) {
39296                                return std::result::Result::Err(A::Error::duplicate_field(
39297                                    "multiple values for disk_quota",
39298                                ));
39299                            }
39300                            struct __With(std::option::Option<i64>);
39301                            impl<'de> serde::de::Deserialize<'de> for __With {
39302                                fn deserialize<D>(
39303                                    deserializer: D,
39304                                ) -> std::result::Result<Self, D::Error>
39305                                where
39306                                    D: serde::de::Deserializer<'de>,
39307                                {
39308                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
39309                                }
39310                            }
39311                            result.disk_quota = map.next_value::<__With>()?.0.unwrap_or_default();
39312                        }
39313                        __FieldTag::__region => {
39314                            if !fields.insert(__FieldTag::__region) {
39315                                return std::result::Result::Err(A::Error::duplicate_field(
39316                                    "multiple values for region",
39317                                ));
39318                            }
39319                            result.region = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
39320                        }
39321                        __FieldTag::Unknown(key) => {
39322                            let value = map.next_value::<serde_json::Value>()?;
39323                            result._unknown_fields.insert(key, value);
39324                        }
39325                    }
39326                }
39327                std::result::Result::Ok(result)
39328            }
39329        }
39330        deserializer.deserialize_any(Visitor)
39331    }
39332}
39333
39334#[doc(hidden)]
39335impl serde::ser::Serialize for Tier {
39336    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
39337    where
39338        S: serde::ser::Serializer,
39339    {
39340        use serde::ser::SerializeMap;
39341        #[allow(unused_imports)]
39342        use std::option::Option::Some;
39343        let mut state = serializer.serialize_map(std::option::Option::None)?;
39344        if !self.tier.is_empty() {
39345            state.serialize_entry("tier", &self.tier)?;
39346        }
39347        if !wkt::internal::is_default(&self.ram) {
39348            struct __With<'a>(&'a i64);
39349            impl<'a> serde::ser::Serialize for __With<'a> {
39350                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
39351                where
39352                    S: serde::ser::Serializer,
39353                {
39354                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
39355                }
39356            }
39357            state.serialize_entry("RAM", &__With(&self.ram))?;
39358        }
39359        if !self.kind.is_empty() {
39360            state.serialize_entry("kind", &self.kind)?;
39361        }
39362        if !wkt::internal::is_default(&self.disk_quota) {
39363            struct __With<'a>(&'a i64);
39364            impl<'a> serde::ser::Serialize for __With<'a> {
39365                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
39366                where
39367                    S: serde::ser::Serializer,
39368                {
39369                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
39370                }
39371            }
39372            state.serialize_entry("DiskQuota", &__With(&self.disk_quota))?;
39373        }
39374        if !self.region.is_empty() {
39375            state.serialize_entry("region", &self.region)?;
39376        }
39377        if !self._unknown_fields.is_empty() {
39378            for (key, value) in self._unknown_fields.iter() {
39379                state.serialize_entry(key, &value)?;
39380            }
39381        }
39382        state.end()
39383    }
39384}
39385
39386#[derive(Clone, Debug, Default, PartialEq)]
39387#[non_exhaustive]
39388pub struct SqlUsersDeleteRequest {
39389    /// Host of the user in the instance.
39390    pub host: std::string::String,
39391
39392    /// Database instance ID. This does not include the project ID.
39393    pub instance: std::string::String,
39394
39395    /// Name of the user in the instance.
39396    pub name: std::string::String,
39397
39398    /// Project ID of the project that contains the instance.
39399    pub project: std::string::String,
39400
39401    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
39402}
39403
39404impl SqlUsersDeleteRequest {
39405    pub fn new() -> Self {
39406        std::default::Default::default()
39407    }
39408
39409    /// Sets the value of [host][crate::model::SqlUsersDeleteRequest::host].
39410    pub fn set_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
39411        self.host = v.into();
39412        self
39413    }
39414
39415    /// Sets the value of [instance][crate::model::SqlUsersDeleteRequest::instance].
39416    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
39417        self.instance = v.into();
39418        self
39419    }
39420
39421    /// Sets the value of [name][crate::model::SqlUsersDeleteRequest::name].
39422    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
39423        self.name = v.into();
39424        self
39425    }
39426
39427    /// Sets the value of [project][crate::model::SqlUsersDeleteRequest::project].
39428    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
39429        self.project = v.into();
39430        self
39431    }
39432}
39433
39434impl wkt::message::Message for SqlUsersDeleteRequest {
39435    fn typename() -> &'static str {
39436        "type.googleapis.com/google.cloud.sql.v1.SqlUsersDeleteRequest"
39437    }
39438}
39439
39440#[doc(hidden)]
39441impl<'de> serde::de::Deserialize<'de> for SqlUsersDeleteRequest {
39442    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
39443    where
39444        D: serde::Deserializer<'de>,
39445    {
39446        #[allow(non_camel_case_types)]
39447        #[doc(hidden)]
39448        #[derive(PartialEq, Eq, Hash)]
39449        enum __FieldTag {
39450            __host,
39451            __instance,
39452            __name,
39453            __project,
39454            Unknown(std::string::String),
39455        }
39456        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
39457            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
39458            where
39459                D: serde::Deserializer<'de>,
39460            {
39461                struct Visitor;
39462                impl<'de> serde::de::Visitor<'de> for Visitor {
39463                    type Value = __FieldTag;
39464                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
39465                        formatter.write_str("a field name for SqlUsersDeleteRequest")
39466                    }
39467                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
39468                    where
39469                        E: serde::de::Error,
39470                    {
39471                        use std::result::Result::Ok;
39472                        use std::string::ToString;
39473                        match value {
39474                            "host" => Ok(__FieldTag::__host),
39475                            "instance" => Ok(__FieldTag::__instance),
39476                            "name" => Ok(__FieldTag::__name),
39477                            "project" => Ok(__FieldTag::__project),
39478                            _ => Ok(__FieldTag::Unknown(value.to_string())),
39479                        }
39480                    }
39481                }
39482                deserializer.deserialize_identifier(Visitor)
39483            }
39484        }
39485        struct Visitor;
39486        impl<'de> serde::de::Visitor<'de> for Visitor {
39487            type Value = SqlUsersDeleteRequest;
39488            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
39489                formatter.write_str("struct SqlUsersDeleteRequest")
39490            }
39491            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
39492            where
39493                A: serde::de::MapAccess<'de>,
39494            {
39495                #[allow(unused_imports)]
39496                use serde::de::Error;
39497                use std::option::Option::Some;
39498                let mut fields = std::collections::HashSet::new();
39499                let mut result = Self::Value::new();
39500                while let Some(tag) = map.next_key::<__FieldTag>()? {
39501                    #[allow(clippy::match_single_binding)]
39502                    match tag {
39503                        __FieldTag::__host => {
39504                            if !fields.insert(__FieldTag::__host) {
39505                                return std::result::Result::Err(A::Error::duplicate_field(
39506                                    "multiple values for host",
39507                                ));
39508                            }
39509                            result.host = map
39510                                .next_value::<std::option::Option<std::string::String>>()?
39511                                .unwrap_or_default();
39512                        }
39513                        __FieldTag::__instance => {
39514                            if !fields.insert(__FieldTag::__instance) {
39515                                return std::result::Result::Err(A::Error::duplicate_field(
39516                                    "multiple values for instance",
39517                                ));
39518                            }
39519                            result.instance = map
39520                                .next_value::<std::option::Option<std::string::String>>()?
39521                                .unwrap_or_default();
39522                        }
39523                        __FieldTag::__name => {
39524                            if !fields.insert(__FieldTag::__name) {
39525                                return std::result::Result::Err(A::Error::duplicate_field(
39526                                    "multiple values for name",
39527                                ));
39528                            }
39529                            result.name = map
39530                                .next_value::<std::option::Option<std::string::String>>()?
39531                                .unwrap_or_default();
39532                        }
39533                        __FieldTag::__project => {
39534                            if !fields.insert(__FieldTag::__project) {
39535                                return std::result::Result::Err(A::Error::duplicate_field(
39536                                    "multiple values for project",
39537                                ));
39538                            }
39539                            result.project = map
39540                                .next_value::<std::option::Option<std::string::String>>()?
39541                                .unwrap_or_default();
39542                        }
39543                        __FieldTag::Unknown(key) => {
39544                            let value = map.next_value::<serde_json::Value>()?;
39545                            result._unknown_fields.insert(key, value);
39546                        }
39547                    }
39548                }
39549                std::result::Result::Ok(result)
39550            }
39551        }
39552        deserializer.deserialize_any(Visitor)
39553    }
39554}
39555
39556#[doc(hidden)]
39557impl serde::ser::Serialize for SqlUsersDeleteRequest {
39558    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
39559    where
39560        S: serde::ser::Serializer,
39561    {
39562        use serde::ser::SerializeMap;
39563        #[allow(unused_imports)]
39564        use std::option::Option::Some;
39565        let mut state = serializer.serialize_map(std::option::Option::None)?;
39566        if !self.host.is_empty() {
39567            state.serialize_entry("host", &self.host)?;
39568        }
39569        if !self.instance.is_empty() {
39570            state.serialize_entry("instance", &self.instance)?;
39571        }
39572        if !self.name.is_empty() {
39573            state.serialize_entry("name", &self.name)?;
39574        }
39575        if !self.project.is_empty() {
39576            state.serialize_entry("project", &self.project)?;
39577        }
39578        if !self._unknown_fields.is_empty() {
39579            for (key, value) in self._unknown_fields.iter() {
39580                state.serialize_entry(key, &value)?;
39581            }
39582        }
39583        state.end()
39584    }
39585}
39586
39587/// Request message for Users Get RPC
39588#[derive(Clone, Debug, Default, PartialEq)]
39589#[non_exhaustive]
39590pub struct SqlUsersGetRequest {
39591    /// Database instance ID. This does not include the project ID.
39592    pub instance: std::string::String,
39593
39594    /// User of the instance.
39595    pub name: std::string::String,
39596
39597    /// Project ID of the project that contains the instance.
39598    pub project: std::string::String,
39599
39600    /// Host of a user of the instance.
39601    pub host: std::string::String,
39602
39603    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
39604}
39605
39606impl SqlUsersGetRequest {
39607    pub fn new() -> Self {
39608        std::default::Default::default()
39609    }
39610
39611    /// Sets the value of [instance][crate::model::SqlUsersGetRequest::instance].
39612    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
39613        self.instance = v.into();
39614        self
39615    }
39616
39617    /// Sets the value of [name][crate::model::SqlUsersGetRequest::name].
39618    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
39619        self.name = v.into();
39620        self
39621    }
39622
39623    /// Sets the value of [project][crate::model::SqlUsersGetRequest::project].
39624    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
39625        self.project = v.into();
39626        self
39627    }
39628
39629    /// Sets the value of [host][crate::model::SqlUsersGetRequest::host].
39630    pub fn set_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
39631        self.host = v.into();
39632        self
39633    }
39634}
39635
39636impl wkt::message::Message for SqlUsersGetRequest {
39637    fn typename() -> &'static str {
39638        "type.googleapis.com/google.cloud.sql.v1.SqlUsersGetRequest"
39639    }
39640}
39641
39642#[doc(hidden)]
39643impl<'de> serde::de::Deserialize<'de> for SqlUsersGetRequest {
39644    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
39645    where
39646        D: serde::Deserializer<'de>,
39647    {
39648        #[allow(non_camel_case_types)]
39649        #[doc(hidden)]
39650        #[derive(PartialEq, Eq, Hash)]
39651        enum __FieldTag {
39652            __instance,
39653            __name,
39654            __project,
39655            __host,
39656            Unknown(std::string::String),
39657        }
39658        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
39659            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
39660            where
39661                D: serde::Deserializer<'de>,
39662            {
39663                struct Visitor;
39664                impl<'de> serde::de::Visitor<'de> for Visitor {
39665                    type Value = __FieldTag;
39666                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
39667                        formatter.write_str("a field name for SqlUsersGetRequest")
39668                    }
39669                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
39670                    where
39671                        E: serde::de::Error,
39672                    {
39673                        use std::result::Result::Ok;
39674                        use std::string::ToString;
39675                        match value {
39676                            "instance" => Ok(__FieldTag::__instance),
39677                            "name" => Ok(__FieldTag::__name),
39678                            "project" => Ok(__FieldTag::__project),
39679                            "host" => Ok(__FieldTag::__host),
39680                            _ => Ok(__FieldTag::Unknown(value.to_string())),
39681                        }
39682                    }
39683                }
39684                deserializer.deserialize_identifier(Visitor)
39685            }
39686        }
39687        struct Visitor;
39688        impl<'de> serde::de::Visitor<'de> for Visitor {
39689            type Value = SqlUsersGetRequest;
39690            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
39691                formatter.write_str("struct SqlUsersGetRequest")
39692            }
39693            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
39694            where
39695                A: serde::de::MapAccess<'de>,
39696            {
39697                #[allow(unused_imports)]
39698                use serde::de::Error;
39699                use std::option::Option::Some;
39700                let mut fields = std::collections::HashSet::new();
39701                let mut result = Self::Value::new();
39702                while let Some(tag) = map.next_key::<__FieldTag>()? {
39703                    #[allow(clippy::match_single_binding)]
39704                    match tag {
39705                        __FieldTag::__instance => {
39706                            if !fields.insert(__FieldTag::__instance) {
39707                                return std::result::Result::Err(A::Error::duplicate_field(
39708                                    "multiple values for instance",
39709                                ));
39710                            }
39711                            result.instance = map
39712                                .next_value::<std::option::Option<std::string::String>>()?
39713                                .unwrap_or_default();
39714                        }
39715                        __FieldTag::__name => {
39716                            if !fields.insert(__FieldTag::__name) {
39717                                return std::result::Result::Err(A::Error::duplicate_field(
39718                                    "multiple values for name",
39719                                ));
39720                            }
39721                            result.name = map
39722                                .next_value::<std::option::Option<std::string::String>>()?
39723                                .unwrap_or_default();
39724                        }
39725                        __FieldTag::__project => {
39726                            if !fields.insert(__FieldTag::__project) {
39727                                return std::result::Result::Err(A::Error::duplicate_field(
39728                                    "multiple values for project",
39729                                ));
39730                            }
39731                            result.project = map
39732                                .next_value::<std::option::Option<std::string::String>>()?
39733                                .unwrap_or_default();
39734                        }
39735                        __FieldTag::__host => {
39736                            if !fields.insert(__FieldTag::__host) {
39737                                return std::result::Result::Err(A::Error::duplicate_field(
39738                                    "multiple values for host",
39739                                ));
39740                            }
39741                            result.host = map
39742                                .next_value::<std::option::Option<std::string::String>>()?
39743                                .unwrap_or_default();
39744                        }
39745                        __FieldTag::Unknown(key) => {
39746                            let value = map.next_value::<serde_json::Value>()?;
39747                            result._unknown_fields.insert(key, value);
39748                        }
39749                    }
39750                }
39751                std::result::Result::Ok(result)
39752            }
39753        }
39754        deserializer.deserialize_any(Visitor)
39755    }
39756}
39757
39758#[doc(hidden)]
39759impl serde::ser::Serialize for SqlUsersGetRequest {
39760    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
39761    where
39762        S: serde::ser::Serializer,
39763    {
39764        use serde::ser::SerializeMap;
39765        #[allow(unused_imports)]
39766        use std::option::Option::Some;
39767        let mut state = serializer.serialize_map(std::option::Option::None)?;
39768        if !self.instance.is_empty() {
39769            state.serialize_entry("instance", &self.instance)?;
39770        }
39771        if !self.name.is_empty() {
39772            state.serialize_entry("name", &self.name)?;
39773        }
39774        if !self.project.is_empty() {
39775            state.serialize_entry("project", &self.project)?;
39776        }
39777        if !self.host.is_empty() {
39778            state.serialize_entry("host", &self.host)?;
39779        }
39780        if !self._unknown_fields.is_empty() {
39781            for (key, value) in self._unknown_fields.iter() {
39782                state.serialize_entry(key, &value)?;
39783            }
39784        }
39785        state.end()
39786    }
39787}
39788
39789#[derive(Clone, Debug, Default, PartialEq)]
39790#[non_exhaustive]
39791pub struct SqlUsersInsertRequest {
39792    /// Database instance ID. This does not include the project ID.
39793    pub instance: std::string::String,
39794
39795    /// Project ID of the project that contains the instance.
39796    pub project: std::string::String,
39797
39798    pub body: std::option::Option<crate::model::User>,
39799
39800    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
39801}
39802
39803impl SqlUsersInsertRequest {
39804    pub fn new() -> Self {
39805        std::default::Default::default()
39806    }
39807
39808    /// Sets the value of [instance][crate::model::SqlUsersInsertRequest::instance].
39809    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
39810        self.instance = v.into();
39811        self
39812    }
39813
39814    /// Sets the value of [project][crate::model::SqlUsersInsertRequest::project].
39815    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
39816        self.project = v.into();
39817        self
39818    }
39819
39820    /// Sets the value of [body][crate::model::SqlUsersInsertRequest::body].
39821    pub fn set_body<T>(mut self, v: T) -> Self
39822    where
39823        T: std::convert::Into<crate::model::User>,
39824    {
39825        self.body = std::option::Option::Some(v.into());
39826        self
39827    }
39828
39829    /// Sets or clears the value of [body][crate::model::SqlUsersInsertRequest::body].
39830    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
39831    where
39832        T: std::convert::Into<crate::model::User>,
39833    {
39834        self.body = v.map(|x| x.into());
39835        self
39836    }
39837}
39838
39839impl wkt::message::Message for SqlUsersInsertRequest {
39840    fn typename() -> &'static str {
39841        "type.googleapis.com/google.cloud.sql.v1.SqlUsersInsertRequest"
39842    }
39843}
39844
39845#[doc(hidden)]
39846impl<'de> serde::de::Deserialize<'de> for SqlUsersInsertRequest {
39847    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
39848    where
39849        D: serde::Deserializer<'de>,
39850    {
39851        #[allow(non_camel_case_types)]
39852        #[doc(hidden)]
39853        #[derive(PartialEq, Eq, Hash)]
39854        enum __FieldTag {
39855            __instance,
39856            __project,
39857            __body,
39858            Unknown(std::string::String),
39859        }
39860        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
39861            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
39862            where
39863                D: serde::Deserializer<'de>,
39864            {
39865                struct Visitor;
39866                impl<'de> serde::de::Visitor<'de> for Visitor {
39867                    type Value = __FieldTag;
39868                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
39869                        formatter.write_str("a field name for SqlUsersInsertRequest")
39870                    }
39871                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
39872                    where
39873                        E: serde::de::Error,
39874                    {
39875                        use std::result::Result::Ok;
39876                        use std::string::ToString;
39877                        match value {
39878                            "instance" => Ok(__FieldTag::__instance),
39879                            "project" => Ok(__FieldTag::__project),
39880                            "body" => Ok(__FieldTag::__body),
39881                            _ => Ok(__FieldTag::Unknown(value.to_string())),
39882                        }
39883                    }
39884                }
39885                deserializer.deserialize_identifier(Visitor)
39886            }
39887        }
39888        struct Visitor;
39889        impl<'de> serde::de::Visitor<'de> for Visitor {
39890            type Value = SqlUsersInsertRequest;
39891            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
39892                formatter.write_str("struct SqlUsersInsertRequest")
39893            }
39894            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
39895            where
39896                A: serde::de::MapAccess<'de>,
39897            {
39898                #[allow(unused_imports)]
39899                use serde::de::Error;
39900                use std::option::Option::Some;
39901                let mut fields = std::collections::HashSet::new();
39902                let mut result = Self::Value::new();
39903                while let Some(tag) = map.next_key::<__FieldTag>()? {
39904                    #[allow(clippy::match_single_binding)]
39905                    match tag {
39906                        __FieldTag::__instance => {
39907                            if !fields.insert(__FieldTag::__instance) {
39908                                return std::result::Result::Err(A::Error::duplicate_field(
39909                                    "multiple values for instance",
39910                                ));
39911                            }
39912                            result.instance = map
39913                                .next_value::<std::option::Option<std::string::String>>()?
39914                                .unwrap_or_default();
39915                        }
39916                        __FieldTag::__project => {
39917                            if !fields.insert(__FieldTag::__project) {
39918                                return std::result::Result::Err(A::Error::duplicate_field(
39919                                    "multiple values for project",
39920                                ));
39921                            }
39922                            result.project = map
39923                                .next_value::<std::option::Option<std::string::String>>()?
39924                                .unwrap_or_default();
39925                        }
39926                        __FieldTag::__body => {
39927                            if !fields.insert(__FieldTag::__body) {
39928                                return std::result::Result::Err(A::Error::duplicate_field(
39929                                    "multiple values for body",
39930                                ));
39931                            }
39932                            result.body =
39933                                map.next_value::<std::option::Option<crate::model::User>>()?;
39934                        }
39935                        __FieldTag::Unknown(key) => {
39936                            let value = map.next_value::<serde_json::Value>()?;
39937                            result._unknown_fields.insert(key, value);
39938                        }
39939                    }
39940                }
39941                std::result::Result::Ok(result)
39942            }
39943        }
39944        deserializer.deserialize_any(Visitor)
39945    }
39946}
39947
39948#[doc(hidden)]
39949impl serde::ser::Serialize for SqlUsersInsertRequest {
39950    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
39951    where
39952        S: serde::ser::Serializer,
39953    {
39954        use serde::ser::SerializeMap;
39955        #[allow(unused_imports)]
39956        use std::option::Option::Some;
39957        let mut state = serializer.serialize_map(std::option::Option::None)?;
39958        if !self.instance.is_empty() {
39959            state.serialize_entry("instance", &self.instance)?;
39960        }
39961        if !self.project.is_empty() {
39962            state.serialize_entry("project", &self.project)?;
39963        }
39964        if self.body.is_some() {
39965            state.serialize_entry("body", &self.body)?;
39966        }
39967        if !self._unknown_fields.is_empty() {
39968            for (key, value) in self._unknown_fields.iter() {
39969                state.serialize_entry(key, &value)?;
39970            }
39971        }
39972        state.end()
39973    }
39974}
39975
39976#[derive(Clone, Debug, Default, PartialEq)]
39977#[non_exhaustive]
39978pub struct SqlUsersListRequest {
39979    /// Database instance ID. This does not include the project ID.
39980    pub instance: std::string::String,
39981
39982    /// Project ID of the project that contains the instance.
39983    pub project: std::string::String,
39984
39985    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
39986}
39987
39988impl SqlUsersListRequest {
39989    pub fn new() -> Self {
39990        std::default::Default::default()
39991    }
39992
39993    /// Sets the value of [instance][crate::model::SqlUsersListRequest::instance].
39994    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
39995        self.instance = v.into();
39996        self
39997    }
39998
39999    /// Sets the value of [project][crate::model::SqlUsersListRequest::project].
40000    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
40001        self.project = v.into();
40002        self
40003    }
40004}
40005
40006impl wkt::message::Message for SqlUsersListRequest {
40007    fn typename() -> &'static str {
40008        "type.googleapis.com/google.cloud.sql.v1.SqlUsersListRequest"
40009    }
40010}
40011
40012#[doc(hidden)]
40013impl<'de> serde::de::Deserialize<'de> for SqlUsersListRequest {
40014    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
40015    where
40016        D: serde::Deserializer<'de>,
40017    {
40018        #[allow(non_camel_case_types)]
40019        #[doc(hidden)]
40020        #[derive(PartialEq, Eq, Hash)]
40021        enum __FieldTag {
40022            __instance,
40023            __project,
40024            Unknown(std::string::String),
40025        }
40026        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
40027            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
40028            where
40029                D: serde::Deserializer<'de>,
40030            {
40031                struct Visitor;
40032                impl<'de> serde::de::Visitor<'de> for Visitor {
40033                    type Value = __FieldTag;
40034                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
40035                        formatter.write_str("a field name for SqlUsersListRequest")
40036                    }
40037                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
40038                    where
40039                        E: serde::de::Error,
40040                    {
40041                        use std::result::Result::Ok;
40042                        use std::string::ToString;
40043                        match value {
40044                            "instance" => Ok(__FieldTag::__instance),
40045                            "project" => Ok(__FieldTag::__project),
40046                            _ => Ok(__FieldTag::Unknown(value.to_string())),
40047                        }
40048                    }
40049                }
40050                deserializer.deserialize_identifier(Visitor)
40051            }
40052        }
40053        struct Visitor;
40054        impl<'de> serde::de::Visitor<'de> for Visitor {
40055            type Value = SqlUsersListRequest;
40056            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
40057                formatter.write_str("struct SqlUsersListRequest")
40058            }
40059            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
40060            where
40061                A: serde::de::MapAccess<'de>,
40062            {
40063                #[allow(unused_imports)]
40064                use serde::de::Error;
40065                use std::option::Option::Some;
40066                let mut fields = std::collections::HashSet::new();
40067                let mut result = Self::Value::new();
40068                while let Some(tag) = map.next_key::<__FieldTag>()? {
40069                    #[allow(clippy::match_single_binding)]
40070                    match tag {
40071                        __FieldTag::__instance => {
40072                            if !fields.insert(__FieldTag::__instance) {
40073                                return std::result::Result::Err(A::Error::duplicate_field(
40074                                    "multiple values for instance",
40075                                ));
40076                            }
40077                            result.instance = map
40078                                .next_value::<std::option::Option<std::string::String>>()?
40079                                .unwrap_or_default();
40080                        }
40081                        __FieldTag::__project => {
40082                            if !fields.insert(__FieldTag::__project) {
40083                                return std::result::Result::Err(A::Error::duplicate_field(
40084                                    "multiple values for project",
40085                                ));
40086                            }
40087                            result.project = map
40088                                .next_value::<std::option::Option<std::string::String>>()?
40089                                .unwrap_or_default();
40090                        }
40091                        __FieldTag::Unknown(key) => {
40092                            let value = map.next_value::<serde_json::Value>()?;
40093                            result._unknown_fields.insert(key, value);
40094                        }
40095                    }
40096                }
40097                std::result::Result::Ok(result)
40098            }
40099        }
40100        deserializer.deserialize_any(Visitor)
40101    }
40102}
40103
40104#[doc(hidden)]
40105impl serde::ser::Serialize for SqlUsersListRequest {
40106    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
40107    where
40108        S: serde::ser::Serializer,
40109    {
40110        use serde::ser::SerializeMap;
40111        #[allow(unused_imports)]
40112        use std::option::Option::Some;
40113        let mut state = serializer.serialize_map(std::option::Option::None)?;
40114        if !self.instance.is_empty() {
40115            state.serialize_entry("instance", &self.instance)?;
40116        }
40117        if !self.project.is_empty() {
40118            state.serialize_entry("project", &self.project)?;
40119        }
40120        if !self._unknown_fields.is_empty() {
40121            for (key, value) in self._unknown_fields.iter() {
40122                state.serialize_entry(key, &value)?;
40123            }
40124        }
40125        state.end()
40126    }
40127}
40128
40129#[derive(Clone, Debug, Default, PartialEq)]
40130#[non_exhaustive]
40131pub struct SqlUsersUpdateRequest {
40132    /// Optional. Host of the user in the instance.
40133    pub host: std::string::String,
40134
40135    /// Database instance ID. This does not include the project ID.
40136    pub instance: std::string::String,
40137
40138    /// Name of the user in the instance.
40139    pub name: std::string::String,
40140
40141    /// Project ID of the project that contains the instance.
40142    pub project: std::string::String,
40143
40144    pub body: std::option::Option<crate::model::User>,
40145
40146    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
40147}
40148
40149impl SqlUsersUpdateRequest {
40150    pub fn new() -> Self {
40151        std::default::Default::default()
40152    }
40153
40154    /// Sets the value of [host][crate::model::SqlUsersUpdateRequest::host].
40155    pub fn set_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
40156        self.host = v.into();
40157        self
40158    }
40159
40160    /// Sets the value of [instance][crate::model::SqlUsersUpdateRequest::instance].
40161    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
40162        self.instance = v.into();
40163        self
40164    }
40165
40166    /// Sets the value of [name][crate::model::SqlUsersUpdateRequest::name].
40167    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
40168        self.name = v.into();
40169        self
40170    }
40171
40172    /// Sets the value of [project][crate::model::SqlUsersUpdateRequest::project].
40173    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
40174        self.project = v.into();
40175        self
40176    }
40177
40178    /// Sets the value of [body][crate::model::SqlUsersUpdateRequest::body].
40179    pub fn set_body<T>(mut self, v: T) -> Self
40180    where
40181        T: std::convert::Into<crate::model::User>,
40182    {
40183        self.body = std::option::Option::Some(v.into());
40184        self
40185    }
40186
40187    /// Sets or clears the value of [body][crate::model::SqlUsersUpdateRequest::body].
40188    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
40189    where
40190        T: std::convert::Into<crate::model::User>,
40191    {
40192        self.body = v.map(|x| x.into());
40193        self
40194    }
40195}
40196
40197impl wkt::message::Message for SqlUsersUpdateRequest {
40198    fn typename() -> &'static str {
40199        "type.googleapis.com/google.cloud.sql.v1.SqlUsersUpdateRequest"
40200    }
40201}
40202
40203#[doc(hidden)]
40204impl<'de> serde::de::Deserialize<'de> for SqlUsersUpdateRequest {
40205    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
40206    where
40207        D: serde::Deserializer<'de>,
40208    {
40209        #[allow(non_camel_case_types)]
40210        #[doc(hidden)]
40211        #[derive(PartialEq, Eq, Hash)]
40212        enum __FieldTag {
40213            __host,
40214            __instance,
40215            __name,
40216            __project,
40217            __body,
40218            Unknown(std::string::String),
40219        }
40220        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
40221            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
40222            where
40223                D: serde::Deserializer<'de>,
40224            {
40225                struct Visitor;
40226                impl<'de> serde::de::Visitor<'de> for Visitor {
40227                    type Value = __FieldTag;
40228                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
40229                        formatter.write_str("a field name for SqlUsersUpdateRequest")
40230                    }
40231                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
40232                    where
40233                        E: serde::de::Error,
40234                    {
40235                        use std::result::Result::Ok;
40236                        use std::string::ToString;
40237                        match value {
40238                            "host" => Ok(__FieldTag::__host),
40239                            "instance" => Ok(__FieldTag::__instance),
40240                            "name" => Ok(__FieldTag::__name),
40241                            "project" => Ok(__FieldTag::__project),
40242                            "body" => Ok(__FieldTag::__body),
40243                            _ => Ok(__FieldTag::Unknown(value.to_string())),
40244                        }
40245                    }
40246                }
40247                deserializer.deserialize_identifier(Visitor)
40248            }
40249        }
40250        struct Visitor;
40251        impl<'de> serde::de::Visitor<'de> for Visitor {
40252            type Value = SqlUsersUpdateRequest;
40253            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
40254                formatter.write_str("struct SqlUsersUpdateRequest")
40255            }
40256            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
40257            where
40258                A: serde::de::MapAccess<'de>,
40259            {
40260                #[allow(unused_imports)]
40261                use serde::de::Error;
40262                use std::option::Option::Some;
40263                let mut fields = std::collections::HashSet::new();
40264                let mut result = Self::Value::new();
40265                while let Some(tag) = map.next_key::<__FieldTag>()? {
40266                    #[allow(clippy::match_single_binding)]
40267                    match tag {
40268                        __FieldTag::__host => {
40269                            if !fields.insert(__FieldTag::__host) {
40270                                return std::result::Result::Err(A::Error::duplicate_field(
40271                                    "multiple values for host",
40272                                ));
40273                            }
40274                            result.host = map
40275                                .next_value::<std::option::Option<std::string::String>>()?
40276                                .unwrap_or_default();
40277                        }
40278                        __FieldTag::__instance => {
40279                            if !fields.insert(__FieldTag::__instance) {
40280                                return std::result::Result::Err(A::Error::duplicate_field(
40281                                    "multiple values for instance",
40282                                ));
40283                            }
40284                            result.instance = map
40285                                .next_value::<std::option::Option<std::string::String>>()?
40286                                .unwrap_or_default();
40287                        }
40288                        __FieldTag::__name => {
40289                            if !fields.insert(__FieldTag::__name) {
40290                                return std::result::Result::Err(A::Error::duplicate_field(
40291                                    "multiple values for name",
40292                                ));
40293                            }
40294                            result.name = map
40295                                .next_value::<std::option::Option<std::string::String>>()?
40296                                .unwrap_or_default();
40297                        }
40298                        __FieldTag::__project => {
40299                            if !fields.insert(__FieldTag::__project) {
40300                                return std::result::Result::Err(A::Error::duplicate_field(
40301                                    "multiple values for project",
40302                                ));
40303                            }
40304                            result.project = map
40305                                .next_value::<std::option::Option<std::string::String>>()?
40306                                .unwrap_or_default();
40307                        }
40308                        __FieldTag::__body => {
40309                            if !fields.insert(__FieldTag::__body) {
40310                                return std::result::Result::Err(A::Error::duplicate_field(
40311                                    "multiple values for body",
40312                                ));
40313                            }
40314                            result.body =
40315                                map.next_value::<std::option::Option<crate::model::User>>()?;
40316                        }
40317                        __FieldTag::Unknown(key) => {
40318                            let value = map.next_value::<serde_json::Value>()?;
40319                            result._unknown_fields.insert(key, value);
40320                        }
40321                    }
40322                }
40323                std::result::Result::Ok(result)
40324            }
40325        }
40326        deserializer.deserialize_any(Visitor)
40327    }
40328}
40329
40330#[doc(hidden)]
40331impl serde::ser::Serialize for SqlUsersUpdateRequest {
40332    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
40333    where
40334        S: serde::ser::Serializer,
40335    {
40336        use serde::ser::SerializeMap;
40337        #[allow(unused_imports)]
40338        use std::option::Option::Some;
40339        let mut state = serializer.serialize_map(std::option::Option::None)?;
40340        if !self.host.is_empty() {
40341            state.serialize_entry("host", &self.host)?;
40342        }
40343        if !self.instance.is_empty() {
40344            state.serialize_entry("instance", &self.instance)?;
40345        }
40346        if !self.name.is_empty() {
40347            state.serialize_entry("name", &self.name)?;
40348        }
40349        if !self.project.is_empty() {
40350            state.serialize_entry("project", &self.project)?;
40351        }
40352        if self.body.is_some() {
40353            state.serialize_entry("body", &self.body)?;
40354        }
40355        if !self._unknown_fields.is_empty() {
40356            for (key, value) in self._unknown_fields.iter() {
40357                state.serialize_entry(key, &value)?;
40358            }
40359        }
40360        state.end()
40361    }
40362}
40363
40364/// User level password validation policy.
40365#[derive(Clone, Debug, Default, PartialEq)]
40366#[non_exhaustive]
40367pub struct UserPasswordValidationPolicy {
40368    /// Number of failed login attempts allowed before user get locked.
40369    pub allowed_failed_attempts: i32,
40370
40371    /// Expiration duration after password is updated.
40372    pub password_expiration_duration: std::option::Option<wkt::Duration>,
40373
40374    /// If true, failed login attempts check will be enabled.
40375    pub enable_failed_attempts_check: bool,
40376
40377    /// Output only. Read-only password status.
40378    pub status: std::option::Option<crate::model::PasswordStatus>,
40379
40380    /// If true, the user must specify the current password before changing the
40381    /// password. This flag is supported only for MySQL.
40382    pub enable_password_verification: bool,
40383
40384    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
40385}
40386
40387impl UserPasswordValidationPolicy {
40388    pub fn new() -> Self {
40389        std::default::Default::default()
40390    }
40391
40392    /// Sets the value of [allowed_failed_attempts][crate::model::UserPasswordValidationPolicy::allowed_failed_attempts].
40393    pub fn set_allowed_failed_attempts<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
40394        self.allowed_failed_attempts = v.into();
40395        self
40396    }
40397
40398    /// Sets the value of [password_expiration_duration][crate::model::UserPasswordValidationPolicy::password_expiration_duration].
40399    pub fn set_password_expiration_duration<T>(mut self, v: T) -> Self
40400    where
40401        T: std::convert::Into<wkt::Duration>,
40402    {
40403        self.password_expiration_duration = std::option::Option::Some(v.into());
40404        self
40405    }
40406
40407    /// Sets or clears the value of [password_expiration_duration][crate::model::UserPasswordValidationPolicy::password_expiration_duration].
40408    pub fn set_or_clear_password_expiration_duration<T>(mut self, v: std::option::Option<T>) -> Self
40409    where
40410        T: std::convert::Into<wkt::Duration>,
40411    {
40412        self.password_expiration_duration = v.map(|x| x.into());
40413        self
40414    }
40415
40416    /// Sets the value of [enable_failed_attempts_check][crate::model::UserPasswordValidationPolicy::enable_failed_attempts_check].
40417    pub fn set_enable_failed_attempts_check<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
40418        self.enable_failed_attempts_check = v.into();
40419        self
40420    }
40421
40422    /// Sets the value of [status][crate::model::UserPasswordValidationPolicy::status].
40423    pub fn set_status<T>(mut self, v: T) -> Self
40424    where
40425        T: std::convert::Into<crate::model::PasswordStatus>,
40426    {
40427        self.status = std::option::Option::Some(v.into());
40428        self
40429    }
40430
40431    /// Sets or clears the value of [status][crate::model::UserPasswordValidationPolicy::status].
40432    pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
40433    where
40434        T: std::convert::Into<crate::model::PasswordStatus>,
40435    {
40436        self.status = v.map(|x| x.into());
40437        self
40438    }
40439
40440    /// Sets the value of [enable_password_verification][crate::model::UserPasswordValidationPolicy::enable_password_verification].
40441    pub fn set_enable_password_verification<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
40442        self.enable_password_verification = v.into();
40443        self
40444    }
40445}
40446
40447impl wkt::message::Message for UserPasswordValidationPolicy {
40448    fn typename() -> &'static str {
40449        "type.googleapis.com/google.cloud.sql.v1.UserPasswordValidationPolicy"
40450    }
40451}
40452
40453#[doc(hidden)]
40454impl<'de> serde::de::Deserialize<'de> for UserPasswordValidationPolicy {
40455    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
40456    where
40457        D: serde::Deserializer<'de>,
40458    {
40459        #[allow(non_camel_case_types)]
40460        #[doc(hidden)]
40461        #[derive(PartialEq, Eq, Hash)]
40462        enum __FieldTag {
40463            __allowed_failed_attempts,
40464            __password_expiration_duration,
40465            __enable_failed_attempts_check,
40466            __status,
40467            __enable_password_verification,
40468            Unknown(std::string::String),
40469        }
40470        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
40471            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
40472            where
40473                D: serde::Deserializer<'de>,
40474            {
40475                struct Visitor;
40476                impl<'de> serde::de::Visitor<'de> for Visitor {
40477                    type Value = __FieldTag;
40478                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
40479                        formatter.write_str("a field name for UserPasswordValidationPolicy")
40480                    }
40481                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
40482                    where
40483                        E: serde::de::Error,
40484                    {
40485                        use std::result::Result::Ok;
40486                        use std::string::ToString;
40487                        match value {
40488                            "allowedFailedAttempts" => Ok(__FieldTag::__allowed_failed_attempts),
40489                            "allowed_failed_attempts" => Ok(__FieldTag::__allowed_failed_attempts),
40490                            "passwordExpirationDuration" => {
40491                                Ok(__FieldTag::__password_expiration_duration)
40492                            }
40493                            "password_expiration_duration" => {
40494                                Ok(__FieldTag::__password_expiration_duration)
40495                            }
40496                            "enableFailedAttemptsCheck" => {
40497                                Ok(__FieldTag::__enable_failed_attempts_check)
40498                            }
40499                            "enable_failed_attempts_check" => {
40500                                Ok(__FieldTag::__enable_failed_attempts_check)
40501                            }
40502                            "status" => Ok(__FieldTag::__status),
40503                            "enablePasswordVerification" => {
40504                                Ok(__FieldTag::__enable_password_verification)
40505                            }
40506                            "enable_password_verification" => {
40507                                Ok(__FieldTag::__enable_password_verification)
40508                            }
40509                            _ => Ok(__FieldTag::Unknown(value.to_string())),
40510                        }
40511                    }
40512                }
40513                deserializer.deserialize_identifier(Visitor)
40514            }
40515        }
40516        struct Visitor;
40517        impl<'de> serde::de::Visitor<'de> for Visitor {
40518            type Value = UserPasswordValidationPolicy;
40519            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
40520                formatter.write_str("struct UserPasswordValidationPolicy")
40521            }
40522            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
40523            where
40524                A: serde::de::MapAccess<'de>,
40525            {
40526                #[allow(unused_imports)]
40527                use serde::de::Error;
40528                use std::option::Option::Some;
40529                let mut fields = std::collections::HashSet::new();
40530                let mut result = Self::Value::new();
40531                while let Some(tag) = map.next_key::<__FieldTag>()? {
40532                    #[allow(clippy::match_single_binding)]
40533                    match tag {
40534                        __FieldTag::__allowed_failed_attempts => {
40535                            if !fields.insert(__FieldTag::__allowed_failed_attempts) {
40536                                return std::result::Result::Err(A::Error::duplicate_field(
40537                                    "multiple values for allowed_failed_attempts",
40538                                ));
40539                            }
40540                            struct __With(std::option::Option<i32>);
40541                            impl<'de> serde::de::Deserialize<'de> for __With {
40542                                fn deserialize<D>(
40543                                    deserializer: D,
40544                                ) -> std::result::Result<Self, D::Error>
40545                                where
40546                                    D: serde::de::Deserializer<'de>,
40547                                {
40548                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
40549                                }
40550                            }
40551                            result.allowed_failed_attempts =
40552                                map.next_value::<__With>()?.0.unwrap_or_default();
40553                        }
40554                        __FieldTag::__password_expiration_duration => {
40555                            if !fields.insert(__FieldTag::__password_expiration_duration) {
40556                                return std::result::Result::Err(A::Error::duplicate_field(
40557                                    "multiple values for password_expiration_duration",
40558                                ));
40559                            }
40560                            result.password_expiration_duration =
40561                                map.next_value::<std::option::Option<wkt::Duration>>()?;
40562                        }
40563                        __FieldTag::__enable_failed_attempts_check => {
40564                            if !fields.insert(__FieldTag::__enable_failed_attempts_check) {
40565                                return std::result::Result::Err(A::Error::duplicate_field(
40566                                    "multiple values for enable_failed_attempts_check",
40567                                ));
40568                            }
40569                            result.enable_failed_attempts_check = map
40570                                .next_value::<std::option::Option<bool>>()?
40571                                .unwrap_or_default();
40572                        }
40573                        __FieldTag::__status => {
40574                            if !fields.insert(__FieldTag::__status) {
40575                                return std::result::Result::Err(A::Error::duplicate_field(
40576                                    "multiple values for status",
40577                                ));
40578                            }
40579                            result.status = map
40580                                .next_value::<std::option::Option<crate::model::PasswordStatus>>(
40581                                )?;
40582                        }
40583                        __FieldTag::__enable_password_verification => {
40584                            if !fields.insert(__FieldTag::__enable_password_verification) {
40585                                return std::result::Result::Err(A::Error::duplicate_field(
40586                                    "multiple values for enable_password_verification",
40587                                ));
40588                            }
40589                            result.enable_password_verification = map
40590                                .next_value::<std::option::Option<bool>>()?
40591                                .unwrap_or_default();
40592                        }
40593                        __FieldTag::Unknown(key) => {
40594                            let value = map.next_value::<serde_json::Value>()?;
40595                            result._unknown_fields.insert(key, value);
40596                        }
40597                    }
40598                }
40599                std::result::Result::Ok(result)
40600            }
40601        }
40602        deserializer.deserialize_any(Visitor)
40603    }
40604}
40605
40606#[doc(hidden)]
40607impl serde::ser::Serialize for UserPasswordValidationPolicy {
40608    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
40609    where
40610        S: serde::ser::Serializer,
40611    {
40612        use serde::ser::SerializeMap;
40613        #[allow(unused_imports)]
40614        use std::option::Option::Some;
40615        let mut state = serializer.serialize_map(std::option::Option::None)?;
40616        if !wkt::internal::is_default(&self.allowed_failed_attempts) {
40617            struct __With<'a>(&'a i32);
40618            impl<'a> serde::ser::Serialize for __With<'a> {
40619                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
40620                where
40621                    S: serde::ser::Serializer,
40622                {
40623                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
40624                }
40625            }
40626            state.serialize_entry(
40627                "allowedFailedAttempts",
40628                &__With(&self.allowed_failed_attempts),
40629            )?;
40630        }
40631        if self.password_expiration_duration.is_some() {
40632            state.serialize_entry(
40633                "passwordExpirationDuration",
40634                &self.password_expiration_duration,
40635            )?;
40636        }
40637        if !wkt::internal::is_default(&self.enable_failed_attempts_check) {
40638            state.serialize_entry(
40639                "enableFailedAttemptsCheck",
40640                &self.enable_failed_attempts_check,
40641            )?;
40642        }
40643        if self.status.is_some() {
40644            state.serialize_entry("status", &self.status)?;
40645        }
40646        if !wkt::internal::is_default(&self.enable_password_verification) {
40647            state.serialize_entry(
40648                "enablePasswordVerification",
40649                &self.enable_password_verification,
40650            )?;
40651        }
40652        if !self._unknown_fields.is_empty() {
40653            for (key, value) in self._unknown_fields.iter() {
40654                state.serialize_entry(key, &value)?;
40655            }
40656        }
40657        state.end()
40658    }
40659}
40660
40661/// Read-only password status.
40662#[derive(Clone, Debug, Default, PartialEq)]
40663#[non_exhaustive]
40664pub struct PasswordStatus {
40665    /// If true, user does not have login privileges.
40666    pub locked: bool,
40667
40668    /// The expiration time of the current password.
40669    pub password_expiration_time: std::option::Option<wkt::Timestamp>,
40670
40671    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
40672}
40673
40674impl PasswordStatus {
40675    pub fn new() -> Self {
40676        std::default::Default::default()
40677    }
40678
40679    /// Sets the value of [locked][crate::model::PasswordStatus::locked].
40680    pub fn set_locked<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
40681        self.locked = v.into();
40682        self
40683    }
40684
40685    /// Sets the value of [password_expiration_time][crate::model::PasswordStatus::password_expiration_time].
40686    pub fn set_password_expiration_time<T>(mut self, v: T) -> Self
40687    where
40688        T: std::convert::Into<wkt::Timestamp>,
40689    {
40690        self.password_expiration_time = std::option::Option::Some(v.into());
40691        self
40692    }
40693
40694    /// Sets or clears the value of [password_expiration_time][crate::model::PasswordStatus::password_expiration_time].
40695    pub fn set_or_clear_password_expiration_time<T>(mut self, v: std::option::Option<T>) -> Self
40696    where
40697        T: std::convert::Into<wkt::Timestamp>,
40698    {
40699        self.password_expiration_time = v.map(|x| x.into());
40700        self
40701    }
40702}
40703
40704impl wkt::message::Message for PasswordStatus {
40705    fn typename() -> &'static str {
40706        "type.googleapis.com/google.cloud.sql.v1.PasswordStatus"
40707    }
40708}
40709
40710#[doc(hidden)]
40711impl<'de> serde::de::Deserialize<'de> for PasswordStatus {
40712    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
40713    where
40714        D: serde::Deserializer<'de>,
40715    {
40716        #[allow(non_camel_case_types)]
40717        #[doc(hidden)]
40718        #[derive(PartialEq, Eq, Hash)]
40719        enum __FieldTag {
40720            __locked,
40721            __password_expiration_time,
40722            Unknown(std::string::String),
40723        }
40724        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
40725            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
40726            where
40727                D: serde::Deserializer<'de>,
40728            {
40729                struct Visitor;
40730                impl<'de> serde::de::Visitor<'de> for Visitor {
40731                    type Value = __FieldTag;
40732                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
40733                        formatter.write_str("a field name for PasswordStatus")
40734                    }
40735                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
40736                    where
40737                        E: serde::de::Error,
40738                    {
40739                        use std::result::Result::Ok;
40740                        use std::string::ToString;
40741                        match value {
40742                            "locked" => Ok(__FieldTag::__locked),
40743                            "passwordExpirationTime" => Ok(__FieldTag::__password_expiration_time),
40744                            "password_expiration_time" => {
40745                                Ok(__FieldTag::__password_expiration_time)
40746                            }
40747                            _ => Ok(__FieldTag::Unknown(value.to_string())),
40748                        }
40749                    }
40750                }
40751                deserializer.deserialize_identifier(Visitor)
40752            }
40753        }
40754        struct Visitor;
40755        impl<'de> serde::de::Visitor<'de> for Visitor {
40756            type Value = PasswordStatus;
40757            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
40758                formatter.write_str("struct PasswordStatus")
40759            }
40760            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
40761            where
40762                A: serde::de::MapAccess<'de>,
40763            {
40764                #[allow(unused_imports)]
40765                use serde::de::Error;
40766                use std::option::Option::Some;
40767                let mut fields = std::collections::HashSet::new();
40768                let mut result = Self::Value::new();
40769                while let Some(tag) = map.next_key::<__FieldTag>()? {
40770                    #[allow(clippy::match_single_binding)]
40771                    match tag {
40772                        __FieldTag::__locked => {
40773                            if !fields.insert(__FieldTag::__locked) {
40774                                return std::result::Result::Err(A::Error::duplicate_field(
40775                                    "multiple values for locked",
40776                                ));
40777                            }
40778                            result.locked = map
40779                                .next_value::<std::option::Option<bool>>()?
40780                                .unwrap_or_default();
40781                        }
40782                        __FieldTag::__password_expiration_time => {
40783                            if !fields.insert(__FieldTag::__password_expiration_time) {
40784                                return std::result::Result::Err(A::Error::duplicate_field(
40785                                    "multiple values for password_expiration_time",
40786                                ));
40787                            }
40788                            result.password_expiration_time =
40789                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
40790                        }
40791                        __FieldTag::Unknown(key) => {
40792                            let value = map.next_value::<serde_json::Value>()?;
40793                            result._unknown_fields.insert(key, value);
40794                        }
40795                    }
40796                }
40797                std::result::Result::Ok(result)
40798            }
40799        }
40800        deserializer.deserialize_any(Visitor)
40801    }
40802}
40803
40804#[doc(hidden)]
40805impl serde::ser::Serialize for PasswordStatus {
40806    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
40807    where
40808        S: serde::ser::Serializer,
40809    {
40810        use serde::ser::SerializeMap;
40811        #[allow(unused_imports)]
40812        use std::option::Option::Some;
40813        let mut state = serializer.serialize_map(std::option::Option::None)?;
40814        if !wkt::internal::is_default(&self.locked) {
40815            state.serialize_entry("locked", &self.locked)?;
40816        }
40817        if self.password_expiration_time.is_some() {
40818            state.serialize_entry("passwordExpirationTime", &self.password_expiration_time)?;
40819        }
40820        if !self._unknown_fields.is_empty() {
40821            for (key, value) in self._unknown_fields.iter() {
40822                state.serialize_entry(key, &value)?;
40823            }
40824        }
40825        state.end()
40826    }
40827}
40828
40829/// A Cloud SQL user resource.
40830#[derive(Clone, Debug, Default, PartialEq)]
40831#[non_exhaustive]
40832pub struct User {
40833    /// This is always `sql#user`.
40834    pub kind: std::string::String,
40835
40836    /// The password for the user.
40837    pub password: std::string::String,
40838
40839    /// This field is deprecated and will be removed from a future version of the
40840    /// API.
40841    pub etag: std::string::String,
40842
40843    /// The name of the user in the Cloud SQL instance. Can be omitted for
40844    /// `update` because it is already specified in the URL.
40845    pub name: std::string::String,
40846
40847    /// Optional. The host from which the user can connect. For `insert`
40848    /// operations, host defaults to an empty string. For `update`
40849    /// operations, host is specified as part of the request URL. The host name
40850    /// cannot be updated after insertion.  For a MySQL instance, it's required;
40851    /// for a PostgreSQL or SQL Server instance, it's optional.
40852    pub host: std::string::String,
40853
40854    /// The name of the Cloud SQL instance. This does not include the project ID.
40855    /// Can be omitted for `update` because it is already specified on the
40856    /// URL.
40857    pub instance: std::string::String,
40858
40859    /// The project ID of the project containing the Cloud SQL database. The Google
40860    /// apps domain is prefixed if applicable. Can be omitted for `update` because
40861    /// it is already specified on the URL.
40862    pub project: std::string::String,
40863
40864    /// The user type. It determines the method to authenticate the user during
40865    /// login. The default is the database's built-in user type.
40866    pub r#type: crate::model::user::SqlUserType,
40867
40868    /// User level password validation policy.
40869    pub password_policy: std::option::Option<crate::model::UserPasswordValidationPolicy>,
40870
40871    /// Dual password status for the user.
40872    pub dual_password_type: std::option::Option<crate::model::user::DualPasswordType>,
40873
40874    /// User details for specific database type
40875    pub user_details: std::option::Option<crate::model::user::UserDetails>,
40876
40877    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
40878}
40879
40880impl User {
40881    pub fn new() -> Self {
40882        std::default::Default::default()
40883    }
40884
40885    /// Sets the value of [kind][crate::model::User::kind].
40886    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
40887        self.kind = v.into();
40888        self
40889    }
40890
40891    /// Sets the value of [password][crate::model::User::password].
40892    pub fn set_password<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
40893        self.password = v.into();
40894        self
40895    }
40896
40897    /// Sets the value of [etag][crate::model::User::etag].
40898    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
40899        self.etag = v.into();
40900        self
40901    }
40902
40903    /// Sets the value of [name][crate::model::User::name].
40904    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
40905        self.name = v.into();
40906        self
40907    }
40908
40909    /// Sets the value of [host][crate::model::User::host].
40910    pub fn set_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
40911        self.host = v.into();
40912        self
40913    }
40914
40915    /// Sets the value of [instance][crate::model::User::instance].
40916    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
40917        self.instance = v.into();
40918        self
40919    }
40920
40921    /// Sets the value of [project][crate::model::User::project].
40922    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
40923        self.project = v.into();
40924        self
40925    }
40926
40927    /// Sets the value of [r#type][crate::model::User::type].
40928    pub fn set_type<T: std::convert::Into<crate::model::user::SqlUserType>>(
40929        mut self,
40930        v: T,
40931    ) -> Self {
40932        self.r#type = v.into();
40933        self
40934    }
40935
40936    /// Sets the value of [password_policy][crate::model::User::password_policy].
40937    pub fn set_password_policy<T>(mut self, v: T) -> Self
40938    where
40939        T: std::convert::Into<crate::model::UserPasswordValidationPolicy>,
40940    {
40941        self.password_policy = std::option::Option::Some(v.into());
40942        self
40943    }
40944
40945    /// Sets or clears the value of [password_policy][crate::model::User::password_policy].
40946    pub fn set_or_clear_password_policy<T>(mut self, v: std::option::Option<T>) -> Self
40947    where
40948        T: std::convert::Into<crate::model::UserPasswordValidationPolicy>,
40949    {
40950        self.password_policy = v.map(|x| x.into());
40951        self
40952    }
40953
40954    /// Sets the value of [dual_password_type][crate::model::User::dual_password_type].
40955    pub fn set_dual_password_type<T>(mut self, v: T) -> Self
40956    where
40957        T: std::convert::Into<crate::model::user::DualPasswordType>,
40958    {
40959        self.dual_password_type = std::option::Option::Some(v.into());
40960        self
40961    }
40962
40963    /// Sets or clears the value of [dual_password_type][crate::model::User::dual_password_type].
40964    pub fn set_or_clear_dual_password_type<T>(mut self, v: std::option::Option<T>) -> Self
40965    where
40966        T: std::convert::Into<crate::model::user::DualPasswordType>,
40967    {
40968        self.dual_password_type = v.map(|x| x.into());
40969        self
40970    }
40971
40972    /// Sets the value of [user_details][crate::model::User::user_details].
40973    ///
40974    /// Note that all the setters affecting `user_details` are mutually
40975    /// exclusive.
40976    pub fn set_user_details<
40977        T: std::convert::Into<std::option::Option<crate::model::user::UserDetails>>,
40978    >(
40979        mut self,
40980        v: T,
40981    ) -> Self {
40982        self.user_details = v.into();
40983        self
40984    }
40985
40986    /// The value of [user_details][crate::model::User::user_details]
40987    /// if it holds a `SqlserverUserDetails`, `None` if the field is not set or
40988    /// holds a different branch.
40989    pub fn sqlserver_user_details(
40990        &self,
40991    ) -> std::option::Option<&std::boxed::Box<crate::model::SqlServerUserDetails>> {
40992        #[allow(unreachable_patterns)]
40993        self.user_details.as_ref().and_then(|v| match v {
40994            crate::model::user::UserDetails::SqlserverUserDetails(v) => {
40995                std::option::Option::Some(v)
40996            }
40997            _ => std::option::Option::None,
40998        })
40999    }
41000
41001    /// Sets the value of [user_details][crate::model::User::user_details]
41002    /// to hold a `SqlserverUserDetails`.
41003    ///
41004    /// Note that all the setters affecting `user_details` are
41005    /// mutually exclusive.
41006    pub fn set_sqlserver_user_details<
41007        T: std::convert::Into<std::boxed::Box<crate::model::SqlServerUserDetails>>,
41008    >(
41009        mut self,
41010        v: T,
41011    ) -> Self {
41012        self.user_details = std::option::Option::Some(
41013            crate::model::user::UserDetails::SqlserverUserDetails(v.into()),
41014        );
41015        self
41016    }
41017}
41018
41019impl wkt::message::Message for User {
41020    fn typename() -> &'static str {
41021        "type.googleapis.com/google.cloud.sql.v1.User"
41022    }
41023}
41024
41025#[doc(hidden)]
41026impl<'de> serde::de::Deserialize<'de> for User {
41027    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
41028    where
41029        D: serde::Deserializer<'de>,
41030    {
41031        #[allow(non_camel_case_types)]
41032        #[doc(hidden)]
41033        #[derive(PartialEq, Eq, Hash)]
41034        enum __FieldTag {
41035            __kind,
41036            __password,
41037            __etag,
41038            __name,
41039            __host,
41040            __instance,
41041            __project,
41042            __type,
41043            __sqlserver_user_details,
41044            __password_policy,
41045            __dual_password_type,
41046            Unknown(std::string::String),
41047        }
41048        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
41049            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
41050            where
41051                D: serde::Deserializer<'de>,
41052            {
41053                struct Visitor;
41054                impl<'de> serde::de::Visitor<'de> for Visitor {
41055                    type Value = __FieldTag;
41056                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
41057                        formatter.write_str("a field name for User")
41058                    }
41059                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
41060                    where
41061                        E: serde::de::Error,
41062                    {
41063                        use std::result::Result::Ok;
41064                        use std::string::ToString;
41065                        match value {
41066                            "kind" => Ok(__FieldTag::__kind),
41067                            "password" => Ok(__FieldTag::__password),
41068                            "etag" => Ok(__FieldTag::__etag),
41069                            "name" => Ok(__FieldTag::__name),
41070                            "host" => Ok(__FieldTag::__host),
41071                            "instance" => Ok(__FieldTag::__instance),
41072                            "project" => Ok(__FieldTag::__project),
41073                            "type" => Ok(__FieldTag::__type),
41074                            "sqlserverUserDetails" => Ok(__FieldTag::__sqlserver_user_details),
41075                            "sqlserver_user_details" => Ok(__FieldTag::__sqlserver_user_details),
41076                            "passwordPolicy" => Ok(__FieldTag::__password_policy),
41077                            "password_policy" => Ok(__FieldTag::__password_policy),
41078                            "dualPasswordType" => Ok(__FieldTag::__dual_password_type),
41079                            "dual_password_type" => Ok(__FieldTag::__dual_password_type),
41080                            _ => Ok(__FieldTag::Unknown(value.to_string())),
41081                        }
41082                    }
41083                }
41084                deserializer.deserialize_identifier(Visitor)
41085            }
41086        }
41087        struct Visitor;
41088        impl<'de> serde::de::Visitor<'de> for Visitor {
41089            type Value = User;
41090            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
41091                formatter.write_str("struct User")
41092            }
41093            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
41094            where
41095                A: serde::de::MapAccess<'de>,
41096            {
41097                #[allow(unused_imports)]
41098                use serde::de::Error;
41099                use std::option::Option::Some;
41100                let mut fields = std::collections::HashSet::new();
41101                let mut result = Self::Value::new();
41102                while let Some(tag) = map.next_key::<__FieldTag>()? {
41103                    #[allow(clippy::match_single_binding)]
41104                    match tag {
41105                        __FieldTag::__kind => {
41106                            if !fields.insert(__FieldTag::__kind) {
41107                                return std::result::Result::Err(A::Error::duplicate_field(
41108                                    "multiple values for kind",
41109                                ));
41110                            }
41111                            result.kind = map
41112                                .next_value::<std::option::Option<std::string::String>>()?
41113                                .unwrap_or_default();
41114                        }
41115                        __FieldTag::__password => {
41116                            if !fields.insert(__FieldTag::__password) {
41117                                return std::result::Result::Err(A::Error::duplicate_field(
41118                                    "multiple values for password",
41119                                ));
41120                            }
41121                            result.password = map
41122                                .next_value::<std::option::Option<std::string::String>>()?
41123                                .unwrap_or_default();
41124                        }
41125                        __FieldTag::__etag => {
41126                            if !fields.insert(__FieldTag::__etag) {
41127                                return std::result::Result::Err(A::Error::duplicate_field(
41128                                    "multiple values for etag",
41129                                ));
41130                            }
41131                            result.etag = map
41132                                .next_value::<std::option::Option<std::string::String>>()?
41133                                .unwrap_or_default();
41134                        }
41135                        __FieldTag::__name => {
41136                            if !fields.insert(__FieldTag::__name) {
41137                                return std::result::Result::Err(A::Error::duplicate_field(
41138                                    "multiple values for name",
41139                                ));
41140                            }
41141                            result.name = map
41142                                .next_value::<std::option::Option<std::string::String>>()?
41143                                .unwrap_or_default();
41144                        }
41145                        __FieldTag::__host => {
41146                            if !fields.insert(__FieldTag::__host) {
41147                                return std::result::Result::Err(A::Error::duplicate_field(
41148                                    "multiple values for host",
41149                                ));
41150                            }
41151                            result.host = map
41152                                .next_value::<std::option::Option<std::string::String>>()?
41153                                .unwrap_or_default();
41154                        }
41155                        __FieldTag::__instance => {
41156                            if !fields.insert(__FieldTag::__instance) {
41157                                return std::result::Result::Err(A::Error::duplicate_field(
41158                                    "multiple values for instance",
41159                                ));
41160                            }
41161                            result.instance = map
41162                                .next_value::<std::option::Option<std::string::String>>()?
41163                                .unwrap_or_default();
41164                        }
41165                        __FieldTag::__project => {
41166                            if !fields.insert(__FieldTag::__project) {
41167                                return std::result::Result::Err(A::Error::duplicate_field(
41168                                    "multiple values for project",
41169                                ));
41170                            }
41171                            result.project = map
41172                                .next_value::<std::option::Option<std::string::String>>()?
41173                                .unwrap_or_default();
41174                        }
41175                        __FieldTag::__type => {
41176                            if !fields.insert(__FieldTag::__type) {
41177                                return std::result::Result::Err(A::Error::duplicate_field(
41178                                    "multiple values for type",
41179                                ));
41180                            }
41181                            result.r#type = map
41182                                .next_value::<std::option::Option<crate::model::user::SqlUserType>>(
41183                                )?
41184                                .unwrap_or_default();
41185                        }
41186                        __FieldTag::__sqlserver_user_details => {
41187                            if !fields.insert(__FieldTag::__sqlserver_user_details) {
41188                                return std::result::Result::Err(A::Error::duplicate_field(
41189                                    "multiple values for sqlserver_user_details",
41190                                ));
41191                            }
41192                            if result.user_details.is_some() {
41193                                return std::result::Result::Err(A::Error::duplicate_field(
41194                                    "multiple values for `user_details`, a oneof with full ID .google.cloud.sql.v1.User.sqlserver_user_details, latest field was sqlserverUserDetails",
41195                                ));
41196                            }
41197                            result.user_details = std::option::Option::Some(
41198                                crate::model::user::UserDetails::SqlserverUserDetails(
41199                                    map.next_value::<std::option::Option<
41200                                        std::boxed::Box<crate::model::SqlServerUserDetails>,
41201                                    >>()?
41202                                    .unwrap_or_default(),
41203                                ),
41204                            );
41205                        }
41206                        __FieldTag::__password_policy => {
41207                            if !fields.insert(__FieldTag::__password_policy) {
41208                                return std::result::Result::Err(A::Error::duplicate_field(
41209                                    "multiple values for password_policy",
41210                                ));
41211                            }
41212                            result.password_policy = map.next_value::<std::option::Option<crate::model::UserPasswordValidationPolicy>>()?
41213                                ;
41214                        }
41215                        __FieldTag::__dual_password_type => {
41216                            if !fields.insert(__FieldTag::__dual_password_type) {
41217                                return std::result::Result::Err(A::Error::duplicate_field(
41218                                    "multiple values for dual_password_type",
41219                                ));
41220                            }
41221                            result.dual_password_type = map.next_value::<std::option::Option<crate::model::user::DualPasswordType>>()?
41222                                ;
41223                        }
41224                        __FieldTag::Unknown(key) => {
41225                            let value = map.next_value::<serde_json::Value>()?;
41226                            result._unknown_fields.insert(key, value);
41227                        }
41228                    }
41229                }
41230                std::result::Result::Ok(result)
41231            }
41232        }
41233        deserializer.deserialize_any(Visitor)
41234    }
41235}
41236
41237#[doc(hidden)]
41238impl serde::ser::Serialize for User {
41239    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
41240    where
41241        S: serde::ser::Serializer,
41242    {
41243        use serde::ser::SerializeMap;
41244        #[allow(unused_imports)]
41245        use std::option::Option::Some;
41246        let mut state = serializer.serialize_map(std::option::Option::None)?;
41247        if !self.kind.is_empty() {
41248            state.serialize_entry("kind", &self.kind)?;
41249        }
41250        if !self.password.is_empty() {
41251            state.serialize_entry("password", &self.password)?;
41252        }
41253        if !self.etag.is_empty() {
41254            state.serialize_entry("etag", &self.etag)?;
41255        }
41256        if !self.name.is_empty() {
41257            state.serialize_entry("name", &self.name)?;
41258        }
41259        if !self.host.is_empty() {
41260            state.serialize_entry("host", &self.host)?;
41261        }
41262        if !self.instance.is_empty() {
41263            state.serialize_entry("instance", &self.instance)?;
41264        }
41265        if !self.project.is_empty() {
41266            state.serialize_entry("project", &self.project)?;
41267        }
41268        if !wkt::internal::is_default(&self.r#type) {
41269            state.serialize_entry("type", &self.r#type)?;
41270        }
41271        if let Some(value) = self.sqlserver_user_details() {
41272            state.serialize_entry("sqlserverUserDetails", value)?;
41273        }
41274        if self.password_policy.is_some() {
41275            state.serialize_entry("passwordPolicy", &self.password_policy)?;
41276        }
41277        if self.dual_password_type.is_some() {
41278            state.serialize_entry("dualPasswordType", &self.dual_password_type)?;
41279        }
41280        if !self._unknown_fields.is_empty() {
41281            for (key, value) in self._unknown_fields.iter() {
41282                state.serialize_entry(key, &value)?;
41283            }
41284        }
41285        state.end()
41286    }
41287}
41288
41289/// Defines additional types related to [User].
41290pub mod user {
41291    #[allow(unused_imports)]
41292    use super::*;
41293
41294    /// The user type.
41295    ///
41296    /// # Working with unknown values
41297    ///
41298    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
41299    /// additional enum variants at any time. Adding new variants is not considered
41300    /// a breaking change. Applications should write their code in anticipation of:
41301    ///
41302    /// - New values appearing in future releases of the client library, **and**
41303    /// - New values received dynamically, without application changes.
41304    ///
41305    /// Please consult the [Working with enums] section in the user guide for some
41306    /// guidelines.
41307    ///
41308    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
41309    #[derive(Clone, Debug, PartialEq)]
41310    #[non_exhaustive]
41311    pub enum SqlUserType {
41312        /// The database's built-in user type.
41313        BuiltIn,
41314        /// Cloud IAM user.
41315        CloudIamUser,
41316        /// Cloud IAM service account.
41317        CloudIamServiceAccount,
41318        /// Cloud IAM group non-login user.
41319        CloudIamGroup,
41320        /// Cloud IAM group login user.
41321        CloudIamGroupUser,
41322        /// Cloud IAM group login service account.
41323        CloudIamGroupServiceAccount,
41324        /// If set, the enum was initialized with an unknown value.
41325        ///
41326        /// Applications can examine the value using [SqlUserType::value] or
41327        /// [SqlUserType::name].
41328        UnknownValue(sql_user_type::UnknownValue),
41329    }
41330
41331    #[doc(hidden)]
41332    pub mod sql_user_type {
41333        #[allow(unused_imports)]
41334        use super::*;
41335        #[derive(Clone, Debug, PartialEq)]
41336        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
41337    }
41338
41339    impl SqlUserType {
41340        /// Gets the enum value.
41341        ///
41342        /// Returns `None` if the enum contains an unknown value deserialized from
41343        /// the string representation of enums.
41344        pub fn value(&self) -> std::option::Option<i32> {
41345            match self {
41346                Self::BuiltIn => std::option::Option::Some(0),
41347                Self::CloudIamUser => std::option::Option::Some(1),
41348                Self::CloudIamServiceAccount => std::option::Option::Some(2),
41349                Self::CloudIamGroup => std::option::Option::Some(3),
41350                Self::CloudIamGroupUser => std::option::Option::Some(4),
41351                Self::CloudIamGroupServiceAccount => std::option::Option::Some(5),
41352                Self::UnknownValue(u) => u.0.value(),
41353            }
41354        }
41355
41356        /// Gets the enum value as a string.
41357        ///
41358        /// Returns `None` if the enum contains an unknown value deserialized from
41359        /// the integer representation of enums.
41360        pub fn name(&self) -> std::option::Option<&str> {
41361            match self {
41362                Self::BuiltIn => std::option::Option::Some("BUILT_IN"),
41363                Self::CloudIamUser => std::option::Option::Some("CLOUD_IAM_USER"),
41364                Self::CloudIamServiceAccount => {
41365                    std::option::Option::Some("CLOUD_IAM_SERVICE_ACCOUNT")
41366                }
41367                Self::CloudIamGroup => std::option::Option::Some("CLOUD_IAM_GROUP"),
41368                Self::CloudIamGroupUser => std::option::Option::Some("CLOUD_IAM_GROUP_USER"),
41369                Self::CloudIamGroupServiceAccount => {
41370                    std::option::Option::Some("CLOUD_IAM_GROUP_SERVICE_ACCOUNT")
41371                }
41372                Self::UnknownValue(u) => u.0.name(),
41373            }
41374        }
41375    }
41376
41377    impl std::default::Default for SqlUserType {
41378        fn default() -> Self {
41379            use std::convert::From;
41380            Self::from(0)
41381        }
41382    }
41383
41384    impl std::fmt::Display for SqlUserType {
41385        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
41386            wkt::internal::display_enum(f, self.name(), self.value())
41387        }
41388    }
41389
41390    impl std::convert::From<i32> for SqlUserType {
41391        fn from(value: i32) -> Self {
41392            match value {
41393                0 => Self::BuiltIn,
41394                1 => Self::CloudIamUser,
41395                2 => Self::CloudIamServiceAccount,
41396                3 => Self::CloudIamGroup,
41397                4 => Self::CloudIamGroupUser,
41398                5 => Self::CloudIamGroupServiceAccount,
41399                _ => Self::UnknownValue(sql_user_type::UnknownValue(
41400                    wkt::internal::UnknownEnumValue::Integer(value),
41401                )),
41402            }
41403        }
41404    }
41405
41406    impl std::convert::From<&str> for SqlUserType {
41407        fn from(value: &str) -> Self {
41408            use std::string::ToString;
41409            match value {
41410                "BUILT_IN" => Self::BuiltIn,
41411                "CLOUD_IAM_USER" => Self::CloudIamUser,
41412                "CLOUD_IAM_SERVICE_ACCOUNT" => Self::CloudIamServiceAccount,
41413                "CLOUD_IAM_GROUP" => Self::CloudIamGroup,
41414                "CLOUD_IAM_GROUP_USER" => Self::CloudIamGroupUser,
41415                "CLOUD_IAM_GROUP_SERVICE_ACCOUNT" => Self::CloudIamGroupServiceAccount,
41416                _ => Self::UnknownValue(sql_user_type::UnknownValue(
41417                    wkt::internal::UnknownEnumValue::String(value.to_string()),
41418                )),
41419            }
41420        }
41421    }
41422
41423    impl serde::ser::Serialize for SqlUserType {
41424        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
41425        where
41426            S: serde::Serializer,
41427        {
41428            match self {
41429                Self::BuiltIn => serializer.serialize_i32(0),
41430                Self::CloudIamUser => serializer.serialize_i32(1),
41431                Self::CloudIamServiceAccount => serializer.serialize_i32(2),
41432                Self::CloudIamGroup => serializer.serialize_i32(3),
41433                Self::CloudIamGroupUser => serializer.serialize_i32(4),
41434                Self::CloudIamGroupServiceAccount => serializer.serialize_i32(5),
41435                Self::UnknownValue(u) => u.0.serialize(serializer),
41436            }
41437        }
41438    }
41439
41440    impl<'de> serde::de::Deserialize<'de> for SqlUserType {
41441        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
41442        where
41443            D: serde::Deserializer<'de>,
41444        {
41445            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlUserType>::new(
41446                ".google.cloud.sql.v1.User.SqlUserType",
41447            ))
41448        }
41449    }
41450
41451    /// The type of retained password.
41452    ///
41453    /// # Working with unknown values
41454    ///
41455    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
41456    /// additional enum variants at any time. Adding new variants is not considered
41457    /// a breaking change. Applications should write their code in anticipation of:
41458    ///
41459    /// - New values appearing in future releases of the client library, **and**
41460    /// - New values received dynamically, without application changes.
41461    ///
41462    /// Please consult the [Working with enums] section in the user guide for some
41463    /// guidelines.
41464    ///
41465    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
41466    #[derive(Clone, Debug, PartialEq)]
41467    #[non_exhaustive]
41468    pub enum DualPasswordType {
41469        /// The default value.
41470        Unspecified,
41471        /// Do not update the user's dual password status.
41472        NoModifyDualPassword,
41473        /// No dual password usable for connecting using this user.
41474        NoDualPassword,
41475        /// Dual password usable for connecting using this user.
41476        DualPassword,
41477        /// If set, the enum was initialized with an unknown value.
41478        ///
41479        /// Applications can examine the value using [DualPasswordType::value] or
41480        /// [DualPasswordType::name].
41481        UnknownValue(dual_password_type::UnknownValue),
41482    }
41483
41484    #[doc(hidden)]
41485    pub mod dual_password_type {
41486        #[allow(unused_imports)]
41487        use super::*;
41488        #[derive(Clone, Debug, PartialEq)]
41489        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
41490    }
41491
41492    impl DualPasswordType {
41493        /// Gets the enum value.
41494        ///
41495        /// Returns `None` if the enum contains an unknown value deserialized from
41496        /// the string representation of enums.
41497        pub fn value(&self) -> std::option::Option<i32> {
41498            match self {
41499                Self::Unspecified => std::option::Option::Some(0),
41500                Self::NoModifyDualPassword => std::option::Option::Some(1),
41501                Self::NoDualPassword => std::option::Option::Some(2),
41502                Self::DualPassword => std::option::Option::Some(3),
41503                Self::UnknownValue(u) => u.0.value(),
41504            }
41505        }
41506
41507        /// Gets the enum value as a string.
41508        ///
41509        /// Returns `None` if the enum contains an unknown value deserialized from
41510        /// the integer representation of enums.
41511        pub fn name(&self) -> std::option::Option<&str> {
41512            match self {
41513                Self::Unspecified => std::option::Option::Some("DUAL_PASSWORD_TYPE_UNSPECIFIED"),
41514                Self::NoModifyDualPassword => std::option::Option::Some("NO_MODIFY_DUAL_PASSWORD"),
41515                Self::NoDualPassword => std::option::Option::Some("NO_DUAL_PASSWORD"),
41516                Self::DualPassword => std::option::Option::Some("DUAL_PASSWORD"),
41517                Self::UnknownValue(u) => u.0.name(),
41518            }
41519        }
41520    }
41521
41522    impl std::default::Default for DualPasswordType {
41523        fn default() -> Self {
41524            use std::convert::From;
41525            Self::from(0)
41526        }
41527    }
41528
41529    impl std::fmt::Display for DualPasswordType {
41530        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
41531            wkt::internal::display_enum(f, self.name(), self.value())
41532        }
41533    }
41534
41535    impl std::convert::From<i32> for DualPasswordType {
41536        fn from(value: i32) -> Self {
41537            match value {
41538                0 => Self::Unspecified,
41539                1 => Self::NoModifyDualPassword,
41540                2 => Self::NoDualPassword,
41541                3 => Self::DualPassword,
41542                _ => Self::UnknownValue(dual_password_type::UnknownValue(
41543                    wkt::internal::UnknownEnumValue::Integer(value),
41544                )),
41545            }
41546        }
41547    }
41548
41549    impl std::convert::From<&str> for DualPasswordType {
41550        fn from(value: &str) -> Self {
41551            use std::string::ToString;
41552            match value {
41553                "DUAL_PASSWORD_TYPE_UNSPECIFIED" => Self::Unspecified,
41554                "NO_MODIFY_DUAL_PASSWORD" => Self::NoModifyDualPassword,
41555                "NO_DUAL_PASSWORD" => Self::NoDualPassword,
41556                "DUAL_PASSWORD" => Self::DualPassword,
41557                _ => Self::UnknownValue(dual_password_type::UnknownValue(
41558                    wkt::internal::UnknownEnumValue::String(value.to_string()),
41559                )),
41560            }
41561        }
41562    }
41563
41564    impl serde::ser::Serialize for DualPasswordType {
41565        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
41566        where
41567            S: serde::Serializer,
41568        {
41569            match self {
41570                Self::Unspecified => serializer.serialize_i32(0),
41571                Self::NoModifyDualPassword => serializer.serialize_i32(1),
41572                Self::NoDualPassword => serializer.serialize_i32(2),
41573                Self::DualPassword => serializer.serialize_i32(3),
41574                Self::UnknownValue(u) => u.0.serialize(serializer),
41575            }
41576        }
41577    }
41578
41579    impl<'de> serde::de::Deserialize<'de> for DualPasswordType {
41580        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
41581        where
41582            D: serde::Deserializer<'de>,
41583        {
41584            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DualPasswordType>::new(
41585                ".google.cloud.sql.v1.User.DualPasswordType",
41586            ))
41587        }
41588    }
41589
41590    /// User details for specific database type
41591    #[derive(Clone, Debug, PartialEq)]
41592    #[non_exhaustive]
41593    pub enum UserDetails {
41594        SqlserverUserDetails(std::boxed::Box<crate::model::SqlServerUserDetails>),
41595    }
41596}
41597
41598/// Represents a Sql Server user on the Cloud SQL instance.
41599#[derive(Clone, Debug, Default, PartialEq)]
41600#[non_exhaustive]
41601pub struct SqlServerUserDetails {
41602    /// If the user has been disabled
41603    pub disabled: bool,
41604
41605    /// The server roles for this user
41606    pub server_roles: std::vec::Vec<std::string::String>,
41607
41608    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
41609}
41610
41611impl SqlServerUserDetails {
41612    pub fn new() -> Self {
41613        std::default::Default::default()
41614    }
41615
41616    /// Sets the value of [disabled][crate::model::SqlServerUserDetails::disabled].
41617    pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
41618        self.disabled = v.into();
41619        self
41620    }
41621
41622    /// Sets the value of [server_roles][crate::model::SqlServerUserDetails::server_roles].
41623    pub fn set_server_roles<T, V>(mut self, v: T) -> Self
41624    where
41625        T: std::iter::IntoIterator<Item = V>,
41626        V: std::convert::Into<std::string::String>,
41627    {
41628        use std::iter::Iterator;
41629        self.server_roles = v.into_iter().map(|i| i.into()).collect();
41630        self
41631    }
41632}
41633
41634impl wkt::message::Message for SqlServerUserDetails {
41635    fn typename() -> &'static str {
41636        "type.googleapis.com/google.cloud.sql.v1.SqlServerUserDetails"
41637    }
41638}
41639
41640#[doc(hidden)]
41641impl<'de> serde::de::Deserialize<'de> for SqlServerUserDetails {
41642    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
41643    where
41644        D: serde::Deserializer<'de>,
41645    {
41646        #[allow(non_camel_case_types)]
41647        #[doc(hidden)]
41648        #[derive(PartialEq, Eq, Hash)]
41649        enum __FieldTag {
41650            __disabled,
41651            __server_roles,
41652            Unknown(std::string::String),
41653        }
41654        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
41655            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
41656            where
41657                D: serde::Deserializer<'de>,
41658            {
41659                struct Visitor;
41660                impl<'de> serde::de::Visitor<'de> for Visitor {
41661                    type Value = __FieldTag;
41662                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
41663                        formatter.write_str("a field name for SqlServerUserDetails")
41664                    }
41665                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
41666                    where
41667                        E: serde::de::Error,
41668                    {
41669                        use std::result::Result::Ok;
41670                        use std::string::ToString;
41671                        match value {
41672                            "disabled" => Ok(__FieldTag::__disabled),
41673                            "serverRoles" => Ok(__FieldTag::__server_roles),
41674                            "server_roles" => Ok(__FieldTag::__server_roles),
41675                            _ => Ok(__FieldTag::Unknown(value.to_string())),
41676                        }
41677                    }
41678                }
41679                deserializer.deserialize_identifier(Visitor)
41680            }
41681        }
41682        struct Visitor;
41683        impl<'de> serde::de::Visitor<'de> for Visitor {
41684            type Value = SqlServerUserDetails;
41685            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
41686                formatter.write_str("struct SqlServerUserDetails")
41687            }
41688            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
41689            where
41690                A: serde::de::MapAccess<'de>,
41691            {
41692                #[allow(unused_imports)]
41693                use serde::de::Error;
41694                use std::option::Option::Some;
41695                let mut fields = std::collections::HashSet::new();
41696                let mut result = Self::Value::new();
41697                while let Some(tag) = map.next_key::<__FieldTag>()? {
41698                    #[allow(clippy::match_single_binding)]
41699                    match tag {
41700                        __FieldTag::__disabled => {
41701                            if !fields.insert(__FieldTag::__disabled) {
41702                                return std::result::Result::Err(A::Error::duplicate_field(
41703                                    "multiple values for disabled",
41704                                ));
41705                            }
41706                            result.disabled = map
41707                                .next_value::<std::option::Option<bool>>()?
41708                                .unwrap_or_default();
41709                        }
41710                        __FieldTag::__server_roles => {
41711                            if !fields.insert(__FieldTag::__server_roles) {
41712                                return std::result::Result::Err(A::Error::duplicate_field(
41713                                    "multiple values for server_roles",
41714                                ));
41715                            }
41716                            result.server_roles = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
41717                        }
41718                        __FieldTag::Unknown(key) => {
41719                            let value = map.next_value::<serde_json::Value>()?;
41720                            result._unknown_fields.insert(key, value);
41721                        }
41722                    }
41723                }
41724                std::result::Result::Ok(result)
41725            }
41726        }
41727        deserializer.deserialize_any(Visitor)
41728    }
41729}
41730
41731#[doc(hidden)]
41732impl serde::ser::Serialize for SqlServerUserDetails {
41733    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
41734    where
41735        S: serde::ser::Serializer,
41736    {
41737        use serde::ser::SerializeMap;
41738        #[allow(unused_imports)]
41739        use std::option::Option::Some;
41740        let mut state = serializer.serialize_map(std::option::Option::None)?;
41741        if !wkt::internal::is_default(&self.disabled) {
41742            state.serialize_entry("disabled", &self.disabled)?;
41743        }
41744        if !self.server_roles.is_empty() {
41745            state.serialize_entry("serverRoles", &self.server_roles)?;
41746        }
41747        if !self._unknown_fields.is_empty() {
41748            for (key, value) in self._unknown_fields.iter() {
41749                state.serialize_entry(key, &value)?;
41750            }
41751        }
41752        state.end()
41753    }
41754}
41755
41756/// User list response.
41757#[derive(Clone, Debug, Default, PartialEq)]
41758#[non_exhaustive]
41759pub struct UsersListResponse {
41760    /// This is always `sql#usersList`.
41761    pub kind: std::string::String,
41762
41763    /// List of user resources in the instance.
41764    pub items: std::vec::Vec<crate::model::User>,
41765
41766    /// Unused.
41767    #[deprecated]
41768    pub next_page_token: std::string::String,
41769
41770    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
41771}
41772
41773impl UsersListResponse {
41774    pub fn new() -> Self {
41775        std::default::Default::default()
41776    }
41777
41778    /// Sets the value of [kind][crate::model::UsersListResponse::kind].
41779    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
41780        self.kind = v.into();
41781        self
41782    }
41783
41784    /// Sets the value of [items][crate::model::UsersListResponse::items].
41785    pub fn set_items<T, V>(mut self, v: T) -> Self
41786    where
41787        T: std::iter::IntoIterator<Item = V>,
41788        V: std::convert::Into<crate::model::User>,
41789    {
41790        use std::iter::Iterator;
41791        self.items = v.into_iter().map(|i| i.into()).collect();
41792        self
41793    }
41794
41795    /// Sets the value of [next_page_token][crate::model::UsersListResponse::next_page_token].
41796    #[deprecated]
41797    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
41798        self.next_page_token = v.into();
41799        self
41800    }
41801}
41802
41803impl wkt::message::Message for UsersListResponse {
41804    fn typename() -> &'static str {
41805        "type.googleapis.com/google.cloud.sql.v1.UsersListResponse"
41806    }
41807}
41808
41809#[doc(hidden)]
41810impl<'de> serde::de::Deserialize<'de> for UsersListResponse {
41811    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
41812    where
41813        D: serde::Deserializer<'de>,
41814    {
41815        #[allow(non_camel_case_types)]
41816        #[doc(hidden)]
41817        #[derive(PartialEq, Eq, Hash)]
41818        enum __FieldTag {
41819            __kind,
41820            __items,
41821            __next_page_token,
41822            Unknown(std::string::String),
41823        }
41824        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
41825            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
41826            where
41827                D: serde::Deserializer<'de>,
41828            {
41829                struct Visitor;
41830                impl<'de> serde::de::Visitor<'de> for Visitor {
41831                    type Value = __FieldTag;
41832                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
41833                        formatter.write_str("a field name for UsersListResponse")
41834                    }
41835                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
41836                    where
41837                        E: serde::de::Error,
41838                    {
41839                        use std::result::Result::Ok;
41840                        use std::string::ToString;
41841                        match value {
41842                            "kind" => Ok(__FieldTag::__kind),
41843                            "items" => Ok(__FieldTag::__items),
41844                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
41845                            "next_page_token" => Ok(__FieldTag::__next_page_token),
41846                            _ => Ok(__FieldTag::Unknown(value.to_string())),
41847                        }
41848                    }
41849                }
41850                deserializer.deserialize_identifier(Visitor)
41851            }
41852        }
41853        struct Visitor;
41854        impl<'de> serde::de::Visitor<'de> for Visitor {
41855            type Value = UsersListResponse;
41856            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
41857                formatter.write_str("struct UsersListResponse")
41858            }
41859            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
41860            where
41861                A: serde::de::MapAccess<'de>,
41862            {
41863                #[allow(unused_imports)]
41864                use serde::de::Error;
41865                use std::option::Option::Some;
41866                let mut fields = std::collections::HashSet::new();
41867                let mut result = Self::Value::new();
41868                while let Some(tag) = map.next_key::<__FieldTag>()? {
41869                    #[allow(clippy::match_single_binding)]
41870                    match tag {
41871                        __FieldTag::__kind => {
41872                            if !fields.insert(__FieldTag::__kind) {
41873                                return std::result::Result::Err(A::Error::duplicate_field(
41874                                    "multiple values for kind",
41875                                ));
41876                            }
41877                            result.kind = map
41878                                .next_value::<std::option::Option<std::string::String>>()?
41879                                .unwrap_or_default();
41880                        }
41881                        __FieldTag::__items => {
41882                            if !fields.insert(__FieldTag::__items) {
41883                                return std::result::Result::Err(A::Error::duplicate_field(
41884                                    "multiple values for items",
41885                                ));
41886                            }
41887                            result.items = map.next_value::<std::option::Option<std::vec::Vec<crate::model::User>>>()?.unwrap_or_default();
41888                        }
41889                        __FieldTag::__next_page_token => {
41890                            if !fields.insert(__FieldTag::__next_page_token) {
41891                                return std::result::Result::Err(A::Error::duplicate_field(
41892                                    "multiple values for next_page_token",
41893                                ));
41894                            }
41895                            result.next_page_token = map
41896                                .next_value::<std::option::Option<std::string::String>>()?
41897                                .unwrap_or_default();
41898                        }
41899                        __FieldTag::Unknown(key) => {
41900                            let value = map.next_value::<serde_json::Value>()?;
41901                            result._unknown_fields.insert(key, value);
41902                        }
41903                    }
41904                }
41905                std::result::Result::Ok(result)
41906            }
41907        }
41908        deserializer.deserialize_any(Visitor)
41909    }
41910}
41911
41912#[doc(hidden)]
41913impl serde::ser::Serialize for UsersListResponse {
41914    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
41915    where
41916        S: serde::ser::Serializer,
41917    {
41918        use serde::ser::SerializeMap;
41919        #[allow(unused_imports)]
41920        use std::option::Option::Some;
41921        let mut state = serializer.serialize_map(std::option::Option::None)?;
41922        if !self.kind.is_empty() {
41923            state.serialize_entry("kind", &self.kind)?;
41924        }
41925        if !self.items.is_empty() {
41926            state.serialize_entry("items", &self.items)?;
41927        }
41928        if !self.next_page_token.is_empty() {
41929            state.serialize_entry("nextPageToken", &self.next_page_token)?;
41930        }
41931        if !self._unknown_fields.is_empty() {
41932            for (key, value) in self._unknown_fields.iter() {
41933                state.serialize_entry(key, &value)?;
41934            }
41935        }
41936        state.end()
41937    }
41938}
41939
41940/// The status of a backup run.
41941///
41942/// # Working with unknown values
41943///
41944/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
41945/// additional enum variants at any time. Adding new variants is not considered
41946/// a breaking change. Applications should write their code in anticipation of:
41947///
41948/// - New values appearing in future releases of the client library, **and**
41949/// - New values received dynamically, without application changes.
41950///
41951/// Please consult the [Working with enums] section in the user guide for some
41952/// guidelines.
41953///
41954/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
41955#[derive(Clone, Debug, PartialEq)]
41956#[non_exhaustive]
41957pub enum SqlBackupRunStatus {
41958    /// The status of the run is unknown.
41959    Unspecified,
41960    /// The backup operation was enqueued.
41961    Enqueued,
41962    /// The backup is overdue across a given backup window. Indicates a
41963    /// problem. Example: Long-running operation in progress during
41964    /// the whole window.
41965    Overdue,
41966    /// The backup is in progress.
41967    Running,
41968    /// The backup failed.
41969    Failed,
41970    /// The backup was successful.
41971    Successful,
41972    /// The backup was skipped (without problems) for a given backup
41973    /// window. Example: Instance was idle.
41974    Skipped,
41975    /// The backup is about to be deleted.
41976    DeletionPending,
41977    /// The backup deletion failed.
41978    DeletionFailed,
41979    /// The backup has been deleted.
41980    Deleted,
41981    /// If set, the enum was initialized with an unknown value.
41982    ///
41983    /// Applications can examine the value using [SqlBackupRunStatus::value] or
41984    /// [SqlBackupRunStatus::name].
41985    UnknownValue(sql_backup_run_status::UnknownValue),
41986}
41987
41988#[doc(hidden)]
41989pub mod sql_backup_run_status {
41990    #[allow(unused_imports)]
41991    use super::*;
41992    #[derive(Clone, Debug, PartialEq)]
41993    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
41994}
41995
41996impl SqlBackupRunStatus {
41997    /// Gets the enum value.
41998    ///
41999    /// Returns `None` if the enum contains an unknown value deserialized from
42000    /// the string representation of enums.
42001    pub fn value(&self) -> std::option::Option<i32> {
42002        match self {
42003            Self::Unspecified => std::option::Option::Some(0),
42004            Self::Enqueued => std::option::Option::Some(1),
42005            Self::Overdue => std::option::Option::Some(2),
42006            Self::Running => std::option::Option::Some(3),
42007            Self::Failed => std::option::Option::Some(4),
42008            Self::Successful => std::option::Option::Some(5),
42009            Self::Skipped => std::option::Option::Some(6),
42010            Self::DeletionPending => std::option::Option::Some(7),
42011            Self::DeletionFailed => std::option::Option::Some(8),
42012            Self::Deleted => std::option::Option::Some(9),
42013            Self::UnknownValue(u) => u.0.value(),
42014        }
42015    }
42016
42017    /// Gets the enum value as a string.
42018    ///
42019    /// Returns `None` if the enum contains an unknown value deserialized from
42020    /// the integer representation of enums.
42021    pub fn name(&self) -> std::option::Option<&str> {
42022        match self {
42023            Self::Unspecified => std::option::Option::Some("SQL_BACKUP_RUN_STATUS_UNSPECIFIED"),
42024            Self::Enqueued => std::option::Option::Some("ENQUEUED"),
42025            Self::Overdue => std::option::Option::Some("OVERDUE"),
42026            Self::Running => std::option::Option::Some("RUNNING"),
42027            Self::Failed => std::option::Option::Some("FAILED"),
42028            Self::Successful => std::option::Option::Some("SUCCESSFUL"),
42029            Self::Skipped => std::option::Option::Some("SKIPPED"),
42030            Self::DeletionPending => std::option::Option::Some("DELETION_PENDING"),
42031            Self::DeletionFailed => std::option::Option::Some("DELETION_FAILED"),
42032            Self::Deleted => std::option::Option::Some("DELETED"),
42033            Self::UnknownValue(u) => u.0.name(),
42034        }
42035    }
42036}
42037
42038impl std::default::Default for SqlBackupRunStatus {
42039    fn default() -> Self {
42040        use std::convert::From;
42041        Self::from(0)
42042    }
42043}
42044
42045impl std::fmt::Display for SqlBackupRunStatus {
42046    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
42047        wkt::internal::display_enum(f, self.name(), self.value())
42048    }
42049}
42050
42051impl std::convert::From<i32> for SqlBackupRunStatus {
42052    fn from(value: i32) -> Self {
42053        match value {
42054            0 => Self::Unspecified,
42055            1 => Self::Enqueued,
42056            2 => Self::Overdue,
42057            3 => Self::Running,
42058            4 => Self::Failed,
42059            5 => Self::Successful,
42060            6 => Self::Skipped,
42061            7 => Self::DeletionPending,
42062            8 => Self::DeletionFailed,
42063            9 => Self::Deleted,
42064            _ => Self::UnknownValue(sql_backup_run_status::UnknownValue(
42065                wkt::internal::UnknownEnumValue::Integer(value),
42066            )),
42067        }
42068    }
42069}
42070
42071impl std::convert::From<&str> for SqlBackupRunStatus {
42072    fn from(value: &str) -> Self {
42073        use std::string::ToString;
42074        match value {
42075            "SQL_BACKUP_RUN_STATUS_UNSPECIFIED" => Self::Unspecified,
42076            "ENQUEUED" => Self::Enqueued,
42077            "OVERDUE" => Self::Overdue,
42078            "RUNNING" => Self::Running,
42079            "FAILED" => Self::Failed,
42080            "SUCCESSFUL" => Self::Successful,
42081            "SKIPPED" => Self::Skipped,
42082            "DELETION_PENDING" => Self::DeletionPending,
42083            "DELETION_FAILED" => Self::DeletionFailed,
42084            "DELETED" => Self::Deleted,
42085            _ => Self::UnknownValue(sql_backup_run_status::UnknownValue(
42086                wkt::internal::UnknownEnumValue::String(value.to_string()),
42087            )),
42088        }
42089    }
42090}
42091
42092impl serde::ser::Serialize for SqlBackupRunStatus {
42093    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
42094    where
42095        S: serde::Serializer,
42096    {
42097        match self {
42098            Self::Unspecified => serializer.serialize_i32(0),
42099            Self::Enqueued => serializer.serialize_i32(1),
42100            Self::Overdue => serializer.serialize_i32(2),
42101            Self::Running => serializer.serialize_i32(3),
42102            Self::Failed => serializer.serialize_i32(4),
42103            Self::Successful => serializer.serialize_i32(5),
42104            Self::Skipped => serializer.serialize_i32(6),
42105            Self::DeletionPending => serializer.serialize_i32(7),
42106            Self::DeletionFailed => serializer.serialize_i32(8),
42107            Self::Deleted => serializer.serialize_i32(9),
42108            Self::UnknownValue(u) => u.0.serialize(serializer),
42109        }
42110    }
42111}
42112
42113impl<'de> serde::de::Deserialize<'de> for SqlBackupRunStatus {
42114    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
42115    where
42116        D: serde::Deserializer<'de>,
42117    {
42118        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlBackupRunStatus>::new(
42119            ".google.cloud.sql.v1.SqlBackupRunStatus",
42120        ))
42121    }
42122}
42123
42124/// Defines the supported backup kinds.
42125///
42126/// # Working with unknown values
42127///
42128/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
42129/// additional enum variants at any time. Adding new variants is not considered
42130/// a breaking change. Applications should write their code in anticipation of:
42131///
42132/// - New values appearing in future releases of the client library, **and**
42133/// - New values received dynamically, without application changes.
42134///
42135/// Please consult the [Working with enums] section in the user guide for some
42136/// guidelines.
42137///
42138/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
42139#[derive(Clone, Debug, PartialEq)]
42140#[non_exhaustive]
42141pub enum SqlBackupKind {
42142    /// This is an unknown BackupKind.
42143    Unspecified,
42144    /// The snapshot based backups
42145    Snapshot,
42146    /// Physical backups
42147    Physical,
42148    /// If set, the enum was initialized with an unknown value.
42149    ///
42150    /// Applications can examine the value using [SqlBackupKind::value] or
42151    /// [SqlBackupKind::name].
42152    UnknownValue(sql_backup_kind::UnknownValue),
42153}
42154
42155#[doc(hidden)]
42156pub mod sql_backup_kind {
42157    #[allow(unused_imports)]
42158    use super::*;
42159    #[derive(Clone, Debug, PartialEq)]
42160    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
42161}
42162
42163impl SqlBackupKind {
42164    /// Gets the enum value.
42165    ///
42166    /// Returns `None` if the enum contains an unknown value deserialized from
42167    /// the string representation of enums.
42168    pub fn value(&self) -> std::option::Option<i32> {
42169        match self {
42170            Self::Unspecified => std::option::Option::Some(0),
42171            Self::Snapshot => std::option::Option::Some(1),
42172            Self::Physical => std::option::Option::Some(2),
42173            Self::UnknownValue(u) => u.0.value(),
42174        }
42175    }
42176
42177    /// Gets the enum value as a string.
42178    ///
42179    /// Returns `None` if the enum contains an unknown value deserialized from
42180    /// the integer representation of enums.
42181    pub fn name(&self) -> std::option::Option<&str> {
42182        match self {
42183            Self::Unspecified => std::option::Option::Some("SQL_BACKUP_KIND_UNSPECIFIED"),
42184            Self::Snapshot => std::option::Option::Some("SNAPSHOT"),
42185            Self::Physical => std::option::Option::Some("PHYSICAL"),
42186            Self::UnknownValue(u) => u.0.name(),
42187        }
42188    }
42189}
42190
42191impl std::default::Default for SqlBackupKind {
42192    fn default() -> Self {
42193        use std::convert::From;
42194        Self::from(0)
42195    }
42196}
42197
42198impl std::fmt::Display for SqlBackupKind {
42199    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
42200        wkt::internal::display_enum(f, self.name(), self.value())
42201    }
42202}
42203
42204impl std::convert::From<i32> for SqlBackupKind {
42205    fn from(value: i32) -> Self {
42206        match value {
42207            0 => Self::Unspecified,
42208            1 => Self::Snapshot,
42209            2 => Self::Physical,
42210            _ => Self::UnknownValue(sql_backup_kind::UnknownValue(
42211                wkt::internal::UnknownEnumValue::Integer(value),
42212            )),
42213        }
42214    }
42215}
42216
42217impl std::convert::From<&str> for SqlBackupKind {
42218    fn from(value: &str) -> Self {
42219        use std::string::ToString;
42220        match value {
42221            "SQL_BACKUP_KIND_UNSPECIFIED" => Self::Unspecified,
42222            "SNAPSHOT" => Self::Snapshot,
42223            "PHYSICAL" => Self::Physical,
42224            _ => Self::UnknownValue(sql_backup_kind::UnknownValue(
42225                wkt::internal::UnknownEnumValue::String(value.to_string()),
42226            )),
42227        }
42228    }
42229}
42230
42231impl serde::ser::Serialize for SqlBackupKind {
42232    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
42233    where
42234        S: serde::Serializer,
42235    {
42236        match self {
42237            Self::Unspecified => serializer.serialize_i32(0),
42238            Self::Snapshot => serializer.serialize_i32(1),
42239            Self::Physical => serializer.serialize_i32(2),
42240            Self::UnknownValue(u) => u.0.serialize(serializer),
42241        }
42242    }
42243}
42244
42245impl<'de> serde::de::Deserialize<'de> for SqlBackupKind {
42246    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
42247    where
42248        D: serde::Deserializer<'de>,
42249    {
42250        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlBackupKind>::new(
42251            ".google.cloud.sql.v1.SqlBackupKind",
42252        ))
42253    }
42254}
42255
42256/// Type of backup (i.e. automated, on demand, etc).
42257///
42258/// # Working with unknown values
42259///
42260/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
42261/// additional enum variants at any time. Adding new variants is not considered
42262/// a breaking change. Applications should write their code in anticipation of:
42263///
42264/// - New values appearing in future releases of the client library, **and**
42265/// - New values received dynamically, without application changes.
42266///
42267/// Please consult the [Working with enums] section in the user guide for some
42268/// guidelines.
42269///
42270/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
42271#[derive(Clone, Debug, PartialEq)]
42272#[non_exhaustive]
42273pub enum SqlBackupRunType {
42274    /// This is an unknown BackupRun type.
42275    Unspecified,
42276    /// The backup schedule automatically triggers a backup.
42277    Automated,
42278    /// The user manually triggers a backup.
42279    OnDemand,
42280    /// If set, the enum was initialized with an unknown value.
42281    ///
42282    /// Applications can examine the value using [SqlBackupRunType::value] or
42283    /// [SqlBackupRunType::name].
42284    UnknownValue(sql_backup_run_type::UnknownValue),
42285}
42286
42287#[doc(hidden)]
42288pub mod sql_backup_run_type {
42289    #[allow(unused_imports)]
42290    use super::*;
42291    #[derive(Clone, Debug, PartialEq)]
42292    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
42293}
42294
42295impl SqlBackupRunType {
42296    /// Gets the enum value.
42297    ///
42298    /// Returns `None` if the enum contains an unknown value deserialized from
42299    /// the string representation of enums.
42300    pub fn value(&self) -> std::option::Option<i32> {
42301        match self {
42302            Self::Unspecified => std::option::Option::Some(0),
42303            Self::Automated => std::option::Option::Some(1),
42304            Self::OnDemand => std::option::Option::Some(2),
42305            Self::UnknownValue(u) => u.0.value(),
42306        }
42307    }
42308
42309    /// Gets the enum value as a string.
42310    ///
42311    /// Returns `None` if the enum contains an unknown value deserialized from
42312    /// the integer representation of enums.
42313    pub fn name(&self) -> std::option::Option<&str> {
42314        match self {
42315            Self::Unspecified => std::option::Option::Some("SQL_BACKUP_RUN_TYPE_UNSPECIFIED"),
42316            Self::Automated => std::option::Option::Some("AUTOMATED"),
42317            Self::OnDemand => std::option::Option::Some("ON_DEMAND"),
42318            Self::UnknownValue(u) => u.0.name(),
42319        }
42320    }
42321}
42322
42323impl std::default::Default for SqlBackupRunType {
42324    fn default() -> Self {
42325        use std::convert::From;
42326        Self::from(0)
42327    }
42328}
42329
42330impl std::fmt::Display for SqlBackupRunType {
42331    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
42332        wkt::internal::display_enum(f, self.name(), self.value())
42333    }
42334}
42335
42336impl std::convert::From<i32> for SqlBackupRunType {
42337    fn from(value: i32) -> Self {
42338        match value {
42339            0 => Self::Unspecified,
42340            1 => Self::Automated,
42341            2 => Self::OnDemand,
42342            _ => Self::UnknownValue(sql_backup_run_type::UnknownValue(
42343                wkt::internal::UnknownEnumValue::Integer(value),
42344            )),
42345        }
42346    }
42347}
42348
42349impl std::convert::From<&str> for SqlBackupRunType {
42350    fn from(value: &str) -> Self {
42351        use std::string::ToString;
42352        match value {
42353            "SQL_BACKUP_RUN_TYPE_UNSPECIFIED" => Self::Unspecified,
42354            "AUTOMATED" => Self::Automated,
42355            "ON_DEMAND" => Self::OnDemand,
42356            _ => Self::UnknownValue(sql_backup_run_type::UnknownValue(
42357                wkt::internal::UnknownEnumValue::String(value.to_string()),
42358            )),
42359        }
42360    }
42361}
42362
42363impl serde::ser::Serialize for SqlBackupRunType {
42364    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
42365    where
42366        S: serde::Serializer,
42367    {
42368        match self {
42369            Self::Unspecified => serializer.serialize_i32(0),
42370            Self::Automated => serializer.serialize_i32(1),
42371            Self::OnDemand => serializer.serialize_i32(2),
42372            Self::UnknownValue(u) => u.0.serialize(serializer),
42373        }
42374    }
42375}
42376
42377impl<'de> serde::de::Deserialize<'de> for SqlBackupRunType {
42378    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
42379    where
42380        D: serde::Deserializer<'de>,
42381    {
42382        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlBackupRunType>::new(
42383            ".google.cloud.sql.v1.SqlBackupRunType",
42384        ))
42385    }
42386}
42387
42388///
42389/// # Working with unknown values
42390///
42391/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
42392/// additional enum variants at any time. Adding new variants is not considered
42393/// a breaking change. Applications should write their code in anticipation of:
42394///
42395/// - New values appearing in future releases of the client library, **and**
42396/// - New values received dynamically, without application changes.
42397///
42398/// Please consult the [Working with enums] section in the user guide for some
42399/// guidelines.
42400///
42401/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
42402#[derive(Clone, Debug, PartialEq)]
42403#[non_exhaustive]
42404pub enum SqlFlagType {
42405    /// This is an unknown flag type.
42406    Unspecified,
42407    /// Boolean type flag.
42408    Boolean,
42409    /// String type flag.
42410    String,
42411    /// Integer type flag.
42412    Integer,
42413    /// Flag type used for a server startup option.
42414    None,
42415    /// Type introduced specially for MySQL TimeZone offset. Accept a string value
42416    /// with the format [-12:59, 13:00].
42417    MysqlTimezoneOffset,
42418    /// Float type flag.
42419    Float,
42420    /// Comma-separated list of the strings in a SqlFlagType enum.
42421    RepeatedString,
42422    /// If set, the enum was initialized with an unknown value.
42423    ///
42424    /// Applications can examine the value using [SqlFlagType::value] or
42425    /// [SqlFlagType::name].
42426    UnknownValue(sql_flag_type::UnknownValue),
42427}
42428
42429#[doc(hidden)]
42430pub mod sql_flag_type {
42431    #[allow(unused_imports)]
42432    use super::*;
42433    #[derive(Clone, Debug, PartialEq)]
42434    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
42435}
42436
42437impl SqlFlagType {
42438    /// Gets the enum value.
42439    ///
42440    /// Returns `None` if the enum contains an unknown value deserialized from
42441    /// the string representation of enums.
42442    pub fn value(&self) -> std::option::Option<i32> {
42443        match self {
42444            Self::Unspecified => std::option::Option::Some(0),
42445            Self::Boolean => std::option::Option::Some(1),
42446            Self::String => std::option::Option::Some(2),
42447            Self::Integer => std::option::Option::Some(3),
42448            Self::None => std::option::Option::Some(4),
42449            Self::MysqlTimezoneOffset => std::option::Option::Some(5),
42450            Self::Float => std::option::Option::Some(6),
42451            Self::RepeatedString => std::option::Option::Some(7),
42452            Self::UnknownValue(u) => u.0.value(),
42453        }
42454    }
42455
42456    /// Gets the enum value as a string.
42457    ///
42458    /// Returns `None` if the enum contains an unknown value deserialized from
42459    /// the integer representation of enums.
42460    pub fn name(&self) -> std::option::Option<&str> {
42461        match self {
42462            Self::Unspecified => std::option::Option::Some("SQL_FLAG_TYPE_UNSPECIFIED"),
42463            Self::Boolean => std::option::Option::Some("BOOLEAN"),
42464            Self::String => std::option::Option::Some("STRING"),
42465            Self::Integer => std::option::Option::Some("INTEGER"),
42466            Self::None => std::option::Option::Some("NONE"),
42467            Self::MysqlTimezoneOffset => std::option::Option::Some("MYSQL_TIMEZONE_OFFSET"),
42468            Self::Float => std::option::Option::Some("FLOAT"),
42469            Self::RepeatedString => std::option::Option::Some("REPEATED_STRING"),
42470            Self::UnknownValue(u) => u.0.name(),
42471        }
42472    }
42473}
42474
42475impl std::default::Default for SqlFlagType {
42476    fn default() -> Self {
42477        use std::convert::From;
42478        Self::from(0)
42479    }
42480}
42481
42482impl std::fmt::Display for SqlFlagType {
42483    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
42484        wkt::internal::display_enum(f, self.name(), self.value())
42485    }
42486}
42487
42488impl std::convert::From<i32> for SqlFlagType {
42489    fn from(value: i32) -> Self {
42490        match value {
42491            0 => Self::Unspecified,
42492            1 => Self::Boolean,
42493            2 => Self::String,
42494            3 => Self::Integer,
42495            4 => Self::None,
42496            5 => Self::MysqlTimezoneOffset,
42497            6 => Self::Float,
42498            7 => Self::RepeatedString,
42499            _ => Self::UnknownValue(sql_flag_type::UnknownValue(
42500                wkt::internal::UnknownEnumValue::Integer(value),
42501            )),
42502        }
42503    }
42504}
42505
42506impl std::convert::From<&str> for SqlFlagType {
42507    fn from(value: &str) -> Self {
42508        use std::string::ToString;
42509        match value {
42510            "SQL_FLAG_TYPE_UNSPECIFIED" => Self::Unspecified,
42511            "BOOLEAN" => Self::Boolean,
42512            "STRING" => Self::String,
42513            "INTEGER" => Self::Integer,
42514            "NONE" => Self::None,
42515            "MYSQL_TIMEZONE_OFFSET" => Self::MysqlTimezoneOffset,
42516            "FLOAT" => Self::Float,
42517            "REPEATED_STRING" => Self::RepeatedString,
42518            _ => Self::UnknownValue(sql_flag_type::UnknownValue(
42519                wkt::internal::UnknownEnumValue::String(value.to_string()),
42520            )),
42521        }
42522    }
42523}
42524
42525impl serde::ser::Serialize for SqlFlagType {
42526    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
42527    where
42528        S: serde::Serializer,
42529    {
42530        match self {
42531            Self::Unspecified => serializer.serialize_i32(0),
42532            Self::Boolean => serializer.serialize_i32(1),
42533            Self::String => serializer.serialize_i32(2),
42534            Self::Integer => serializer.serialize_i32(3),
42535            Self::None => serializer.serialize_i32(4),
42536            Self::MysqlTimezoneOffset => serializer.serialize_i32(5),
42537            Self::Float => serializer.serialize_i32(6),
42538            Self::RepeatedString => serializer.serialize_i32(7),
42539            Self::UnknownValue(u) => u.0.serialize(serializer),
42540        }
42541    }
42542}
42543
42544impl<'de> serde::de::Deserialize<'de> for SqlFlagType {
42545    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
42546    where
42547        D: serde::Deserializer<'de>,
42548    {
42549        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlFlagType>::new(
42550            ".google.cloud.sql.v1.SqlFlagType",
42551        ))
42552    }
42553}
42554
42555/// External Sync parallel level.
42556///
42557/// # Working with unknown values
42558///
42559/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
42560/// additional enum variants at any time. Adding new variants is not considered
42561/// a breaking change. Applications should write their code in anticipation of:
42562///
42563/// - New values appearing in future releases of the client library, **and**
42564/// - New values received dynamically, without application changes.
42565///
42566/// Please consult the [Working with enums] section in the user guide for some
42567/// guidelines.
42568///
42569/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
42570#[derive(Clone, Debug, PartialEq)]
42571#[non_exhaustive]
42572pub enum ExternalSyncParallelLevel {
42573    /// Unknown sync parallel level. Will be defaulted to OPTIMAL.
42574    Unspecified,
42575    /// Minimal parallel level.
42576    Min,
42577    /// Optimal parallel level.
42578    Optimal,
42579    /// Maximum parallel level.
42580    Max,
42581    /// If set, the enum was initialized with an unknown value.
42582    ///
42583    /// Applications can examine the value using [ExternalSyncParallelLevel::value] or
42584    /// [ExternalSyncParallelLevel::name].
42585    UnknownValue(external_sync_parallel_level::UnknownValue),
42586}
42587
42588#[doc(hidden)]
42589pub mod external_sync_parallel_level {
42590    #[allow(unused_imports)]
42591    use super::*;
42592    #[derive(Clone, Debug, PartialEq)]
42593    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
42594}
42595
42596impl ExternalSyncParallelLevel {
42597    /// Gets the enum value.
42598    ///
42599    /// Returns `None` if the enum contains an unknown value deserialized from
42600    /// the string representation of enums.
42601    pub fn value(&self) -> std::option::Option<i32> {
42602        match self {
42603            Self::Unspecified => std::option::Option::Some(0),
42604            Self::Min => std::option::Option::Some(1),
42605            Self::Optimal => std::option::Option::Some(2),
42606            Self::Max => std::option::Option::Some(3),
42607            Self::UnknownValue(u) => u.0.value(),
42608        }
42609    }
42610
42611    /// Gets the enum value as a string.
42612    ///
42613    /// Returns `None` if the enum contains an unknown value deserialized from
42614    /// the integer representation of enums.
42615    pub fn name(&self) -> std::option::Option<&str> {
42616        match self {
42617            Self::Unspecified => {
42618                std::option::Option::Some("EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED")
42619            }
42620            Self::Min => std::option::Option::Some("MIN"),
42621            Self::Optimal => std::option::Option::Some("OPTIMAL"),
42622            Self::Max => std::option::Option::Some("MAX"),
42623            Self::UnknownValue(u) => u.0.name(),
42624        }
42625    }
42626}
42627
42628impl std::default::Default for ExternalSyncParallelLevel {
42629    fn default() -> Self {
42630        use std::convert::From;
42631        Self::from(0)
42632    }
42633}
42634
42635impl std::fmt::Display for ExternalSyncParallelLevel {
42636    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
42637        wkt::internal::display_enum(f, self.name(), self.value())
42638    }
42639}
42640
42641impl std::convert::From<i32> for ExternalSyncParallelLevel {
42642    fn from(value: i32) -> Self {
42643        match value {
42644            0 => Self::Unspecified,
42645            1 => Self::Min,
42646            2 => Self::Optimal,
42647            3 => Self::Max,
42648            _ => Self::UnknownValue(external_sync_parallel_level::UnknownValue(
42649                wkt::internal::UnknownEnumValue::Integer(value),
42650            )),
42651        }
42652    }
42653}
42654
42655impl std::convert::From<&str> for ExternalSyncParallelLevel {
42656    fn from(value: &str) -> Self {
42657        use std::string::ToString;
42658        match value {
42659            "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED" => Self::Unspecified,
42660            "MIN" => Self::Min,
42661            "OPTIMAL" => Self::Optimal,
42662            "MAX" => Self::Max,
42663            _ => Self::UnknownValue(external_sync_parallel_level::UnknownValue(
42664                wkt::internal::UnknownEnumValue::String(value.to_string()),
42665            )),
42666        }
42667    }
42668}
42669
42670impl serde::ser::Serialize for ExternalSyncParallelLevel {
42671    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
42672    where
42673        S: serde::Serializer,
42674    {
42675        match self {
42676            Self::Unspecified => serializer.serialize_i32(0),
42677            Self::Min => serializer.serialize_i32(1),
42678            Self::Optimal => serializer.serialize_i32(2),
42679            Self::Max => serializer.serialize_i32(3),
42680            Self::UnknownValue(u) => u.0.serialize(serializer),
42681        }
42682    }
42683}
42684
42685impl<'de> serde::de::Deserialize<'de> for ExternalSyncParallelLevel {
42686    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
42687    where
42688        D: serde::Deserializer<'de>,
42689    {
42690        deserializer.deserialize_any(
42691            wkt::internal::EnumVisitor::<ExternalSyncParallelLevel>::new(
42692                ".google.cloud.sql.v1.ExternalSyncParallelLevel",
42693            ),
42694        )
42695    }
42696}
42697
42698///
42699/// # Working with unknown values
42700///
42701/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
42702/// additional enum variants at any time. Adding new variants is not considered
42703/// a breaking change. Applications should write their code in anticipation of:
42704///
42705/// - New values appearing in future releases of the client library, **and**
42706/// - New values received dynamically, without application changes.
42707///
42708/// Please consult the [Working with enums] section in the user guide for some
42709/// guidelines.
42710///
42711/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
42712#[derive(Clone, Debug, PartialEq)]
42713#[non_exhaustive]
42714pub enum SqlInstanceType {
42715    /// This is an unknown Cloud SQL instance type.
42716    Unspecified,
42717    /// A regular Cloud SQL instance that is not replicating from a primary
42718    /// instance.
42719    CloudSqlInstance,
42720    /// An instance running on the customer's premises that is not managed by
42721    /// Cloud SQL.
42722    OnPremisesInstance,
42723    /// A Cloud SQL instance acting as a read-replica.
42724    ReadReplicaInstance,
42725    /// If set, the enum was initialized with an unknown value.
42726    ///
42727    /// Applications can examine the value using [SqlInstanceType::value] or
42728    /// [SqlInstanceType::name].
42729    UnknownValue(sql_instance_type::UnknownValue),
42730}
42731
42732#[doc(hidden)]
42733pub mod sql_instance_type {
42734    #[allow(unused_imports)]
42735    use super::*;
42736    #[derive(Clone, Debug, PartialEq)]
42737    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
42738}
42739
42740impl SqlInstanceType {
42741    /// Gets the enum value.
42742    ///
42743    /// Returns `None` if the enum contains an unknown value deserialized from
42744    /// the string representation of enums.
42745    pub fn value(&self) -> std::option::Option<i32> {
42746        match self {
42747            Self::Unspecified => std::option::Option::Some(0),
42748            Self::CloudSqlInstance => std::option::Option::Some(1),
42749            Self::OnPremisesInstance => std::option::Option::Some(2),
42750            Self::ReadReplicaInstance => std::option::Option::Some(3),
42751            Self::UnknownValue(u) => u.0.value(),
42752        }
42753    }
42754
42755    /// Gets the enum value as a string.
42756    ///
42757    /// Returns `None` if the enum contains an unknown value deserialized from
42758    /// the integer representation of enums.
42759    pub fn name(&self) -> std::option::Option<&str> {
42760        match self {
42761            Self::Unspecified => std::option::Option::Some("SQL_INSTANCE_TYPE_UNSPECIFIED"),
42762            Self::CloudSqlInstance => std::option::Option::Some("CLOUD_SQL_INSTANCE"),
42763            Self::OnPremisesInstance => std::option::Option::Some("ON_PREMISES_INSTANCE"),
42764            Self::ReadReplicaInstance => std::option::Option::Some("READ_REPLICA_INSTANCE"),
42765            Self::UnknownValue(u) => u.0.name(),
42766        }
42767    }
42768}
42769
42770impl std::default::Default for SqlInstanceType {
42771    fn default() -> Self {
42772        use std::convert::From;
42773        Self::from(0)
42774    }
42775}
42776
42777impl std::fmt::Display for SqlInstanceType {
42778    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
42779        wkt::internal::display_enum(f, self.name(), self.value())
42780    }
42781}
42782
42783impl std::convert::From<i32> for SqlInstanceType {
42784    fn from(value: i32) -> Self {
42785        match value {
42786            0 => Self::Unspecified,
42787            1 => Self::CloudSqlInstance,
42788            2 => Self::OnPremisesInstance,
42789            3 => Self::ReadReplicaInstance,
42790            _ => Self::UnknownValue(sql_instance_type::UnknownValue(
42791                wkt::internal::UnknownEnumValue::Integer(value),
42792            )),
42793        }
42794    }
42795}
42796
42797impl std::convert::From<&str> for SqlInstanceType {
42798    fn from(value: &str) -> Self {
42799        use std::string::ToString;
42800        match value {
42801            "SQL_INSTANCE_TYPE_UNSPECIFIED" => Self::Unspecified,
42802            "CLOUD_SQL_INSTANCE" => Self::CloudSqlInstance,
42803            "ON_PREMISES_INSTANCE" => Self::OnPremisesInstance,
42804            "READ_REPLICA_INSTANCE" => Self::ReadReplicaInstance,
42805            _ => Self::UnknownValue(sql_instance_type::UnknownValue(
42806                wkt::internal::UnknownEnumValue::String(value.to_string()),
42807            )),
42808        }
42809    }
42810}
42811
42812impl serde::ser::Serialize for SqlInstanceType {
42813    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
42814    where
42815        S: serde::Serializer,
42816    {
42817        match self {
42818            Self::Unspecified => serializer.serialize_i32(0),
42819            Self::CloudSqlInstance => serializer.serialize_i32(1),
42820            Self::OnPremisesInstance => serializer.serialize_i32(2),
42821            Self::ReadReplicaInstance => serializer.serialize_i32(3),
42822            Self::UnknownValue(u) => u.0.serialize(serializer),
42823        }
42824    }
42825}
42826
42827impl<'de> serde::de::Deserialize<'de> for SqlInstanceType {
42828    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
42829    where
42830        D: serde::Deserializer<'de>,
42831    {
42832        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlInstanceType>::new(
42833            ".google.cloud.sql.v1.SqlInstanceType",
42834        ))
42835    }
42836}
42837
42838/// The suspension reason of the database instance if the state is SUSPENDED.
42839///
42840/// # Working with unknown values
42841///
42842/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
42843/// additional enum variants at any time. Adding new variants is not considered
42844/// a breaking change. Applications should write their code in anticipation of:
42845///
42846/// - New values appearing in future releases of the client library, **and**
42847/// - New values received dynamically, without application changes.
42848///
42849/// Please consult the [Working with enums] section in the user guide for some
42850/// guidelines.
42851///
42852/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
42853#[derive(Clone, Debug, PartialEq)]
42854#[non_exhaustive]
42855pub enum SqlSuspensionReason {
42856    /// This is an unknown suspension reason.
42857    Unspecified,
42858    /// The instance is suspended due to billing issues (for example:, GCP account
42859    /// issue)
42860    BillingIssue,
42861    /// The instance is suspended due to illegal content (for example:, child
42862    /// pornography, copyrighted material, etc.).
42863    LegalIssue,
42864    /// The instance is causing operational issues (for example:, causing the
42865    /// database to crash).
42866    OperationalIssue,
42867    /// The KMS key used by the instance is either revoked or denied access to
42868    KmsKeyIssue,
42869    /// If set, the enum was initialized with an unknown value.
42870    ///
42871    /// Applications can examine the value using [SqlSuspensionReason::value] or
42872    /// [SqlSuspensionReason::name].
42873    UnknownValue(sql_suspension_reason::UnknownValue),
42874}
42875
42876#[doc(hidden)]
42877pub mod sql_suspension_reason {
42878    #[allow(unused_imports)]
42879    use super::*;
42880    #[derive(Clone, Debug, PartialEq)]
42881    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
42882}
42883
42884impl SqlSuspensionReason {
42885    /// Gets the enum value.
42886    ///
42887    /// Returns `None` if the enum contains an unknown value deserialized from
42888    /// the string representation of enums.
42889    pub fn value(&self) -> std::option::Option<i32> {
42890        match self {
42891            Self::Unspecified => std::option::Option::Some(0),
42892            Self::BillingIssue => std::option::Option::Some(2),
42893            Self::LegalIssue => std::option::Option::Some(3),
42894            Self::OperationalIssue => std::option::Option::Some(4),
42895            Self::KmsKeyIssue => std::option::Option::Some(5),
42896            Self::UnknownValue(u) => u.0.value(),
42897        }
42898    }
42899
42900    /// Gets the enum value as a string.
42901    ///
42902    /// Returns `None` if the enum contains an unknown value deserialized from
42903    /// the integer representation of enums.
42904    pub fn name(&self) -> std::option::Option<&str> {
42905        match self {
42906            Self::Unspecified => std::option::Option::Some("SQL_SUSPENSION_REASON_UNSPECIFIED"),
42907            Self::BillingIssue => std::option::Option::Some("BILLING_ISSUE"),
42908            Self::LegalIssue => std::option::Option::Some("LEGAL_ISSUE"),
42909            Self::OperationalIssue => std::option::Option::Some("OPERATIONAL_ISSUE"),
42910            Self::KmsKeyIssue => std::option::Option::Some("KMS_KEY_ISSUE"),
42911            Self::UnknownValue(u) => u.0.name(),
42912        }
42913    }
42914}
42915
42916impl std::default::Default for SqlSuspensionReason {
42917    fn default() -> Self {
42918        use std::convert::From;
42919        Self::from(0)
42920    }
42921}
42922
42923impl std::fmt::Display for SqlSuspensionReason {
42924    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
42925        wkt::internal::display_enum(f, self.name(), self.value())
42926    }
42927}
42928
42929impl std::convert::From<i32> for SqlSuspensionReason {
42930    fn from(value: i32) -> Self {
42931        match value {
42932            0 => Self::Unspecified,
42933            2 => Self::BillingIssue,
42934            3 => Self::LegalIssue,
42935            4 => Self::OperationalIssue,
42936            5 => Self::KmsKeyIssue,
42937            _ => Self::UnknownValue(sql_suspension_reason::UnknownValue(
42938                wkt::internal::UnknownEnumValue::Integer(value),
42939            )),
42940        }
42941    }
42942}
42943
42944impl std::convert::From<&str> for SqlSuspensionReason {
42945    fn from(value: &str) -> Self {
42946        use std::string::ToString;
42947        match value {
42948            "SQL_SUSPENSION_REASON_UNSPECIFIED" => Self::Unspecified,
42949            "BILLING_ISSUE" => Self::BillingIssue,
42950            "LEGAL_ISSUE" => Self::LegalIssue,
42951            "OPERATIONAL_ISSUE" => Self::OperationalIssue,
42952            "KMS_KEY_ISSUE" => Self::KmsKeyIssue,
42953            _ => Self::UnknownValue(sql_suspension_reason::UnknownValue(
42954                wkt::internal::UnknownEnumValue::String(value.to_string()),
42955            )),
42956        }
42957    }
42958}
42959
42960impl serde::ser::Serialize for SqlSuspensionReason {
42961    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
42962    where
42963        S: serde::Serializer,
42964    {
42965        match self {
42966            Self::Unspecified => serializer.serialize_i32(0),
42967            Self::BillingIssue => serializer.serialize_i32(2),
42968            Self::LegalIssue => serializer.serialize_i32(3),
42969            Self::OperationalIssue => serializer.serialize_i32(4),
42970            Self::KmsKeyIssue => serializer.serialize_i32(5),
42971            Self::UnknownValue(u) => u.0.serialize(serializer),
42972        }
42973    }
42974}
42975
42976impl<'de> serde::de::Deserialize<'de> for SqlSuspensionReason {
42977    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
42978    where
42979        D: serde::Deserializer<'de>,
42980    {
42981        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlSuspensionReason>::new(
42982            ".google.cloud.sql.v1.SqlSuspensionReason",
42983        ))
42984    }
42985}
42986
42987///
42988/// # Working with unknown values
42989///
42990/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
42991/// additional enum variants at any time. Adding new variants is not considered
42992/// a breaking change. Applications should write their code in anticipation of:
42993///
42994/// - New values appearing in future releases of the client library, **and**
42995/// - New values received dynamically, without application changes.
42996///
42997/// Please consult the [Working with enums] section in the user guide for some
42998/// guidelines.
42999///
43000/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
43001#[derive(Clone, Debug, PartialEq)]
43002#[non_exhaustive]
43003pub enum SqlFileType {
43004    /// Unknown file type.
43005    Unspecified,
43006    /// File containing SQL statements.
43007    Sql,
43008    /// File in CSV format.
43009    Csv,
43010    Bak,
43011    /// If set, the enum was initialized with an unknown value.
43012    ///
43013    /// Applications can examine the value using [SqlFileType::value] or
43014    /// [SqlFileType::name].
43015    UnknownValue(sql_file_type::UnknownValue),
43016}
43017
43018#[doc(hidden)]
43019pub mod sql_file_type {
43020    #[allow(unused_imports)]
43021    use super::*;
43022    #[derive(Clone, Debug, PartialEq)]
43023    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
43024}
43025
43026impl SqlFileType {
43027    /// Gets the enum value.
43028    ///
43029    /// Returns `None` if the enum contains an unknown value deserialized from
43030    /// the string representation of enums.
43031    pub fn value(&self) -> std::option::Option<i32> {
43032        match self {
43033            Self::Unspecified => std::option::Option::Some(0),
43034            Self::Sql => std::option::Option::Some(1),
43035            Self::Csv => std::option::Option::Some(2),
43036            Self::Bak => std::option::Option::Some(4),
43037            Self::UnknownValue(u) => u.0.value(),
43038        }
43039    }
43040
43041    /// Gets the enum value as a string.
43042    ///
43043    /// Returns `None` if the enum contains an unknown value deserialized from
43044    /// the integer representation of enums.
43045    pub fn name(&self) -> std::option::Option<&str> {
43046        match self {
43047            Self::Unspecified => std::option::Option::Some("SQL_FILE_TYPE_UNSPECIFIED"),
43048            Self::Sql => std::option::Option::Some("SQL"),
43049            Self::Csv => std::option::Option::Some("CSV"),
43050            Self::Bak => std::option::Option::Some("BAK"),
43051            Self::UnknownValue(u) => u.0.name(),
43052        }
43053    }
43054}
43055
43056impl std::default::Default for SqlFileType {
43057    fn default() -> Self {
43058        use std::convert::From;
43059        Self::from(0)
43060    }
43061}
43062
43063impl std::fmt::Display for SqlFileType {
43064    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
43065        wkt::internal::display_enum(f, self.name(), self.value())
43066    }
43067}
43068
43069impl std::convert::From<i32> for SqlFileType {
43070    fn from(value: i32) -> Self {
43071        match value {
43072            0 => Self::Unspecified,
43073            1 => Self::Sql,
43074            2 => Self::Csv,
43075            4 => Self::Bak,
43076            _ => Self::UnknownValue(sql_file_type::UnknownValue(
43077                wkt::internal::UnknownEnumValue::Integer(value),
43078            )),
43079        }
43080    }
43081}
43082
43083impl std::convert::From<&str> for SqlFileType {
43084    fn from(value: &str) -> Self {
43085        use std::string::ToString;
43086        match value {
43087            "SQL_FILE_TYPE_UNSPECIFIED" => Self::Unspecified,
43088            "SQL" => Self::Sql,
43089            "CSV" => Self::Csv,
43090            "BAK" => Self::Bak,
43091            _ => Self::UnknownValue(sql_file_type::UnknownValue(
43092                wkt::internal::UnknownEnumValue::String(value.to_string()),
43093            )),
43094        }
43095    }
43096}
43097
43098impl serde::ser::Serialize for SqlFileType {
43099    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
43100    where
43101        S: serde::Serializer,
43102    {
43103        match self {
43104            Self::Unspecified => serializer.serialize_i32(0),
43105            Self::Sql => serializer.serialize_i32(1),
43106            Self::Csv => serializer.serialize_i32(2),
43107            Self::Bak => serializer.serialize_i32(4),
43108            Self::UnknownValue(u) => u.0.serialize(serializer),
43109        }
43110    }
43111}
43112
43113impl<'de> serde::de::Deserialize<'de> for SqlFileType {
43114    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
43115    where
43116        D: serde::Deserializer<'de>,
43117    {
43118        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlFileType>::new(
43119            ".google.cloud.sql.v1.SqlFileType",
43120        ))
43121    }
43122}
43123
43124///
43125/// # Working with unknown values
43126///
43127/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
43128/// additional enum variants at any time. Adding new variants is not considered
43129/// a breaking change. Applications should write their code in anticipation of:
43130///
43131/// - New values appearing in future releases of the client library, **and**
43132/// - New values received dynamically, without application changes.
43133///
43134/// Please consult the [Working with enums] section in the user guide for some
43135/// guidelines.
43136///
43137/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
43138#[derive(Clone, Debug, PartialEq)]
43139#[non_exhaustive]
43140pub enum BakType {
43141    /// Default type.
43142    Unspecified,
43143    /// Full backup.
43144    Full,
43145    /// Differential backup.
43146    Diff,
43147    /// Transaction Log backup
43148    Tlog,
43149    /// If set, the enum was initialized with an unknown value.
43150    ///
43151    /// Applications can examine the value using [BakType::value] or
43152    /// [BakType::name].
43153    UnknownValue(bak_type::UnknownValue),
43154}
43155
43156#[doc(hidden)]
43157pub mod bak_type {
43158    #[allow(unused_imports)]
43159    use super::*;
43160    #[derive(Clone, Debug, PartialEq)]
43161    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
43162}
43163
43164impl BakType {
43165    /// Gets the enum value.
43166    ///
43167    /// Returns `None` if the enum contains an unknown value deserialized from
43168    /// the string representation of enums.
43169    pub fn value(&self) -> std::option::Option<i32> {
43170        match self {
43171            Self::Unspecified => std::option::Option::Some(0),
43172            Self::Full => std::option::Option::Some(1),
43173            Self::Diff => std::option::Option::Some(2),
43174            Self::Tlog => std::option::Option::Some(3),
43175            Self::UnknownValue(u) => u.0.value(),
43176        }
43177    }
43178
43179    /// Gets the enum value as a string.
43180    ///
43181    /// Returns `None` if the enum contains an unknown value deserialized from
43182    /// the integer representation of enums.
43183    pub fn name(&self) -> std::option::Option<&str> {
43184        match self {
43185            Self::Unspecified => std::option::Option::Some("BAK_TYPE_UNSPECIFIED"),
43186            Self::Full => std::option::Option::Some("FULL"),
43187            Self::Diff => std::option::Option::Some("DIFF"),
43188            Self::Tlog => std::option::Option::Some("TLOG"),
43189            Self::UnknownValue(u) => u.0.name(),
43190        }
43191    }
43192}
43193
43194impl std::default::Default for BakType {
43195    fn default() -> Self {
43196        use std::convert::From;
43197        Self::from(0)
43198    }
43199}
43200
43201impl std::fmt::Display for BakType {
43202    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
43203        wkt::internal::display_enum(f, self.name(), self.value())
43204    }
43205}
43206
43207impl std::convert::From<i32> for BakType {
43208    fn from(value: i32) -> Self {
43209        match value {
43210            0 => Self::Unspecified,
43211            1 => Self::Full,
43212            2 => Self::Diff,
43213            3 => Self::Tlog,
43214            _ => Self::UnknownValue(bak_type::UnknownValue(
43215                wkt::internal::UnknownEnumValue::Integer(value),
43216            )),
43217        }
43218    }
43219}
43220
43221impl std::convert::From<&str> for BakType {
43222    fn from(value: &str) -> Self {
43223        use std::string::ToString;
43224        match value {
43225            "BAK_TYPE_UNSPECIFIED" => Self::Unspecified,
43226            "FULL" => Self::Full,
43227            "DIFF" => Self::Diff,
43228            "TLOG" => Self::Tlog,
43229            _ => Self::UnknownValue(bak_type::UnknownValue(
43230                wkt::internal::UnknownEnumValue::String(value.to_string()),
43231            )),
43232        }
43233    }
43234}
43235
43236impl serde::ser::Serialize for BakType {
43237    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
43238    where
43239        S: serde::Serializer,
43240    {
43241        match self {
43242            Self::Unspecified => serializer.serialize_i32(0),
43243            Self::Full => serializer.serialize_i32(1),
43244            Self::Diff => serializer.serialize_i32(2),
43245            Self::Tlog => serializer.serialize_i32(3),
43246            Self::UnknownValue(u) => u.0.serialize(serializer),
43247        }
43248    }
43249}
43250
43251impl<'de> serde::de::Deserialize<'de> for BakType {
43252    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
43253    where
43254        D: serde::Deserializer<'de>,
43255    {
43256        deserializer.deserialize_any(wkt::internal::EnumVisitor::<BakType>::new(
43257            ".google.cloud.sql.v1.BakType",
43258        ))
43259    }
43260}
43261
43262///
43263/// # Working with unknown values
43264///
43265/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
43266/// additional enum variants at any time. Adding new variants is not considered
43267/// a breaking change. Applications should write their code in anticipation of:
43268///
43269/// - New values appearing in future releases of the client library, **and**
43270/// - New values received dynamically, without application changes.
43271///
43272/// Please consult the [Working with enums] section in the user guide for some
43273/// guidelines.
43274///
43275/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
43276#[derive(Clone, Debug, PartialEq)]
43277#[non_exhaustive]
43278pub enum SqlBackendType {
43279    /// This is an unknown backend type for instance.
43280    Unspecified,
43281    /// V1 speckle instance.
43282    #[deprecated]
43283    FirstGen,
43284    /// V2 speckle instance.
43285    SecondGen,
43286    /// On premises instance.
43287    External,
43288    /// If set, the enum was initialized with an unknown value.
43289    ///
43290    /// Applications can examine the value using [SqlBackendType::value] or
43291    /// [SqlBackendType::name].
43292    UnknownValue(sql_backend_type::UnknownValue),
43293}
43294
43295#[doc(hidden)]
43296pub mod sql_backend_type {
43297    #[allow(unused_imports)]
43298    use super::*;
43299    #[derive(Clone, Debug, PartialEq)]
43300    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
43301}
43302
43303impl SqlBackendType {
43304    /// Gets the enum value.
43305    ///
43306    /// Returns `None` if the enum contains an unknown value deserialized from
43307    /// the string representation of enums.
43308    pub fn value(&self) -> std::option::Option<i32> {
43309        match self {
43310            Self::Unspecified => std::option::Option::Some(0),
43311            Self::FirstGen => std::option::Option::Some(1),
43312            Self::SecondGen => std::option::Option::Some(2),
43313            Self::External => std::option::Option::Some(3),
43314            Self::UnknownValue(u) => u.0.value(),
43315        }
43316    }
43317
43318    /// Gets the enum value as a string.
43319    ///
43320    /// Returns `None` if the enum contains an unknown value deserialized from
43321    /// the integer representation of enums.
43322    pub fn name(&self) -> std::option::Option<&str> {
43323        match self {
43324            Self::Unspecified => std::option::Option::Some("SQL_BACKEND_TYPE_UNSPECIFIED"),
43325            Self::FirstGen => std::option::Option::Some("FIRST_GEN"),
43326            Self::SecondGen => std::option::Option::Some("SECOND_GEN"),
43327            Self::External => std::option::Option::Some("EXTERNAL"),
43328            Self::UnknownValue(u) => u.0.name(),
43329        }
43330    }
43331}
43332
43333impl std::default::Default for SqlBackendType {
43334    fn default() -> Self {
43335        use std::convert::From;
43336        Self::from(0)
43337    }
43338}
43339
43340impl std::fmt::Display for SqlBackendType {
43341    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
43342        wkt::internal::display_enum(f, self.name(), self.value())
43343    }
43344}
43345
43346impl std::convert::From<i32> for SqlBackendType {
43347    fn from(value: i32) -> Self {
43348        match value {
43349            0 => Self::Unspecified,
43350            1 => Self::FirstGen,
43351            2 => Self::SecondGen,
43352            3 => Self::External,
43353            _ => Self::UnknownValue(sql_backend_type::UnknownValue(
43354                wkt::internal::UnknownEnumValue::Integer(value),
43355            )),
43356        }
43357    }
43358}
43359
43360impl std::convert::From<&str> for SqlBackendType {
43361    fn from(value: &str) -> Self {
43362        use std::string::ToString;
43363        match value {
43364            "SQL_BACKEND_TYPE_UNSPECIFIED" => Self::Unspecified,
43365            "FIRST_GEN" => Self::FirstGen,
43366            "SECOND_GEN" => Self::SecondGen,
43367            "EXTERNAL" => Self::External,
43368            _ => Self::UnknownValue(sql_backend_type::UnknownValue(
43369                wkt::internal::UnknownEnumValue::String(value.to_string()),
43370            )),
43371        }
43372    }
43373}
43374
43375impl serde::ser::Serialize for SqlBackendType {
43376    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
43377    where
43378        S: serde::Serializer,
43379    {
43380        match self {
43381            Self::Unspecified => serializer.serialize_i32(0),
43382            Self::FirstGen => serializer.serialize_i32(1),
43383            Self::SecondGen => serializer.serialize_i32(2),
43384            Self::External => serializer.serialize_i32(3),
43385            Self::UnknownValue(u) => u.0.serialize(serializer),
43386        }
43387    }
43388}
43389
43390impl<'de> serde::de::Deserialize<'de> for SqlBackendType {
43391    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
43392    where
43393        D: serde::Deserializer<'de>,
43394    {
43395        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlBackendType>::new(
43396            ".google.cloud.sql.v1.SqlBackendType",
43397        ))
43398    }
43399}
43400
43401///
43402/// # Working with unknown values
43403///
43404/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
43405/// additional enum variants at any time. Adding new variants is not considered
43406/// a breaking change. Applications should write their code in anticipation of:
43407///
43408/// - New values appearing in future releases of the client library, **and**
43409/// - New values received dynamically, without application changes.
43410///
43411/// Please consult the [Working with enums] section in the user guide for some
43412/// guidelines.
43413///
43414/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
43415#[derive(Clone, Debug, PartialEq)]
43416#[non_exhaustive]
43417pub enum SqlIpAddressType {
43418    /// This is an unknown IP address type.
43419    Unspecified,
43420    /// IP address the customer is supposed to connect to. Usually this is the
43421    /// load balancer's IP address
43422    Primary,
43423    /// Source IP address of the connection a read replica establishes to its
43424    /// external primary instance. This IP address can be allowlisted by the
43425    /// customer in case it has a firewall that filters incoming connection to its
43426    /// on premises primary instance.
43427    Outgoing,
43428    /// Private IP used when using private IPs and network peering.
43429    Private,
43430    /// V1 IP of a migrated instance. We want the user to
43431    /// decommission this IP as soon as the migration is complete.
43432    /// Note: V1 instances with V1 ip addresses will be counted as PRIMARY.
43433    Migrated1StGen,
43434    /// If set, the enum was initialized with an unknown value.
43435    ///
43436    /// Applications can examine the value using [SqlIpAddressType::value] or
43437    /// [SqlIpAddressType::name].
43438    UnknownValue(sql_ip_address_type::UnknownValue),
43439}
43440
43441#[doc(hidden)]
43442pub mod sql_ip_address_type {
43443    #[allow(unused_imports)]
43444    use super::*;
43445    #[derive(Clone, Debug, PartialEq)]
43446    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
43447}
43448
43449impl SqlIpAddressType {
43450    /// Gets the enum value.
43451    ///
43452    /// Returns `None` if the enum contains an unknown value deserialized from
43453    /// the string representation of enums.
43454    pub fn value(&self) -> std::option::Option<i32> {
43455        match self {
43456            Self::Unspecified => std::option::Option::Some(0),
43457            Self::Primary => std::option::Option::Some(1),
43458            Self::Outgoing => std::option::Option::Some(2),
43459            Self::Private => std::option::Option::Some(3),
43460            Self::Migrated1StGen => std::option::Option::Some(4),
43461            Self::UnknownValue(u) => u.0.value(),
43462        }
43463    }
43464
43465    /// Gets the enum value as a string.
43466    ///
43467    /// Returns `None` if the enum contains an unknown value deserialized from
43468    /// the integer representation of enums.
43469    pub fn name(&self) -> std::option::Option<&str> {
43470        match self {
43471            Self::Unspecified => std::option::Option::Some("SQL_IP_ADDRESS_TYPE_UNSPECIFIED"),
43472            Self::Primary => std::option::Option::Some("PRIMARY"),
43473            Self::Outgoing => std::option::Option::Some("OUTGOING"),
43474            Self::Private => std::option::Option::Some("PRIVATE"),
43475            Self::Migrated1StGen => std::option::Option::Some("MIGRATED_1ST_GEN"),
43476            Self::UnknownValue(u) => u.0.name(),
43477        }
43478    }
43479}
43480
43481impl std::default::Default for SqlIpAddressType {
43482    fn default() -> Self {
43483        use std::convert::From;
43484        Self::from(0)
43485    }
43486}
43487
43488impl std::fmt::Display for SqlIpAddressType {
43489    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
43490        wkt::internal::display_enum(f, self.name(), self.value())
43491    }
43492}
43493
43494impl std::convert::From<i32> for SqlIpAddressType {
43495    fn from(value: i32) -> Self {
43496        match value {
43497            0 => Self::Unspecified,
43498            1 => Self::Primary,
43499            2 => Self::Outgoing,
43500            3 => Self::Private,
43501            4 => Self::Migrated1StGen,
43502            _ => Self::UnknownValue(sql_ip_address_type::UnknownValue(
43503                wkt::internal::UnknownEnumValue::Integer(value),
43504            )),
43505        }
43506    }
43507}
43508
43509impl std::convert::From<&str> for SqlIpAddressType {
43510    fn from(value: &str) -> Self {
43511        use std::string::ToString;
43512        match value {
43513            "SQL_IP_ADDRESS_TYPE_UNSPECIFIED" => Self::Unspecified,
43514            "PRIMARY" => Self::Primary,
43515            "OUTGOING" => Self::Outgoing,
43516            "PRIVATE" => Self::Private,
43517            "MIGRATED_1ST_GEN" => Self::Migrated1StGen,
43518            _ => Self::UnknownValue(sql_ip_address_type::UnknownValue(
43519                wkt::internal::UnknownEnumValue::String(value.to_string()),
43520            )),
43521        }
43522    }
43523}
43524
43525impl serde::ser::Serialize for SqlIpAddressType {
43526    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
43527    where
43528        S: serde::Serializer,
43529    {
43530        match self {
43531            Self::Unspecified => serializer.serialize_i32(0),
43532            Self::Primary => serializer.serialize_i32(1),
43533            Self::Outgoing => serializer.serialize_i32(2),
43534            Self::Private => serializer.serialize_i32(3),
43535            Self::Migrated1StGen => serializer.serialize_i32(4),
43536            Self::UnknownValue(u) => u.0.serialize(serializer),
43537        }
43538    }
43539}
43540
43541impl<'de> serde::de::Deserialize<'de> for SqlIpAddressType {
43542    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
43543    where
43544        D: serde::Deserializer<'de>,
43545    {
43546        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlIpAddressType>::new(
43547            ".google.cloud.sql.v1.SqlIpAddressType",
43548        ))
43549    }
43550}
43551
43552/// The database engine type and version.
43553///
43554/// # Working with unknown values
43555///
43556/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
43557/// additional enum variants at any time. Adding new variants is not considered
43558/// a breaking change. Applications should write their code in anticipation of:
43559///
43560/// - New values appearing in future releases of the client library, **and**
43561/// - New values received dynamically, without application changes.
43562///
43563/// Please consult the [Working with enums] section in the user guide for some
43564/// guidelines.
43565///
43566/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
43567#[derive(Clone, Debug, PartialEq)]
43568#[non_exhaustive]
43569pub enum SqlDatabaseVersion {
43570    /// This is an unknown database version.
43571    Unspecified,
43572    /// The database version is MySQL 5.1.
43573    #[deprecated]
43574    Mysql51,
43575    /// The database version is MySQL 5.5.
43576    #[deprecated]
43577    Mysql55,
43578    /// The database version is MySQL 5.6.
43579    Mysql56,
43580    /// The database version is MySQL 5.7.
43581    Mysql57,
43582    /// The database version is SQL Server 2017 Standard.
43583    Sqlserver2017Standard,
43584    /// The database version is SQL Server 2017 Enterprise.
43585    Sqlserver2017Enterprise,
43586    /// The database version is SQL Server 2017 Express.
43587    Sqlserver2017Express,
43588    /// The database version is SQL Server 2017 Web.
43589    Sqlserver2017Web,
43590    /// The database version is PostgreSQL 9.6.
43591    Postgres96,
43592    /// The database version is PostgreSQL 10.
43593    Postgres10,
43594    /// The database version is PostgreSQL 11.
43595    Postgres11,
43596    /// The database version is PostgreSQL 12.
43597    Postgres12,
43598    /// The database version is PostgreSQL 13.
43599    Postgres13,
43600    /// The database version is PostgreSQL 14.
43601    Postgres14,
43602    /// The database version is PostgreSQL 15.
43603    Postgres15,
43604    /// The database version is PostgreSQL 16.
43605    Postgres16,
43606    /// The database version is MySQL 8.
43607    Mysql80,
43608    /// The database major version is MySQL 8.0 and the minor version is 18.
43609    Mysql8018,
43610    /// The database major version is MySQL 8.0 and the minor version is 26.
43611    Mysql8026,
43612    /// The database major version is MySQL 8.0 and the minor version is 27.
43613    Mysql8027,
43614    /// The database major version is MySQL 8.0 and the minor version is 28.
43615    Mysql8028,
43616    /// The database major version is MySQL 8.0 and the minor version is 29.
43617    #[deprecated]
43618    Mysql8029,
43619    /// The database major version is MySQL 8.0 and the minor version is 30.
43620    Mysql8030,
43621    /// The database major version is MySQL 8.0 and the minor version is 31.
43622    Mysql8031,
43623    /// The database major version is MySQL 8.0 and the minor version is 32.
43624    Mysql8032,
43625    /// The database major version is MySQL 8.0 and the minor version is 33.
43626    Mysql8033,
43627    /// The database major version is MySQL 8.0 and the minor version is 34.
43628    Mysql8034,
43629    /// The database major version is MySQL 8.0 and the minor version is 35.
43630    Mysql8035,
43631    /// The database major version is MySQL 8.0 and the minor version is 36.
43632    Mysql8036,
43633    /// The database major version is MySQL 8.0 and the minor version is 37.
43634    Mysql8037,
43635    /// The database major version is MySQL 8.0 and the minor version is 38.
43636    Mysql8038,
43637    /// The database major version is MySQL 8.0 and the minor version is 39.
43638    Mysql8039,
43639    /// The database major version is MySQL 8.0 and the minor version is 40.
43640    Mysql8040,
43641    /// The database version is MySQL 8.4.
43642    Mysql84,
43643    /// The database version is MySQL 8.4 and the patch version is 0.
43644    Mysql840,
43645    /// The database version is SQL Server 2019 Standard.
43646    Sqlserver2019Standard,
43647    /// The database version is SQL Server 2019 Enterprise.
43648    Sqlserver2019Enterprise,
43649    /// The database version is SQL Server 2019 Express.
43650    Sqlserver2019Express,
43651    /// The database version is SQL Server 2019 Web.
43652    Sqlserver2019Web,
43653    /// The database version is SQL Server 2022 Standard.
43654    Sqlserver2022Standard,
43655    /// The database version is SQL Server 2022 Enterprise.
43656    Sqlserver2022Enterprise,
43657    /// The database version is SQL Server 2022 Express.
43658    Sqlserver2022Express,
43659    /// The database version is SQL Server 2022 Web.
43660    Sqlserver2022Web,
43661    /// If set, the enum was initialized with an unknown value.
43662    ///
43663    /// Applications can examine the value using [SqlDatabaseVersion::value] or
43664    /// [SqlDatabaseVersion::name].
43665    UnknownValue(sql_database_version::UnknownValue),
43666}
43667
43668#[doc(hidden)]
43669pub mod sql_database_version {
43670    #[allow(unused_imports)]
43671    use super::*;
43672    #[derive(Clone, Debug, PartialEq)]
43673    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
43674}
43675
43676impl SqlDatabaseVersion {
43677    /// Gets the enum value.
43678    ///
43679    /// Returns `None` if the enum contains an unknown value deserialized from
43680    /// the string representation of enums.
43681    pub fn value(&self) -> std::option::Option<i32> {
43682        match self {
43683            Self::Unspecified => std::option::Option::Some(0),
43684            Self::Mysql51 => std::option::Option::Some(2),
43685            Self::Mysql55 => std::option::Option::Some(3),
43686            Self::Mysql56 => std::option::Option::Some(5),
43687            Self::Mysql57 => std::option::Option::Some(6),
43688            Self::Sqlserver2017Standard => std::option::Option::Some(11),
43689            Self::Sqlserver2017Enterprise => std::option::Option::Some(14),
43690            Self::Sqlserver2017Express => std::option::Option::Some(15),
43691            Self::Sqlserver2017Web => std::option::Option::Some(16),
43692            Self::Postgres96 => std::option::Option::Some(9),
43693            Self::Postgres10 => std::option::Option::Some(18),
43694            Self::Postgres11 => std::option::Option::Some(10),
43695            Self::Postgres12 => std::option::Option::Some(19),
43696            Self::Postgres13 => std::option::Option::Some(23),
43697            Self::Postgres14 => std::option::Option::Some(110),
43698            Self::Postgres15 => std::option::Option::Some(172),
43699            Self::Postgres16 => std::option::Option::Some(272),
43700            Self::Mysql80 => std::option::Option::Some(20),
43701            Self::Mysql8018 => std::option::Option::Some(41),
43702            Self::Mysql8026 => std::option::Option::Some(85),
43703            Self::Mysql8027 => std::option::Option::Some(111),
43704            Self::Mysql8028 => std::option::Option::Some(132),
43705            Self::Mysql8029 => std::option::Option::Some(148),
43706            Self::Mysql8030 => std::option::Option::Some(174),
43707            Self::Mysql8031 => std::option::Option::Some(197),
43708            Self::Mysql8032 => std::option::Option::Some(213),
43709            Self::Mysql8033 => std::option::Option::Some(238),
43710            Self::Mysql8034 => std::option::Option::Some(239),
43711            Self::Mysql8035 => std::option::Option::Some(240),
43712            Self::Mysql8036 => std::option::Option::Some(241),
43713            Self::Mysql8037 => std::option::Option::Some(355),
43714            Self::Mysql8038 => std::option::Option::Some(356),
43715            Self::Mysql8039 => std::option::Option::Some(357),
43716            Self::Mysql8040 => std::option::Option::Some(358),
43717            Self::Mysql84 => std::option::Option::Some(398),
43718            Self::Mysql840 => std::option::Option::Some(399),
43719            Self::Sqlserver2019Standard => std::option::Option::Some(26),
43720            Self::Sqlserver2019Enterprise => std::option::Option::Some(27),
43721            Self::Sqlserver2019Express => std::option::Option::Some(28),
43722            Self::Sqlserver2019Web => std::option::Option::Some(29),
43723            Self::Sqlserver2022Standard => std::option::Option::Some(199),
43724            Self::Sqlserver2022Enterprise => std::option::Option::Some(200),
43725            Self::Sqlserver2022Express => std::option::Option::Some(201),
43726            Self::Sqlserver2022Web => std::option::Option::Some(202),
43727            Self::UnknownValue(u) => u.0.value(),
43728        }
43729    }
43730
43731    /// Gets the enum value as a string.
43732    ///
43733    /// Returns `None` if the enum contains an unknown value deserialized from
43734    /// the integer representation of enums.
43735    pub fn name(&self) -> std::option::Option<&str> {
43736        match self {
43737            Self::Unspecified => std::option::Option::Some("SQL_DATABASE_VERSION_UNSPECIFIED"),
43738            Self::Mysql51 => std::option::Option::Some("MYSQL_5_1"),
43739            Self::Mysql55 => std::option::Option::Some("MYSQL_5_5"),
43740            Self::Mysql56 => std::option::Option::Some("MYSQL_5_6"),
43741            Self::Mysql57 => std::option::Option::Some("MYSQL_5_7"),
43742            Self::Sqlserver2017Standard => std::option::Option::Some("SQLSERVER_2017_STANDARD"),
43743            Self::Sqlserver2017Enterprise => std::option::Option::Some("SQLSERVER_2017_ENTERPRISE"),
43744            Self::Sqlserver2017Express => std::option::Option::Some("SQLSERVER_2017_EXPRESS"),
43745            Self::Sqlserver2017Web => std::option::Option::Some("SQLSERVER_2017_WEB"),
43746            Self::Postgres96 => std::option::Option::Some("POSTGRES_9_6"),
43747            Self::Postgres10 => std::option::Option::Some("POSTGRES_10"),
43748            Self::Postgres11 => std::option::Option::Some("POSTGRES_11"),
43749            Self::Postgres12 => std::option::Option::Some("POSTGRES_12"),
43750            Self::Postgres13 => std::option::Option::Some("POSTGRES_13"),
43751            Self::Postgres14 => std::option::Option::Some("POSTGRES_14"),
43752            Self::Postgres15 => std::option::Option::Some("POSTGRES_15"),
43753            Self::Postgres16 => std::option::Option::Some("POSTGRES_16"),
43754            Self::Mysql80 => std::option::Option::Some("MYSQL_8_0"),
43755            Self::Mysql8018 => std::option::Option::Some("MYSQL_8_0_18"),
43756            Self::Mysql8026 => std::option::Option::Some("MYSQL_8_0_26"),
43757            Self::Mysql8027 => std::option::Option::Some("MYSQL_8_0_27"),
43758            Self::Mysql8028 => std::option::Option::Some("MYSQL_8_0_28"),
43759            Self::Mysql8029 => std::option::Option::Some("MYSQL_8_0_29"),
43760            Self::Mysql8030 => std::option::Option::Some("MYSQL_8_0_30"),
43761            Self::Mysql8031 => std::option::Option::Some("MYSQL_8_0_31"),
43762            Self::Mysql8032 => std::option::Option::Some("MYSQL_8_0_32"),
43763            Self::Mysql8033 => std::option::Option::Some("MYSQL_8_0_33"),
43764            Self::Mysql8034 => std::option::Option::Some("MYSQL_8_0_34"),
43765            Self::Mysql8035 => std::option::Option::Some("MYSQL_8_0_35"),
43766            Self::Mysql8036 => std::option::Option::Some("MYSQL_8_0_36"),
43767            Self::Mysql8037 => std::option::Option::Some("MYSQL_8_0_37"),
43768            Self::Mysql8038 => std::option::Option::Some("MYSQL_8_0_38"),
43769            Self::Mysql8039 => std::option::Option::Some("MYSQL_8_0_39"),
43770            Self::Mysql8040 => std::option::Option::Some("MYSQL_8_0_40"),
43771            Self::Mysql84 => std::option::Option::Some("MYSQL_8_4"),
43772            Self::Mysql840 => std::option::Option::Some("MYSQL_8_4_0"),
43773            Self::Sqlserver2019Standard => std::option::Option::Some("SQLSERVER_2019_STANDARD"),
43774            Self::Sqlserver2019Enterprise => std::option::Option::Some("SQLSERVER_2019_ENTERPRISE"),
43775            Self::Sqlserver2019Express => std::option::Option::Some("SQLSERVER_2019_EXPRESS"),
43776            Self::Sqlserver2019Web => std::option::Option::Some("SQLSERVER_2019_WEB"),
43777            Self::Sqlserver2022Standard => std::option::Option::Some("SQLSERVER_2022_STANDARD"),
43778            Self::Sqlserver2022Enterprise => std::option::Option::Some("SQLSERVER_2022_ENTERPRISE"),
43779            Self::Sqlserver2022Express => std::option::Option::Some("SQLSERVER_2022_EXPRESS"),
43780            Self::Sqlserver2022Web => std::option::Option::Some("SQLSERVER_2022_WEB"),
43781            Self::UnknownValue(u) => u.0.name(),
43782        }
43783    }
43784}
43785
43786impl std::default::Default for SqlDatabaseVersion {
43787    fn default() -> Self {
43788        use std::convert::From;
43789        Self::from(0)
43790    }
43791}
43792
43793impl std::fmt::Display for SqlDatabaseVersion {
43794    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
43795        wkt::internal::display_enum(f, self.name(), self.value())
43796    }
43797}
43798
43799impl std::convert::From<i32> for SqlDatabaseVersion {
43800    fn from(value: i32) -> Self {
43801        match value {
43802            0 => Self::Unspecified,
43803            2 => Self::Mysql51,
43804            3 => Self::Mysql55,
43805            5 => Self::Mysql56,
43806            6 => Self::Mysql57,
43807            9 => Self::Postgres96,
43808            10 => Self::Postgres11,
43809            11 => Self::Sqlserver2017Standard,
43810            14 => Self::Sqlserver2017Enterprise,
43811            15 => Self::Sqlserver2017Express,
43812            16 => Self::Sqlserver2017Web,
43813            18 => Self::Postgres10,
43814            19 => Self::Postgres12,
43815            20 => Self::Mysql80,
43816            23 => Self::Postgres13,
43817            26 => Self::Sqlserver2019Standard,
43818            27 => Self::Sqlserver2019Enterprise,
43819            28 => Self::Sqlserver2019Express,
43820            29 => Self::Sqlserver2019Web,
43821            41 => Self::Mysql8018,
43822            85 => Self::Mysql8026,
43823            110 => Self::Postgres14,
43824            111 => Self::Mysql8027,
43825            132 => Self::Mysql8028,
43826            148 => Self::Mysql8029,
43827            172 => Self::Postgres15,
43828            174 => Self::Mysql8030,
43829            197 => Self::Mysql8031,
43830            199 => Self::Sqlserver2022Standard,
43831            200 => Self::Sqlserver2022Enterprise,
43832            201 => Self::Sqlserver2022Express,
43833            202 => Self::Sqlserver2022Web,
43834            213 => Self::Mysql8032,
43835            238 => Self::Mysql8033,
43836            239 => Self::Mysql8034,
43837            240 => Self::Mysql8035,
43838            241 => Self::Mysql8036,
43839            272 => Self::Postgres16,
43840            355 => Self::Mysql8037,
43841            356 => Self::Mysql8038,
43842            357 => Self::Mysql8039,
43843            358 => Self::Mysql8040,
43844            398 => Self::Mysql84,
43845            399 => Self::Mysql840,
43846            _ => Self::UnknownValue(sql_database_version::UnknownValue(
43847                wkt::internal::UnknownEnumValue::Integer(value),
43848            )),
43849        }
43850    }
43851}
43852
43853impl std::convert::From<&str> for SqlDatabaseVersion {
43854    fn from(value: &str) -> Self {
43855        use std::string::ToString;
43856        match value {
43857            "SQL_DATABASE_VERSION_UNSPECIFIED" => Self::Unspecified,
43858            "MYSQL_5_1" => Self::Mysql51,
43859            "MYSQL_5_5" => Self::Mysql55,
43860            "MYSQL_5_6" => Self::Mysql56,
43861            "MYSQL_5_7" => Self::Mysql57,
43862            "SQLSERVER_2017_STANDARD" => Self::Sqlserver2017Standard,
43863            "SQLSERVER_2017_ENTERPRISE" => Self::Sqlserver2017Enterprise,
43864            "SQLSERVER_2017_EXPRESS" => Self::Sqlserver2017Express,
43865            "SQLSERVER_2017_WEB" => Self::Sqlserver2017Web,
43866            "POSTGRES_9_6" => Self::Postgres96,
43867            "POSTGRES_10" => Self::Postgres10,
43868            "POSTGRES_11" => Self::Postgres11,
43869            "POSTGRES_12" => Self::Postgres12,
43870            "POSTGRES_13" => Self::Postgres13,
43871            "POSTGRES_14" => Self::Postgres14,
43872            "POSTGRES_15" => Self::Postgres15,
43873            "POSTGRES_16" => Self::Postgres16,
43874            "MYSQL_8_0" => Self::Mysql80,
43875            "MYSQL_8_0_18" => Self::Mysql8018,
43876            "MYSQL_8_0_26" => Self::Mysql8026,
43877            "MYSQL_8_0_27" => Self::Mysql8027,
43878            "MYSQL_8_0_28" => Self::Mysql8028,
43879            "MYSQL_8_0_29" => Self::Mysql8029,
43880            "MYSQL_8_0_30" => Self::Mysql8030,
43881            "MYSQL_8_0_31" => Self::Mysql8031,
43882            "MYSQL_8_0_32" => Self::Mysql8032,
43883            "MYSQL_8_0_33" => Self::Mysql8033,
43884            "MYSQL_8_0_34" => Self::Mysql8034,
43885            "MYSQL_8_0_35" => Self::Mysql8035,
43886            "MYSQL_8_0_36" => Self::Mysql8036,
43887            "MYSQL_8_0_37" => Self::Mysql8037,
43888            "MYSQL_8_0_38" => Self::Mysql8038,
43889            "MYSQL_8_0_39" => Self::Mysql8039,
43890            "MYSQL_8_0_40" => Self::Mysql8040,
43891            "MYSQL_8_4" => Self::Mysql84,
43892            "MYSQL_8_4_0" => Self::Mysql840,
43893            "SQLSERVER_2019_STANDARD" => Self::Sqlserver2019Standard,
43894            "SQLSERVER_2019_ENTERPRISE" => Self::Sqlserver2019Enterprise,
43895            "SQLSERVER_2019_EXPRESS" => Self::Sqlserver2019Express,
43896            "SQLSERVER_2019_WEB" => Self::Sqlserver2019Web,
43897            "SQLSERVER_2022_STANDARD" => Self::Sqlserver2022Standard,
43898            "SQLSERVER_2022_ENTERPRISE" => Self::Sqlserver2022Enterprise,
43899            "SQLSERVER_2022_EXPRESS" => Self::Sqlserver2022Express,
43900            "SQLSERVER_2022_WEB" => Self::Sqlserver2022Web,
43901            _ => Self::UnknownValue(sql_database_version::UnknownValue(
43902                wkt::internal::UnknownEnumValue::String(value.to_string()),
43903            )),
43904        }
43905    }
43906}
43907
43908impl serde::ser::Serialize for SqlDatabaseVersion {
43909    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
43910    where
43911        S: serde::Serializer,
43912    {
43913        match self {
43914            Self::Unspecified => serializer.serialize_i32(0),
43915            Self::Mysql51 => serializer.serialize_i32(2),
43916            Self::Mysql55 => serializer.serialize_i32(3),
43917            Self::Mysql56 => serializer.serialize_i32(5),
43918            Self::Mysql57 => serializer.serialize_i32(6),
43919            Self::Sqlserver2017Standard => serializer.serialize_i32(11),
43920            Self::Sqlserver2017Enterprise => serializer.serialize_i32(14),
43921            Self::Sqlserver2017Express => serializer.serialize_i32(15),
43922            Self::Sqlserver2017Web => serializer.serialize_i32(16),
43923            Self::Postgres96 => serializer.serialize_i32(9),
43924            Self::Postgres10 => serializer.serialize_i32(18),
43925            Self::Postgres11 => serializer.serialize_i32(10),
43926            Self::Postgres12 => serializer.serialize_i32(19),
43927            Self::Postgres13 => serializer.serialize_i32(23),
43928            Self::Postgres14 => serializer.serialize_i32(110),
43929            Self::Postgres15 => serializer.serialize_i32(172),
43930            Self::Postgres16 => serializer.serialize_i32(272),
43931            Self::Mysql80 => serializer.serialize_i32(20),
43932            Self::Mysql8018 => serializer.serialize_i32(41),
43933            Self::Mysql8026 => serializer.serialize_i32(85),
43934            Self::Mysql8027 => serializer.serialize_i32(111),
43935            Self::Mysql8028 => serializer.serialize_i32(132),
43936            Self::Mysql8029 => serializer.serialize_i32(148),
43937            Self::Mysql8030 => serializer.serialize_i32(174),
43938            Self::Mysql8031 => serializer.serialize_i32(197),
43939            Self::Mysql8032 => serializer.serialize_i32(213),
43940            Self::Mysql8033 => serializer.serialize_i32(238),
43941            Self::Mysql8034 => serializer.serialize_i32(239),
43942            Self::Mysql8035 => serializer.serialize_i32(240),
43943            Self::Mysql8036 => serializer.serialize_i32(241),
43944            Self::Mysql8037 => serializer.serialize_i32(355),
43945            Self::Mysql8038 => serializer.serialize_i32(356),
43946            Self::Mysql8039 => serializer.serialize_i32(357),
43947            Self::Mysql8040 => serializer.serialize_i32(358),
43948            Self::Mysql84 => serializer.serialize_i32(398),
43949            Self::Mysql840 => serializer.serialize_i32(399),
43950            Self::Sqlserver2019Standard => serializer.serialize_i32(26),
43951            Self::Sqlserver2019Enterprise => serializer.serialize_i32(27),
43952            Self::Sqlserver2019Express => serializer.serialize_i32(28),
43953            Self::Sqlserver2019Web => serializer.serialize_i32(29),
43954            Self::Sqlserver2022Standard => serializer.serialize_i32(199),
43955            Self::Sqlserver2022Enterprise => serializer.serialize_i32(200),
43956            Self::Sqlserver2022Express => serializer.serialize_i32(201),
43957            Self::Sqlserver2022Web => serializer.serialize_i32(202),
43958            Self::UnknownValue(u) => u.0.serialize(serializer),
43959        }
43960    }
43961}
43962
43963impl<'de> serde::de::Deserialize<'de> for SqlDatabaseVersion {
43964    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
43965    where
43966        D: serde::Deserializer<'de>,
43967    {
43968        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlDatabaseVersion>::new(
43969            ".google.cloud.sql.v1.SqlDatabaseVersion",
43970        ))
43971    }
43972}
43973
43974/// The pricing plan for this instance.
43975///
43976/// # Working with unknown values
43977///
43978/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
43979/// additional enum variants at any time. Adding new variants is not considered
43980/// a breaking change. Applications should write their code in anticipation of:
43981///
43982/// - New values appearing in future releases of the client library, **and**
43983/// - New values received dynamically, without application changes.
43984///
43985/// Please consult the [Working with enums] section in the user guide for some
43986/// guidelines.
43987///
43988/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
43989#[derive(Clone, Debug, PartialEq)]
43990#[non_exhaustive]
43991pub enum SqlPricingPlan {
43992    /// This is an unknown pricing plan for this instance.
43993    Unspecified,
43994    /// The instance is billed at a monthly flat rate.
43995    Package,
43996    /// The instance is billed per usage.
43997    PerUse,
43998    /// If set, the enum was initialized with an unknown value.
43999    ///
44000    /// Applications can examine the value using [SqlPricingPlan::value] or
44001    /// [SqlPricingPlan::name].
44002    UnknownValue(sql_pricing_plan::UnknownValue),
44003}
44004
44005#[doc(hidden)]
44006pub mod sql_pricing_plan {
44007    #[allow(unused_imports)]
44008    use super::*;
44009    #[derive(Clone, Debug, PartialEq)]
44010    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
44011}
44012
44013impl SqlPricingPlan {
44014    /// Gets the enum value.
44015    ///
44016    /// Returns `None` if the enum contains an unknown value deserialized from
44017    /// the string representation of enums.
44018    pub fn value(&self) -> std::option::Option<i32> {
44019        match self {
44020            Self::Unspecified => std::option::Option::Some(0),
44021            Self::Package => std::option::Option::Some(1),
44022            Self::PerUse => std::option::Option::Some(2),
44023            Self::UnknownValue(u) => u.0.value(),
44024        }
44025    }
44026
44027    /// Gets the enum value as a string.
44028    ///
44029    /// Returns `None` if the enum contains an unknown value deserialized from
44030    /// the integer representation of enums.
44031    pub fn name(&self) -> std::option::Option<&str> {
44032        match self {
44033            Self::Unspecified => std::option::Option::Some("SQL_PRICING_PLAN_UNSPECIFIED"),
44034            Self::Package => std::option::Option::Some("PACKAGE"),
44035            Self::PerUse => std::option::Option::Some("PER_USE"),
44036            Self::UnknownValue(u) => u.0.name(),
44037        }
44038    }
44039}
44040
44041impl std::default::Default for SqlPricingPlan {
44042    fn default() -> Self {
44043        use std::convert::From;
44044        Self::from(0)
44045    }
44046}
44047
44048impl std::fmt::Display for SqlPricingPlan {
44049    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
44050        wkt::internal::display_enum(f, self.name(), self.value())
44051    }
44052}
44053
44054impl std::convert::From<i32> for SqlPricingPlan {
44055    fn from(value: i32) -> Self {
44056        match value {
44057            0 => Self::Unspecified,
44058            1 => Self::Package,
44059            2 => Self::PerUse,
44060            _ => Self::UnknownValue(sql_pricing_plan::UnknownValue(
44061                wkt::internal::UnknownEnumValue::Integer(value),
44062            )),
44063        }
44064    }
44065}
44066
44067impl std::convert::From<&str> for SqlPricingPlan {
44068    fn from(value: &str) -> Self {
44069        use std::string::ToString;
44070        match value {
44071            "SQL_PRICING_PLAN_UNSPECIFIED" => Self::Unspecified,
44072            "PACKAGE" => Self::Package,
44073            "PER_USE" => Self::PerUse,
44074            _ => Self::UnknownValue(sql_pricing_plan::UnknownValue(
44075                wkt::internal::UnknownEnumValue::String(value.to_string()),
44076            )),
44077        }
44078    }
44079}
44080
44081impl serde::ser::Serialize for SqlPricingPlan {
44082    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
44083    where
44084        S: serde::Serializer,
44085    {
44086        match self {
44087            Self::Unspecified => serializer.serialize_i32(0),
44088            Self::Package => serializer.serialize_i32(1),
44089            Self::PerUse => serializer.serialize_i32(2),
44090            Self::UnknownValue(u) => u.0.serialize(serializer),
44091        }
44092    }
44093}
44094
44095impl<'de> serde::de::Deserialize<'de> for SqlPricingPlan {
44096    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
44097    where
44098        D: serde::Deserializer<'de>,
44099    {
44100        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlPricingPlan>::new(
44101            ".google.cloud.sql.v1.SqlPricingPlan",
44102        ))
44103    }
44104}
44105
44106///
44107/// # Working with unknown values
44108///
44109/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
44110/// additional enum variants at any time. Adding new variants is not considered
44111/// a breaking change. Applications should write their code in anticipation of:
44112///
44113/// - New values appearing in future releases of the client library, **and**
44114/// - New values received dynamically, without application changes.
44115///
44116/// Please consult the [Working with enums] section in the user guide for some
44117/// guidelines.
44118///
44119/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
44120#[derive(Clone, Debug, PartialEq)]
44121#[non_exhaustive]
44122pub enum SqlReplicationType {
44123    /// This is an unknown replication type for a Cloud SQL instance.
44124    Unspecified,
44125    /// The synchronous replication mode for First Generation instances. It is the
44126    /// default value.
44127    Synchronous,
44128    /// The asynchronous replication mode for First Generation instances. It
44129    /// provides a slight performance gain, but if an outage occurs while this
44130    /// option is set to asynchronous, you can lose up to a few seconds of updates
44131    /// to your data.
44132    Asynchronous,
44133    /// If set, the enum was initialized with an unknown value.
44134    ///
44135    /// Applications can examine the value using [SqlReplicationType::value] or
44136    /// [SqlReplicationType::name].
44137    UnknownValue(sql_replication_type::UnknownValue),
44138}
44139
44140#[doc(hidden)]
44141pub mod sql_replication_type {
44142    #[allow(unused_imports)]
44143    use super::*;
44144    #[derive(Clone, Debug, PartialEq)]
44145    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
44146}
44147
44148impl SqlReplicationType {
44149    /// Gets the enum value.
44150    ///
44151    /// Returns `None` if the enum contains an unknown value deserialized from
44152    /// the string representation of enums.
44153    pub fn value(&self) -> std::option::Option<i32> {
44154        match self {
44155            Self::Unspecified => std::option::Option::Some(0),
44156            Self::Synchronous => std::option::Option::Some(1),
44157            Self::Asynchronous => std::option::Option::Some(2),
44158            Self::UnknownValue(u) => u.0.value(),
44159        }
44160    }
44161
44162    /// Gets the enum value as a string.
44163    ///
44164    /// Returns `None` if the enum contains an unknown value deserialized from
44165    /// the integer representation of enums.
44166    pub fn name(&self) -> std::option::Option<&str> {
44167        match self {
44168            Self::Unspecified => std::option::Option::Some("SQL_REPLICATION_TYPE_UNSPECIFIED"),
44169            Self::Synchronous => std::option::Option::Some("SYNCHRONOUS"),
44170            Self::Asynchronous => std::option::Option::Some("ASYNCHRONOUS"),
44171            Self::UnknownValue(u) => u.0.name(),
44172        }
44173    }
44174}
44175
44176impl std::default::Default for SqlReplicationType {
44177    fn default() -> Self {
44178        use std::convert::From;
44179        Self::from(0)
44180    }
44181}
44182
44183impl std::fmt::Display for SqlReplicationType {
44184    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
44185        wkt::internal::display_enum(f, self.name(), self.value())
44186    }
44187}
44188
44189impl std::convert::From<i32> for SqlReplicationType {
44190    fn from(value: i32) -> Self {
44191        match value {
44192            0 => Self::Unspecified,
44193            1 => Self::Synchronous,
44194            2 => Self::Asynchronous,
44195            _ => Self::UnknownValue(sql_replication_type::UnknownValue(
44196                wkt::internal::UnknownEnumValue::Integer(value),
44197            )),
44198        }
44199    }
44200}
44201
44202impl std::convert::From<&str> for SqlReplicationType {
44203    fn from(value: &str) -> Self {
44204        use std::string::ToString;
44205        match value {
44206            "SQL_REPLICATION_TYPE_UNSPECIFIED" => Self::Unspecified,
44207            "SYNCHRONOUS" => Self::Synchronous,
44208            "ASYNCHRONOUS" => Self::Asynchronous,
44209            _ => Self::UnknownValue(sql_replication_type::UnknownValue(
44210                wkt::internal::UnknownEnumValue::String(value.to_string()),
44211            )),
44212        }
44213    }
44214}
44215
44216impl serde::ser::Serialize for SqlReplicationType {
44217    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
44218    where
44219        S: serde::Serializer,
44220    {
44221        match self {
44222            Self::Unspecified => serializer.serialize_i32(0),
44223            Self::Synchronous => serializer.serialize_i32(1),
44224            Self::Asynchronous => serializer.serialize_i32(2),
44225            Self::UnknownValue(u) => u.0.serialize(serializer),
44226        }
44227    }
44228}
44229
44230impl<'de> serde::de::Deserialize<'de> for SqlReplicationType {
44231    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
44232    where
44233        D: serde::Deserializer<'de>,
44234    {
44235        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlReplicationType>::new(
44236            ".google.cloud.sql.v1.SqlReplicationType",
44237        ))
44238    }
44239}
44240
44241/// The type of disk that is used for a v2 instance to use.
44242///
44243/// # Working with unknown values
44244///
44245/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
44246/// additional enum variants at any time. Adding new variants is not considered
44247/// a breaking change. Applications should write their code in anticipation of:
44248///
44249/// - New values appearing in future releases of the client library, **and**
44250/// - New values received dynamically, without application changes.
44251///
44252/// Please consult the [Working with enums] section in the user guide for some
44253/// guidelines.
44254///
44255/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
44256#[derive(Clone, Debug, PartialEq)]
44257#[non_exhaustive]
44258pub enum SqlDataDiskType {
44259    /// This is an unknown data disk type.
44260    Unspecified,
44261    /// An SSD data disk.
44262    PdSsd,
44263    /// An HDD data disk.
44264    PdHdd,
44265    /// This field is deprecated and will be removed from a future version of the
44266    /// API.
44267    #[deprecated]
44268    ObsoleteLocalSsd,
44269    /// If set, the enum was initialized with an unknown value.
44270    ///
44271    /// Applications can examine the value using [SqlDataDiskType::value] or
44272    /// [SqlDataDiskType::name].
44273    UnknownValue(sql_data_disk_type::UnknownValue),
44274}
44275
44276#[doc(hidden)]
44277pub mod sql_data_disk_type {
44278    #[allow(unused_imports)]
44279    use super::*;
44280    #[derive(Clone, Debug, PartialEq)]
44281    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
44282}
44283
44284impl SqlDataDiskType {
44285    /// Gets the enum value.
44286    ///
44287    /// Returns `None` if the enum contains an unknown value deserialized from
44288    /// the string representation of enums.
44289    pub fn value(&self) -> std::option::Option<i32> {
44290        match self {
44291            Self::Unspecified => std::option::Option::Some(0),
44292            Self::PdSsd => std::option::Option::Some(1),
44293            Self::PdHdd => std::option::Option::Some(2),
44294            Self::ObsoleteLocalSsd => std::option::Option::Some(3),
44295            Self::UnknownValue(u) => u.0.value(),
44296        }
44297    }
44298
44299    /// Gets the enum value as a string.
44300    ///
44301    /// Returns `None` if the enum contains an unknown value deserialized from
44302    /// the integer representation of enums.
44303    pub fn name(&self) -> std::option::Option<&str> {
44304        match self {
44305            Self::Unspecified => std::option::Option::Some("SQL_DATA_DISK_TYPE_UNSPECIFIED"),
44306            Self::PdSsd => std::option::Option::Some("PD_SSD"),
44307            Self::PdHdd => std::option::Option::Some("PD_HDD"),
44308            Self::ObsoleteLocalSsd => std::option::Option::Some("OBSOLETE_LOCAL_SSD"),
44309            Self::UnknownValue(u) => u.0.name(),
44310        }
44311    }
44312}
44313
44314impl std::default::Default for SqlDataDiskType {
44315    fn default() -> Self {
44316        use std::convert::From;
44317        Self::from(0)
44318    }
44319}
44320
44321impl std::fmt::Display for SqlDataDiskType {
44322    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
44323        wkt::internal::display_enum(f, self.name(), self.value())
44324    }
44325}
44326
44327impl std::convert::From<i32> for SqlDataDiskType {
44328    fn from(value: i32) -> Self {
44329        match value {
44330            0 => Self::Unspecified,
44331            1 => Self::PdSsd,
44332            2 => Self::PdHdd,
44333            3 => Self::ObsoleteLocalSsd,
44334            _ => Self::UnknownValue(sql_data_disk_type::UnknownValue(
44335                wkt::internal::UnknownEnumValue::Integer(value),
44336            )),
44337        }
44338    }
44339}
44340
44341impl std::convert::From<&str> for SqlDataDiskType {
44342    fn from(value: &str) -> Self {
44343        use std::string::ToString;
44344        match value {
44345            "SQL_DATA_DISK_TYPE_UNSPECIFIED" => Self::Unspecified,
44346            "PD_SSD" => Self::PdSsd,
44347            "PD_HDD" => Self::PdHdd,
44348            "OBSOLETE_LOCAL_SSD" => Self::ObsoleteLocalSsd,
44349            _ => Self::UnknownValue(sql_data_disk_type::UnknownValue(
44350                wkt::internal::UnknownEnumValue::String(value.to_string()),
44351            )),
44352        }
44353    }
44354}
44355
44356impl serde::ser::Serialize for SqlDataDiskType {
44357    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
44358    where
44359        S: serde::Serializer,
44360    {
44361        match self {
44362            Self::Unspecified => serializer.serialize_i32(0),
44363            Self::PdSsd => serializer.serialize_i32(1),
44364            Self::PdHdd => serializer.serialize_i32(2),
44365            Self::ObsoleteLocalSsd => serializer.serialize_i32(3),
44366            Self::UnknownValue(u) => u.0.serialize(serializer),
44367        }
44368    }
44369}
44370
44371impl<'de> serde::de::Deserialize<'de> for SqlDataDiskType {
44372    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
44373    where
44374        D: serde::Deserializer<'de>,
44375    {
44376        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlDataDiskType>::new(
44377            ".google.cloud.sql.v1.SqlDataDiskType",
44378        ))
44379    }
44380}
44381
44382/// The availability type of the given Cloud SQL instance.
44383///
44384/// # Working with unknown values
44385///
44386/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
44387/// additional enum variants at any time. Adding new variants is not considered
44388/// a breaking change. Applications should write their code in anticipation of:
44389///
44390/// - New values appearing in future releases of the client library, **and**
44391/// - New values received dynamically, without application changes.
44392///
44393/// Please consult the [Working with enums] section in the user guide for some
44394/// guidelines.
44395///
44396/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
44397#[derive(Clone, Debug, PartialEq)]
44398#[non_exhaustive]
44399pub enum SqlAvailabilityType {
44400    /// This is an unknown Availability type.
44401    Unspecified,
44402    /// Zonal available instance.
44403    Zonal,
44404    /// Regional available instance.
44405    Regional,
44406    /// If set, the enum was initialized with an unknown value.
44407    ///
44408    /// Applications can examine the value using [SqlAvailabilityType::value] or
44409    /// [SqlAvailabilityType::name].
44410    UnknownValue(sql_availability_type::UnknownValue),
44411}
44412
44413#[doc(hidden)]
44414pub mod sql_availability_type {
44415    #[allow(unused_imports)]
44416    use super::*;
44417    #[derive(Clone, Debug, PartialEq)]
44418    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
44419}
44420
44421impl SqlAvailabilityType {
44422    /// Gets the enum value.
44423    ///
44424    /// Returns `None` if the enum contains an unknown value deserialized from
44425    /// the string representation of enums.
44426    pub fn value(&self) -> std::option::Option<i32> {
44427        match self {
44428            Self::Unspecified => std::option::Option::Some(0),
44429            Self::Zonal => std::option::Option::Some(1),
44430            Self::Regional => std::option::Option::Some(2),
44431            Self::UnknownValue(u) => u.0.value(),
44432        }
44433    }
44434
44435    /// Gets the enum value as a string.
44436    ///
44437    /// Returns `None` if the enum contains an unknown value deserialized from
44438    /// the integer representation of enums.
44439    pub fn name(&self) -> std::option::Option<&str> {
44440        match self {
44441            Self::Unspecified => std::option::Option::Some("SQL_AVAILABILITY_TYPE_UNSPECIFIED"),
44442            Self::Zonal => std::option::Option::Some("ZONAL"),
44443            Self::Regional => std::option::Option::Some("REGIONAL"),
44444            Self::UnknownValue(u) => u.0.name(),
44445        }
44446    }
44447}
44448
44449impl std::default::Default for SqlAvailabilityType {
44450    fn default() -> Self {
44451        use std::convert::From;
44452        Self::from(0)
44453    }
44454}
44455
44456impl std::fmt::Display for SqlAvailabilityType {
44457    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
44458        wkt::internal::display_enum(f, self.name(), self.value())
44459    }
44460}
44461
44462impl std::convert::From<i32> for SqlAvailabilityType {
44463    fn from(value: i32) -> Self {
44464        match value {
44465            0 => Self::Unspecified,
44466            1 => Self::Zonal,
44467            2 => Self::Regional,
44468            _ => Self::UnknownValue(sql_availability_type::UnknownValue(
44469                wkt::internal::UnknownEnumValue::Integer(value),
44470            )),
44471        }
44472    }
44473}
44474
44475impl std::convert::From<&str> for SqlAvailabilityType {
44476    fn from(value: &str) -> Self {
44477        use std::string::ToString;
44478        match value {
44479            "SQL_AVAILABILITY_TYPE_UNSPECIFIED" => Self::Unspecified,
44480            "ZONAL" => Self::Zonal,
44481            "REGIONAL" => Self::Regional,
44482            _ => Self::UnknownValue(sql_availability_type::UnknownValue(
44483                wkt::internal::UnknownEnumValue::String(value.to_string()),
44484            )),
44485        }
44486    }
44487}
44488
44489impl serde::ser::Serialize for SqlAvailabilityType {
44490    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
44491    where
44492        S: serde::Serializer,
44493    {
44494        match self {
44495            Self::Unspecified => serializer.serialize_i32(0),
44496            Self::Zonal => serializer.serialize_i32(1),
44497            Self::Regional => serializer.serialize_i32(2),
44498            Self::UnknownValue(u) => u.0.serialize(serializer),
44499        }
44500    }
44501}
44502
44503impl<'de> serde::de::Deserialize<'de> for SqlAvailabilityType {
44504    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
44505    where
44506        D: serde::Deserializer<'de>,
44507    {
44508        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlAvailabilityType>::new(
44509            ".google.cloud.sql.v1.SqlAvailabilityType",
44510        ))
44511    }
44512}
44513
44514///
44515/// # Working with unknown values
44516///
44517/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
44518/// additional enum variants at any time. Adding new variants is not considered
44519/// a breaking change. Applications should write their code in anticipation of:
44520///
44521/// - New values appearing in future releases of the client library, **and**
44522/// - New values received dynamically, without application changes.
44523///
44524/// Please consult the [Working with enums] section in the user guide for some
44525/// guidelines.
44526///
44527/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
44528#[derive(Clone, Debug, PartialEq)]
44529#[non_exhaustive]
44530pub enum SqlUpdateTrack {
44531    /// This is an unknown maintenance timing preference.
44532    Unspecified,
44533    /// For an instance with a scheduled maintenance window, this maintenance
44534    /// timing indicates that the maintenance update is scheduled 7 to 14 days
44535    /// after the notification is sent out. Also referred to as `Week 1` (Console)
44536    /// and `preview` (gcloud CLI).
44537    Canary,
44538    /// For an instance with a scheduled maintenance window, this maintenance
44539    /// timing indicates that the maintenance update is scheduled 15 to 21 days
44540    /// after the notification is sent out. Also referred to as `Week 2` (Console)
44541    /// and `production` (gcloud CLI).
44542    Stable,
44543    /// For instance with a scheduled maintenance window, this maintenance
44544    /// timing indicates that the maintenance update is scheduled 35 to 42 days
44545    /// after the notification is sent out.
44546    Week5,
44547    /// If set, the enum was initialized with an unknown value.
44548    ///
44549    /// Applications can examine the value using [SqlUpdateTrack::value] or
44550    /// [SqlUpdateTrack::name].
44551    UnknownValue(sql_update_track::UnknownValue),
44552}
44553
44554#[doc(hidden)]
44555pub mod sql_update_track {
44556    #[allow(unused_imports)]
44557    use super::*;
44558    #[derive(Clone, Debug, PartialEq)]
44559    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
44560}
44561
44562impl SqlUpdateTrack {
44563    /// Gets the enum value.
44564    ///
44565    /// Returns `None` if the enum contains an unknown value deserialized from
44566    /// the string representation of enums.
44567    pub fn value(&self) -> std::option::Option<i32> {
44568        match self {
44569            Self::Unspecified => std::option::Option::Some(0),
44570            Self::Canary => std::option::Option::Some(1),
44571            Self::Stable => std::option::Option::Some(2),
44572            Self::Week5 => std::option::Option::Some(3),
44573            Self::UnknownValue(u) => u.0.value(),
44574        }
44575    }
44576
44577    /// Gets the enum value as a string.
44578    ///
44579    /// Returns `None` if the enum contains an unknown value deserialized from
44580    /// the integer representation of enums.
44581    pub fn name(&self) -> std::option::Option<&str> {
44582        match self {
44583            Self::Unspecified => std::option::Option::Some("SQL_UPDATE_TRACK_UNSPECIFIED"),
44584            Self::Canary => std::option::Option::Some("canary"),
44585            Self::Stable => std::option::Option::Some("stable"),
44586            Self::Week5 => std::option::Option::Some("week5"),
44587            Self::UnknownValue(u) => u.0.name(),
44588        }
44589    }
44590}
44591
44592impl std::default::Default for SqlUpdateTrack {
44593    fn default() -> Self {
44594        use std::convert::From;
44595        Self::from(0)
44596    }
44597}
44598
44599impl std::fmt::Display for SqlUpdateTrack {
44600    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
44601        wkt::internal::display_enum(f, self.name(), self.value())
44602    }
44603}
44604
44605impl std::convert::From<i32> for SqlUpdateTrack {
44606    fn from(value: i32) -> Self {
44607        match value {
44608            0 => Self::Unspecified,
44609            1 => Self::Canary,
44610            2 => Self::Stable,
44611            3 => Self::Week5,
44612            _ => Self::UnknownValue(sql_update_track::UnknownValue(
44613                wkt::internal::UnknownEnumValue::Integer(value),
44614            )),
44615        }
44616    }
44617}
44618
44619impl std::convert::From<&str> for SqlUpdateTrack {
44620    fn from(value: &str) -> Self {
44621        use std::string::ToString;
44622        match value {
44623            "SQL_UPDATE_TRACK_UNSPECIFIED" => Self::Unspecified,
44624            "canary" => Self::Canary,
44625            "stable" => Self::Stable,
44626            "week5" => Self::Week5,
44627            _ => Self::UnknownValue(sql_update_track::UnknownValue(
44628                wkt::internal::UnknownEnumValue::String(value.to_string()),
44629            )),
44630        }
44631    }
44632}
44633
44634impl serde::ser::Serialize for SqlUpdateTrack {
44635    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
44636    where
44637        S: serde::Serializer,
44638    {
44639        match self {
44640            Self::Unspecified => serializer.serialize_i32(0),
44641            Self::Canary => serializer.serialize_i32(1),
44642            Self::Stable => serializer.serialize_i32(2),
44643            Self::Week5 => serializer.serialize_i32(3),
44644            Self::UnknownValue(u) => u.0.serialize(serializer),
44645        }
44646    }
44647}
44648
44649impl<'de> serde::de::Deserialize<'de> for SqlUpdateTrack {
44650    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
44651    where
44652        D: serde::Deserializer<'de>,
44653    {
44654        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlUpdateTrack>::new(
44655            ".google.cloud.sql.v1.SqlUpdateTrack",
44656        ))
44657    }
44658}