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, 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
231impl std::fmt::Debug for SqlBackupRunsDeleteRequest {
232    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
233        let mut debug_struct = f.debug_struct("SqlBackupRunsDeleteRequest");
234        debug_struct.field("id", &self.id);
235        debug_struct.field("instance", &self.instance);
236        debug_struct.field("project", &self.project);
237        if !self._unknown_fields.is_empty() {
238            debug_struct.field("_unknown_fields", &self._unknown_fields);
239        }
240        debug_struct.finish()
241    }
242}
243
244/// Backup runs get request.
245#[derive(Clone, Default, PartialEq)]
246#[non_exhaustive]
247pub struct SqlBackupRunsGetRequest {
248    /// The ID of this backup run.
249    pub id: i64,
250
251    /// Cloud SQL instance ID. This does not include the project ID.
252    pub instance: std::string::String,
253
254    /// Project ID of the project that contains the instance.
255    pub project: std::string::String,
256
257    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
258}
259
260impl SqlBackupRunsGetRequest {
261    pub fn new() -> Self {
262        std::default::Default::default()
263    }
264
265    /// Sets the value of [id][crate::model::SqlBackupRunsGetRequest::id].
266    pub fn set_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
267        self.id = v.into();
268        self
269    }
270
271    /// Sets the value of [instance][crate::model::SqlBackupRunsGetRequest::instance].
272    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
273        self.instance = v.into();
274        self
275    }
276
277    /// Sets the value of [project][crate::model::SqlBackupRunsGetRequest::project].
278    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
279        self.project = v.into();
280        self
281    }
282}
283
284impl wkt::message::Message for SqlBackupRunsGetRequest {
285    fn typename() -> &'static str {
286        "type.googleapis.com/google.cloud.sql.v1.SqlBackupRunsGetRequest"
287    }
288}
289
290#[doc(hidden)]
291impl<'de> serde::de::Deserialize<'de> for SqlBackupRunsGetRequest {
292    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
293    where
294        D: serde::Deserializer<'de>,
295    {
296        #[allow(non_camel_case_types)]
297        #[doc(hidden)]
298        #[derive(PartialEq, Eq, Hash)]
299        enum __FieldTag {
300            __id,
301            __instance,
302            __project,
303            Unknown(std::string::String),
304        }
305        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
306            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
307            where
308                D: serde::Deserializer<'de>,
309            {
310                struct Visitor;
311                impl<'de> serde::de::Visitor<'de> for Visitor {
312                    type Value = __FieldTag;
313                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
314                        formatter.write_str("a field name for SqlBackupRunsGetRequest")
315                    }
316                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
317                    where
318                        E: serde::de::Error,
319                    {
320                        use std::result::Result::Ok;
321                        use std::string::ToString;
322                        match value {
323                            "id" => Ok(__FieldTag::__id),
324                            "instance" => Ok(__FieldTag::__instance),
325                            "project" => Ok(__FieldTag::__project),
326                            _ => Ok(__FieldTag::Unknown(value.to_string())),
327                        }
328                    }
329                }
330                deserializer.deserialize_identifier(Visitor)
331            }
332        }
333        struct Visitor;
334        impl<'de> serde::de::Visitor<'de> for Visitor {
335            type Value = SqlBackupRunsGetRequest;
336            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
337                formatter.write_str("struct SqlBackupRunsGetRequest")
338            }
339            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
340            where
341                A: serde::de::MapAccess<'de>,
342            {
343                #[allow(unused_imports)]
344                use serde::de::Error;
345                use std::option::Option::Some;
346                let mut fields = std::collections::HashSet::new();
347                let mut result = Self::Value::new();
348                while let Some(tag) = map.next_key::<__FieldTag>()? {
349                    #[allow(clippy::match_single_binding)]
350                    match tag {
351                        __FieldTag::__id => {
352                            if !fields.insert(__FieldTag::__id) {
353                                return std::result::Result::Err(A::Error::duplicate_field(
354                                    "multiple values for id",
355                                ));
356                            }
357                            struct __With(std::option::Option<i64>);
358                            impl<'de> serde::de::Deserialize<'de> for __With {
359                                fn deserialize<D>(
360                                    deserializer: D,
361                                ) -> std::result::Result<Self, D::Error>
362                                where
363                                    D: serde::de::Deserializer<'de>,
364                                {
365                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
366                                }
367                            }
368                            result.id = map.next_value::<__With>()?.0.unwrap_or_default();
369                        }
370                        __FieldTag::__instance => {
371                            if !fields.insert(__FieldTag::__instance) {
372                                return std::result::Result::Err(A::Error::duplicate_field(
373                                    "multiple values for instance",
374                                ));
375                            }
376                            result.instance = map
377                                .next_value::<std::option::Option<std::string::String>>()?
378                                .unwrap_or_default();
379                        }
380                        __FieldTag::__project => {
381                            if !fields.insert(__FieldTag::__project) {
382                                return std::result::Result::Err(A::Error::duplicate_field(
383                                    "multiple values for project",
384                                ));
385                            }
386                            result.project = map
387                                .next_value::<std::option::Option<std::string::String>>()?
388                                .unwrap_or_default();
389                        }
390                        __FieldTag::Unknown(key) => {
391                            let value = map.next_value::<serde_json::Value>()?;
392                            result._unknown_fields.insert(key, value);
393                        }
394                    }
395                }
396                std::result::Result::Ok(result)
397            }
398        }
399        deserializer.deserialize_any(Visitor)
400    }
401}
402
403#[doc(hidden)]
404impl serde::ser::Serialize for SqlBackupRunsGetRequest {
405    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
406    where
407        S: serde::ser::Serializer,
408    {
409        use serde::ser::SerializeMap;
410        #[allow(unused_imports)]
411        use std::option::Option::Some;
412        let mut state = serializer.serialize_map(std::option::Option::None)?;
413        if !wkt::internal::is_default(&self.id) {
414            struct __With<'a>(&'a i64);
415            impl<'a> serde::ser::Serialize for __With<'a> {
416                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
417                where
418                    S: serde::ser::Serializer,
419                {
420                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
421                }
422            }
423            state.serialize_entry("id", &__With(&self.id))?;
424        }
425        if !self.instance.is_empty() {
426            state.serialize_entry("instance", &self.instance)?;
427        }
428        if !self.project.is_empty() {
429            state.serialize_entry("project", &self.project)?;
430        }
431        if !self._unknown_fields.is_empty() {
432            for (key, value) in self._unknown_fields.iter() {
433                state.serialize_entry(key, &value)?;
434            }
435        }
436        state.end()
437    }
438}
439
440impl std::fmt::Debug for SqlBackupRunsGetRequest {
441    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
442        let mut debug_struct = f.debug_struct("SqlBackupRunsGetRequest");
443        debug_struct.field("id", &self.id);
444        debug_struct.field("instance", &self.instance);
445        debug_struct.field("project", &self.project);
446        if !self._unknown_fields.is_empty() {
447            debug_struct.field("_unknown_fields", &self._unknown_fields);
448        }
449        debug_struct.finish()
450    }
451}
452
453/// Backup runs insert request.
454#[derive(Clone, Default, PartialEq)]
455#[non_exhaustive]
456pub struct SqlBackupRunsInsertRequest {
457    /// Cloud SQL instance ID. This does not include the project ID.
458    pub instance: std::string::String,
459
460    /// Project ID of the project that contains the instance.
461    pub project: std::string::String,
462
463    pub body: std::option::Option<crate::model::BackupRun>,
464
465    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
466}
467
468impl SqlBackupRunsInsertRequest {
469    pub fn new() -> Self {
470        std::default::Default::default()
471    }
472
473    /// Sets the value of [instance][crate::model::SqlBackupRunsInsertRequest::instance].
474    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
475        self.instance = v.into();
476        self
477    }
478
479    /// Sets the value of [project][crate::model::SqlBackupRunsInsertRequest::project].
480    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
481        self.project = v.into();
482        self
483    }
484
485    /// Sets the value of [body][crate::model::SqlBackupRunsInsertRequest::body].
486    pub fn set_body<T>(mut self, v: T) -> Self
487    where
488        T: std::convert::Into<crate::model::BackupRun>,
489    {
490        self.body = std::option::Option::Some(v.into());
491        self
492    }
493
494    /// Sets or clears the value of [body][crate::model::SqlBackupRunsInsertRequest::body].
495    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
496    where
497        T: std::convert::Into<crate::model::BackupRun>,
498    {
499        self.body = v.map(|x| x.into());
500        self
501    }
502}
503
504impl wkt::message::Message for SqlBackupRunsInsertRequest {
505    fn typename() -> &'static str {
506        "type.googleapis.com/google.cloud.sql.v1.SqlBackupRunsInsertRequest"
507    }
508}
509
510#[doc(hidden)]
511impl<'de> serde::de::Deserialize<'de> for SqlBackupRunsInsertRequest {
512    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
513    where
514        D: serde::Deserializer<'de>,
515    {
516        #[allow(non_camel_case_types)]
517        #[doc(hidden)]
518        #[derive(PartialEq, Eq, Hash)]
519        enum __FieldTag {
520            __instance,
521            __project,
522            __body,
523            Unknown(std::string::String),
524        }
525        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
526            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
527            where
528                D: serde::Deserializer<'de>,
529            {
530                struct Visitor;
531                impl<'de> serde::de::Visitor<'de> for Visitor {
532                    type Value = __FieldTag;
533                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
534                        formatter.write_str("a field name for SqlBackupRunsInsertRequest")
535                    }
536                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
537                    where
538                        E: serde::de::Error,
539                    {
540                        use std::result::Result::Ok;
541                        use std::string::ToString;
542                        match value {
543                            "instance" => Ok(__FieldTag::__instance),
544                            "project" => Ok(__FieldTag::__project),
545                            "body" => Ok(__FieldTag::__body),
546                            _ => Ok(__FieldTag::Unknown(value.to_string())),
547                        }
548                    }
549                }
550                deserializer.deserialize_identifier(Visitor)
551            }
552        }
553        struct Visitor;
554        impl<'de> serde::de::Visitor<'de> for Visitor {
555            type Value = SqlBackupRunsInsertRequest;
556            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
557                formatter.write_str("struct SqlBackupRunsInsertRequest")
558            }
559            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
560            where
561                A: serde::de::MapAccess<'de>,
562            {
563                #[allow(unused_imports)]
564                use serde::de::Error;
565                use std::option::Option::Some;
566                let mut fields = std::collections::HashSet::new();
567                let mut result = Self::Value::new();
568                while let Some(tag) = map.next_key::<__FieldTag>()? {
569                    #[allow(clippy::match_single_binding)]
570                    match tag {
571                        __FieldTag::__instance => {
572                            if !fields.insert(__FieldTag::__instance) {
573                                return std::result::Result::Err(A::Error::duplicate_field(
574                                    "multiple values for instance",
575                                ));
576                            }
577                            result.instance = map
578                                .next_value::<std::option::Option<std::string::String>>()?
579                                .unwrap_or_default();
580                        }
581                        __FieldTag::__project => {
582                            if !fields.insert(__FieldTag::__project) {
583                                return std::result::Result::Err(A::Error::duplicate_field(
584                                    "multiple values for project",
585                                ));
586                            }
587                            result.project = map
588                                .next_value::<std::option::Option<std::string::String>>()?
589                                .unwrap_or_default();
590                        }
591                        __FieldTag::__body => {
592                            if !fields.insert(__FieldTag::__body) {
593                                return std::result::Result::Err(A::Error::duplicate_field(
594                                    "multiple values for body",
595                                ));
596                            }
597                            result.body =
598                                map.next_value::<std::option::Option<crate::model::BackupRun>>()?;
599                        }
600                        __FieldTag::Unknown(key) => {
601                            let value = map.next_value::<serde_json::Value>()?;
602                            result._unknown_fields.insert(key, value);
603                        }
604                    }
605                }
606                std::result::Result::Ok(result)
607            }
608        }
609        deserializer.deserialize_any(Visitor)
610    }
611}
612
613#[doc(hidden)]
614impl serde::ser::Serialize for SqlBackupRunsInsertRequest {
615    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
616    where
617        S: serde::ser::Serializer,
618    {
619        use serde::ser::SerializeMap;
620        #[allow(unused_imports)]
621        use std::option::Option::Some;
622        let mut state = serializer.serialize_map(std::option::Option::None)?;
623        if !self.instance.is_empty() {
624            state.serialize_entry("instance", &self.instance)?;
625        }
626        if !self.project.is_empty() {
627            state.serialize_entry("project", &self.project)?;
628        }
629        if self.body.is_some() {
630            state.serialize_entry("body", &self.body)?;
631        }
632        if !self._unknown_fields.is_empty() {
633            for (key, value) in self._unknown_fields.iter() {
634                state.serialize_entry(key, &value)?;
635            }
636        }
637        state.end()
638    }
639}
640
641impl std::fmt::Debug for SqlBackupRunsInsertRequest {
642    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
643        let mut debug_struct = f.debug_struct("SqlBackupRunsInsertRequest");
644        debug_struct.field("instance", &self.instance);
645        debug_struct.field("project", &self.project);
646        debug_struct.field("body", &self.body);
647        if !self._unknown_fields.is_empty() {
648            debug_struct.field("_unknown_fields", &self._unknown_fields);
649        }
650        debug_struct.finish()
651    }
652}
653
654/// Backup runs list request.
655#[derive(Clone, Default, PartialEq)]
656#[non_exhaustive]
657pub struct SqlBackupRunsListRequest {
658    /// Cloud SQL instance ID, or "-" for all instances. This does not include
659    /// the project ID.
660    pub instance: std::string::String,
661
662    /// Maximum number of backup runs per response.
663    pub max_results: i32,
664
665    /// A previously-returned page token representing part of the larger set of
666    /// results to view.
667    pub page_token: std::string::String,
668
669    /// Project ID of the project that contains the instance.
670    pub project: std::string::String,
671
672    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
673}
674
675impl SqlBackupRunsListRequest {
676    pub fn new() -> Self {
677        std::default::Default::default()
678    }
679
680    /// Sets the value of [instance][crate::model::SqlBackupRunsListRequest::instance].
681    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
682        self.instance = v.into();
683        self
684    }
685
686    /// Sets the value of [max_results][crate::model::SqlBackupRunsListRequest::max_results].
687    pub fn set_max_results<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
688        self.max_results = v.into();
689        self
690    }
691
692    /// Sets the value of [page_token][crate::model::SqlBackupRunsListRequest::page_token].
693    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
694        self.page_token = v.into();
695        self
696    }
697
698    /// Sets the value of [project][crate::model::SqlBackupRunsListRequest::project].
699    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
700        self.project = v.into();
701        self
702    }
703}
704
705impl wkt::message::Message for SqlBackupRunsListRequest {
706    fn typename() -> &'static str {
707        "type.googleapis.com/google.cloud.sql.v1.SqlBackupRunsListRequest"
708    }
709}
710
711#[doc(hidden)]
712impl<'de> serde::de::Deserialize<'de> for SqlBackupRunsListRequest {
713    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
714    where
715        D: serde::Deserializer<'de>,
716    {
717        #[allow(non_camel_case_types)]
718        #[doc(hidden)]
719        #[derive(PartialEq, Eq, Hash)]
720        enum __FieldTag {
721            __instance,
722            __max_results,
723            __page_token,
724            __project,
725            Unknown(std::string::String),
726        }
727        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
728            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
729            where
730                D: serde::Deserializer<'de>,
731            {
732                struct Visitor;
733                impl<'de> serde::de::Visitor<'de> for Visitor {
734                    type Value = __FieldTag;
735                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
736                        formatter.write_str("a field name for SqlBackupRunsListRequest")
737                    }
738                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
739                    where
740                        E: serde::de::Error,
741                    {
742                        use std::result::Result::Ok;
743                        use std::string::ToString;
744                        match value {
745                            "instance" => Ok(__FieldTag::__instance),
746                            "maxResults" => Ok(__FieldTag::__max_results),
747                            "max_results" => Ok(__FieldTag::__max_results),
748                            "pageToken" => Ok(__FieldTag::__page_token),
749                            "page_token" => Ok(__FieldTag::__page_token),
750                            "project" => Ok(__FieldTag::__project),
751                            _ => Ok(__FieldTag::Unknown(value.to_string())),
752                        }
753                    }
754                }
755                deserializer.deserialize_identifier(Visitor)
756            }
757        }
758        struct Visitor;
759        impl<'de> serde::de::Visitor<'de> for Visitor {
760            type Value = SqlBackupRunsListRequest;
761            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
762                formatter.write_str("struct SqlBackupRunsListRequest")
763            }
764            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
765            where
766                A: serde::de::MapAccess<'de>,
767            {
768                #[allow(unused_imports)]
769                use serde::de::Error;
770                use std::option::Option::Some;
771                let mut fields = std::collections::HashSet::new();
772                let mut result = Self::Value::new();
773                while let Some(tag) = map.next_key::<__FieldTag>()? {
774                    #[allow(clippy::match_single_binding)]
775                    match tag {
776                        __FieldTag::__instance => {
777                            if !fields.insert(__FieldTag::__instance) {
778                                return std::result::Result::Err(A::Error::duplicate_field(
779                                    "multiple values for instance",
780                                ));
781                            }
782                            result.instance = map
783                                .next_value::<std::option::Option<std::string::String>>()?
784                                .unwrap_or_default();
785                        }
786                        __FieldTag::__max_results => {
787                            if !fields.insert(__FieldTag::__max_results) {
788                                return std::result::Result::Err(A::Error::duplicate_field(
789                                    "multiple values for max_results",
790                                ));
791                            }
792                            struct __With(std::option::Option<i32>);
793                            impl<'de> serde::de::Deserialize<'de> for __With {
794                                fn deserialize<D>(
795                                    deserializer: D,
796                                ) -> std::result::Result<Self, D::Error>
797                                where
798                                    D: serde::de::Deserializer<'de>,
799                                {
800                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
801                                }
802                            }
803                            result.max_results = map.next_value::<__With>()?.0.unwrap_or_default();
804                        }
805                        __FieldTag::__page_token => {
806                            if !fields.insert(__FieldTag::__page_token) {
807                                return std::result::Result::Err(A::Error::duplicate_field(
808                                    "multiple values for page_token",
809                                ));
810                            }
811                            result.page_token = map
812                                .next_value::<std::option::Option<std::string::String>>()?
813                                .unwrap_or_default();
814                        }
815                        __FieldTag::__project => {
816                            if !fields.insert(__FieldTag::__project) {
817                                return std::result::Result::Err(A::Error::duplicate_field(
818                                    "multiple values for project",
819                                ));
820                            }
821                            result.project = map
822                                .next_value::<std::option::Option<std::string::String>>()?
823                                .unwrap_or_default();
824                        }
825                        __FieldTag::Unknown(key) => {
826                            let value = map.next_value::<serde_json::Value>()?;
827                            result._unknown_fields.insert(key, value);
828                        }
829                    }
830                }
831                std::result::Result::Ok(result)
832            }
833        }
834        deserializer.deserialize_any(Visitor)
835    }
836}
837
838#[doc(hidden)]
839impl serde::ser::Serialize for SqlBackupRunsListRequest {
840    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
841    where
842        S: serde::ser::Serializer,
843    {
844        use serde::ser::SerializeMap;
845        #[allow(unused_imports)]
846        use std::option::Option::Some;
847        let mut state = serializer.serialize_map(std::option::Option::None)?;
848        if !self.instance.is_empty() {
849            state.serialize_entry("instance", &self.instance)?;
850        }
851        if !wkt::internal::is_default(&self.max_results) {
852            struct __With<'a>(&'a i32);
853            impl<'a> serde::ser::Serialize for __With<'a> {
854                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
855                where
856                    S: serde::ser::Serializer,
857                {
858                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
859                }
860            }
861            state.serialize_entry("maxResults", &__With(&self.max_results))?;
862        }
863        if !self.page_token.is_empty() {
864            state.serialize_entry("pageToken", &self.page_token)?;
865        }
866        if !self.project.is_empty() {
867            state.serialize_entry("project", &self.project)?;
868        }
869        if !self._unknown_fields.is_empty() {
870            for (key, value) in self._unknown_fields.iter() {
871                state.serialize_entry(key, &value)?;
872            }
873        }
874        state.end()
875    }
876}
877
878impl std::fmt::Debug for SqlBackupRunsListRequest {
879    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
880        let mut debug_struct = f.debug_struct("SqlBackupRunsListRequest");
881        debug_struct.field("instance", &self.instance);
882        debug_struct.field("max_results", &self.max_results);
883        debug_struct.field("page_token", &self.page_token);
884        debug_struct.field("project", &self.project);
885        if !self._unknown_fields.is_empty() {
886            debug_struct.field("_unknown_fields", &self._unknown_fields);
887        }
888        debug_struct.finish()
889    }
890}
891
892/// A BackupRun resource.
893#[derive(Clone, Default, PartialEq)]
894#[non_exhaustive]
895pub struct BackupRun {
896    /// This is always `sql#backupRun`.
897    pub kind: std::string::String,
898
899    /// The status of this run.
900    pub status: crate::model::SqlBackupRunStatus,
901
902    /// The time the run was enqueued in UTC timezone in
903    /// [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example
904    /// `2012-11-15T16:19:00.094Z`.
905    pub enqueued_time: std::option::Option<wkt::Timestamp>,
906
907    /// The identifier for this backup run. Unique only for a specific Cloud SQL
908    /// instance.
909    pub id: i64,
910
911    /// The time the backup operation actually started in UTC timezone in
912    /// [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example
913    /// `2012-11-15T16:19:00.094Z`.
914    pub start_time: std::option::Option<wkt::Timestamp>,
915
916    /// The time the backup operation completed in UTC timezone in
917    /// [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example
918    /// `2012-11-15T16:19:00.094Z`.
919    pub end_time: std::option::Option<wkt::Timestamp>,
920
921    /// Information about why the backup operation failed. This is only present if
922    /// the run has the FAILED status.
923    pub error: std::option::Option<crate::model::OperationError>,
924
925    /// The type of this run; can be either "AUTOMATED" or "ON_DEMAND" or "FINAL".
926    /// This field defaults to "ON_DEMAND" and is ignored, when specified for
927    /// insert requests.
928    pub r#type: crate::model::SqlBackupRunType,
929
930    /// The description of this run, only applicable to on-demand backups.
931    pub description: std::string::String,
932
933    /// The start time of the backup window during which this the backup was
934    /// attempted in [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for
935    /// example `2012-11-15T16:19:00.094Z`.
936    pub window_start_time: std::option::Option<wkt::Timestamp>,
937
938    /// Name of the database instance.
939    pub instance: std::string::String,
940
941    /// The URI of this resource.
942    pub self_link: std::string::String,
943
944    /// Location of the backups.
945    pub location: std::string::String,
946
947    /// Encryption configuration specific to a backup.
948    pub disk_encryption_configuration:
949        std::option::Option<crate::model::DiskEncryptionConfiguration>,
950
951    /// Encryption status specific to a backup.
952    pub disk_encryption_status: std::option::Option<crate::model::DiskEncryptionStatus>,
953
954    /// Specifies the kind of backup, PHYSICAL or DEFAULT_SNAPSHOT.
955    pub backup_kind: crate::model::SqlBackupKind,
956
957    /// Backup time zone to prevent restores to an instance with
958    /// a different time zone. Now relevant only for SQL Server.
959    pub time_zone: std::string::String,
960
961    /// Output only. The maximum chargeable bytes for the backup.
962    pub max_chargeable_bytes: std::option::Option<i64>,
963
964    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
965}
966
967impl BackupRun {
968    pub fn new() -> Self {
969        std::default::Default::default()
970    }
971
972    /// Sets the value of [kind][crate::model::BackupRun::kind].
973    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
974        self.kind = v.into();
975        self
976    }
977
978    /// Sets the value of [status][crate::model::BackupRun::status].
979    pub fn set_status<T: std::convert::Into<crate::model::SqlBackupRunStatus>>(
980        mut self,
981        v: T,
982    ) -> Self {
983        self.status = v.into();
984        self
985    }
986
987    /// Sets the value of [enqueued_time][crate::model::BackupRun::enqueued_time].
988    pub fn set_enqueued_time<T>(mut self, v: T) -> Self
989    where
990        T: std::convert::Into<wkt::Timestamp>,
991    {
992        self.enqueued_time = std::option::Option::Some(v.into());
993        self
994    }
995
996    /// Sets or clears the value of [enqueued_time][crate::model::BackupRun::enqueued_time].
997    pub fn set_or_clear_enqueued_time<T>(mut self, v: std::option::Option<T>) -> Self
998    where
999        T: std::convert::Into<wkt::Timestamp>,
1000    {
1001        self.enqueued_time = v.map(|x| x.into());
1002        self
1003    }
1004
1005    /// Sets the value of [id][crate::model::BackupRun::id].
1006    pub fn set_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1007        self.id = v.into();
1008        self
1009    }
1010
1011    /// Sets the value of [start_time][crate::model::BackupRun::start_time].
1012    pub fn set_start_time<T>(mut self, v: T) -> Self
1013    where
1014        T: std::convert::Into<wkt::Timestamp>,
1015    {
1016        self.start_time = std::option::Option::Some(v.into());
1017        self
1018    }
1019
1020    /// Sets or clears the value of [start_time][crate::model::BackupRun::start_time].
1021    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
1022    where
1023        T: std::convert::Into<wkt::Timestamp>,
1024    {
1025        self.start_time = v.map(|x| x.into());
1026        self
1027    }
1028
1029    /// Sets the value of [end_time][crate::model::BackupRun::end_time].
1030    pub fn set_end_time<T>(mut self, v: T) -> Self
1031    where
1032        T: std::convert::Into<wkt::Timestamp>,
1033    {
1034        self.end_time = std::option::Option::Some(v.into());
1035        self
1036    }
1037
1038    /// Sets or clears the value of [end_time][crate::model::BackupRun::end_time].
1039    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
1040    where
1041        T: std::convert::Into<wkt::Timestamp>,
1042    {
1043        self.end_time = v.map(|x| x.into());
1044        self
1045    }
1046
1047    /// Sets the value of [error][crate::model::BackupRun::error].
1048    pub fn set_error<T>(mut self, v: T) -> Self
1049    where
1050        T: std::convert::Into<crate::model::OperationError>,
1051    {
1052        self.error = std::option::Option::Some(v.into());
1053        self
1054    }
1055
1056    /// Sets or clears the value of [error][crate::model::BackupRun::error].
1057    pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
1058    where
1059        T: std::convert::Into<crate::model::OperationError>,
1060    {
1061        self.error = v.map(|x| x.into());
1062        self
1063    }
1064
1065    /// Sets the value of [r#type][crate::model::BackupRun::type].
1066    pub fn set_type<T: std::convert::Into<crate::model::SqlBackupRunType>>(mut self, v: T) -> Self {
1067        self.r#type = v.into();
1068        self
1069    }
1070
1071    /// Sets the value of [description][crate::model::BackupRun::description].
1072    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1073        self.description = v.into();
1074        self
1075    }
1076
1077    /// Sets the value of [window_start_time][crate::model::BackupRun::window_start_time].
1078    pub fn set_window_start_time<T>(mut self, v: T) -> Self
1079    where
1080        T: std::convert::Into<wkt::Timestamp>,
1081    {
1082        self.window_start_time = std::option::Option::Some(v.into());
1083        self
1084    }
1085
1086    /// Sets or clears the value of [window_start_time][crate::model::BackupRun::window_start_time].
1087    pub fn set_or_clear_window_start_time<T>(mut self, v: std::option::Option<T>) -> Self
1088    where
1089        T: std::convert::Into<wkt::Timestamp>,
1090    {
1091        self.window_start_time = v.map(|x| x.into());
1092        self
1093    }
1094
1095    /// Sets the value of [instance][crate::model::BackupRun::instance].
1096    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1097        self.instance = v.into();
1098        self
1099    }
1100
1101    /// Sets the value of [self_link][crate::model::BackupRun::self_link].
1102    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1103        self.self_link = v.into();
1104        self
1105    }
1106
1107    /// Sets the value of [location][crate::model::BackupRun::location].
1108    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1109        self.location = v.into();
1110        self
1111    }
1112
1113    /// Sets the value of [disk_encryption_configuration][crate::model::BackupRun::disk_encryption_configuration].
1114    pub fn set_disk_encryption_configuration<T>(mut self, v: T) -> Self
1115    where
1116        T: std::convert::Into<crate::model::DiskEncryptionConfiguration>,
1117    {
1118        self.disk_encryption_configuration = std::option::Option::Some(v.into());
1119        self
1120    }
1121
1122    /// Sets or clears the value of [disk_encryption_configuration][crate::model::BackupRun::disk_encryption_configuration].
1123    pub fn set_or_clear_disk_encryption_configuration<T>(
1124        mut self,
1125        v: std::option::Option<T>,
1126    ) -> Self
1127    where
1128        T: std::convert::Into<crate::model::DiskEncryptionConfiguration>,
1129    {
1130        self.disk_encryption_configuration = v.map(|x| x.into());
1131        self
1132    }
1133
1134    /// Sets the value of [disk_encryption_status][crate::model::BackupRun::disk_encryption_status].
1135    pub fn set_disk_encryption_status<T>(mut self, v: T) -> Self
1136    where
1137        T: std::convert::Into<crate::model::DiskEncryptionStatus>,
1138    {
1139        self.disk_encryption_status = std::option::Option::Some(v.into());
1140        self
1141    }
1142
1143    /// Sets or clears the value of [disk_encryption_status][crate::model::BackupRun::disk_encryption_status].
1144    pub fn set_or_clear_disk_encryption_status<T>(mut self, v: std::option::Option<T>) -> Self
1145    where
1146        T: std::convert::Into<crate::model::DiskEncryptionStatus>,
1147    {
1148        self.disk_encryption_status = v.map(|x| x.into());
1149        self
1150    }
1151
1152    /// Sets the value of [backup_kind][crate::model::BackupRun::backup_kind].
1153    pub fn set_backup_kind<T: std::convert::Into<crate::model::SqlBackupKind>>(
1154        mut self,
1155        v: T,
1156    ) -> Self {
1157        self.backup_kind = v.into();
1158        self
1159    }
1160
1161    /// Sets the value of [time_zone][crate::model::BackupRun::time_zone].
1162    pub fn set_time_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1163        self.time_zone = v.into();
1164        self
1165    }
1166
1167    /// Sets the value of [max_chargeable_bytes][crate::model::BackupRun::max_chargeable_bytes].
1168    pub fn set_max_chargeable_bytes<T>(mut self, v: T) -> Self
1169    where
1170        T: std::convert::Into<i64>,
1171    {
1172        self.max_chargeable_bytes = std::option::Option::Some(v.into());
1173        self
1174    }
1175
1176    /// Sets or clears the value of [max_chargeable_bytes][crate::model::BackupRun::max_chargeable_bytes].
1177    pub fn set_or_clear_max_chargeable_bytes<T>(mut self, v: std::option::Option<T>) -> Self
1178    where
1179        T: std::convert::Into<i64>,
1180    {
1181        self.max_chargeable_bytes = v.map(|x| x.into());
1182        self
1183    }
1184}
1185
1186impl wkt::message::Message for BackupRun {
1187    fn typename() -> &'static str {
1188        "type.googleapis.com/google.cloud.sql.v1.BackupRun"
1189    }
1190}
1191
1192#[doc(hidden)]
1193impl<'de> serde::de::Deserialize<'de> for BackupRun {
1194    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1195    where
1196        D: serde::Deserializer<'de>,
1197    {
1198        #[allow(non_camel_case_types)]
1199        #[doc(hidden)]
1200        #[derive(PartialEq, Eq, Hash)]
1201        enum __FieldTag {
1202            __kind,
1203            __status,
1204            __enqueued_time,
1205            __id,
1206            __start_time,
1207            __end_time,
1208            __error,
1209            __type,
1210            __description,
1211            __window_start_time,
1212            __instance,
1213            __self_link,
1214            __location,
1215            __disk_encryption_configuration,
1216            __disk_encryption_status,
1217            __backup_kind,
1218            __time_zone,
1219            __max_chargeable_bytes,
1220            Unknown(std::string::String),
1221        }
1222        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1223            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1224            where
1225                D: serde::Deserializer<'de>,
1226            {
1227                struct Visitor;
1228                impl<'de> serde::de::Visitor<'de> for Visitor {
1229                    type Value = __FieldTag;
1230                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1231                        formatter.write_str("a field name for BackupRun")
1232                    }
1233                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1234                    where
1235                        E: serde::de::Error,
1236                    {
1237                        use std::result::Result::Ok;
1238                        use std::string::ToString;
1239                        match value {
1240                            "kind" => Ok(__FieldTag::__kind),
1241                            "status" => Ok(__FieldTag::__status),
1242                            "enqueuedTime" => Ok(__FieldTag::__enqueued_time),
1243                            "enqueued_time" => Ok(__FieldTag::__enqueued_time),
1244                            "id" => Ok(__FieldTag::__id),
1245                            "startTime" => Ok(__FieldTag::__start_time),
1246                            "start_time" => Ok(__FieldTag::__start_time),
1247                            "endTime" => Ok(__FieldTag::__end_time),
1248                            "end_time" => Ok(__FieldTag::__end_time),
1249                            "error" => Ok(__FieldTag::__error),
1250                            "type" => Ok(__FieldTag::__type),
1251                            "description" => Ok(__FieldTag::__description),
1252                            "windowStartTime" => Ok(__FieldTag::__window_start_time),
1253                            "window_start_time" => Ok(__FieldTag::__window_start_time),
1254                            "instance" => Ok(__FieldTag::__instance),
1255                            "selfLink" => Ok(__FieldTag::__self_link),
1256                            "self_link" => Ok(__FieldTag::__self_link),
1257                            "location" => Ok(__FieldTag::__location),
1258                            "diskEncryptionConfiguration" => {
1259                                Ok(__FieldTag::__disk_encryption_configuration)
1260                            }
1261                            "disk_encryption_configuration" => {
1262                                Ok(__FieldTag::__disk_encryption_configuration)
1263                            }
1264                            "diskEncryptionStatus" => Ok(__FieldTag::__disk_encryption_status),
1265                            "disk_encryption_status" => Ok(__FieldTag::__disk_encryption_status),
1266                            "backupKind" => Ok(__FieldTag::__backup_kind),
1267                            "backup_kind" => Ok(__FieldTag::__backup_kind),
1268                            "timeZone" => Ok(__FieldTag::__time_zone),
1269                            "time_zone" => Ok(__FieldTag::__time_zone),
1270                            "maxChargeableBytes" => Ok(__FieldTag::__max_chargeable_bytes),
1271                            "max_chargeable_bytes" => Ok(__FieldTag::__max_chargeable_bytes),
1272                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1273                        }
1274                    }
1275                }
1276                deserializer.deserialize_identifier(Visitor)
1277            }
1278        }
1279        struct Visitor;
1280        impl<'de> serde::de::Visitor<'de> for Visitor {
1281            type Value = BackupRun;
1282            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1283                formatter.write_str("struct BackupRun")
1284            }
1285            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1286            where
1287                A: serde::de::MapAccess<'de>,
1288            {
1289                #[allow(unused_imports)]
1290                use serde::de::Error;
1291                use std::option::Option::Some;
1292                let mut fields = std::collections::HashSet::new();
1293                let mut result = Self::Value::new();
1294                while let Some(tag) = map.next_key::<__FieldTag>()? {
1295                    #[allow(clippy::match_single_binding)]
1296                    match tag {
1297                        __FieldTag::__kind => {
1298                            if !fields.insert(__FieldTag::__kind) {
1299                                return std::result::Result::Err(A::Error::duplicate_field(
1300                                    "multiple values for kind",
1301                                ));
1302                            }
1303                            result.kind = map
1304                                .next_value::<std::option::Option<std::string::String>>()?
1305                                .unwrap_or_default();
1306                        }
1307                        __FieldTag::__status => {
1308                            if !fields.insert(__FieldTag::__status) {
1309                                return std::result::Result::Err(A::Error::duplicate_field(
1310                                    "multiple values for status",
1311                                ));
1312                            }
1313                            result.status = map.next_value::<std::option::Option<crate::model::SqlBackupRunStatus>>()?.unwrap_or_default();
1314                        }
1315                        __FieldTag::__enqueued_time => {
1316                            if !fields.insert(__FieldTag::__enqueued_time) {
1317                                return std::result::Result::Err(A::Error::duplicate_field(
1318                                    "multiple values for enqueued_time",
1319                                ));
1320                            }
1321                            result.enqueued_time =
1322                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1323                        }
1324                        __FieldTag::__id => {
1325                            if !fields.insert(__FieldTag::__id) {
1326                                return std::result::Result::Err(A::Error::duplicate_field(
1327                                    "multiple values for id",
1328                                ));
1329                            }
1330                            struct __With(std::option::Option<i64>);
1331                            impl<'de> serde::de::Deserialize<'de> for __With {
1332                                fn deserialize<D>(
1333                                    deserializer: D,
1334                                ) -> std::result::Result<Self, D::Error>
1335                                where
1336                                    D: serde::de::Deserializer<'de>,
1337                                {
1338                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
1339                                }
1340                            }
1341                            result.id = map.next_value::<__With>()?.0.unwrap_or_default();
1342                        }
1343                        __FieldTag::__start_time => {
1344                            if !fields.insert(__FieldTag::__start_time) {
1345                                return std::result::Result::Err(A::Error::duplicate_field(
1346                                    "multiple values for start_time",
1347                                ));
1348                            }
1349                            result.start_time =
1350                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1351                        }
1352                        __FieldTag::__end_time => {
1353                            if !fields.insert(__FieldTag::__end_time) {
1354                                return std::result::Result::Err(A::Error::duplicate_field(
1355                                    "multiple values for end_time",
1356                                ));
1357                            }
1358                            result.end_time =
1359                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1360                        }
1361                        __FieldTag::__error => {
1362                            if !fields.insert(__FieldTag::__error) {
1363                                return std::result::Result::Err(A::Error::duplicate_field(
1364                                    "multiple values for error",
1365                                ));
1366                            }
1367                            result.error = map
1368                                .next_value::<std::option::Option<crate::model::OperationError>>(
1369                                )?;
1370                        }
1371                        __FieldTag::__type => {
1372                            if !fields.insert(__FieldTag::__type) {
1373                                return std::result::Result::Err(A::Error::duplicate_field(
1374                                    "multiple values for type",
1375                                ));
1376                            }
1377                            result.r#type = map
1378                                .next_value::<std::option::Option<crate::model::SqlBackupRunType>>(
1379                                )?
1380                                .unwrap_or_default();
1381                        }
1382                        __FieldTag::__description => {
1383                            if !fields.insert(__FieldTag::__description) {
1384                                return std::result::Result::Err(A::Error::duplicate_field(
1385                                    "multiple values for description",
1386                                ));
1387                            }
1388                            result.description = map
1389                                .next_value::<std::option::Option<std::string::String>>()?
1390                                .unwrap_or_default();
1391                        }
1392                        __FieldTag::__window_start_time => {
1393                            if !fields.insert(__FieldTag::__window_start_time) {
1394                                return std::result::Result::Err(A::Error::duplicate_field(
1395                                    "multiple values for window_start_time",
1396                                ));
1397                            }
1398                            result.window_start_time =
1399                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1400                        }
1401                        __FieldTag::__instance => {
1402                            if !fields.insert(__FieldTag::__instance) {
1403                                return std::result::Result::Err(A::Error::duplicate_field(
1404                                    "multiple values for instance",
1405                                ));
1406                            }
1407                            result.instance = map
1408                                .next_value::<std::option::Option<std::string::String>>()?
1409                                .unwrap_or_default();
1410                        }
1411                        __FieldTag::__self_link => {
1412                            if !fields.insert(__FieldTag::__self_link) {
1413                                return std::result::Result::Err(A::Error::duplicate_field(
1414                                    "multiple values for self_link",
1415                                ));
1416                            }
1417                            result.self_link = map
1418                                .next_value::<std::option::Option<std::string::String>>()?
1419                                .unwrap_or_default();
1420                        }
1421                        __FieldTag::__location => {
1422                            if !fields.insert(__FieldTag::__location) {
1423                                return std::result::Result::Err(A::Error::duplicate_field(
1424                                    "multiple values for location",
1425                                ));
1426                            }
1427                            result.location = map
1428                                .next_value::<std::option::Option<std::string::String>>()?
1429                                .unwrap_or_default();
1430                        }
1431                        __FieldTag::__disk_encryption_configuration => {
1432                            if !fields.insert(__FieldTag::__disk_encryption_configuration) {
1433                                return std::result::Result::Err(A::Error::duplicate_field(
1434                                    "multiple values for disk_encryption_configuration",
1435                                ));
1436                            }
1437                            result.disk_encryption_configuration = map.next_value::<std::option::Option<crate::model::DiskEncryptionConfiguration>>()?
1438                                ;
1439                        }
1440                        __FieldTag::__disk_encryption_status => {
1441                            if !fields.insert(__FieldTag::__disk_encryption_status) {
1442                                return std::result::Result::Err(A::Error::duplicate_field(
1443                                    "multiple values for disk_encryption_status",
1444                                ));
1445                            }
1446                            result.disk_encryption_status = map.next_value::<std::option::Option<crate::model::DiskEncryptionStatus>>()?
1447                                ;
1448                        }
1449                        __FieldTag::__backup_kind => {
1450                            if !fields.insert(__FieldTag::__backup_kind) {
1451                                return std::result::Result::Err(A::Error::duplicate_field(
1452                                    "multiple values for backup_kind",
1453                                ));
1454                            }
1455                            result.backup_kind = map
1456                                .next_value::<std::option::Option<crate::model::SqlBackupKind>>()?
1457                                .unwrap_or_default();
1458                        }
1459                        __FieldTag::__time_zone => {
1460                            if !fields.insert(__FieldTag::__time_zone) {
1461                                return std::result::Result::Err(A::Error::duplicate_field(
1462                                    "multiple values for time_zone",
1463                                ));
1464                            }
1465                            result.time_zone = map
1466                                .next_value::<std::option::Option<std::string::String>>()?
1467                                .unwrap_or_default();
1468                        }
1469                        __FieldTag::__max_chargeable_bytes => {
1470                            if !fields.insert(__FieldTag::__max_chargeable_bytes) {
1471                                return std::result::Result::Err(A::Error::duplicate_field(
1472                                    "multiple values for max_chargeable_bytes",
1473                                ));
1474                            }
1475                            struct __With(std::option::Option<i64>);
1476                            impl<'de> serde::de::Deserialize<'de> for __With {
1477                                fn deserialize<D>(
1478                                    deserializer: D,
1479                                ) -> std::result::Result<Self, D::Error>
1480                                where
1481                                    D: serde::de::Deserializer<'de>,
1482                                {
1483                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
1484                                }
1485                            }
1486                            result.max_chargeable_bytes = map.next_value::<__With>()?.0;
1487                        }
1488                        __FieldTag::Unknown(key) => {
1489                            let value = map.next_value::<serde_json::Value>()?;
1490                            result._unknown_fields.insert(key, value);
1491                        }
1492                    }
1493                }
1494                std::result::Result::Ok(result)
1495            }
1496        }
1497        deserializer.deserialize_any(Visitor)
1498    }
1499}
1500
1501#[doc(hidden)]
1502impl serde::ser::Serialize for BackupRun {
1503    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1504    where
1505        S: serde::ser::Serializer,
1506    {
1507        use serde::ser::SerializeMap;
1508        #[allow(unused_imports)]
1509        use std::option::Option::Some;
1510        let mut state = serializer.serialize_map(std::option::Option::None)?;
1511        if !self.kind.is_empty() {
1512            state.serialize_entry("kind", &self.kind)?;
1513        }
1514        if !wkt::internal::is_default(&self.status) {
1515            state.serialize_entry("status", &self.status)?;
1516        }
1517        if self.enqueued_time.is_some() {
1518            state.serialize_entry("enqueuedTime", &self.enqueued_time)?;
1519        }
1520        if !wkt::internal::is_default(&self.id) {
1521            struct __With<'a>(&'a i64);
1522            impl<'a> serde::ser::Serialize for __With<'a> {
1523                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1524                where
1525                    S: serde::ser::Serializer,
1526                {
1527                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
1528                }
1529            }
1530            state.serialize_entry("id", &__With(&self.id))?;
1531        }
1532        if self.start_time.is_some() {
1533            state.serialize_entry("startTime", &self.start_time)?;
1534        }
1535        if self.end_time.is_some() {
1536            state.serialize_entry("endTime", &self.end_time)?;
1537        }
1538        if self.error.is_some() {
1539            state.serialize_entry("error", &self.error)?;
1540        }
1541        if !wkt::internal::is_default(&self.r#type) {
1542            state.serialize_entry("type", &self.r#type)?;
1543        }
1544        if !self.description.is_empty() {
1545            state.serialize_entry("description", &self.description)?;
1546        }
1547        if self.window_start_time.is_some() {
1548            state.serialize_entry("windowStartTime", &self.window_start_time)?;
1549        }
1550        if !self.instance.is_empty() {
1551            state.serialize_entry("instance", &self.instance)?;
1552        }
1553        if !self.self_link.is_empty() {
1554            state.serialize_entry("selfLink", &self.self_link)?;
1555        }
1556        if !self.location.is_empty() {
1557            state.serialize_entry("location", &self.location)?;
1558        }
1559        if self.disk_encryption_configuration.is_some() {
1560            state.serialize_entry(
1561                "diskEncryptionConfiguration",
1562                &self.disk_encryption_configuration,
1563            )?;
1564        }
1565        if self.disk_encryption_status.is_some() {
1566            state.serialize_entry("diskEncryptionStatus", &self.disk_encryption_status)?;
1567        }
1568        if !wkt::internal::is_default(&self.backup_kind) {
1569            state.serialize_entry("backupKind", &self.backup_kind)?;
1570        }
1571        if !self.time_zone.is_empty() {
1572            state.serialize_entry("timeZone", &self.time_zone)?;
1573        }
1574        if self.max_chargeable_bytes.is_some() {
1575            struct __With<'a>(&'a std::option::Option<i64>);
1576            impl<'a> serde::ser::Serialize for __With<'a> {
1577                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1578                where
1579                    S: serde::ser::Serializer,
1580                {
1581                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
1582                        self.0, serializer,
1583                    )
1584                }
1585            }
1586            state.serialize_entry("maxChargeableBytes", &__With(&self.max_chargeable_bytes))?;
1587        }
1588        if !self._unknown_fields.is_empty() {
1589            for (key, value) in self._unknown_fields.iter() {
1590                state.serialize_entry(key, &value)?;
1591            }
1592        }
1593        state.end()
1594    }
1595}
1596
1597impl std::fmt::Debug for BackupRun {
1598    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1599        let mut debug_struct = f.debug_struct("BackupRun");
1600        debug_struct.field("kind", &self.kind);
1601        debug_struct.field("status", &self.status);
1602        debug_struct.field("enqueued_time", &self.enqueued_time);
1603        debug_struct.field("id", &self.id);
1604        debug_struct.field("start_time", &self.start_time);
1605        debug_struct.field("end_time", &self.end_time);
1606        debug_struct.field("error", &self.error);
1607        debug_struct.field("r#type", &self.r#type);
1608        debug_struct.field("description", &self.description);
1609        debug_struct.field("window_start_time", &self.window_start_time);
1610        debug_struct.field("instance", &self.instance);
1611        debug_struct.field("self_link", &self.self_link);
1612        debug_struct.field("location", &self.location);
1613        debug_struct.field(
1614            "disk_encryption_configuration",
1615            &self.disk_encryption_configuration,
1616        );
1617        debug_struct.field("disk_encryption_status", &self.disk_encryption_status);
1618        debug_struct.field("backup_kind", &self.backup_kind);
1619        debug_struct.field("time_zone", &self.time_zone);
1620        debug_struct.field("max_chargeable_bytes", &self.max_chargeable_bytes);
1621        if !self._unknown_fields.is_empty() {
1622            debug_struct.field("_unknown_fields", &self._unknown_fields);
1623        }
1624        debug_struct.finish()
1625    }
1626}
1627
1628/// Backup run list results.
1629#[derive(Clone, Default, PartialEq)]
1630#[non_exhaustive]
1631pub struct BackupRunsListResponse {
1632    /// This is always `sql#backupRunsList`.
1633    pub kind: std::string::String,
1634
1635    /// A list of backup runs in reverse chronological order of the enqueued time.
1636    pub items: std::vec::Vec<crate::model::BackupRun>,
1637
1638    /// The continuation token, used to page through large result sets. Provide
1639    /// this value in a subsequent request to return the next page of results.
1640    pub next_page_token: std::string::String,
1641
1642    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1643}
1644
1645impl BackupRunsListResponse {
1646    pub fn new() -> Self {
1647        std::default::Default::default()
1648    }
1649
1650    /// Sets the value of [kind][crate::model::BackupRunsListResponse::kind].
1651    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1652        self.kind = v.into();
1653        self
1654    }
1655
1656    /// Sets the value of [items][crate::model::BackupRunsListResponse::items].
1657    pub fn set_items<T, V>(mut self, v: T) -> Self
1658    where
1659        T: std::iter::IntoIterator<Item = V>,
1660        V: std::convert::Into<crate::model::BackupRun>,
1661    {
1662        use std::iter::Iterator;
1663        self.items = v.into_iter().map(|i| i.into()).collect();
1664        self
1665    }
1666
1667    /// Sets the value of [next_page_token][crate::model::BackupRunsListResponse::next_page_token].
1668    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1669        self.next_page_token = v.into();
1670        self
1671    }
1672}
1673
1674impl wkt::message::Message for BackupRunsListResponse {
1675    fn typename() -> &'static str {
1676        "type.googleapis.com/google.cloud.sql.v1.BackupRunsListResponse"
1677    }
1678}
1679
1680#[doc(hidden)]
1681impl gax::paginator::internal::PageableResponse for BackupRunsListResponse {
1682    type PageItem = crate::model::BackupRun;
1683
1684    fn items(self) -> std::vec::Vec<Self::PageItem> {
1685        self.items
1686    }
1687
1688    fn next_page_token(&self) -> std::string::String {
1689        use std::clone::Clone;
1690        self.next_page_token.clone()
1691    }
1692}
1693
1694#[doc(hidden)]
1695impl<'de> serde::de::Deserialize<'de> for BackupRunsListResponse {
1696    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1697    where
1698        D: serde::Deserializer<'de>,
1699    {
1700        #[allow(non_camel_case_types)]
1701        #[doc(hidden)]
1702        #[derive(PartialEq, Eq, Hash)]
1703        enum __FieldTag {
1704            __kind,
1705            __items,
1706            __next_page_token,
1707            Unknown(std::string::String),
1708        }
1709        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1710            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1711            where
1712                D: serde::Deserializer<'de>,
1713            {
1714                struct Visitor;
1715                impl<'de> serde::de::Visitor<'de> for Visitor {
1716                    type Value = __FieldTag;
1717                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1718                        formatter.write_str("a field name for BackupRunsListResponse")
1719                    }
1720                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1721                    where
1722                        E: serde::de::Error,
1723                    {
1724                        use std::result::Result::Ok;
1725                        use std::string::ToString;
1726                        match value {
1727                            "kind" => Ok(__FieldTag::__kind),
1728                            "items" => Ok(__FieldTag::__items),
1729                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
1730                            "next_page_token" => Ok(__FieldTag::__next_page_token),
1731                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1732                        }
1733                    }
1734                }
1735                deserializer.deserialize_identifier(Visitor)
1736            }
1737        }
1738        struct Visitor;
1739        impl<'de> serde::de::Visitor<'de> for Visitor {
1740            type Value = BackupRunsListResponse;
1741            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1742                formatter.write_str("struct BackupRunsListResponse")
1743            }
1744            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1745            where
1746                A: serde::de::MapAccess<'de>,
1747            {
1748                #[allow(unused_imports)]
1749                use serde::de::Error;
1750                use std::option::Option::Some;
1751                let mut fields = std::collections::HashSet::new();
1752                let mut result = Self::Value::new();
1753                while let Some(tag) = map.next_key::<__FieldTag>()? {
1754                    #[allow(clippy::match_single_binding)]
1755                    match tag {
1756                        __FieldTag::__kind => {
1757                            if !fields.insert(__FieldTag::__kind) {
1758                                return std::result::Result::Err(A::Error::duplicate_field(
1759                                    "multiple values for kind",
1760                                ));
1761                            }
1762                            result.kind = map
1763                                .next_value::<std::option::Option<std::string::String>>()?
1764                                .unwrap_or_default();
1765                        }
1766                        __FieldTag::__items => {
1767                            if !fields.insert(__FieldTag::__items) {
1768                                return std::result::Result::Err(A::Error::duplicate_field(
1769                                    "multiple values for items",
1770                                ));
1771                            }
1772                            result.items = map.next_value::<std::option::Option<std::vec::Vec<crate::model::BackupRun>>>()?.unwrap_or_default();
1773                        }
1774                        __FieldTag::__next_page_token => {
1775                            if !fields.insert(__FieldTag::__next_page_token) {
1776                                return std::result::Result::Err(A::Error::duplicate_field(
1777                                    "multiple values for next_page_token",
1778                                ));
1779                            }
1780                            result.next_page_token = map
1781                                .next_value::<std::option::Option<std::string::String>>()?
1782                                .unwrap_or_default();
1783                        }
1784                        __FieldTag::Unknown(key) => {
1785                            let value = map.next_value::<serde_json::Value>()?;
1786                            result._unknown_fields.insert(key, value);
1787                        }
1788                    }
1789                }
1790                std::result::Result::Ok(result)
1791            }
1792        }
1793        deserializer.deserialize_any(Visitor)
1794    }
1795}
1796
1797#[doc(hidden)]
1798impl serde::ser::Serialize for BackupRunsListResponse {
1799    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1800    where
1801        S: serde::ser::Serializer,
1802    {
1803        use serde::ser::SerializeMap;
1804        #[allow(unused_imports)]
1805        use std::option::Option::Some;
1806        let mut state = serializer.serialize_map(std::option::Option::None)?;
1807        if !self.kind.is_empty() {
1808            state.serialize_entry("kind", &self.kind)?;
1809        }
1810        if !self.items.is_empty() {
1811            state.serialize_entry("items", &self.items)?;
1812        }
1813        if !self.next_page_token.is_empty() {
1814            state.serialize_entry("nextPageToken", &self.next_page_token)?;
1815        }
1816        if !self._unknown_fields.is_empty() {
1817            for (key, value) in self._unknown_fields.iter() {
1818                state.serialize_entry(key, &value)?;
1819            }
1820        }
1821        state.end()
1822    }
1823}
1824
1825impl std::fmt::Debug for BackupRunsListResponse {
1826    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1827        let mut debug_struct = f.debug_struct("BackupRunsListResponse");
1828        debug_struct.field("kind", &self.kind);
1829        debug_struct.field("items", &self.items);
1830        debug_struct.field("next_page_token", &self.next_page_token);
1831        if !self._unknown_fields.is_empty() {
1832            debug_struct.field("_unknown_fields", &self._unknown_fields);
1833        }
1834        debug_struct.finish()
1835    }
1836}
1837
1838/// Connect settings retrieval request.
1839#[derive(Clone, Default, PartialEq)]
1840#[non_exhaustive]
1841pub struct GetConnectSettingsRequest {
1842    /// Cloud SQL instance ID. This does not include the project ID.
1843    pub instance: std::string::String,
1844
1845    /// Project ID of the project that contains the instance.
1846    pub project: std::string::String,
1847
1848    /// Optional. Optional snapshot read timestamp to trade freshness for
1849    /// performance.
1850    pub read_time: std::option::Option<wkt::Timestamp>,
1851
1852    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1853}
1854
1855impl GetConnectSettingsRequest {
1856    pub fn new() -> Self {
1857        std::default::Default::default()
1858    }
1859
1860    /// Sets the value of [instance][crate::model::GetConnectSettingsRequest::instance].
1861    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1862        self.instance = v.into();
1863        self
1864    }
1865
1866    /// Sets the value of [project][crate::model::GetConnectSettingsRequest::project].
1867    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1868        self.project = v.into();
1869        self
1870    }
1871
1872    /// Sets the value of [read_time][crate::model::GetConnectSettingsRequest::read_time].
1873    pub fn set_read_time<T>(mut self, v: T) -> Self
1874    where
1875        T: std::convert::Into<wkt::Timestamp>,
1876    {
1877        self.read_time = std::option::Option::Some(v.into());
1878        self
1879    }
1880
1881    /// Sets or clears the value of [read_time][crate::model::GetConnectSettingsRequest::read_time].
1882    pub fn set_or_clear_read_time<T>(mut self, v: std::option::Option<T>) -> Self
1883    where
1884        T: std::convert::Into<wkt::Timestamp>,
1885    {
1886        self.read_time = v.map(|x| x.into());
1887        self
1888    }
1889}
1890
1891impl wkt::message::Message for GetConnectSettingsRequest {
1892    fn typename() -> &'static str {
1893        "type.googleapis.com/google.cloud.sql.v1.GetConnectSettingsRequest"
1894    }
1895}
1896
1897#[doc(hidden)]
1898impl<'de> serde::de::Deserialize<'de> for GetConnectSettingsRequest {
1899    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1900    where
1901        D: serde::Deserializer<'de>,
1902    {
1903        #[allow(non_camel_case_types)]
1904        #[doc(hidden)]
1905        #[derive(PartialEq, Eq, Hash)]
1906        enum __FieldTag {
1907            __instance,
1908            __project,
1909            __read_time,
1910            Unknown(std::string::String),
1911        }
1912        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1913            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1914            where
1915                D: serde::Deserializer<'de>,
1916            {
1917                struct Visitor;
1918                impl<'de> serde::de::Visitor<'de> for Visitor {
1919                    type Value = __FieldTag;
1920                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1921                        formatter.write_str("a field name for GetConnectSettingsRequest")
1922                    }
1923                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1924                    where
1925                        E: serde::de::Error,
1926                    {
1927                        use std::result::Result::Ok;
1928                        use std::string::ToString;
1929                        match value {
1930                            "instance" => Ok(__FieldTag::__instance),
1931                            "project" => Ok(__FieldTag::__project),
1932                            "readTime" => Ok(__FieldTag::__read_time),
1933                            "read_time" => Ok(__FieldTag::__read_time),
1934                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1935                        }
1936                    }
1937                }
1938                deserializer.deserialize_identifier(Visitor)
1939            }
1940        }
1941        struct Visitor;
1942        impl<'de> serde::de::Visitor<'de> for Visitor {
1943            type Value = GetConnectSettingsRequest;
1944            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1945                formatter.write_str("struct GetConnectSettingsRequest")
1946            }
1947            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1948            where
1949                A: serde::de::MapAccess<'de>,
1950            {
1951                #[allow(unused_imports)]
1952                use serde::de::Error;
1953                use std::option::Option::Some;
1954                let mut fields = std::collections::HashSet::new();
1955                let mut result = Self::Value::new();
1956                while let Some(tag) = map.next_key::<__FieldTag>()? {
1957                    #[allow(clippy::match_single_binding)]
1958                    match tag {
1959                        __FieldTag::__instance => {
1960                            if !fields.insert(__FieldTag::__instance) {
1961                                return std::result::Result::Err(A::Error::duplicate_field(
1962                                    "multiple values for instance",
1963                                ));
1964                            }
1965                            result.instance = map
1966                                .next_value::<std::option::Option<std::string::String>>()?
1967                                .unwrap_or_default();
1968                        }
1969                        __FieldTag::__project => {
1970                            if !fields.insert(__FieldTag::__project) {
1971                                return std::result::Result::Err(A::Error::duplicate_field(
1972                                    "multiple values for project",
1973                                ));
1974                            }
1975                            result.project = map
1976                                .next_value::<std::option::Option<std::string::String>>()?
1977                                .unwrap_or_default();
1978                        }
1979                        __FieldTag::__read_time => {
1980                            if !fields.insert(__FieldTag::__read_time) {
1981                                return std::result::Result::Err(A::Error::duplicate_field(
1982                                    "multiple values for read_time",
1983                                ));
1984                            }
1985                            result.read_time =
1986                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1987                        }
1988                        __FieldTag::Unknown(key) => {
1989                            let value = map.next_value::<serde_json::Value>()?;
1990                            result._unknown_fields.insert(key, value);
1991                        }
1992                    }
1993                }
1994                std::result::Result::Ok(result)
1995            }
1996        }
1997        deserializer.deserialize_any(Visitor)
1998    }
1999}
2000
2001#[doc(hidden)]
2002impl serde::ser::Serialize for GetConnectSettingsRequest {
2003    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2004    where
2005        S: serde::ser::Serializer,
2006    {
2007        use serde::ser::SerializeMap;
2008        #[allow(unused_imports)]
2009        use std::option::Option::Some;
2010        let mut state = serializer.serialize_map(std::option::Option::None)?;
2011        if !self.instance.is_empty() {
2012            state.serialize_entry("instance", &self.instance)?;
2013        }
2014        if !self.project.is_empty() {
2015            state.serialize_entry("project", &self.project)?;
2016        }
2017        if self.read_time.is_some() {
2018            state.serialize_entry("readTime", &self.read_time)?;
2019        }
2020        if !self._unknown_fields.is_empty() {
2021            for (key, value) in self._unknown_fields.iter() {
2022                state.serialize_entry(key, &value)?;
2023            }
2024        }
2025        state.end()
2026    }
2027}
2028
2029impl std::fmt::Debug for GetConnectSettingsRequest {
2030    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2031        let mut debug_struct = f.debug_struct("GetConnectSettingsRequest");
2032        debug_struct.field("instance", &self.instance);
2033        debug_struct.field("project", &self.project);
2034        debug_struct.field("read_time", &self.read_time);
2035        if !self._unknown_fields.is_empty() {
2036            debug_struct.field("_unknown_fields", &self._unknown_fields);
2037        }
2038        debug_struct.finish()
2039    }
2040}
2041
2042/// Connect settings retrieval response.
2043#[derive(Clone, Default, PartialEq)]
2044#[non_exhaustive]
2045pub struct ConnectSettings {
2046    /// This is always `sql#connectSettings`.
2047    pub kind: std::string::String,
2048
2049    /// SSL configuration.
2050    pub server_ca_cert: std::option::Option<crate::model::SslCert>,
2051
2052    /// The assigned IP addresses for the instance.
2053    pub ip_addresses: std::vec::Vec<crate::model::IpMapping>,
2054
2055    /// The cloud region for the instance. For example, `us-central1`,
2056    /// `europe-west1`. The region cannot be changed after instance creation.
2057    pub region: std::string::String,
2058
2059    /// The database engine type and version. The `databaseVersion`
2060    /// field cannot be changed after instance creation.
2061    /// MySQL instances: `MYSQL_8_0`, `MYSQL_5_7` (default),
2062    /// or `MYSQL_5_6`.
2063    /// PostgreSQL instances: `POSTGRES_9_6`, `POSTGRES_10`,
2064    /// `POSTGRES_11`, `POSTGRES_12` (default), `POSTGRES_13`, or `POSTGRES_14`.
2065    /// SQL Server instances: `SQLSERVER_2017_STANDARD` (default),
2066    /// `SQLSERVER_2017_ENTERPRISE`, `SQLSERVER_2017_EXPRESS`,
2067    /// `SQLSERVER_2017_WEB`, `SQLSERVER_2019_STANDARD`,
2068    /// `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`, or
2069    /// `SQLSERVER_2019_WEB`.
2070    pub database_version: crate::model::SqlDatabaseVersion,
2071
2072    /// `SECOND_GEN`: Cloud SQL database instance.
2073    /// `EXTERNAL`: A database server that is not managed by Google.
2074    /// This property is read-only; use the `tier` property in the `settings`
2075    /// object to determine the database type.
2076    pub backend_type: crate::model::SqlBackendType,
2077
2078    /// Whether PSC connectivity is enabled for this instance.
2079    pub psc_enabled: bool,
2080
2081    /// The dns name of the instance.
2082    pub dns_name: std::string::String,
2083
2084    /// Specify what type of CA is used for the server certificate.
2085    pub server_ca_mode: crate::model::connect_settings::CaMode,
2086
2087    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2088}
2089
2090impl ConnectSettings {
2091    pub fn new() -> Self {
2092        std::default::Default::default()
2093    }
2094
2095    /// Sets the value of [kind][crate::model::ConnectSettings::kind].
2096    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2097        self.kind = v.into();
2098        self
2099    }
2100
2101    /// Sets the value of [server_ca_cert][crate::model::ConnectSettings::server_ca_cert].
2102    pub fn set_server_ca_cert<T>(mut self, v: T) -> Self
2103    where
2104        T: std::convert::Into<crate::model::SslCert>,
2105    {
2106        self.server_ca_cert = std::option::Option::Some(v.into());
2107        self
2108    }
2109
2110    /// Sets or clears the value of [server_ca_cert][crate::model::ConnectSettings::server_ca_cert].
2111    pub fn set_or_clear_server_ca_cert<T>(mut self, v: std::option::Option<T>) -> Self
2112    where
2113        T: std::convert::Into<crate::model::SslCert>,
2114    {
2115        self.server_ca_cert = v.map(|x| x.into());
2116        self
2117    }
2118
2119    /// Sets the value of [ip_addresses][crate::model::ConnectSettings::ip_addresses].
2120    pub fn set_ip_addresses<T, V>(mut self, v: T) -> Self
2121    where
2122        T: std::iter::IntoIterator<Item = V>,
2123        V: std::convert::Into<crate::model::IpMapping>,
2124    {
2125        use std::iter::Iterator;
2126        self.ip_addresses = v.into_iter().map(|i| i.into()).collect();
2127        self
2128    }
2129
2130    /// Sets the value of [region][crate::model::ConnectSettings::region].
2131    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2132        self.region = v.into();
2133        self
2134    }
2135
2136    /// Sets the value of [database_version][crate::model::ConnectSettings::database_version].
2137    pub fn set_database_version<T: std::convert::Into<crate::model::SqlDatabaseVersion>>(
2138        mut self,
2139        v: T,
2140    ) -> Self {
2141        self.database_version = v.into();
2142        self
2143    }
2144
2145    /// Sets the value of [backend_type][crate::model::ConnectSettings::backend_type].
2146    pub fn set_backend_type<T: std::convert::Into<crate::model::SqlBackendType>>(
2147        mut self,
2148        v: T,
2149    ) -> Self {
2150        self.backend_type = v.into();
2151        self
2152    }
2153
2154    /// Sets the value of [psc_enabled][crate::model::ConnectSettings::psc_enabled].
2155    pub fn set_psc_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2156        self.psc_enabled = v.into();
2157        self
2158    }
2159
2160    /// Sets the value of [dns_name][crate::model::ConnectSettings::dns_name].
2161    pub fn set_dns_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2162        self.dns_name = v.into();
2163        self
2164    }
2165
2166    /// Sets the value of [server_ca_mode][crate::model::ConnectSettings::server_ca_mode].
2167    pub fn set_server_ca_mode<T: std::convert::Into<crate::model::connect_settings::CaMode>>(
2168        mut self,
2169        v: T,
2170    ) -> Self {
2171        self.server_ca_mode = v.into();
2172        self
2173    }
2174}
2175
2176impl wkt::message::Message for ConnectSettings {
2177    fn typename() -> &'static str {
2178        "type.googleapis.com/google.cloud.sql.v1.ConnectSettings"
2179    }
2180}
2181
2182#[doc(hidden)]
2183impl<'de> serde::de::Deserialize<'de> for ConnectSettings {
2184    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2185    where
2186        D: serde::Deserializer<'de>,
2187    {
2188        #[allow(non_camel_case_types)]
2189        #[doc(hidden)]
2190        #[derive(PartialEq, Eq, Hash)]
2191        enum __FieldTag {
2192            __kind,
2193            __server_ca_cert,
2194            __ip_addresses,
2195            __region,
2196            __database_version,
2197            __backend_type,
2198            __psc_enabled,
2199            __dns_name,
2200            __server_ca_mode,
2201            Unknown(std::string::String),
2202        }
2203        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2204            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2205            where
2206                D: serde::Deserializer<'de>,
2207            {
2208                struct Visitor;
2209                impl<'de> serde::de::Visitor<'de> for Visitor {
2210                    type Value = __FieldTag;
2211                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2212                        formatter.write_str("a field name for ConnectSettings")
2213                    }
2214                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2215                    where
2216                        E: serde::de::Error,
2217                    {
2218                        use std::result::Result::Ok;
2219                        use std::string::ToString;
2220                        match value {
2221                            "kind" => Ok(__FieldTag::__kind),
2222                            "serverCaCert" => Ok(__FieldTag::__server_ca_cert),
2223                            "server_ca_cert" => Ok(__FieldTag::__server_ca_cert),
2224                            "ipAddresses" => Ok(__FieldTag::__ip_addresses),
2225                            "ip_addresses" => Ok(__FieldTag::__ip_addresses),
2226                            "region" => Ok(__FieldTag::__region),
2227                            "databaseVersion" => Ok(__FieldTag::__database_version),
2228                            "database_version" => Ok(__FieldTag::__database_version),
2229                            "backendType" => Ok(__FieldTag::__backend_type),
2230                            "backend_type" => Ok(__FieldTag::__backend_type),
2231                            "pscEnabled" => Ok(__FieldTag::__psc_enabled),
2232                            "psc_enabled" => Ok(__FieldTag::__psc_enabled),
2233                            "dnsName" => Ok(__FieldTag::__dns_name),
2234                            "dns_name" => Ok(__FieldTag::__dns_name),
2235                            "serverCaMode" => Ok(__FieldTag::__server_ca_mode),
2236                            "server_ca_mode" => Ok(__FieldTag::__server_ca_mode),
2237                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2238                        }
2239                    }
2240                }
2241                deserializer.deserialize_identifier(Visitor)
2242            }
2243        }
2244        struct Visitor;
2245        impl<'de> serde::de::Visitor<'de> for Visitor {
2246            type Value = ConnectSettings;
2247            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2248                formatter.write_str("struct ConnectSettings")
2249            }
2250            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2251            where
2252                A: serde::de::MapAccess<'de>,
2253            {
2254                #[allow(unused_imports)]
2255                use serde::de::Error;
2256                use std::option::Option::Some;
2257                let mut fields = std::collections::HashSet::new();
2258                let mut result = Self::Value::new();
2259                while let Some(tag) = map.next_key::<__FieldTag>()? {
2260                    #[allow(clippy::match_single_binding)]
2261                    match tag {
2262                        __FieldTag::__kind => {
2263                            if !fields.insert(__FieldTag::__kind) {
2264                                return std::result::Result::Err(A::Error::duplicate_field(
2265                                    "multiple values for kind",
2266                                ));
2267                            }
2268                            result.kind = map
2269                                .next_value::<std::option::Option<std::string::String>>()?
2270                                .unwrap_or_default();
2271                        }
2272                        __FieldTag::__server_ca_cert => {
2273                            if !fields.insert(__FieldTag::__server_ca_cert) {
2274                                return std::result::Result::Err(A::Error::duplicate_field(
2275                                    "multiple values for server_ca_cert",
2276                                ));
2277                            }
2278                            result.server_ca_cert =
2279                                map.next_value::<std::option::Option<crate::model::SslCert>>()?;
2280                        }
2281                        __FieldTag::__ip_addresses => {
2282                            if !fields.insert(__FieldTag::__ip_addresses) {
2283                                return std::result::Result::Err(A::Error::duplicate_field(
2284                                    "multiple values for ip_addresses",
2285                                ));
2286                            }
2287                            result.ip_addresses = map.next_value::<std::option::Option<std::vec::Vec<crate::model::IpMapping>>>()?.unwrap_or_default();
2288                        }
2289                        __FieldTag::__region => {
2290                            if !fields.insert(__FieldTag::__region) {
2291                                return std::result::Result::Err(A::Error::duplicate_field(
2292                                    "multiple values for region",
2293                                ));
2294                            }
2295                            result.region = map
2296                                .next_value::<std::option::Option<std::string::String>>()?
2297                                .unwrap_or_default();
2298                        }
2299                        __FieldTag::__database_version => {
2300                            if !fields.insert(__FieldTag::__database_version) {
2301                                return std::result::Result::Err(A::Error::duplicate_field(
2302                                    "multiple values for database_version",
2303                                ));
2304                            }
2305                            result.database_version = map.next_value::<std::option::Option<crate::model::SqlDatabaseVersion>>()?.unwrap_or_default();
2306                        }
2307                        __FieldTag::__backend_type => {
2308                            if !fields.insert(__FieldTag::__backend_type) {
2309                                return std::result::Result::Err(A::Error::duplicate_field(
2310                                    "multiple values for backend_type",
2311                                ));
2312                            }
2313                            result.backend_type = map
2314                                .next_value::<std::option::Option<crate::model::SqlBackendType>>()?
2315                                .unwrap_or_default();
2316                        }
2317                        __FieldTag::__psc_enabled => {
2318                            if !fields.insert(__FieldTag::__psc_enabled) {
2319                                return std::result::Result::Err(A::Error::duplicate_field(
2320                                    "multiple values for psc_enabled",
2321                                ));
2322                            }
2323                            result.psc_enabled = map
2324                                .next_value::<std::option::Option<bool>>()?
2325                                .unwrap_or_default();
2326                        }
2327                        __FieldTag::__dns_name => {
2328                            if !fields.insert(__FieldTag::__dns_name) {
2329                                return std::result::Result::Err(A::Error::duplicate_field(
2330                                    "multiple values for dns_name",
2331                                ));
2332                            }
2333                            result.dns_name = map
2334                                .next_value::<std::option::Option<std::string::String>>()?
2335                                .unwrap_or_default();
2336                        }
2337                        __FieldTag::__server_ca_mode => {
2338                            if !fields.insert(__FieldTag::__server_ca_mode) {
2339                                return std::result::Result::Err(A::Error::duplicate_field(
2340                                    "multiple values for server_ca_mode",
2341                                ));
2342                            }
2343                            result.server_ca_mode = map.next_value::<std::option::Option<crate::model::connect_settings::CaMode>>()?.unwrap_or_default();
2344                        }
2345                        __FieldTag::Unknown(key) => {
2346                            let value = map.next_value::<serde_json::Value>()?;
2347                            result._unknown_fields.insert(key, value);
2348                        }
2349                    }
2350                }
2351                std::result::Result::Ok(result)
2352            }
2353        }
2354        deserializer.deserialize_any(Visitor)
2355    }
2356}
2357
2358#[doc(hidden)]
2359impl serde::ser::Serialize for ConnectSettings {
2360    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2361    where
2362        S: serde::ser::Serializer,
2363    {
2364        use serde::ser::SerializeMap;
2365        #[allow(unused_imports)]
2366        use std::option::Option::Some;
2367        let mut state = serializer.serialize_map(std::option::Option::None)?;
2368        if !self.kind.is_empty() {
2369            state.serialize_entry("kind", &self.kind)?;
2370        }
2371        if self.server_ca_cert.is_some() {
2372            state.serialize_entry("serverCaCert", &self.server_ca_cert)?;
2373        }
2374        if !self.ip_addresses.is_empty() {
2375            state.serialize_entry("ipAddresses", &self.ip_addresses)?;
2376        }
2377        if !self.region.is_empty() {
2378            state.serialize_entry("region", &self.region)?;
2379        }
2380        if !wkt::internal::is_default(&self.database_version) {
2381            state.serialize_entry("databaseVersion", &self.database_version)?;
2382        }
2383        if !wkt::internal::is_default(&self.backend_type) {
2384            state.serialize_entry("backendType", &self.backend_type)?;
2385        }
2386        if !wkt::internal::is_default(&self.psc_enabled) {
2387            state.serialize_entry("pscEnabled", &self.psc_enabled)?;
2388        }
2389        if !self.dns_name.is_empty() {
2390            state.serialize_entry("dnsName", &self.dns_name)?;
2391        }
2392        if !wkt::internal::is_default(&self.server_ca_mode) {
2393            state.serialize_entry("serverCaMode", &self.server_ca_mode)?;
2394        }
2395        if !self._unknown_fields.is_empty() {
2396            for (key, value) in self._unknown_fields.iter() {
2397                state.serialize_entry(key, &value)?;
2398            }
2399        }
2400        state.end()
2401    }
2402}
2403
2404impl std::fmt::Debug for ConnectSettings {
2405    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2406        let mut debug_struct = f.debug_struct("ConnectSettings");
2407        debug_struct.field("kind", &self.kind);
2408        debug_struct.field("server_ca_cert", &self.server_ca_cert);
2409        debug_struct.field("ip_addresses", &self.ip_addresses);
2410        debug_struct.field("region", &self.region);
2411        debug_struct.field("database_version", &self.database_version);
2412        debug_struct.field("backend_type", &self.backend_type);
2413        debug_struct.field("psc_enabled", &self.psc_enabled);
2414        debug_struct.field("dns_name", &self.dns_name);
2415        debug_struct.field("server_ca_mode", &self.server_ca_mode);
2416        if !self._unknown_fields.is_empty() {
2417            debug_struct.field("_unknown_fields", &self._unknown_fields);
2418        }
2419        debug_struct.finish()
2420    }
2421}
2422
2423/// Defines additional types related to [ConnectSettings].
2424pub mod connect_settings {
2425    #[allow(unused_imports)]
2426    use super::*;
2427
2428    /// Various Certificate Authority (CA) modes for certificate signing.
2429    ///
2430    /// # Working with unknown values
2431    ///
2432    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2433    /// additional enum variants at any time. Adding new variants is not considered
2434    /// a breaking change. Applications should write their code in anticipation of:
2435    ///
2436    /// - New values appearing in future releases of the client library, **and**
2437    /// - New values received dynamically, without application changes.
2438    ///
2439    /// Please consult the [Working with enums] section in the user guide for some
2440    /// guidelines.
2441    ///
2442    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2443    #[derive(Clone, Debug, PartialEq)]
2444    #[non_exhaustive]
2445    pub enum CaMode {
2446        /// CA mode is unknown.
2447        Unspecified,
2448        /// Google-managed self-signed internal CA.
2449        GoogleManagedInternalCa,
2450        /// Google-managed regional CA part of root CA hierarchy hosted on Google
2451        /// Cloud's Certificate Authority Service (CAS).
2452        GoogleManagedCasCa,
2453        /// If set, the enum was initialized with an unknown value.
2454        ///
2455        /// Applications can examine the value using [CaMode::value] or
2456        /// [CaMode::name].
2457        UnknownValue(ca_mode::UnknownValue),
2458    }
2459
2460    #[doc(hidden)]
2461    pub mod ca_mode {
2462        #[allow(unused_imports)]
2463        use super::*;
2464        #[derive(Clone, Debug, PartialEq)]
2465        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2466    }
2467
2468    impl CaMode {
2469        /// Gets the enum value.
2470        ///
2471        /// Returns `None` if the enum contains an unknown value deserialized from
2472        /// the string representation of enums.
2473        pub fn value(&self) -> std::option::Option<i32> {
2474            match self {
2475                Self::Unspecified => std::option::Option::Some(0),
2476                Self::GoogleManagedInternalCa => std::option::Option::Some(1),
2477                Self::GoogleManagedCasCa => std::option::Option::Some(2),
2478                Self::UnknownValue(u) => u.0.value(),
2479            }
2480        }
2481
2482        /// Gets the enum value as a string.
2483        ///
2484        /// Returns `None` if the enum contains an unknown value deserialized from
2485        /// the integer representation of enums.
2486        pub fn name(&self) -> std::option::Option<&str> {
2487            match self {
2488                Self::Unspecified => std::option::Option::Some("CA_MODE_UNSPECIFIED"),
2489                Self::GoogleManagedInternalCa => {
2490                    std::option::Option::Some("GOOGLE_MANAGED_INTERNAL_CA")
2491                }
2492                Self::GoogleManagedCasCa => std::option::Option::Some("GOOGLE_MANAGED_CAS_CA"),
2493                Self::UnknownValue(u) => u.0.name(),
2494            }
2495        }
2496    }
2497
2498    impl std::default::Default for CaMode {
2499        fn default() -> Self {
2500            use std::convert::From;
2501            Self::from(0)
2502        }
2503    }
2504
2505    impl std::fmt::Display for CaMode {
2506        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2507            wkt::internal::display_enum(f, self.name(), self.value())
2508        }
2509    }
2510
2511    impl std::convert::From<i32> for CaMode {
2512        fn from(value: i32) -> Self {
2513            match value {
2514                0 => Self::Unspecified,
2515                1 => Self::GoogleManagedInternalCa,
2516                2 => Self::GoogleManagedCasCa,
2517                _ => Self::UnknownValue(ca_mode::UnknownValue(
2518                    wkt::internal::UnknownEnumValue::Integer(value),
2519                )),
2520            }
2521        }
2522    }
2523
2524    impl std::convert::From<&str> for CaMode {
2525        fn from(value: &str) -> Self {
2526            use std::string::ToString;
2527            match value {
2528                "CA_MODE_UNSPECIFIED" => Self::Unspecified,
2529                "GOOGLE_MANAGED_INTERNAL_CA" => Self::GoogleManagedInternalCa,
2530                "GOOGLE_MANAGED_CAS_CA" => Self::GoogleManagedCasCa,
2531                _ => Self::UnknownValue(ca_mode::UnknownValue(
2532                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2533                )),
2534            }
2535        }
2536    }
2537
2538    impl serde::ser::Serialize for CaMode {
2539        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2540        where
2541            S: serde::Serializer,
2542        {
2543            match self {
2544                Self::Unspecified => serializer.serialize_i32(0),
2545                Self::GoogleManagedInternalCa => serializer.serialize_i32(1),
2546                Self::GoogleManagedCasCa => serializer.serialize_i32(2),
2547                Self::UnknownValue(u) => u.0.serialize(serializer),
2548            }
2549        }
2550    }
2551
2552    impl<'de> serde::de::Deserialize<'de> for CaMode {
2553        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2554        where
2555            D: serde::Deserializer<'de>,
2556        {
2557            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CaMode>::new(
2558                ".google.cloud.sql.v1.ConnectSettings.CaMode",
2559            ))
2560        }
2561    }
2562}
2563
2564/// Ephemeral certificate creation request.
2565#[derive(Clone, Default, PartialEq)]
2566#[non_exhaustive]
2567pub struct GenerateEphemeralCertRequest {
2568    /// Cloud SQL instance ID. This does not include the project ID.
2569    pub instance: std::string::String,
2570
2571    /// Project ID of the project that contains the instance.
2572    pub project: std::string::String,
2573
2574    /// PEM encoded public key to include in the signed certificate.
2575    pub public_key: std::string::String,
2576
2577    /// Optional. Access token to include in the signed certificate.
2578    pub access_token: std::string::String,
2579
2580    /// Optional. Optional snapshot read timestamp to trade freshness for
2581    /// performance.
2582    pub read_time: std::option::Option<wkt::Timestamp>,
2583
2584    /// Optional. If set, it will contain the cert valid duration.
2585    pub valid_duration: std::option::Option<wkt::Duration>,
2586
2587    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2588}
2589
2590impl GenerateEphemeralCertRequest {
2591    pub fn new() -> Self {
2592        std::default::Default::default()
2593    }
2594
2595    /// Sets the value of [instance][crate::model::GenerateEphemeralCertRequest::instance].
2596    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2597        self.instance = v.into();
2598        self
2599    }
2600
2601    /// Sets the value of [project][crate::model::GenerateEphemeralCertRequest::project].
2602    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2603        self.project = v.into();
2604        self
2605    }
2606
2607    /// Sets the value of [public_key][crate::model::GenerateEphemeralCertRequest::public_key].
2608    pub fn set_public_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2609        self.public_key = v.into();
2610        self
2611    }
2612
2613    /// Sets the value of [access_token][crate::model::GenerateEphemeralCertRequest::access_token].
2614    pub fn set_access_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2615        self.access_token = v.into();
2616        self
2617    }
2618
2619    /// Sets the value of [read_time][crate::model::GenerateEphemeralCertRequest::read_time].
2620    pub fn set_read_time<T>(mut self, v: T) -> Self
2621    where
2622        T: std::convert::Into<wkt::Timestamp>,
2623    {
2624        self.read_time = std::option::Option::Some(v.into());
2625        self
2626    }
2627
2628    /// Sets or clears the value of [read_time][crate::model::GenerateEphemeralCertRequest::read_time].
2629    pub fn set_or_clear_read_time<T>(mut self, v: std::option::Option<T>) -> Self
2630    where
2631        T: std::convert::Into<wkt::Timestamp>,
2632    {
2633        self.read_time = v.map(|x| x.into());
2634        self
2635    }
2636
2637    /// Sets the value of [valid_duration][crate::model::GenerateEphemeralCertRequest::valid_duration].
2638    pub fn set_valid_duration<T>(mut self, v: T) -> Self
2639    where
2640        T: std::convert::Into<wkt::Duration>,
2641    {
2642        self.valid_duration = std::option::Option::Some(v.into());
2643        self
2644    }
2645
2646    /// Sets or clears the value of [valid_duration][crate::model::GenerateEphemeralCertRequest::valid_duration].
2647    pub fn set_or_clear_valid_duration<T>(mut self, v: std::option::Option<T>) -> Self
2648    where
2649        T: std::convert::Into<wkt::Duration>,
2650    {
2651        self.valid_duration = v.map(|x| x.into());
2652        self
2653    }
2654}
2655
2656impl wkt::message::Message for GenerateEphemeralCertRequest {
2657    fn typename() -> &'static str {
2658        "type.googleapis.com/google.cloud.sql.v1.GenerateEphemeralCertRequest"
2659    }
2660}
2661
2662#[doc(hidden)]
2663impl<'de> serde::de::Deserialize<'de> for GenerateEphemeralCertRequest {
2664    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2665    where
2666        D: serde::Deserializer<'de>,
2667    {
2668        #[allow(non_camel_case_types)]
2669        #[doc(hidden)]
2670        #[derive(PartialEq, Eq, Hash)]
2671        enum __FieldTag {
2672            __instance,
2673            __project,
2674            __public_key,
2675            __access_token,
2676            __read_time,
2677            __valid_duration,
2678            Unknown(std::string::String),
2679        }
2680        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2681            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2682            where
2683                D: serde::Deserializer<'de>,
2684            {
2685                struct Visitor;
2686                impl<'de> serde::de::Visitor<'de> for Visitor {
2687                    type Value = __FieldTag;
2688                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2689                        formatter.write_str("a field name for GenerateEphemeralCertRequest")
2690                    }
2691                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2692                    where
2693                        E: serde::de::Error,
2694                    {
2695                        use std::result::Result::Ok;
2696                        use std::string::ToString;
2697                        match value {
2698                            "instance" => Ok(__FieldTag::__instance),
2699                            "project" => Ok(__FieldTag::__project),
2700                            "public_key" => Ok(__FieldTag::__public_key),
2701                            "access_token" => Ok(__FieldTag::__access_token),
2702                            "readTime" => Ok(__FieldTag::__read_time),
2703                            "read_time" => Ok(__FieldTag::__read_time),
2704                            "validDuration" => Ok(__FieldTag::__valid_duration),
2705                            "valid_duration" => Ok(__FieldTag::__valid_duration),
2706                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2707                        }
2708                    }
2709                }
2710                deserializer.deserialize_identifier(Visitor)
2711            }
2712        }
2713        struct Visitor;
2714        impl<'de> serde::de::Visitor<'de> for Visitor {
2715            type Value = GenerateEphemeralCertRequest;
2716            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2717                formatter.write_str("struct GenerateEphemeralCertRequest")
2718            }
2719            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2720            where
2721                A: serde::de::MapAccess<'de>,
2722            {
2723                #[allow(unused_imports)]
2724                use serde::de::Error;
2725                use std::option::Option::Some;
2726                let mut fields = std::collections::HashSet::new();
2727                let mut result = Self::Value::new();
2728                while let Some(tag) = map.next_key::<__FieldTag>()? {
2729                    #[allow(clippy::match_single_binding)]
2730                    match tag {
2731                        __FieldTag::__instance => {
2732                            if !fields.insert(__FieldTag::__instance) {
2733                                return std::result::Result::Err(A::Error::duplicate_field(
2734                                    "multiple values for instance",
2735                                ));
2736                            }
2737                            result.instance = map
2738                                .next_value::<std::option::Option<std::string::String>>()?
2739                                .unwrap_or_default();
2740                        }
2741                        __FieldTag::__project => {
2742                            if !fields.insert(__FieldTag::__project) {
2743                                return std::result::Result::Err(A::Error::duplicate_field(
2744                                    "multiple values for project",
2745                                ));
2746                            }
2747                            result.project = map
2748                                .next_value::<std::option::Option<std::string::String>>()?
2749                                .unwrap_or_default();
2750                        }
2751                        __FieldTag::__public_key => {
2752                            if !fields.insert(__FieldTag::__public_key) {
2753                                return std::result::Result::Err(A::Error::duplicate_field(
2754                                    "multiple values for public_key",
2755                                ));
2756                            }
2757                            result.public_key = map
2758                                .next_value::<std::option::Option<std::string::String>>()?
2759                                .unwrap_or_default();
2760                        }
2761                        __FieldTag::__access_token => {
2762                            if !fields.insert(__FieldTag::__access_token) {
2763                                return std::result::Result::Err(A::Error::duplicate_field(
2764                                    "multiple values for access_token",
2765                                ));
2766                            }
2767                            result.access_token = map
2768                                .next_value::<std::option::Option<std::string::String>>()?
2769                                .unwrap_or_default();
2770                        }
2771                        __FieldTag::__read_time => {
2772                            if !fields.insert(__FieldTag::__read_time) {
2773                                return std::result::Result::Err(A::Error::duplicate_field(
2774                                    "multiple values for read_time",
2775                                ));
2776                            }
2777                            result.read_time =
2778                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
2779                        }
2780                        __FieldTag::__valid_duration => {
2781                            if !fields.insert(__FieldTag::__valid_duration) {
2782                                return std::result::Result::Err(A::Error::duplicate_field(
2783                                    "multiple values for valid_duration",
2784                                ));
2785                            }
2786                            result.valid_duration =
2787                                map.next_value::<std::option::Option<wkt::Duration>>()?;
2788                        }
2789                        __FieldTag::Unknown(key) => {
2790                            let value = map.next_value::<serde_json::Value>()?;
2791                            result._unknown_fields.insert(key, value);
2792                        }
2793                    }
2794                }
2795                std::result::Result::Ok(result)
2796            }
2797        }
2798        deserializer.deserialize_any(Visitor)
2799    }
2800}
2801
2802#[doc(hidden)]
2803impl serde::ser::Serialize for GenerateEphemeralCertRequest {
2804    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2805    where
2806        S: serde::ser::Serializer,
2807    {
2808        use serde::ser::SerializeMap;
2809        #[allow(unused_imports)]
2810        use std::option::Option::Some;
2811        let mut state = serializer.serialize_map(std::option::Option::None)?;
2812        if !self.instance.is_empty() {
2813            state.serialize_entry("instance", &self.instance)?;
2814        }
2815        if !self.project.is_empty() {
2816            state.serialize_entry("project", &self.project)?;
2817        }
2818        if !self.public_key.is_empty() {
2819            state.serialize_entry("public_key", &self.public_key)?;
2820        }
2821        if !self.access_token.is_empty() {
2822            state.serialize_entry("access_token", &self.access_token)?;
2823        }
2824        if self.read_time.is_some() {
2825            state.serialize_entry("readTime", &self.read_time)?;
2826        }
2827        if self.valid_duration.is_some() {
2828            state.serialize_entry("validDuration", &self.valid_duration)?;
2829        }
2830        if !self._unknown_fields.is_empty() {
2831            for (key, value) in self._unknown_fields.iter() {
2832                state.serialize_entry(key, &value)?;
2833            }
2834        }
2835        state.end()
2836    }
2837}
2838
2839impl std::fmt::Debug for GenerateEphemeralCertRequest {
2840    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2841        let mut debug_struct = f.debug_struct("GenerateEphemeralCertRequest");
2842        debug_struct.field("instance", &self.instance);
2843        debug_struct.field("project", &self.project);
2844        debug_struct.field("public_key", &self.public_key);
2845        debug_struct.field("access_token", &self.access_token);
2846        debug_struct.field("read_time", &self.read_time);
2847        debug_struct.field("valid_duration", &self.valid_duration);
2848        if !self._unknown_fields.is_empty() {
2849            debug_struct.field("_unknown_fields", &self._unknown_fields);
2850        }
2851        debug_struct.finish()
2852    }
2853}
2854
2855/// Ephemeral certificate creation request.
2856#[derive(Clone, Default, PartialEq)]
2857#[non_exhaustive]
2858pub struct GenerateEphemeralCertResponse {
2859    /// Generated cert
2860    pub ephemeral_cert: std::option::Option<crate::model::SslCert>,
2861
2862    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2863}
2864
2865impl GenerateEphemeralCertResponse {
2866    pub fn new() -> Self {
2867        std::default::Default::default()
2868    }
2869
2870    /// Sets the value of [ephemeral_cert][crate::model::GenerateEphemeralCertResponse::ephemeral_cert].
2871    pub fn set_ephemeral_cert<T>(mut self, v: T) -> Self
2872    where
2873        T: std::convert::Into<crate::model::SslCert>,
2874    {
2875        self.ephemeral_cert = std::option::Option::Some(v.into());
2876        self
2877    }
2878
2879    /// Sets or clears the value of [ephemeral_cert][crate::model::GenerateEphemeralCertResponse::ephemeral_cert].
2880    pub fn set_or_clear_ephemeral_cert<T>(mut self, v: std::option::Option<T>) -> Self
2881    where
2882        T: std::convert::Into<crate::model::SslCert>,
2883    {
2884        self.ephemeral_cert = v.map(|x| x.into());
2885        self
2886    }
2887}
2888
2889impl wkt::message::Message for GenerateEphemeralCertResponse {
2890    fn typename() -> &'static str {
2891        "type.googleapis.com/google.cloud.sql.v1.GenerateEphemeralCertResponse"
2892    }
2893}
2894
2895#[doc(hidden)]
2896impl<'de> serde::de::Deserialize<'de> for GenerateEphemeralCertResponse {
2897    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2898    where
2899        D: serde::Deserializer<'de>,
2900    {
2901        #[allow(non_camel_case_types)]
2902        #[doc(hidden)]
2903        #[derive(PartialEq, Eq, Hash)]
2904        enum __FieldTag {
2905            __ephemeral_cert,
2906            Unknown(std::string::String),
2907        }
2908        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2909            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2910            where
2911                D: serde::Deserializer<'de>,
2912            {
2913                struct Visitor;
2914                impl<'de> serde::de::Visitor<'de> for Visitor {
2915                    type Value = __FieldTag;
2916                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2917                        formatter.write_str("a field name for GenerateEphemeralCertResponse")
2918                    }
2919                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2920                    where
2921                        E: serde::de::Error,
2922                    {
2923                        use std::result::Result::Ok;
2924                        use std::string::ToString;
2925                        match value {
2926                            "ephemeralCert" => Ok(__FieldTag::__ephemeral_cert),
2927                            "ephemeral_cert" => Ok(__FieldTag::__ephemeral_cert),
2928                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2929                        }
2930                    }
2931                }
2932                deserializer.deserialize_identifier(Visitor)
2933            }
2934        }
2935        struct Visitor;
2936        impl<'de> serde::de::Visitor<'de> for Visitor {
2937            type Value = GenerateEphemeralCertResponse;
2938            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2939                formatter.write_str("struct GenerateEphemeralCertResponse")
2940            }
2941            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2942            where
2943                A: serde::de::MapAccess<'de>,
2944            {
2945                #[allow(unused_imports)]
2946                use serde::de::Error;
2947                use std::option::Option::Some;
2948                let mut fields = std::collections::HashSet::new();
2949                let mut result = Self::Value::new();
2950                while let Some(tag) = map.next_key::<__FieldTag>()? {
2951                    #[allow(clippy::match_single_binding)]
2952                    match tag {
2953                        __FieldTag::__ephemeral_cert => {
2954                            if !fields.insert(__FieldTag::__ephemeral_cert) {
2955                                return std::result::Result::Err(A::Error::duplicate_field(
2956                                    "multiple values for ephemeral_cert",
2957                                ));
2958                            }
2959                            result.ephemeral_cert =
2960                                map.next_value::<std::option::Option<crate::model::SslCert>>()?;
2961                        }
2962                        __FieldTag::Unknown(key) => {
2963                            let value = map.next_value::<serde_json::Value>()?;
2964                            result._unknown_fields.insert(key, value);
2965                        }
2966                    }
2967                }
2968                std::result::Result::Ok(result)
2969            }
2970        }
2971        deserializer.deserialize_any(Visitor)
2972    }
2973}
2974
2975#[doc(hidden)]
2976impl serde::ser::Serialize for GenerateEphemeralCertResponse {
2977    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2978    where
2979        S: serde::ser::Serializer,
2980    {
2981        use serde::ser::SerializeMap;
2982        #[allow(unused_imports)]
2983        use std::option::Option::Some;
2984        let mut state = serializer.serialize_map(std::option::Option::None)?;
2985        if self.ephemeral_cert.is_some() {
2986            state.serialize_entry("ephemeralCert", &self.ephemeral_cert)?;
2987        }
2988        if !self._unknown_fields.is_empty() {
2989            for (key, value) in self._unknown_fields.iter() {
2990                state.serialize_entry(key, &value)?;
2991            }
2992        }
2993        state.end()
2994    }
2995}
2996
2997impl std::fmt::Debug for GenerateEphemeralCertResponse {
2998    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2999        let mut debug_struct = f.debug_struct("GenerateEphemeralCertResponse");
3000        debug_struct.field("ephemeral_cert", &self.ephemeral_cert);
3001        if !self._unknown_fields.is_empty() {
3002            debug_struct.field("_unknown_fields", &self._unknown_fields);
3003        }
3004        debug_struct.finish()
3005    }
3006}
3007
3008/// Database delete request.
3009#[derive(Clone, Default, PartialEq)]
3010#[non_exhaustive]
3011pub struct SqlDatabasesDeleteRequest {
3012    /// Name of the database to be deleted in the instance.
3013    pub database: std::string::String,
3014
3015    /// Database instance ID. This does not include the project ID.
3016    pub instance: std::string::String,
3017
3018    /// Project ID of the project that contains the instance.
3019    pub project: std::string::String,
3020
3021    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3022}
3023
3024impl SqlDatabasesDeleteRequest {
3025    pub fn new() -> Self {
3026        std::default::Default::default()
3027    }
3028
3029    /// Sets the value of [database][crate::model::SqlDatabasesDeleteRequest::database].
3030    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3031        self.database = v.into();
3032        self
3033    }
3034
3035    /// Sets the value of [instance][crate::model::SqlDatabasesDeleteRequest::instance].
3036    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3037        self.instance = v.into();
3038        self
3039    }
3040
3041    /// Sets the value of [project][crate::model::SqlDatabasesDeleteRequest::project].
3042    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3043        self.project = v.into();
3044        self
3045    }
3046}
3047
3048impl wkt::message::Message for SqlDatabasesDeleteRequest {
3049    fn typename() -> &'static str {
3050        "type.googleapis.com/google.cloud.sql.v1.SqlDatabasesDeleteRequest"
3051    }
3052}
3053
3054#[doc(hidden)]
3055impl<'de> serde::de::Deserialize<'de> for SqlDatabasesDeleteRequest {
3056    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3057    where
3058        D: serde::Deserializer<'de>,
3059    {
3060        #[allow(non_camel_case_types)]
3061        #[doc(hidden)]
3062        #[derive(PartialEq, Eq, Hash)]
3063        enum __FieldTag {
3064            __database,
3065            __instance,
3066            __project,
3067            Unknown(std::string::String),
3068        }
3069        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3070            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3071            where
3072                D: serde::Deserializer<'de>,
3073            {
3074                struct Visitor;
3075                impl<'de> serde::de::Visitor<'de> for Visitor {
3076                    type Value = __FieldTag;
3077                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3078                        formatter.write_str("a field name for SqlDatabasesDeleteRequest")
3079                    }
3080                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3081                    where
3082                        E: serde::de::Error,
3083                    {
3084                        use std::result::Result::Ok;
3085                        use std::string::ToString;
3086                        match value {
3087                            "database" => Ok(__FieldTag::__database),
3088                            "instance" => Ok(__FieldTag::__instance),
3089                            "project" => Ok(__FieldTag::__project),
3090                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3091                        }
3092                    }
3093                }
3094                deserializer.deserialize_identifier(Visitor)
3095            }
3096        }
3097        struct Visitor;
3098        impl<'de> serde::de::Visitor<'de> for Visitor {
3099            type Value = SqlDatabasesDeleteRequest;
3100            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3101                formatter.write_str("struct SqlDatabasesDeleteRequest")
3102            }
3103            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3104            where
3105                A: serde::de::MapAccess<'de>,
3106            {
3107                #[allow(unused_imports)]
3108                use serde::de::Error;
3109                use std::option::Option::Some;
3110                let mut fields = std::collections::HashSet::new();
3111                let mut result = Self::Value::new();
3112                while let Some(tag) = map.next_key::<__FieldTag>()? {
3113                    #[allow(clippy::match_single_binding)]
3114                    match tag {
3115                        __FieldTag::__database => {
3116                            if !fields.insert(__FieldTag::__database) {
3117                                return std::result::Result::Err(A::Error::duplicate_field(
3118                                    "multiple values for database",
3119                                ));
3120                            }
3121                            result.database = map
3122                                .next_value::<std::option::Option<std::string::String>>()?
3123                                .unwrap_or_default();
3124                        }
3125                        __FieldTag::__instance => {
3126                            if !fields.insert(__FieldTag::__instance) {
3127                                return std::result::Result::Err(A::Error::duplicate_field(
3128                                    "multiple values for instance",
3129                                ));
3130                            }
3131                            result.instance = map
3132                                .next_value::<std::option::Option<std::string::String>>()?
3133                                .unwrap_or_default();
3134                        }
3135                        __FieldTag::__project => {
3136                            if !fields.insert(__FieldTag::__project) {
3137                                return std::result::Result::Err(A::Error::duplicate_field(
3138                                    "multiple values for project",
3139                                ));
3140                            }
3141                            result.project = map
3142                                .next_value::<std::option::Option<std::string::String>>()?
3143                                .unwrap_or_default();
3144                        }
3145                        __FieldTag::Unknown(key) => {
3146                            let value = map.next_value::<serde_json::Value>()?;
3147                            result._unknown_fields.insert(key, value);
3148                        }
3149                    }
3150                }
3151                std::result::Result::Ok(result)
3152            }
3153        }
3154        deserializer.deserialize_any(Visitor)
3155    }
3156}
3157
3158#[doc(hidden)]
3159impl serde::ser::Serialize for SqlDatabasesDeleteRequest {
3160    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3161    where
3162        S: serde::ser::Serializer,
3163    {
3164        use serde::ser::SerializeMap;
3165        #[allow(unused_imports)]
3166        use std::option::Option::Some;
3167        let mut state = serializer.serialize_map(std::option::Option::None)?;
3168        if !self.database.is_empty() {
3169            state.serialize_entry("database", &self.database)?;
3170        }
3171        if !self.instance.is_empty() {
3172            state.serialize_entry("instance", &self.instance)?;
3173        }
3174        if !self.project.is_empty() {
3175            state.serialize_entry("project", &self.project)?;
3176        }
3177        if !self._unknown_fields.is_empty() {
3178            for (key, value) in self._unknown_fields.iter() {
3179                state.serialize_entry(key, &value)?;
3180            }
3181        }
3182        state.end()
3183    }
3184}
3185
3186impl std::fmt::Debug for SqlDatabasesDeleteRequest {
3187    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3188        let mut debug_struct = f.debug_struct("SqlDatabasesDeleteRequest");
3189        debug_struct.field("database", &self.database);
3190        debug_struct.field("instance", &self.instance);
3191        debug_struct.field("project", &self.project);
3192        if !self._unknown_fields.is_empty() {
3193            debug_struct.field("_unknown_fields", &self._unknown_fields);
3194        }
3195        debug_struct.finish()
3196    }
3197}
3198
3199/// Database get request.
3200#[derive(Clone, Default, PartialEq)]
3201#[non_exhaustive]
3202pub struct SqlDatabasesGetRequest {
3203    /// Name of the database in the instance.
3204    pub database: std::string::String,
3205
3206    /// Database instance ID. This does not include the project ID.
3207    pub instance: std::string::String,
3208
3209    /// Project ID of the project that contains the instance.
3210    pub project: std::string::String,
3211
3212    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3213}
3214
3215impl SqlDatabasesGetRequest {
3216    pub fn new() -> Self {
3217        std::default::Default::default()
3218    }
3219
3220    /// Sets the value of [database][crate::model::SqlDatabasesGetRequest::database].
3221    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3222        self.database = v.into();
3223        self
3224    }
3225
3226    /// Sets the value of [instance][crate::model::SqlDatabasesGetRequest::instance].
3227    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3228        self.instance = v.into();
3229        self
3230    }
3231
3232    /// Sets the value of [project][crate::model::SqlDatabasesGetRequest::project].
3233    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3234        self.project = v.into();
3235        self
3236    }
3237}
3238
3239impl wkt::message::Message for SqlDatabasesGetRequest {
3240    fn typename() -> &'static str {
3241        "type.googleapis.com/google.cloud.sql.v1.SqlDatabasesGetRequest"
3242    }
3243}
3244
3245#[doc(hidden)]
3246impl<'de> serde::de::Deserialize<'de> for SqlDatabasesGetRequest {
3247    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3248    where
3249        D: serde::Deserializer<'de>,
3250    {
3251        #[allow(non_camel_case_types)]
3252        #[doc(hidden)]
3253        #[derive(PartialEq, Eq, Hash)]
3254        enum __FieldTag {
3255            __database,
3256            __instance,
3257            __project,
3258            Unknown(std::string::String),
3259        }
3260        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3261            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3262            where
3263                D: serde::Deserializer<'de>,
3264            {
3265                struct Visitor;
3266                impl<'de> serde::de::Visitor<'de> for Visitor {
3267                    type Value = __FieldTag;
3268                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3269                        formatter.write_str("a field name for SqlDatabasesGetRequest")
3270                    }
3271                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3272                    where
3273                        E: serde::de::Error,
3274                    {
3275                        use std::result::Result::Ok;
3276                        use std::string::ToString;
3277                        match value {
3278                            "database" => Ok(__FieldTag::__database),
3279                            "instance" => Ok(__FieldTag::__instance),
3280                            "project" => Ok(__FieldTag::__project),
3281                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3282                        }
3283                    }
3284                }
3285                deserializer.deserialize_identifier(Visitor)
3286            }
3287        }
3288        struct Visitor;
3289        impl<'de> serde::de::Visitor<'de> for Visitor {
3290            type Value = SqlDatabasesGetRequest;
3291            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3292                formatter.write_str("struct SqlDatabasesGetRequest")
3293            }
3294            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3295            where
3296                A: serde::de::MapAccess<'de>,
3297            {
3298                #[allow(unused_imports)]
3299                use serde::de::Error;
3300                use std::option::Option::Some;
3301                let mut fields = std::collections::HashSet::new();
3302                let mut result = Self::Value::new();
3303                while let Some(tag) = map.next_key::<__FieldTag>()? {
3304                    #[allow(clippy::match_single_binding)]
3305                    match tag {
3306                        __FieldTag::__database => {
3307                            if !fields.insert(__FieldTag::__database) {
3308                                return std::result::Result::Err(A::Error::duplicate_field(
3309                                    "multiple values for database",
3310                                ));
3311                            }
3312                            result.database = map
3313                                .next_value::<std::option::Option<std::string::String>>()?
3314                                .unwrap_or_default();
3315                        }
3316                        __FieldTag::__instance => {
3317                            if !fields.insert(__FieldTag::__instance) {
3318                                return std::result::Result::Err(A::Error::duplicate_field(
3319                                    "multiple values for instance",
3320                                ));
3321                            }
3322                            result.instance = map
3323                                .next_value::<std::option::Option<std::string::String>>()?
3324                                .unwrap_or_default();
3325                        }
3326                        __FieldTag::__project => {
3327                            if !fields.insert(__FieldTag::__project) {
3328                                return std::result::Result::Err(A::Error::duplicate_field(
3329                                    "multiple values for project",
3330                                ));
3331                            }
3332                            result.project = map
3333                                .next_value::<std::option::Option<std::string::String>>()?
3334                                .unwrap_or_default();
3335                        }
3336                        __FieldTag::Unknown(key) => {
3337                            let value = map.next_value::<serde_json::Value>()?;
3338                            result._unknown_fields.insert(key, value);
3339                        }
3340                    }
3341                }
3342                std::result::Result::Ok(result)
3343            }
3344        }
3345        deserializer.deserialize_any(Visitor)
3346    }
3347}
3348
3349#[doc(hidden)]
3350impl serde::ser::Serialize for SqlDatabasesGetRequest {
3351    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3352    where
3353        S: serde::ser::Serializer,
3354    {
3355        use serde::ser::SerializeMap;
3356        #[allow(unused_imports)]
3357        use std::option::Option::Some;
3358        let mut state = serializer.serialize_map(std::option::Option::None)?;
3359        if !self.database.is_empty() {
3360            state.serialize_entry("database", &self.database)?;
3361        }
3362        if !self.instance.is_empty() {
3363            state.serialize_entry("instance", &self.instance)?;
3364        }
3365        if !self.project.is_empty() {
3366            state.serialize_entry("project", &self.project)?;
3367        }
3368        if !self._unknown_fields.is_empty() {
3369            for (key, value) in self._unknown_fields.iter() {
3370                state.serialize_entry(key, &value)?;
3371            }
3372        }
3373        state.end()
3374    }
3375}
3376
3377impl std::fmt::Debug for SqlDatabasesGetRequest {
3378    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3379        let mut debug_struct = f.debug_struct("SqlDatabasesGetRequest");
3380        debug_struct.field("database", &self.database);
3381        debug_struct.field("instance", &self.instance);
3382        debug_struct.field("project", &self.project);
3383        if !self._unknown_fields.is_empty() {
3384            debug_struct.field("_unknown_fields", &self._unknown_fields);
3385        }
3386        debug_struct.finish()
3387    }
3388}
3389
3390/// Database insert request.
3391#[derive(Clone, Default, PartialEq)]
3392#[non_exhaustive]
3393pub struct SqlDatabasesInsertRequest {
3394    /// Database instance ID. This does not include the project ID.
3395    pub instance: std::string::String,
3396
3397    /// Project ID of the project that contains the instance.
3398    pub project: std::string::String,
3399
3400    pub body: std::option::Option<crate::model::Database>,
3401
3402    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3403}
3404
3405impl SqlDatabasesInsertRequest {
3406    pub fn new() -> Self {
3407        std::default::Default::default()
3408    }
3409
3410    /// Sets the value of [instance][crate::model::SqlDatabasesInsertRequest::instance].
3411    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3412        self.instance = v.into();
3413        self
3414    }
3415
3416    /// Sets the value of [project][crate::model::SqlDatabasesInsertRequest::project].
3417    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3418        self.project = v.into();
3419        self
3420    }
3421
3422    /// Sets the value of [body][crate::model::SqlDatabasesInsertRequest::body].
3423    pub fn set_body<T>(mut self, v: T) -> Self
3424    where
3425        T: std::convert::Into<crate::model::Database>,
3426    {
3427        self.body = std::option::Option::Some(v.into());
3428        self
3429    }
3430
3431    /// Sets or clears the value of [body][crate::model::SqlDatabasesInsertRequest::body].
3432    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
3433    where
3434        T: std::convert::Into<crate::model::Database>,
3435    {
3436        self.body = v.map(|x| x.into());
3437        self
3438    }
3439}
3440
3441impl wkt::message::Message for SqlDatabasesInsertRequest {
3442    fn typename() -> &'static str {
3443        "type.googleapis.com/google.cloud.sql.v1.SqlDatabasesInsertRequest"
3444    }
3445}
3446
3447#[doc(hidden)]
3448impl<'de> serde::de::Deserialize<'de> for SqlDatabasesInsertRequest {
3449    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3450    where
3451        D: serde::Deserializer<'de>,
3452    {
3453        #[allow(non_camel_case_types)]
3454        #[doc(hidden)]
3455        #[derive(PartialEq, Eq, Hash)]
3456        enum __FieldTag {
3457            __instance,
3458            __project,
3459            __body,
3460            Unknown(std::string::String),
3461        }
3462        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3463            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3464            where
3465                D: serde::Deserializer<'de>,
3466            {
3467                struct Visitor;
3468                impl<'de> serde::de::Visitor<'de> for Visitor {
3469                    type Value = __FieldTag;
3470                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3471                        formatter.write_str("a field name for SqlDatabasesInsertRequest")
3472                    }
3473                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3474                    where
3475                        E: serde::de::Error,
3476                    {
3477                        use std::result::Result::Ok;
3478                        use std::string::ToString;
3479                        match value {
3480                            "instance" => Ok(__FieldTag::__instance),
3481                            "project" => Ok(__FieldTag::__project),
3482                            "body" => Ok(__FieldTag::__body),
3483                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3484                        }
3485                    }
3486                }
3487                deserializer.deserialize_identifier(Visitor)
3488            }
3489        }
3490        struct Visitor;
3491        impl<'de> serde::de::Visitor<'de> for Visitor {
3492            type Value = SqlDatabasesInsertRequest;
3493            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3494                formatter.write_str("struct SqlDatabasesInsertRequest")
3495            }
3496            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3497            where
3498                A: serde::de::MapAccess<'de>,
3499            {
3500                #[allow(unused_imports)]
3501                use serde::de::Error;
3502                use std::option::Option::Some;
3503                let mut fields = std::collections::HashSet::new();
3504                let mut result = Self::Value::new();
3505                while let Some(tag) = map.next_key::<__FieldTag>()? {
3506                    #[allow(clippy::match_single_binding)]
3507                    match tag {
3508                        __FieldTag::__instance => {
3509                            if !fields.insert(__FieldTag::__instance) {
3510                                return std::result::Result::Err(A::Error::duplicate_field(
3511                                    "multiple values for instance",
3512                                ));
3513                            }
3514                            result.instance = map
3515                                .next_value::<std::option::Option<std::string::String>>()?
3516                                .unwrap_or_default();
3517                        }
3518                        __FieldTag::__project => {
3519                            if !fields.insert(__FieldTag::__project) {
3520                                return std::result::Result::Err(A::Error::duplicate_field(
3521                                    "multiple values for project",
3522                                ));
3523                            }
3524                            result.project = map
3525                                .next_value::<std::option::Option<std::string::String>>()?
3526                                .unwrap_or_default();
3527                        }
3528                        __FieldTag::__body => {
3529                            if !fields.insert(__FieldTag::__body) {
3530                                return std::result::Result::Err(A::Error::duplicate_field(
3531                                    "multiple values for body",
3532                                ));
3533                            }
3534                            result.body =
3535                                map.next_value::<std::option::Option<crate::model::Database>>()?;
3536                        }
3537                        __FieldTag::Unknown(key) => {
3538                            let value = map.next_value::<serde_json::Value>()?;
3539                            result._unknown_fields.insert(key, value);
3540                        }
3541                    }
3542                }
3543                std::result::Result::Ok(result)
3544            }
3545        }
3546        deserializer.deserialize_any(Visitor)
3547    }
3548}
3549
3550#[doc(hidden)]
3551impl serde::ser::Serialize for SqlDatabasesInsertRequest {
3552    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3553    where
3554        S: serde::ser::Serializer,
3555    {
3556        use serde::ser::SerializeMap;
3557        #[allow(unused_imports)]
3558        use std::option::Option::Some;
3559        let mut state = serializer.serialize_map(std::option::Option::None)?;
3560        if !self.instance.is_empty() {
3561            state.serialize_entry("instance", &self.instance)?;
3562        }
3563        if !self.project.is_empty() {
3564            state.serialize_entry("project", &self.project)?;
3565        }
3566        if self.body.is_some() {
3567            state.serialize_entry("body", &self.body)?;
3568        }
3569        if !self._unknown_fields.is_empty() {
3570            for (key, value) in self._unknown_fields.iter() {
3571                state.serialize_entry(key, &value)?;
3572            }
3573        }
3574        state.end()
3575    }
3576}
3577
3578impl std::fmt::Debug for SqlDatabasesInsertRequest {
3579    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3580        let mut debug_struct = f.debug_struct("SqlDatabasesInsertRequest");
3581        debug_struct.field("instance", &self.instance);
3582        debug_struct.field("project", &self.project);
3583        debug_struct.field("body", &self.body);
3584        if !self._unknown_fields.is_empty() {
3585            debug_struct.field("_unknown_fields", &self._unknown_fields);
3586        }
3587        debug_struct.finish()
3588    }
3589}
3590
3591/// Database list request.
3592#[derive(Clone, Default, PartialEq)]
3593#[non_exhaustive]
3594pub struct SqlDatabasesListRequest {
3595    /// Cloud SQL instance ID. This does not include the project ID.
3596    pub instance: std::string::String,
3597
3598    /// Project ID of the project that contains the instance.
3599    pub project: std::string::String,
3600
3601    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3602}
3603
3604impl SqlDatabasesListRequest {
3605    pub fn new() -> Self {
3606        std::default::Default::default()
3607    }
3608
3609    /// Sets the value of [instance][crate::model::SqlDatabasesListRequest::instance].
3610    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3611        self.instance = v.into();
3612        self
3613    }
3614
3615    /// Sets the value of [project][crate::model::SqlDatabasesListRequest::project].
3616    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3617        self.project = v.into();
3618        self
3619    }
3620}
3621
3622impl wkt::message::Message for SqlDatabasesListRequest {
3623    fn typename() -> &'static str {
3624        "type.googleapis.com/google.cloud.sql.v1.SqlDatabasesListRequest"
3625    }
3626}
3627
3628#[doc(hidden)]
3629impl<'de> serde::de::Deserialize<'de> for SqlDatabasesListRequest {
3630    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3631    where
3632        D: serde::Deserializer<'de>,
3633    {
3634        #[allow(non_camel_case_types)]
3635        #[doc(hidden)]
3636        #[derive(PartialEq, Eq, Hash)]
3637        enum __FieldTag {
3638            __instance,
3639            __project,
3640            Unknown(std::string::String),
3641        }
3642        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3643            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3644            where
3645                D: serde::Deserializer<'de>,
3646            {
3647                struct Visitor;
3648                impl<'de> serde::de::Visitor<'de> for Visitor {
3649                    type Value = __FieldTag;
3650                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3651                        formatter.write_str("a field name for SqlDatabasesListRequest")
3652                    }
3653                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3654                    where
3655                        E: serde::de::Error,
3656                    {
3657                        use std::result::Result::Ok;
3658                        use std::string::ToString;
3659                        match value {
3660                            "instance" => Ok(__FieldTag::__instance),
3661                            "project" => Ok(__FieldTag::__project),
3662                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3663                        }
3664                    }
3665                }
3666                deserializer.deserialize_identifier(Visitor)
3667            }
3668        }
3669        struct Visitor;
3670        impl<'de> serde::de::Visitor<'de> for Visitor {
3671            type Value = SqlDatabasesListRequest;
3672            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3673                formatter.write_str("struct SqlDatabasesListRequest")
3674            }
3675            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3676            where
3677                A: serde::de::MapAccess<'de>,
3678            {
3679                #[allow(unused_imports)]
3680                use serde::de::Error;
3681                use std::option::Option::Some;
3682                let mut fields = std::collections::HashSet::new();
3683                let mut result = Self::Value::new();
3684                while let Some(tag) = map.next_key::<__FieldTag>()? {
3685                    #[allow(clippy::match_single_binding)]
3686                    match tag {
3687                        __FieldTag::__instance => {
3688                            if !fields.insert(__FieldTag::__instance) {
3689                                return std::result::Result::Err(A::Error::duplicate_field(
3690                                    "multiple values for instance",
3691                                ));
3692                            }
3693                            result.instance = map
3694                                .next_value::<std::option::Option<std::string::String>>()?
3695                                .unwrap_or_default();
3696                        }
3697                        __FieldTag::__project => {
3698                            if !fields.insert(__FieldTag::__project) {
3699                                return std::result::Result::Err(A::Error::duplicate_field(
3700                                    "multiple values for project",
3701                                ));
3702                            }
3703                            result.project = map
3704                                .next_value::<std::option::Option<std::string::String>>()?
3705                                .unwrap_or_default();
3706                        }
3707                        __FieldTag::Unknown(key) => {
3708                            let value = map.next_value::<serde_json::Value>()?;
3709                            result._unknown_fields.insert(key, value);
3710                        }
3711                    }
3712                }
3713                std::result::Result::Ok(result)
3714            }
3715        }
3716        deserializer.deserialize_any(Visitor)
3717    }
3718}
3719
3720#[doc(hidden)]
3721impl serde::ser::Serialize for SqlDatabasesListRequest {
3722    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3723    where
3724        S: serde::ser::Serializer,
3725    {
3726        use serde::ser::SerializeMap;
3727        #[allow(unused_imports)]
3728        use std::option::Option::Some;
3729        let mut state = serializer.serialize_map(std::option::Option::None)?;
3730        if !self.instance.is_empty() {
3731            state.serialize_entry("instance", &self.instance)?;
3732        }
3733        if !self.project.is_empty() {
3734            state.serialize_entry("project", &self.project)?;
3735        }
3736        if !self._unknown_fields.is_empty() {
3737            for (key, value) in self._unknown_fields.iter() {
3738                state.serialize_entry(key, &value)?;
3739            }
3740        }
3741        state.end()
3742    }
3743}
3744
3745impl std::fmt::Debug for SqlDatabasesListRequest {
3746    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3747        let mut debug_struct = f.debug_struct("SqlDatabasesListRequest");
3748        debug_struct.field("instance", &self.instance);
3749        debug_struct.field("project", &self.project);
3750        if !self._unknown_fields.is_empty() {
3751            debug_struct.field("_unknown_fields", &self._unknown_fields);
3752        }
3753        debug_struct.finish()
3754    }
3755}
3756
3757/// Database update request.
3758#[derive(Clone, Default, PartialEq)]
3759#[non_exhaustive]
3760pub struct SqlDatabasesUpdateRequest {
3761    /// Name of the database to be updated in the instance.
3762    pub database: std::string::String,
3763
3764    /// Database instance ID. This does not include the project ID.
3765    pub instance: std::string::String,
3766
3767    /// Project ID of the project that contains the instance.
3768    pub project: std::string::String,
3769
3770    pub body: std::option::Option<crate::model::Database>,
3771
3772    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3773}
3774
3775impl SqlDatabasesUpdateRequest {
3776    pub fn new() -> Self {
3777        std::default::Default::default()
3778    }
3779
3780    /// Sets the value of [database][crate::model::SqlDatabasesUpdateRequest::database].
3781    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3782        self.database = v.into();
3783        self
3784    }
3785
3786    /// Sets the value of [instance][crate::model::SqlDatabasesUpdateRequest::instance].
3787    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3788        self.instance = v.into();
3789        self
3790    }
3791
3792    /// Sets the value of [project][crate::model::SqlDatabasesUpdateRequest::project].
3793    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3794        self.project = v.into();
3795        self
3796    }
3797
3798    /// Sets the value of [body][crate::model::SqlDatabasesUpdateRequest::body].
3799    pub fn set_body<T>(mut self, v: T) -> Self
3800    where
3801        T: std::convert::Into<crate::model::Database>,
3802    {
3803        self.body = std::option::Option::Some(v.into());
3804        self
3805    }
3806
3807    /// Sets or clears the value of [body][crate::model::SqlDatabasesUpdateRequest::body].
3808    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
3809    where
3810        T: std::convert::Into<crate::model::Database>,
3811    {
3812        self.body = v.map(|x| x.into());
3813        self
3814    }
3815}
3816
3817impl wkt::message::Message for SqlDatabasesUpdateRequest {
3818    fn typename() -> &'static str {
3819        "type.googleapis.com/google.cloud.sql.v1.SqlDatabasesUpdateRequest"
3820    }
3821}
3822
3823#[doc(hidden)]
3824impl<'de> serde::de::Deserialize<'de> for SqlDatabasesUpdateRequest {
3825    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3826    where
3827        D: serde::Deserializer<'de>,
3828    {
3829        #[allow(non_camel_case_types)]
3830        #[doc(hidden)]
3831        #[derive(PartialEq, Eq, Hash)]
3832        enum __FieldTag {
3833            __database,
3834            __instance,
3835            __project,
3836            __body,
3837            Unknown(std::string::String),
3838        }
3839        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3840            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3841            where
3842                D: serde::Deserializer<'de>,
3843            {
3844                struct Visitor;
3845                impl<'de> serde::de::Visitor<'de> for Visitor {
3846                    type Value = __FieldTag;
3847                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3848                        formatter.write_str("a field name for SqlDatabasesUpdateRequest")
3849                    }
3850                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3851                    where
3852                        E: serde::de::Error,
3853                    {
3854                        use std::result::Result::Ok;
3855                        use std::string::ToString;
3856                        match value {
3857                            "database" => Ok(__FieldTag::__database),
3858                            "instance" => Ok(__FieldTag::__instance),
3859                            "project" => Ok(__FieldTag::__project),
3860                            "body" => Ok(__FieldTag::__body),
3861                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3862                        }
3863                    }
3864                }
3865                deserializer.deserialize_identifier(Visitor)
3866            }
3867        }
3868        struct Visitor;
3869        impl<'de> serde::de::Visitor<'de> for Visitor {
3870            type Value = SqlDatabasesUpdateRequest;
3871            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3872                formatter.write_str("struct SqlDatabasesUpdateRequest")
3873            }
3874            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3875            where
3876                A: serde::de::MapAccess<'de>,
3877            {
3878                #[allow(unused_imports)]
3879                use serde::de::Error;
3880                use std::option::Option::Some;
3881                let mut fields = std::collections::HashSet::new();
3882                let mut result = Self::Value::new();
3883                while let Some(tag) = map.next_key::<__FieldTag>()? {
3884                    #[allow(clippy::match_single_binding)]
3885                    match tag {
3886                        __FieldTag::__database => {
3887                            if !fields.insert(__FieldTag::__database) {
3888                                return std::result::Result::Err(A::Error::duplicate_field(
3889                                    "multiple values for database",
3890                                ));
3891                            }
3892                            result.database = map
3893                                .next_value::<std::option::Option<std::string::String>>()?
3894                                .unwrap_or_default();
3895                        }
3896                        __FieldTag::__instance => {
3897                            if !fields.insert(__FieldTag::__instance) {
3898                                return std::result::Result::Err(A::Error::duplicate_field(
3899                                    "multiple values for instance",
3900                                ));
3901                            }
3902                            result.instance = map
3903                                .next_value::<std::option::Option<std::string::String>>()?
3904                                .unwrap_or_default();
3905                        }
3906                        __FieldTag::__project => {
3907                            if !fields.insert(__FieldTag::__project) {
3908                                return std::result::Result::Err(A::Error::duplicate_field(
3909                                    "multiple values for project",
3910                                ));
3911                            }
3912                            result.project = map
3913                                .next_value::<std::option::Option<std::string::String>>()?
3914                                .unwrap_or_default();
3915                        }
3916                        __FieldTag::__body => {
3917                            if !fields.insert(__FieldTag::__body) {
3918                                return std::result::Result::Err(A::Error::duplicate_field(
3919                                    "multiple values for body",
3920                                ));
3921                            }
3922                            result.body =
3923                                map.next_value::<std::option::Option<crate::model::Database>>()?;
3924                        }
3925                        __FieldTag::Unknown(key) => {
3926                            let value = map.next_value::<serde_json::Value>()?;
3927                            result._unknown_fields.insert(key, value);
3928                        }
3929                    }
3930                }
3931                std::result::Result::Ok(result)
3932            }
3933        }
3934        deserializer.deserialize_any(Visitor)
3935    }
3936}
3937
3938#[doc(hidden)]
3939impl serde::ser::Serialize for SqlDatabasesUpdateRequest {
3940    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3941    where
3942        S: serde::ser::Serializer,
3943    {
3944        use serde::ser::SerializeMap;
3945        #[allow(unused_imports)]
3946        use std::option::Option::Some;
3947        let mut state = serializer.serialize_map(std::option::Option::None)?;
3948        if !self.database.is_empty() {
3949            state.serialize_entry("database", &self.database)?;
3950        }
3951        if !self.instance.is_empty() {
3952            state.serialize_entry("instance", &self.instance)?;
3953        }
3954        if !self.project.is_empty() {
3955            state.serialize_entry("project", &self.project)?;
3956        }
3957        if self.body.is_some() {
3958            state.serialize_entry("body", &self.body)?;
3959        }
3960        if !self._unknown_fields.is_empty() {
3961            for (key, value) in self._unknown_fields.iter() {
3962                state.serialize_entry(key, &value)?;
3963            }
3964        }
3965        state.end()
3966    }
3967}
3968
3969impl std::fmt::Debug for SqlDatabasesUpdateRequest {
3970    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3971        let mut debug_struct = f.debug_struct("SqlDatabasesUpdateRequest");
3972        debug_struct.field("database", &self.database);
3973        debug_struct.field("instance", &self.instance);
3974        debug_struct.field("project", &self.project);
3975        debug_struct.field("body", &self.body);
3976        if !self._unknown_fields.is_empty() {
3977            debug_struct.field("_unknown_fields", &self._unknown_fields);
3978        }
3979        debug_struct.finish()
3980    }
3981}
3982
3983/// Database list response.
3984#[derive(Clone, Default, PartialEq)]
3985#[non_exhaustive]
3986pub struct DatabasesListResponse {
3987    /// This is always `sql#databasesList`.
3988    pub kind: std::string::String,
3989
3990    /// List of database resources in the instance.
3991    pub items: std::vec::Vec<crate::model::Database>,
3992
3993    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3994}
3995
3996impl DatabasesListResponse {
3997    pub fn new() -> Self {
3998        std::default::Default::default()
3999    }
4000
4001    /// Sets the value of [kind][crate::model::DatabasesListResponse::kind].
4002    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4003        self.kind = v.into();
4004        self
4005    }
4006
4007    /// Sets the value of [items][crate::model::DatabasesListResponse::items].
4008    pub fn set_items<T, V>(mut self, v: T) -> Self
4009    where
4010        T: std::iter::IntoIterator<Item = V>,
4011        V: std::convert::Into<crate::model::Database>,
4012    {
4013        use std::iter::Iterator;
4014        self.items = v.into_iter().map(|i| i.into()).collect();
4015        self
4016    }
4017}
4018
4019impl wkt::message::Message for DatabasesListResponse {
4020    fn typename() -> &'static str {
4021        "type.googleapis.com/google.cloud.sql.v1.DatabasesListResponse"
4022    }
4023}
4024
4025#[doc(hidden)]
4026impl<'de> serde::de::Deserialize<'de> for DatabasesListResponse {
4027    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4028    where
4029        D: serde::Deserializer<'de>,
4030    {
4031        #[allow(non_camel_case_types)]
4032        #[doc(hidden)]
4033        #[derive(PartialEq, Eq, Hash)]
4034        enum __FieldTag {
4035            __kind,
4036            __items,
4037            Unknown(std::string::String),
4038        }
4039        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4040            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4041            where
4042                D: serde::Deserializer<'de>,
4043            {
4044                struct Visitor;
4045                impl<'de> serde::de::Visitor<'de> for Visitor {
4046                    type Value = __FieldTag;
4047                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4048                        formatter.write_str("a field name for DatabasesListResponse")
4049                    }
4050                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4051                    where
4052                        E: serde::de::Error,
4053                    {
4054                        use std::result::Result::Ok;
4055                        use std::string::ToString;
4056                        match value {
4057                            "kind" => Ok(__FieldTag::__kind),
4058                            "items" => Ok(__FieldTag::__items),
4059                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4060                        }
4061                    }
4062                }
4063                deserializer.deserialize_identifier(Visitor)
4064            }
4065        }
4066        struct Visitor;
4067        impl<'de> serde::de::Visitor<'de> for Visitor {
4068            type Value = DatabasesListResponse;
4069            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4070                formatter.write_str("struct DatabasesListResponse")
4071            }
4072            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4073            where
4074                A: serde::de::MapAccess<'de>,
4075            {
4076                #[allow(unused_imports)]
4077                use serde::de::Error;
4078                use std::option::Option::Some;
4079                let mut fields = std::collections::HashSet::new();
4080                let mut result = Self::Value::new();
4081                while let Some(tag) = map.next_key::<__FieldTag>()? {
4082                    #[allow(clippy::match_single_binding)]
4083                    match tag {
4084                        __FieldTag::__kind => {
4085                            if !fields.insert(__FieldTag::__kind) {
4086                                return std::result::Result::Err(A::Error::duplicate_field(
4087                                    "multiple values for kind",
4088                                ));
4089                            }
4090                            result.kind = map
4091                                .next_value::<std::option::Option<std::string::String>>()?
4092                                .unwrap_or_default();
4093                        }
4094                        __FieldTag::__items => {
4095                            if !fields.insert(__FieldTag::__items) {
4096                                return std::result::Result::Err(A::Error::duplicate_field(
4097                                    "multiple values for items",
4098                                ));
4099                            }
4100                            result.items = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Database>>>()?.unwrap_or_default();
4101                        }
4102                        __FieldTag::Unknown(key) => {
4103                            let value = map.next_value::<serde_json::Value>()?;
4104                            result._unknown_fields.insert(key, value);
4105                        }
4106                    }
4107                }
4108                std::result::Result::Ok(result)
4109            }
4110        }
4111        deserializer.deserialize_any(Visitor)
4112    }
4113}
4114
4115#[doc(hidden)]
4116impl serde::ser::Serialize for DatabasesListResponse {
4117    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4118    where
4119        S: serde::ser::Serializer,
4120    {
4121        use serde::ser::SerializeMap;
4122        #[allow(unused_imports)]
4123        use std::option::Option::Some;
4124        let mut state = serializer.serialize_map(std::option::Option::None)?;
4125        if !self.kind.is_empty() {
4126            state.serialize_entry("kind", &self.kind)?;
4127        }
4128        if !self.items.is_empty() {
4129            state.serialize_entry("items", &self.items)?;
4130        }
4131        if !self._unknown_fields.is_empty() {
4132            for (key, value) in self._unknown_fields.iter() {
4133                state.serialize_entry(key, &value)?;
4134            }
4135        }
4136        state.end()
4137    }
4138}
4139
4140impl std::fmt::Debug for DatabasesListResponse {
4141    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4142        let mut debug_struct = f.debug_struct("DatabasesListResponse");
4143        debug_struct.field("kind", &self.kind);
4144        debug_struct.field("items", &self.items);
4145        if !self._unknown_fields.is_empty() {
4146            debug_struct.field("_unknown_fields", &self._unknown_fields);
4147        }
4148        debug_struct.finish()
4149    }
4150}
4151
4152/// Flags list request.
4153#[derive(Clone, Default, PartialEq)]
4154#[non_exhaustive]
4155pub struct SqlFlagsListRequest {
4156    /// Database type and version you want to retrieve flags for. By default, this
4157    /// method returns flags for all database types and versions.
4158    pub database_version: std::string::String,
4159
4160    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4161}
4162
4163impl SqlFlagsListRequest {
4164    pub fn new() -> Self {
4165        std::default::Default::default()
4166    }
4167
4168    /// Sets the value of [database_version][crate::model::SqlFlagsListRequest::database_version].
4169    pub fn set_database_version<T: std::convert::Into<std::string::String>>(
4170        mut self,
4171        v: T,
4172    ) -> Self {
4173        self.database_version = v.into();
4174        self
4175    }
4176}
4177
4178impl wkt::message::Message for SqlFlagsListRequest {
4179    fn typename() -> &'static str {
4180        "type.googleapis.com/google.cloud.sql.v1.SqlFlagsListRequest"
4181    }
4182}
4183
4184#[doc(hidden)]
4185impl<'de> serde::de::Deserialize<'de> for SqlFlagsListRequest {
4186    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4187    where
4188        D: serde::Deserializer<'de>,
4189    {
4190        #[allow(non_camel_case_types)]
4191        #[doc(hidden)]
4192        #[derive(PartialEq, Eq, Hash)]
4193        enum __FieldTag {
4194            __database_version,
4195            Unknown(std::string::String),
4196        }
4197        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4198            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4199            where
4200                D: serde::Deserializer<'de>,
4201            {
4202                struct Visitor;
4203                impl<'de> serde::de::Visitor<'de> for Visitor {
4204                    type Value = __FieldTag;
4205                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4206                        formatter.write_str("a field name for SqlFlagsListRequest")
4207                    }
4208                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4209                    where
4210                        E: serde::de::Error,
4211                    {
4212                        use std::result::Result::Ok;
4213                        use std::string::ToString;
4214                        match value {
4215                            "databaseVersion" => Ok(__FieldTag::__database_version),
4216                            "database_version" => Ok(__FieldTag::__database_version),
4217                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4218                        }
4219                    }
4220                }
4221                deserializer.deserialize_identifier(Visitor)
4222            }
4223        }
4224        struct Visitor;
4225        impl<'de> serde::de::Visitor<'de> for Visitor {
4226            type Value = SqlFlagsListRequest;
4227            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4228                formatter.write_str("struct SqlFlagsListRequest")
4229            }
4230            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4231            where
4232                A: serde::de::MapAccess<'de>,
4233            {
4234                #[allow(unused_imports)]
4235                use serde::de::Error;
4236                use std::option::Option::Some;
4237                let mut fields = std::collections::HashSet::new();
4238                let mut result = Self::Value::new();
4239                while let Some(tag) = map.next_key::<__FieldTag>()? {
4240                    #[allow(clippy::match_single_binding)]
4241                    match tag {
4242                        __FieldTag::__database_version => {
4243                            if !fields.insert(__FieldTag::__database_version) {
4244                                return std::result::Result::Err(A::Error::duplicate_field(
4245                                    "multiple values for database_version",
4246                                ));
4247                            }
4248                            result.database_version = map
4249                                .next_value::<std::option::Option<std::string::String>>()?
4250                                .unwrap_or_default();
4251                        }
4252                        __FieldTag::Unknown(key) => {
4253                            let value = map.next_value::<serde_json::Value>()?;
4254                            result._unknown_fields.insert(key, value);
4255                        }
4256                    }
4257                }
4258                std::result::Result::Ok(result)
4259            }
4260        }
4261        deserializer.deserialize_any(Visitor)
4262    }
4263}
4264
4265#[doc(hidden)]
4266impl serde::ser::Serialize for SqlFlagsListRequest {
4267    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4268    where
4269        S: serde::ser::Serializer,
4270    {
4271        use serde::ser::SerializeMap;
4272        #[allow(unused_imports)]
4273        use std::option::Option::Some;
4274        let mut state = serializer.serialize_map(std::option::Option::None)?;
4275        if !self.database_version.is_empty() {
4276            state.serialize_entry("databaseVersion", &self.database_version)?;
4277        }
4278        if !self._unknown_fields.is_empty() {
4279            for (key, value) in self._unknown_fields.iter() {
4280                state.serialize_entry(key, &value)?;
4281            }
4282        }
4283        state.end()
4284    }
4285}
4286
4287impl std::fmt::Debug for SqlFlagsListRequest {
4288    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4289        let mut debug_struct = f.debug_struct("SqlFlagsListRequest");
4290        debug_struct.field("database_version", &self.database_version);
4291        if !self._unknown_fields.is_empty() {
4292            debug_struct.field("_unknown_fields", &self._unknown_fields);
4293        }
4294        debug_struct.finish()
4295    }
4296}
4297
4298/// Flags list response.
4299#[derive(Clone, Default, PartialEq)]
4300#[non_exhaustive]
4301pub struct FlagsListResponse {
4302    /// This is always `sql#flagsList`.
4303    pub kind: std::string::String,
4304
4305    /// List of flags.
4306    pub items: std::vec::Vec<crate::model::Flag>,
4307
4308    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4309}
4310
4311impl FlagsListResponse {
4312    pub fn new() -> Self {
4313        std::default::Default::default()
4314    }
4315
4316    /// Sets the value of [kind][crate::model::FlagsListResponse::kind].
4317    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4318        self.kind = v.into();
4319        self
4320    }
4321
4322    /// Sets the value of [items][crate::model::FlagsListResponse::items].
4323    pub fn set_items<T, V>(mut self, v: T) -> Self
4324    where
4325        T: std::iter::IntoIterator<Item = V>,
4326        V: std::convert::Into<crate::model::Flag>,
4327    {
4328        use std::iter::Iterator;
4329        self.items = v.into_iter().map(|i| i.into()).collect();
4330        self
4331    }
4332}
4333
4334impl wkt::message::Message for FlagsListResponse {
4335    fn typename() -> &'static str {
4336        "type.googleapis.com/google.cloud.sql.v1.FlagsListResponse"
4337    }
4338}
4339
4340#[doc(hidden)]
4341impl<'de> serde::de::Deserialize<'de> for FlagsListResponse {
4342    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4343    where
4344        D: serde::Deserializer<'de>,
4345    {
4346        #[allow(non_camel_case_types)]
4347        #[doc(hidden)]
4348        #[derive(PartialEq, Eq, Hash)]
4349        enum __FieldTag {
4350            __kind,
4351            __items,
4352            Unknown(std::string::String),
4353        }
4354        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4355            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4356            where
4357                D: serde::Deserializer<'de>,
4358            {
4359                struct Visitor;
4360                impl<'de> serde::de::Visitor<'de> for Visitor {
4361                    type Value = __FieldTag;
4362                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4363                        formatter.write_str("a field name for FlagsListResponse")
4364                    }
4365                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4366                    where
4367                        E: serde::de::Error,
4368                    {
4369                        use std::result::Result::Ok;
4370                        use std::string::ToString;
4371                        match value {
4372                            "kind" => Ok(__FieldTag::__kind),
4373                            "items" => Ok(__FieldTag::__items),
4374                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4375                        }
4376                    }
4377                }
4378                deserializer.deserialize_identifier(Visitor)
4379            }
4380        }
4381        struct Visitor;
4382        impl<'de> serde::de::Visitor<'de> for Visitor {
4383            type Value = FlagsListResponse;
4384            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4385                formatter.write_str("struct FlagsListResponse")
4386            }
4387            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4388            where
4389                A: serde::de::MapAccess<'de>,
4390            {
4391                #[allow(unused_imports)]
4392                use serde::de::Error;
4393                use std::option::Option::Some;
4394                let mut fields = std::collections::HashSet::new();
4395                let mut result = Self::Value::new();
4396                while let Some(tag) = map.next_key::<__FieldTag>()? {
4397                    #[allow(clippy::match_single_binding)]
4398                    match tag {
4399                        __FieldTag::__kind => {
4400                            if !fields.insert(__FieldTag::__kind) {
4401                                return std::result::Result::Err(A::Error::duplicate_field(
4402                                    "multiple values for kind",
4403                                ));
4404                            }
4405                            result.kind = map
4406                                .next_value::<std::option::Option<std::string::String>>()?
4407                                .unwrap_or_default();
4408                        }
4409                        __FieldTag::__items => {
4410                            if !fields.insert(__FieldTag::__items) {
4411                                return std::result::Result::Err(A::Error::duplicate_field(
4412                                    "multiple values for items",
4413                                ));
4414                            }
4415                            result.items = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Flag>>>()?.unwrap_or_default();
4416                        }
4417                        __FieldTag::Unknown(key) => {
4418                            let value = map.next_value::<serde_json::Value>()?;
4419                            result._unknown_fields.insert(key, value);
4420                        }
4421                    }
4422                }
4423                std::result::Result::Ok(result)
4424            }
4425        }
4426        deserializer.deserialize_any(Visitor)
4427    }
4428}
4429
4430#[doc(hidden)]
4431impl serde::ser::Serialize for FlagsListResponse {
4432    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4433    where
4434        S: serde::ser::Serializer,
4435    {
4436        use serde::ser::SerializeMap;
4437        #[allow(unused_imports)]
4438        use std::option::Option::Some;
4439        let mut state = serializer.serialize_map(std::option::Option::None)?;
4440        if !self.kind.is_empty() {
4441            state.serialize_entry("kind", &self.kind)?;
4442        }
4443        if !self.items.is_empty() {
4444            state.serialize_entry("items", &self.items)?;
4445        }
4446        if !self._unknown_fields.is_empty() {
4447            for (key, value) in self._unknown_fields.iter() {
4448                state.serialize_entry(key, &value)?;
4449            }
4450        }
4451        state.end()
4452    }
4453}
4454
4455impl std::fmt::Debug for FlagsListResponse {
4456    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4457        let mut debug_struct = f.debug_struct("FlagsListResponse");
4458        debug_struct.field("kind", &self.kind);
4459        debug_struct.field("items", &self.items);
4460        if !self._unknown_fields.is_empty() {
4461            debug_struct.field("_unknown_fields", &self._unknown_fields);
4462        }
4463        debug_struct.finish()
4464    }
4465}
4466
4467/// A flag resource.
4468#[derive(Clone, Default, PartialEq)]
4469#[non_exhaustive]
4470pub struct Flag {
4471    /// This is the name of the flag. Flag names always use underscores, not
4472    /// hyphens, for example: `max_allowed_packet`
4473    pub name: std::string::String,
4474
4475    /// The type of the flag. Flags are typed to being `BOOLEAN`, `STRING`,
4476    /// `INTEGER` or `NONE`. `NONE` is used for flags that do not take a
4477    /// value, such as `skip_grant_tables`.
4478    pub r#type: crate::model::SqlFlagType,
4479
4480    /// The database version this flag applies to. Can be
4481    /// MySQL instances: `MYSQL_8_0`, `MYSQL_8_0_18`, `MYSQL_8_0_26`, `MYSQL_5_7`,
4482    /// or `MYSQL_5_6`. PostgreSQL instances: `POSTGRES_9_6`, `POSTGRES_10`,
4483    /// `POSTGRES_11` or `POSTGRES_12`. SQL Server instances:
4484    /// `SQLSERVER_2017_STANDARD`, `SQLSERVER_2017_ENTERPRISE`,
4485    /// `SQLSERVER_2017_EXPRESS`, `SQLSERVER_2017_WEB`, `SQLSERVER_2019_STANDARD`,
4486    /// `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`, or
4487    /// `SQLSERVER_2019_WEB`.
4488    /// See [the complete
4489    /// list](/sql/docs/mysql/admin-api/rest/v1/SqlDatabaseVersion).
4490    pub applies_to: std::vec::Vec<crate::model::SqlDatabaseVersion>,
4491
4492    /// For `STRING` flags, a list of strings that the value can be set to.
4493    pub allowed_string_values: std::vec::Vec<std::string::String>,
4494
4495    /// For `INTEGER` flags, the minimum allowed value.
4496    pub min_value: std::option::Option<wkt::Int64Value>,
4497
4498    /// For `INTEGER` flags, the maximum allowed value.
4499    pub max_value: std::option::Option<wkt::Int64Value>,
4500
4501    /// Indicates whether changing this flag will trigger a database restart. Only
4502    /// applicable to Second Generation instances.
4503    pub requires_restart: std::option::Option<wkt::BoolValue>,
4504
4505    /// This is always `sql#flag`.
4506    pub kind: std::string::String,
4507
4508    /// Whether or not the flag is considered in beta.
4509    pub in_beta: std::option::Option<wkt::BoolValue>,
4510
4511    /// Use this field if only certain integers are accepted. Can be combined
4512    /// with min_value and max_value to add additional values.
4513    pub allowed_int_values: std::vec::Vec<i64>,
4514
4515    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4516}
4517
4518impl Flag {
4519    pub fn new() -> Self {
4520        std::default::Default::default()
4521    }
4522
4523    /// Sets the value of [name][crate::model::Flag::name].
4524    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4525        self.name = v.into();
4526        self
4527    }
4528
4529    /// Sets the value of [r#type][crate::model::Flag::type].
4530    pub fn set_type<T: std::convert::Into<crate::model::SqlFlagType>>(mut self, v: T) -> Self {
4531        self.r#type = v.into();
4532        self
4533    }
4534
4535    /// Sets the value of [applies_to][crate::model::Flag::applies_to].
4536    pub fn set_applies_to<T, V>(mut self, v: T) -> Self
4537    where
4538        T: std::iter::IntoIterator<Item = V>,
4539        V: std::convert::Into<crate::model::SqlDatabaseVersion>,
4540    {
4541        use std::iter::Iterator;
4542        self.applies_to = v.into_iter().map(|i| i.into()).collect();
4543        self
4544    }
4545
4546    /// Sets the value of [allowed_string_values][crate::model::Flag::allowed_string_values].
4547    pub fn set_allowed_string_values<T, V>(mut self, v: T) -> Self
4548    where
4549        T: std::iter::IntoIterator<Item = V>,
4550        V: std::convert::Into<std::string::String>,
4551    {
4552        use std::iter::Iterator;
4553        self.allowed_string_values = v.into_iter().map(|i| i.into()).collect();
4554        self
4555    }
4556
4557    /// Sets the value of [min_value][crate::model::Flag::min_value].
4558    pub fn set_min_value<T>(mut self, v: T) -> Self
4559    where
4560        T: std::convert::Into<wkt::Int64Value>,
4561    {
4562        self.min_value = std::option::Option::Some(v.into());
4563        self
4564    }
4565
4566    /// Sets or clears the value of [min_value][crate::model::Flag::min_value].
4567    pub fn set_or_clear_min_value<T>(mut self, v: std::option::Option<T>) -> Self
4568    where
4569        T: std::convert::Into<wkt::Int64Value>,
4570    {
4571        self.min_value = v.map(|x| x.into());
4572        self
4573    }
4574
4575    /// Sets the value of [max_value][crate::model::Flag::max_value].
4576    pub fn set_max_value<T>(mut self, v: T) -> Self
4577    where
4578        T: std::convert::Into<wkt::Int64Value>,
4579    {
4580        self.max_value = std::option::Option::Some(v.into());
4581        self
4582    }
4583
4584    /// Sets or clears the value of [max_value][crate::model::Flag::max_value].
4585    pub fn set_or_clear_max_value<T>(mut self, v: std::option::Option<T>) -> Self
4586    where
4587        T: std::convert::Into<wkt::Int64Value>,
4588    {
4589        self.max_value = v.map(|x| x.into());
4590        self
4591    }
4592
4593    /// Sets the value of [requires_restart][crate::model::Flag::requires_restart].
4594    pub fn set_requires_restart<T>(mut self, v: T) -> Self
4595    where
4596        T: std::convert::Into<wkt::BoolValue>,
4597    {
4598        self.requires_restart = std::option::Option::Some(v.into());
4599        self
4600    }
4601
4602    /// Sets or clears the value of [requires_restart][crate::model::Flag::requires_restart].
4603    pub fn set_or_clear_requires_restart<T>(mut self, v: std::option::Option<T>) -> Self
4604    where
4605        T: std::convert::Into<wkt::BoolValue>,
4606    {
4607        self.requires_restart = v.map(|x| x.into());
4608        self
4609    }
4610
4611    /// Sets the value of [kind][crate::model::Flag::kind].
4612    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4613        self.kind = v.into();
4614        self
4615    }
4616
4617    /// Sets the value of [in_beta][crate::model::Flag::in_beta].
4618    pub fn set_in_beta<T>(mut self, v: T) -> Self
4619    where
4620        T: std::convert::Into<wkt::BoolValue>,
4621    {
4622        self.in_beta = std::option::Option::Some(v.into());
4623        self
4624    }
4625
4626    /// Sets or clears the value of [in_beta][crate::model::Flag::in_beta].
4627    pub fn set_or_clear_in_beta<T>(mut self, v: std::option::Option<T>) -> Self
4628    where
4629        T: std::convert::Into<wkt::BoolValue>,
4630    {
4631        self.in_beta = v.map(|x| x.into());
4632        self
4633    }
4634
4635    /// Sets the value of [allowed_int_values][crate::model::Flag::allowed_int_values].
4636    pub fn set_allowed_int_values<T, V>(mut self, v: T) -> Self
4637    where
4638        T: std::iter::IntoIterator<Item = V>,
4639        V: std::convert::Into<i64>,
4640    {
4641        use std::iter::Iterator;
4642        self.allowed_int_values = v.into_iter().map(|i| i.into()).collect();
4643        self
4644    }
4645}
4646
4647impl wkt::message::Message for Flag {
4648    fn typename() -> &'static str {
4649        "type.googleapis.com/google.cloud.sql.v1.Flag"
4650    }
4651}
4652
4653#[doc(hidden)]
4654impl<'de> serde::de::Deserialize<'de> for Flag {
4655    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4656    where
4657        D: serde::Deserializer<'de>,
4658    {
4659        #[allow(non_camel_case_types)]
4660        #[doc(hidden)]
4661        #[derive(PartialEq, Eq, Hash)]
4662        enum __FieldTag {
4663            __name,
4664            __type,
4665            __applies_to,
4666            __allowed_string_values,
4667            __min_value,
4668            __max_value,
4669            __requires_restart,
4670            __kind,
4671            __in_beta,
4672            __allowed_int_values,
4673            Unknown(std::string::String),
4674        }
4675        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4676            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4677            where
4678                D: serde::Deserializer<'de>,
4679            {
4680                struct Visitor;
4681                impl<'de> serde::de::Visitor<'de> for Visitor {
4682                    type Value = __FieldTag;
4683                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4684                        formatter.write_str("a field name for Flag")
4685                    }
4686                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4687                    where
4688                        E: serde::de::Error,
4689                    {
4690                        use std::result::Result::Ok;
4691                        use std::string::ToString;
4692                        match value {
4693                            "name" => Ok(__FieldTag::__name),
4694                            "type" => Ok(__FieldTag::__type),
4695                            "appliesTo" => Ok(__FieldTag::__applies_to),
4696                            "applies_to" => Ok(__FieldTag::__applies_to),
4697                            "allowedStringValues" => Ok(__FieldTag::__allowed_string_values),
4698                            "allowed_string_values" => Ok(__FieldTag::__allowed_string_values),
4699                            "minValue" => Ok(__FieldTag::__min_value),
4700                            "min_value" => Ok(__FieldTag::__min_value),
4701                            "maxValue" => Ok(__FieldTag::__max_value),
4702                            "max_value" => Ok(__FieldTag::__max_value),
4703                            "requiresRestart" => Ok(__FieldTag::__requires_restart),
4704                            "requires_restart" => Ok(__FieldTag::__requires_restart),
4705                            "kind" => Ok(__FieldTag::__kind),
4706                            "inBeta" => Ok(__FieldTag::__in_beta),
4707                            "in_beta" => Ok(__FieldTag::__in_beta),
4708                            "allowedIntValues" => Ok(__FieldTag::__allowed_int_values),
4709                            "allowed_int_values" => Ok(__FieldTag::__allowed_int_values),
4710                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4711                        }
4712                    }
4713                }
4714                deserializer.deserialize_identifier(Visitor)
4715            }
4716        }
4717        struct Visitor;
4718        impl<'de> serde::de::Visitor<'de> for Visitor {
4719            type Value = Flag;
4720            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4721                formatter.write_str("struct Flag")
4722            }
4723            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4724            where
4725                A: serde::de::MapAccess<'de>,
4726            {
4727                #[allow(unused_imports)]
4728                use serde::de::Error;
4729                use std::option::Option::Some;
4730                let mut fields = std::collections::HashSet::new();
4731                let mut result = Self::Value::new();
4732                while let Some(tag) = map.next_key::<__FieldTag>()? {
4733                    #[allow(clippy::match_single_binding)]
4734                    match tag {
4735                        __FieldTag::__name => {
4736                            if !fields.insert(__FieldTag::__name) {
4737                                return std::result::Result::Err(A::Error::duplicate_field(
4738                                    "multiple values for name",
4739                                ));
4740                            }
4741                            result.name = map
4742                                .next_value::<std::option::Option<std::string::String>>()?
4743                                .unwrap_or_default();
4744                        }
4745                        __FieldTag::__type => {
4746                            if !fields.insert(__FieldTag::__type) {
4747                                return std::result::Result::Err(A::Error::duplicate_field(
4748                                    "multiple values for type",
4749                                ));
4750                            }
4751                            result.r#type = map
4752                                .next_value::<std::option::Option<crate::model::SqlFlagType>>()?
4753                                .unwrap_or_default();
4754                        }
4755                        __FieldTag::__applies_to => {
4756                            if !fields.insert(__FieldTag::__applies_to) {
4757                                return std::result::Result::Err(A::Error::duplicate_field(
4758                                    "multiple values for applies_to",
4759                                ));
4760                            }
4761                            result.applies_to = map
4762                                .next_value::<std::option::Option<
4763                                    std::vec::Vec<crate::model::SqlDatabaseVersion>,
4764                                >>()?
4765                                .unwrap_or_default();
4766                        }
4767                        __FieldTag::__allowed_string_values => {
4768                            if !fields.insert(__FieldTag::__allowed_string_values) {
4769                                return std::result::Result::Err(A::Error::duplicate_field(
4770                                    "multiple values for allowed_string_values",
4771                                ));
4772                            }
4773                            result.allowed_string_values = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
4774                        }
4775                        __FieldTag::__min_value => {
4776                            if !fields.insert(__FieldTag::__min_value) {
4777                                return std::result::Result::Err(A::Error::duplicate_field(
4778                                    "multiple values for min_value",
4779                                ));
4780                            }
4781                            struct __With(std::option::Option<wkt::Int64Value>);
4782                            impl<'de> serde::de::Deserialize<'de> for __With {
4783                                fn deserialize<D>(
4784                                    deserializer: D,
4785                                ) -> std::result::Result<Self, D::Error>
4786                                where
4787                                    D: serde::de::Deserializer<'de>,
4788                                {
4789                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4790                                }
4791                            }
4792                            result.min_value = map.next_value::<__With>()?.0;
4793                        }
4794                        __FieldTag::__max_value => {
4795                            if !fields.insert(__FieldTag::__max_value) {
4796                                return std::result::Result::Err(A::Error::duplicate_field(
4797                                    "multiple values for max_value",
4798                                ));
4799                            }
4800                            struct __With(std::option::Option<wkt::Int64Value>);
4801                            impl<'de> serde::de::Deserialize<'de> for __With {
4802                                fn deserialize<D>(
4803                                    deserializer: D,
4804                                ) -> std::result::Result<Self, D::Error>
4805                                where
4806                                    D: serde::de::Deserializer<'de>,
4807                                {
4808                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4809                                }
4810                            }
4811                            result.max_value = map.next_value::<__With>()?.0;
4812                        }
4813                        __FieldTag::__requires_restart => {
4814                            if !fields.insert(__FieldTag::__requires_restart) {
4815                                return std::result::Result::Err(A::Error::duplicate_field(
4816                                    "multiple values for requires_restart",
4817                                ));
4818                            }
4819                            result.requires_restart =
4820                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
4821                        }
4822                        __FieldTag::__kind => {
4823                            if !fields.insert(__FieldTag::__kind) {
4824                                return std::result::Result::Err(A::Error::duplicate_field(
4825                                    "multiple values for kind",
4826                                ));
4827                            }
4828                            result.kind = map
4829                                .next_value::<std::option::Option<std::string::String>>()?
4830                                .unwrap_or_default();
4831                        }
4832                        __FieldTag::__in_beta => {
4833                            if !fields.insert(__FieldTag::__in_beta) {
4834                                return std::result::Result::Err(A::Error::duplicate_field(
4835                                    "multiple values for in_beta",
4836                                ));
4837                            }
4838                            result.in_beta =
4839                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
4840                        }
4841                        __FieldTag::__allowed_int_values => {
4842                            if !fields.insert(__FieldTag::__allowed_int_values) {
4843                                return std::result::Result::Err(A::Error::duplicate_field(
4844                                    "multiple values for allowed_int_values",
4845                                ));
4846                            }
4847                            struct __With(std::option::Option<std::vec::Vec<i64>>);
4848                            impl<'de> serde::de::Deserialize<'de> for __With {
4849                                fn deserialize<D>(
4850                                    deserializer: D,
4851                                ) -> std::result::Result<Self, D::Error>
4852                                where
4853                                    D: serde::de::Deserializer<'de>,
4854                                {
4855                                    serde_with::As::<
4856                                        std::option::Option<std::vec::Vec<wkt::internal::I64>>,
4857                                    >::deserialize(deserializer)
4858                                    .map(__With)
4859                                }
4860                            }
4861                            result.allowed_int_values =
4862                                map.next_value::<__With>()?.0.unwrap_or_default();
4863                        }
4864                        __FieldTag::Unknown(key) => {
4865                            let value = map.next_value::<serde_json::Value>()?;
4866                            result._unknown_fields.insert(key, value);
4867                        }
4868                    }
4869                }
4870                std::result::Result::Ok(result)
4871            }
4872        }
4873        deserializer.deserialize_any(Visitor)
4874    }
4875}
4876
4877#[doc(hidden)]
4878impl serde::ser::Serialize for Flag {
4879    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4880    where
4881        S: serde::ser::Serializer,
4882    {
4883        use serde::ser::SerializeMap;
4884        #[allow(unused_imports)]
4885        use std::option::Option::Some;
4886        let mut state = serializer.serialize_map(std::option::Option::None)?;
4887        if !self.name.is_empty() {
4888            state.serialize_entry("name", &self.name)?;
4889        }
4890        if !wkt::internal::is_default(&self.r#type) {
4891            state.serialize_entry("type", &self.r#type)?;
4892        }
4893        if !self.applies_to.is_empty() {
4894            state.serialize_entry("appliesTo", &self.applies_to)?;
4895        }
4896        if !self.allowed_string_values.is_empty() {
4897            state.serialize_entry("allowedStringValues", &self.allowed_string_values)?;
4898        }
4899        if self.min_value.is_some() {
4900            struct __With<'a>(&'a std::option::Option<wkt::Int64Value>);
4901            impl<'a> serde::ser::Serialize for __With<'a> {
4902                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4903                where
4904                    S: serde::ser::Serializer,
4905                {
4906                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
4907                        self.0, serializer,
4908                    )
4909                }
4910            }
4911            state.serialize_entry("minValue", &__With(&self.min_value))?;
4912        }
4913        if self.max_value.is_some() {
4914            struct __With<'a>(&'a std::option::Option<wkt::Int64Value>);
4915            impl<'a> serde::ser::Serialize for __With<'a> {
4916                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4917                where
4918                    S: serde::ser::Serializer,
4919                {
4920                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
4921                        self.0, serializer,
4922                    )
4923                }
4924            }
4925            state.serialize_entry("maxValue", &__With(&self.max_value))?;
4926        }
4927        if self.requires_restart.is_some() {
4928            state.serialize_entry("requiresRestart", &self.requires_restart)?;
4929        }
4930        if !self.kind.is_empty() {
4931            state.serialize_entry("kind", &self.kind)?;
4932        }
4933        if self.in_beta.is_some() {
4934            state.serialize_entry("inBeta", &self.in_beta)?;
4935        }
4936        if !self.allowed_int_values.is_empty() {
4937            struct __With<'a>(&'a std::vec::Vec<i64>);
4938            impl<'a> serde::ser::Serialize for __With<'a> {
4939                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4940                where
4941                    S: serde::ser::Serializer,
4942                {
4943                    serde_with::As::<std::vec::Vec<wkt::internal::I64>>::serialize(
4944                        self.0, serializer,
4945                    )
4946                }
4947            }
4948            state.serialize_entry("allowedIntValues", &__With(&self.allowed_int_values))?;
4949        }
4950        if !self._unknown_fields.is_empty() {
4951            for (key, value) in self._unknown_fields.iter() {
4952                state.serialize_entry(key, &value)?;
4953            }
4954        }
4955        state.end()
4956    }
4957}
4958
4959impl std::fmt::Debug for Flag {
4960    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4961        let mut debug_struct = f.debug_struct("Flag");
4962        debug_struct.field("name", &self.name);
4963        debug_struct.field("r#type", &self.r#type);
4964        debug_struct.field("applies_to", &self.applies_to);
4965        debug_struct.field("allowed_string_values", &self.allowed_string_values);
4966        debug_struct.field("min_value", &self.min_value);
4967        debug_struct.field("max_value", &self.max_value);
4968        debug_struct.field("requires_restart", &self.requires_restart);
4969        debug_struct.field("kind", &self.kind);
4970        debug_struct.field("in_beta", &self.in_beta);
4971        debug_struct.field("allowed_int_values", &self.allowed_int_values);
4972        if !self._unknown_fields.is_empty() {
4973            debug_struct.field("_unknown_fields", &self._unknown_fields);
4974        }
4975        debug_struct.finish()
4976    }
4977}
4978
4979/// Instance add server CA request.
4980#[derive(Clone, Default, PartialEq)]
4981#[non_exhaustive]
4982pub struct SqlInstancesAddServerCaRequest {
4983    /// Cloud SQL instance ID. This does not include the project ID.
4984    pub instance: std::string::String,
4985
4986    /// Project ID of the project that contains the instance.
4987    pub project: std::string::String,
4988
4989    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4990}
4991
4992impl SqlInstancesAddServerCaRequest {
4993    pub fn new() -> Self {
4994        std::default::Default::default()
4995    }
4996
4997    /// Sets the value of [instance][crate::model::SqlInstancesAddServerCaRequest::instance].
4998    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4999        self.instance = v.into();
5000        self
5001    }
5002
5003    /// Sets the value of [project][crate::model::SqlInstancesAddServerCaRequest::project].
5004    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5005        self.project = v.into();
5006        self
5007    }
5008}
5009
5010impl wkt::message::Message for SqlInstancesAddServerCaRequest {
5011    fn typename() -> &'static str {
5012        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesAddServerCaRequest"
5013    }
5014}
5015
5016#[doc(hidden)]
5017impl<'de> serde::de::Deserialize<'de> for SqlInstancesAddServerCaRequest {
5018    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5019    where
5020        D: serde::Deserializer<'de>,
5021    {
5022        #[allow(non_camel_case_types)]
5023        #[doc(hidden)]
5024        #[derive(PartialEq, Eq, Hash)]
5025        enum __FieldTag {
5026            __instance,
5027            __project,
5028            Unknown(std::string::String),
5029        }
5030        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5031            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5032            where
5033                D: serde::Deserializer<'de>,
5034            {
5035                struct Visitor;
5036                impl<'de> serde::de::Visitor<'de> for Visitor {
5037                    type Value = __FieldTag;
5038                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5039                        formatter.write_str("a field name for SqlInstancesAddServerCaRequest")
5040                    }
5041                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5042                    where
5043                        E: serde::de::Error,
5044                    {
5045                        use std::result::Result::Ok;
5046                        use std::string::ToString;
5047                        match value {
5048                            "instance" => Ok(__FieldTag::__instance),
5049                            "project" => Ok(__FieldTag::__project),
5050                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5051                        }
5052                    }
5053                }
5054                deserializer.deserialize_identifier(Visitor)
5055            }
5056        }
5057        struct Visitor;
5058        impl<'de> serde::de::Visitor<'de> for Visitor {
5059            type Value = SqlInstancesAddServerCaRequest;
5060            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5061                formatter.write_str("struct SqlInstancesAddServerCaRequest")
5062            }
5063            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5064            where
5065                A: serde::de::MapAccess<'de>,
5066            {
5067                #[allow(unused_imports)]
5068                use serde::de::Error;
5069                use std::option::Option::Some;
5070                let mut fields = std::collections::HashSet::new();
5071                let mut result = Self::Value::new();
5072                while let Some(tag) = map.next_key::<__FieldTag>()? {
5073                    #[allow(clippy::match_single_binding)]
5074                    match tag {
5075                        __FieldTag::__instance => {
5076                            if !fields.insert(__FieldTag::__instance) {
5077                                return std::result::Result::Err(A::Error::duplicate_field(
5078                                    "multiple values for instance",
5079                                ));
5080                            }
5081                            result.instance = map
5082                                .next_value::<std::option::Option<std::string::String>>()?
5083                                .unwrap_or_default();
5084                        }
5085                        __FieldTag::__project => {
5086                            if !fields.insert(__FieldTag::__project) {
5087                                return std::result::Result::Err(A::Error::duplicate_field(
5088                                    "multiple values for project",
5089                                ));
5090                            }
5091                            result.project = map
5092                                .next_value::<std::option::Option<std::string::String>>()?
5093                                .unwrap_or_default();
5094                        }
5095                        __FieldTag::Unknown(key) => {
5096                            let value = map.next_value::<serde_json::Value>()?;
5097                            result._unknown_fields.insert(key, value);
5098                        }
5099                    }
5100                }
5101                std::result::Result::Ok(result)
5102            }
5103        }
5104        deserializer.deserialize_any(Visitor)
5105    }
5106}
5107
5108#[doc(hidden)]
5109impl serde::ser::Serialize for SqlInstancesAddServerCaRequest {
5110    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5111    where
5112        S: serde::ser::Serializer,
5113    {
5114        use serde::ser::SerializeMap;
5115        #[allow(unused_imports)]
5116        use std::option::Option::Some;
5117        let mut state = serializer.serialize_map(std::option::Option::None)?;
5118        if !self.instance.is_empty() {
5119            state.serialize_entry("instance", &self.instance)?;
5120        }
5121        if !self.project.is_empty() {
5122            state.serialize_entry("project", &self.project)?;
5123        }
5124        if !self._unknown_fields.is_empty() {
5125            for (key, value) in self._unknown_fields.iter() {
5126                state.serialize_entry(key, &value)?;
5127            }
5128        }
5129        state.end()
5130    }
5131}
5132
5133impl std::fmt::Debug for SqlInstancesAddServerCaRequest {
5134    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5135        let mut debug_struct = f.debug_struct("SqlInstancesAddServerCaRequest");
5136        debug_struct.field("instance", &self.instance);
5137        debug_struct.field("project", &self.project);
5138        if !self._unknown_fields.is_empty() {
5139            debug_struct.field("_unknown_fields", &self._unknown_fields);
5140        }
5141        debug_struct.finish()
5142    }
5143}
5144
5145/// Instance clone request.
5146#[derive(Clone, Default, PartialEq)]
5147#[non_exhaustive]
5148pub struct SqlInstancesCloneRequest {
5149    /// The ID of the Cloud SQL instance to be cloned (source). This does not
5150    /// include the project ID.
5151    pub instance: std::string::String,
5152
5153    /// Project ID of the source as well as the clone Cloud SQL instance.
5154    pub project: std::string::String,
5155
5156    pub body: std::option::Option<crate::model::InstancesCloneRequest>,
5157
5158    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5159}
5160
5161impl SqlInstancesCloneRequest {
5162    pub fn new() -> Self {
5163        std::default::Default::default()
5164    }
5165
5166    /// Sets the value of [instance][crate::model::SqlInstancesCloneRequest::instance].
5167    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5168        self.instance = v.into();
5169        self
5170    }
5171
5172    /// Sets the value of [project][crate::model::SqlInstancesCloneRequest::project].
5173    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5174        self.project = v.into();
5175        self
5176    }
5177
5178    /// Sets the value of [body][crate::model::SqlInstancesCloneRequest::body].
5179    pub fn set_body<T>(mut self, v: T) -> Self
5180    where
5181        T: std::convert::Into<crate::model::InstancesCloneRequest>,
5182    {
5183        self.body = std::option::Option::Some(v.into());
5184        self
5185    }
5186
5187    /// Sets or clears the value of [body][crate::model::SqlInstancesCloneRequest::body].
5188    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
5189    where
5190        T: std::convert::Into<crate::model::InstancesCloneRequest>,
5191    {
5192        self.body = v.map(|x| x.into());
5193        self
5194    }
5195}
5196
5197impl wkt::message::Message for SqlInstancesCloneRequest {
5198    fn typename() -> &'static str {
5199        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesCloneRequest"
5200    }
5201}
5202
5203#[doc(hidden)]
5204impl<'de> serde::de::Deserialize<'de> for SqlInstancesCloneRequest {
5205    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5206    where
5207        D: serde::Deserializer<'de>,
5208    {
5209        #[allow(non_camel_case_types)]
5210        #[doc(hidden)]
5211        #[derive(PartialEq, Eq, Hash)]
5212        enum __FieldTag {
5213            __instance,
5214            __project,
5215            __body,
5216            Unknown(std::string::String),
5217        }
5218        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5219            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5220            where
5221                D: serde::Deserializer<'de>,
5222            {
5223                struct Visitor;
5224                impl<'de> serde::de::Visitor<'de> for Visitor {
5225                    type Value = __FieldTag;
5226                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5227                        formatter.write_str("a field name for SqlInstancesCloneRequest")
5228                    }
5229                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5230                    where
5231                        E: serde::de::Error,
5232                    {
5233                        use std::result::Result::Ok;
5234                        use std::string::ToString;
5235                        match value {
5236                            "instance" => Ok(__FieldTag::__instance),
5237                            "project" => Ok(__FieldTag::__project),
5238                            "body" => Ok(__FieldTag::__body),
5239                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5240                        }
5241                    }
5242                }
5243                deserializer.deserialize_identifier(Visitor)
5244            }
5245        }
5246        struct Visitor;
5247        impl<'de> serde::de::Visitor<'de> for Visitor {
5248            type Value = SqlInstancesCloneRequest;
5249            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5250                formatter.write_str("struct SqlInstancesCloneRequest")
5251            }
5252            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5253            where
5254                A: serde::de::MapAccess<'de>,
5255            {
5256                #[allow(unused_imports)]
5257                use serde::de::Error;
5258                use std::option::Option::Some;
5259                let mut fields = std::collections::HashSet::new();
5260                let mut result = Self::Value::new();
5261                while let Some(tag) = map.next_key::<__FieldTag>()? {
5262                    #[allow(clippy::match_single_binding)]
5263                    match tag {
5264                        __FieldTag::__instance => {
5265                            if !fields.insert(__FieldTag::__instance) {
5266                                return std::result::Result::Err(A::Error::duplicate_field(
5267                                    "multiple values for instance",
5268                                ));
5269                            }
5270                            result.instance = map
5271                                .next_value::<std::option::Option<std::string::String>>()?
5272                                .unwrap_or_default();
5273                        }
5274                        __FieldTag::__project => {
5275                            if !fields.insert(__FieldTag::__project) {
5276                                return std::result::Result::Err(A::Error::duplicate_field(
5277                                    "multiple values for project",
5278                                ));
5279                            }
5280                            result.project = map
5281                                .next_value::<std::option::Option<std::string::String>>()?
5282                                .unwrap_or_default();
5283                        }
5284                        __FieldTag::__body => {
5285                            if !fields.insert(__FieldTag::__body) {
5286                                return std::result::Result::Err(A::Error::duplicate_field(
5287                                    "multiple values for body",
5288                                ));
5289                            }
5290                            result.body = map.next_value::<std::option::Option<crate::model::InstancesCloneRequest>>()?
5291                                ;
5292                        }
5293                        __FieldTag::Unknown(key) => {
5294                            let value = map.next_value::<serde_json::Value>()?;
5295                            result._unknown_fields.insert(key, value);
5296                        }
5297                    }
5298                }
5299                std::result::Result::Ok(result)
5300            }
5301        }
5302        deserializer.deserialize_any(Visitor)
5303    }
5304}
5305
5306#[doc(hidden)]
5307impl serde::ser::Serialize for SqlInstancesCloneRequest {
5308    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5309    where
5310        S: serde::ser::Serializer,
5311    {
5312        use serde::ser::SerializeMap;
5313        #[allow(unused_imports)]
5314        use std::option::Option::Some;
5315        let mut state = serializer.serialize_map(std::option::Option::None)?;
5316        if !self.instance.is_empty() {
5317            state.serialize_entry("instance", &self.instance)?;
5318        }
5319        if !self.project.is_empty() {
5320            state.serialize_entry("project", &self.project)?;
5321        }
5322        if self.body.is_some() {
5323            state.serialize_entry("body", &self.body)?;
5324        }
5325        if !self._unknown_fields.is_empty() {
5326            for (key, value) in self._unknown_fields.iter() {
5327                state.serialize_entry(key, &value)?;
5328            }
5329        }
5330        state.end()
5331    }
5332}
5333
5334impl std::fmt::Debug for SqlInstancesCloneRequest {
5335    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5336        let mut debug_struct = f.debug_struct("SqlInstancesCloneRequest");
5337        debug_struct.field("instance", &self.instance);
5338        debug_struct.field("project", &self.project);
5339        debug_struct.field("body", &self.body);
5340        if !self._unknown_fields.is_empty() {
5341            debug_struct.field("_unknown_fields", &self._unknown_fields);
5342        }
5343        debug_struct.finish()
5344    }
5345}
5346
5347/// Instance delete request.
5348#[derive(Clone, Default, PartialEq)]
5349#[non_exhaustive]
5350pub struct SqlInstancesDeleteRequest {
5351    /// Cloud SQL instance ID. This does not include the project ID.
5352    pub instance: std::string::String,
5353
5354    /// Project ID of the project that contains the instance to be deleted.
5355    pub project: std::string::String,
5356
5357    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5358}
5359
5360impl SqlInstancesDeleteRequest {
5361    pub fn new() -> Self {
5362        std::default::Default::default()
5363    }
5364
5365    /// Sets the value of [instance][crate::model::SqlInstancesDeleteRequest::instance].
5366    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5367        self.instance = v.into();
5368        self
5369    }
5370
5371    /// Sets the value of [project][crate::model::SqlInstancesDeleteRequest::project].
5372    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5373        self.project = v.into();
5374        self
5375    }
5376}
5377
5378impl wkt::message::Message for SqlInstancesDeleteRequest {
5379    fn typename() -> &'static str {
5380        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesDeleteRequest"
5381    }
5382}
5383
5384#[doc(hidden)]
5385impl<'de> serde::de::Deserialize<'de> for SqlInstancesDeleteRequest {
5386    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5387    where
5388        D: serde::Deserializer<'de>,
5389    {
5390        #[allow(non_camel_case_types)]
5391        #[doc(hidden)]
5392        #[derive(PartialEq, Eq, Hash)]
5393        enum __FieldTag {
5394            __instance,
5395            __project,
5396            Unknown(std::string::String),
5397        }
5398        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5399            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5400            where
5401                D: serde::Deserializer<'de>,
5402            {
5403                struct Visitor;
5404                impl<'de> serde::de::Visitor<'de> for Visitor {
5405                    type Value = __FieldTag;
5406                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5407                        formatter.write_str("a field name for SqlInstancesDeleteRequest")
5408                    }
5409                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5410                    where
5411                        E: serde::de::Error,
5412                    {
5413                        use std::result::Result::Ok;
5414                        use std::string::ToString;
5415                        match value {
5416                            "instance" => Ok(__FieldTag::__instance),
5417                            "project" => Ok(__FieldTag::__project),
5418                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5419                        }
5420                    }
5421                }
5422                deserializer.deserialize_identifier(Visitor)
5423            }
5424        }
5425        struct Visitor;
5426        impl<'de> serde::de::Visitor<'de> for Visitor {
5427            type Value = SqlInstancesDeleteRequest;
5428            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5429                formatter.write_str("struct SqlInstancesDeleteRequest")
5430            }
5431            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5432            where
5433                A: serde::de::MapAccess<'de>,
5434            {
5435                #[allow(unused_imports)]
5436                use serde::de::Error;
5437                use std::option::Option::Some;
5438                let mut fields = std::collections::HashSet::new();
5439                let mut result = Self::Value::new();
5440                while let Some(tag) = map.next_key::<__FieldTag>()? {
5441                    #[allow(clippy::match_single_binding)]
5442                    match tag {
5443                        __FieldTag::__instance => {
5444                            if !fields.insert(__FieldTag::__instance) {
5445                                return std::result::Result::Err(A::Error::duplicate_field(
5446                                    "multiple values for instance",
5447                                ));
5448                            }
5449                            result.instance = map
5450                                .next_value::<std::option::Option<std::string::String>>()?
5451                                .unwrap_or_default();
5452                        }
5453                        __FieldTag::__project => {
5454                            if !fields.insert(__FieldTag::__project) {
5455                                return std::result::Result::Err(A::Error::duplicate_field(
5456                                    "multiple values for project",
5457                                ));
5458                            }
5459                            result.project = map
5460                                .next_value::<std::option::Option<std::string::String>>()?
5461                                .unwrap_or_default();
5462                        }
5463                        __FieldTag::Unknown(key) => {
5464                            let value = map.next_value::<serde_json::Value>()?;
5465                            result._unknown_fields.insert(key, value);
5466                        }
5467                    }
5468                }
5469                std::result::Result::Ok(result)
5470            }
5471        }
5472        deserializer.deserialize_any(Visitor)
5473    }
5474}
5475
5476#[doc(hidden)]
5477impl serde::ser::Serialize for SqlInstancesDeleteRequest {
5478    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5479    where
5480        S: serde::ser::Serializer,
5481    {
5482        use serde::ser::SerializeMap;
5483        #[allow(unused_imports)]
5484        use std::option::Option::Some;
5485        let mut state = serializer.serialize_map(std::option::Option::None)?;
5486        if !self.instance.is_empty() {
5487            state.serialize_entry("instance", &self.instance)?;
5488        }
5489        if !self.project.is_empty() {
5490            state.serialize_entry("project", &self.project)?;
5491        }
5492        if !self._unknown_fields.is_empty() {
5493            for (key, value) in self._unknown_fields.iter() {
5494                state.serialize_entry(key, &value)?;
5495            }
5496        }
5497        state.end()
5498    }
5499}
5500
5501impl std::fmt::Debug for SqlInstancesDeleteRequest {
5502    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5503        let mut debug_struct = f.debug_struct("SqlInstancesDeleteRequest");
5504        debug_struct.field("instance", &self.instance);
5505        debug_struct.field("project", &self.project);
5506        if !self._unknown_fields.is_empty() {
5507            debug_struct.field("_unknown_fields", &self._unknown_fields);
5508        }
5509        debug_struct.finish()
5510    }
5511}
5512
5513/// Instance demote master request.
5514#[derive(Clone, Default, PartialEq)]
5515#[non_exhaustive]
5516pub struct SqlInstancesDemoteMasterRequest {
5517    /// Cloud SQL instance name.
5518    pub instance: std::string::String,
5519
5520    /// ID of the project that contains the instance.
5521    pub project: std::string::String,
5522
5523    pub body: std::option::Option<crate::model::InstancesDemoteMasterRequest>,
5524
5525    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5526}
5527
5528impl SqlInstancesDemoteMasterRequest {
5529    pub fn new() -> Self {
5530        std::default::Default::default()
5531    }
5532
5533    /// Sets the value of [instance][crate::model::SqlInstancesDemoteMasterRequest::instance].
5534    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5535        self.instance = v.into();
5536        self
5537    }
5538
5539    /// Sets the value of [project][crate::model::SqlInstancesDemoteMasterRequest::project].
5540    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5541        self.project = v.into();
5542        self
5543    }
5544
5545    /// Sets the value of [body][crate::model::SqlInstancesDemoteMasterRequest::body].
5546    pub fn set_body<T>(mut self, v: T) -> Self
5547    where
5548        T: std::convert::Into<crate::model::InstancesDemoteMasterRequest>,
5549    {
5550        self.body = std::option::Option::Some(v.into());
5551        self
5552    }
5553
5554    /// Sets or clears the value of [body][crate::model::SqlInstancesDemoteMasterRequest::body].
5555    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
5556    where
5557        T: std::convert::Into<crate::model::InstancesDemoteMasterRequest>,
5558    {
5559        self.body = v.map(|x| x.into());
5560        self
5561    }
5562}
5563
5564impl wkt::message::Message for SqlInstancesDemoteMasterRequest {
5565    fn typename() -> &'static str {
5566        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesDemoteMasterRequest"
5567    }
5568}
5569
5570#[doc(hidden)]
5571impl<'de> serde::de::Deserialize<'de> for SqlInstancesDemoteMasterRequest {
5572    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5573    where
5574        D: serde::Deserializer<'de>,
5575    {
5576        #[allow(non_camel_case_types)]
5577        #[doc(hidden)]
5578        #[derive(PartialEq, Eq, Hash)]
5579        enum __FieldTag {
5580            __instance,
5581            __project,
5582            __body,
5583            Unknown(std::string::String),
5584        }
5585        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5586            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5587            where
5588                D: serde::Deserializer<'de>,
5589            {
5590                struct Visitor;
5591                impl<'de> serde::de::Visitor<'de> for Visitor {
5592                    type Value = __FieldTag;
5593                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5594                        formatter.write_str("a field name for SqlInstancesDemoteMasterRequest")
5595                    }
5596                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5597                    where
5598                        E: serde::de::Error,
5599                    {
5600                        use std::result::Result::Ok;
5601                        use std::string::ToString;
5602                        match value {
5603                            "instance" => Ok(__FieldTag::__instance),
5604                            "project" => Ok(__FieldTag::__project),
5605                            "body" => Ok(__FieldTag::__body),
5606                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5607                        }
5608                    }
5609                }
5610                deserializer.deserialize_identifier(Visitor)
5611            }
5612        }
5613        struct Visitor;
5614        impl<'de> serde::de::Visitor<'de> for Visitor {
5615            type Value = SqlInstancesDemoteMasterRequest;
5616            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5617                formatter.write_str("struct SqlInstancesDemoteMasterRequest")
5618            }
5619            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5620            where
5621                A: serde::de::MapAccess<'de>,
5622            {
5623                #[allow(unused_imports)]
5624                use serde::de::Error;
5625                use std::option::Option::Some;
5626                let mut fields = std::collections::HashSet::new();
5627                let mut result = Self::Value::new();
5628                while let Some(tag) = map.next_key::<__FieldTag>()? {
5629                    #[allow(clippy::match_single_binding)]
5630                    match tag {
5631                        __FieldTag::__instance => {
5632                            if !fields.insert(__FieldTag::__instance) {
5633                                return std::result::Result::Err(A::Error::duplicate_field(
5634                                    "multiple values for instance",
5635                                ));
5636                            }
5637                            result.instance = map
5638                                .next_value::<std::option::Option<std::string::String>>()?
5639                                .unwrap_or_default();
5640                        }
5641                        __FieldTag::__project => {
5642                            if !fields.insert(__FieldTag::__project) {
5643                                return std::result::Result::Err(A::Error::duplicate_field(
5644                                    "multiple values for project",
5645                                ));
5646                            }
5647                            result.project = map
5648                                .next_value::<std::option::Option<std::string::String>>()?
5649                                .unwrap_or_default();
5650                        }
5651                        __FieldTag::__body => {
5652                            if !fields.insert(__FieldTag::__body) {
5653                                return std::result::Result::Err(A::Error::duplicate_field(
5654                                    "multiple values for body",
5655                                ));
5656                            }
5657                            result.body = map.next_value::<std::option::Option<crate::model::InstancesDemoteMasterRequest>>()?
5658                                ;
5659                        }
5660                        __FieldTag::Unknown(key) => {
5661                            let value = map.next_value::<serde_json::Value>()?;
5662                            result._unknown_fields.insert(key, value);
5663                        }
5664                    }
5665                }
5666                std::result::Result::Ok(result)
5667            }
5668        }
5669        deserializer.deserialize_any(Visitor)
5670    }
5671}
5672
5673#[doc(hidden)]
5674impl serde::ser::Serialize for SqlInstancesDemoteMasterRequest {
5675    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5676    where
5677        S: serde::ser::Serializer,
5678    {
5679        use serde::ser::SerializeMap;
5680        #[allow(unused_imports)]
5681        use std::option::Option::Some;
5682        let mut state = serializer.serialize_map(std::option::Option::None)?;
5683        if !self.instance.is_empty() {
5684            state.serialize_entry("instance", &self.instance)?;
5685        }
5686        if !self.project.is_empty() {
5687            state.serialize_entry("project", &self.project)?;
5688        }
5689        if self.body.is_some() {
5690            state.serialize_entry("body", &self.body)?;
5691        }
5692        if !self._unknown_fields.is_empty() {
5693            for (key, value) in self._unknown_fields.iter() {
5694                state.serialize_entry(key, &value)?;
5695            }
5696        }
5697        state.end()
5698    }
5699}
5700
5701impl std::fmt::Debug for SqlInstancesDemoteMasterRequest {
5702    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5703        let mut debug_struct = f.debug_struct("SqlInstancesDemoteMasterRequest");
5704        debug_struct.field("instance", &self.instance);
5705        debug_struct.field("project", &self.project);
5706        debug_struct.field("body", &self.body);
5707        if !self._unknown_fields.is_empty() {
5708            debug_struct.field("_unknown_fields", &self._unknown_fields);
5709        }
5710        debug_struct.finish()
5711    }
5712}
5713
5714/// Instance demote request.
5715#[derive(Clone, Default, PartialEq)]
5716#[non_exhaustive]
5717pub struct SqlInstancesDemoteRequest {
5718    /// Required. Cloud SQL instance name.
5719    pub instance: std::string::String,
5720
5721    /// Required. ID of the project that contains the instance.
5722    pub project: std::string::String,
5723
5724    /// Required. The request body.
5725    pub body: std::option::Option<crate::model::InstancesDemoteRequest>,
5726
5727    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5728}
5729
5730impl SqlInstancesDemoteRequest {
5731    pub fn new() -> Self {
5732        std::default::Default::default()
5733    }
5734
5735    /// Sets the value of [instance][crate::model::SqlInstancesDemoteRequest::instance].
5736    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5737        self.instance = v.into();
5738        self
5739    }
5740
5741    /// Sets the value of [project][crate::model::SqlInstancesDemoteRequest::project].
5742    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5743        self.project = v.into();
5744        self
5745    }
5746
5747    /// Sets the value of [body][crate::model::SqlInstancesDemoteRequest::body].
5748    pub fn set_body<T>(mut self, v: T) -> Self
5749    where
5750        T: std::convert::Into<crate::model::InstancesDemoteRequest>,
5751    {
5752        self.body = std::option::Option::Some(v.into());
5753        self
5754    }
5755
5756    /// Sets or clears the value of [body][crate::model::SqlInstancesDemoteRequest::body].
5757    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
5758    where
5759        T: std::convert::Into<crate::model::InstancesDemoteRequest>,
5760    {
5761        self.body = v.map(|x| x.into());
5762        self
5763    }
5764}
5765
5766impl wkt::message::Message for SqlInstancesDemoteRequest {
5767    fn typename() -> &'static str {
5768        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesDemoteRequest"
5769    }
5770}
5771
5772#[doc(hidden)]
5773impl<'de> serde::de::Deserialize<'de> for SqlInstancesDemoteRequest {
5774    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5775    where
5776        D: serde::Deserializer<'de>,
5777    {
5778        #[allow(non_camel_case_types)]
5779        #[doc(hidden)]
5780        #[derive(PartialEq, Eq, Hash)]
5781        enum __FieldTag {
5782            __instance,
5783            __project,
5784            __body,
5785            Unknown(std::string::String),
5786        }
5787        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5788            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5789            where
5790                D: serde::Deserializer<'de>,
5791            {
5792                struct Visitor;
5793                impl<'de> serde::de::Visitor<'de> for Visitor {
5794                    type Value = __FieldTag;
5795                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5796                        formatter.write_str("a field name for SqlInstancesDemoteRequest")
5797                    }
5798                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5799                    where
5800                        E: serde::de::Error,
5801                    {
5802                        use std::result::Result::Ok;
5803                        use std::string::ToString;
5804                        match value {
5805                            "instance" => Ok(__FieldTag::__instance),
5806                            "project" => Ok(__FieldTag::__project),
5807                            "body" => Ok(__FieldTag::__body),
5808                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5809                        }
5810                    }
5811                }
5812                deserializer.deserialize_identifier(Visitor)
5813            }
5814        }
5815        struct Visitor;
5816        impl<'de> serde::de::Visitor<'de> for Visitor {
5817            type Value = SqlInstancesDemoteRequest;
5818            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5819                formatter.write_str("struct SqlInstancesDemoteRequest")
5820            }
5821            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5822            where
5823                A: serde::de::MapAccess<'de>,
5824            {
5825                #[allow(unused_imports)]
5826                use serde::de::Error;
5827                use std::option::Option::Some;
5828                let mut fields = std::collections::HashSet::new();
5829                let mut result = Self::Value::new();
5830                while let Some(tag) = map.next_key::<__FieldTag>()? {
5831                    #[allow(clippy::match_single_binding)]
5832                    match tag {
5833                        __FieldTag::__instance => {
5834                            if !fields.insert(__FieldTag::__instance) {
5835                                return std::result::Result::Err(A::Error::duplicate_field(
5836                                    "multiple values for instance",
5837                                ));
5838                            }
5839                            result.instance = map
5840                                .next_value::<std::option::Option<std::string::String>>()?
5841                                .unwrap_or_default();
5842                        }
5843                        __FieldTag::__project => {
5844                            if !fields.insert(__FieldTag::__project) {
5845                                return std::result::Result::Err(A::Error::duplicate_field(
5846                                    "multiple values for project",
5847                                ));
5848                            }
5849                            result.project = map
5850                                .next_value::<std::option::Option<std::string::String>>()?
5851                                .unwrap_or_default();
5852                        }
5853                        __FieldTag::__body => {
5854                            if !fields.insert(__FieldTag::__body) {
5855                                return std::result::Result::Err(A::Error::duplicate_field(
5856                                    "multiple values for body",
5857                                ));
5858                            }
5859                            result.body = map.next_value::<std::option::Option<crate::model::InstancesDemoteRequest>>()?
5860                                ;
5861                        }
5862                        __FieldTag::Unknown(key) => {
5863                            let value = map.next_value::<serde_json::Value>()?;
5864                            result._unknown_fields.insert(key, value);
5865                        }
5866                    }
5867                }
5868                std::result::Result::Ok(result)
5869            }
5870        }
5871        deserializer.deserialize_any(Visitor)
5872    }
5873}
5874
5875#[doc(hidden)]
5876impl serde::ser::Serialize for SqlInstancesDemoteRequest {
5877    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5878    where
5879        S: serde::ser::Serializer,
5880    {
5881        use serde::ser::SerializeMap;
5882        #[allow(unused_imports)]
5883        use std::option::Option::Some;
5884        let mut state = serializer.serialize_map(std::option::Option::None)?;
5885        if !self.instance.is_empty() {
5886            state.serialize_entry("instance", &self.instance)?;
5887        }
5888        if !self.project.is_empty() {
5889            state.serialize_entry("project", &self.project)?;
5890        }
5891        if self.body.is_some() {
5892            state.serialize_entry("body", &self.body)?;
5893        }
5894        if !self._unknown_fields.is_empty() {
5895            for (key, value) in self._unknown_fields.iter() {
5896                state.serialize_entry(key, &value)?;
5897            }
5898        }
5899        state.end()
5900    }
5901}
5902
5903impl std::fmt::Debug for SqlInstancesDemoteRequest {
5904    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5905        let mut debug_struct = f.debug_struct("SqlInstancesDemoteRequest");
5906        debug_struct.field("instance", &self.instance);
5907        debug_struct.field("project", &self.project);
5908        debug_struct.field("body", &self.body);
5909        if !self._unknown_fields.is_empty() {
5910            debug_struct.field("_unknown_fields", &self._unknown_fields);
5911        }
5912        debug_struct.finish()
5913    }
5914}
5915
5916/// Instance export request.
5917#[derive(Clone, Default, PartialEq)]
5918#[non_exhaustive]
5919pub struct SqlInstancesExportRequest {
5920    /// Cloud SQL instance ID. This does not include the project ID.
5921    pub instance: std::string::String,
5922
5923    /// Project ID of the project that contains the instance to be exported.
5924    pub project: std::string::String,
5925
5926    pub body: std::option::Option<crate::model::InstancesExportRequest>,
5927
5928    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5929}
5930
5931impl SqlInstancesExportRequest {
5932    pub fn new() -> Self {
5933        std::default::Default::default()
5934    }
5935
5936    /// Sets the value of [instance][crate::model::SqlInstancesExportRequest::instance].
5937    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5938        self.instance = v.into();
5939        self
5940    }
5941
5942    /// Sets the value of [project][crate::model::SqlInstancesExportRequest::project].
5943    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5944        self.project = v.into();
5945        self
5946    }
5947
5948    /// Sets the value of [body][crate::model::SqlInstancesExportRequest::body].
5949    pub fn set_body<T>(mut self, v: T) -> Self
5950    where
5951        T: std::convert::Into<crate::model::InstancesExportRequest>,
5952    {
5953        self.body = std::option::Option::Some(v.into());
5954        self
5955    }
5956
5957    /// Sets or clears the value of [body][crate::model::SqlInstancesExportRequest::body].
5958    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
5959    where
5960        T: std::convert::Into<crate::model::InstancesExportRequest>,
5961    {
5962        self.body = v.map(|x| x.into());
5963        self
5964    }
5965}
5966
5967impl wkt::message::Message for SqlInstancesExportRequest {
5968    fn typename() -> &'static str {
5969        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesExportRequest"
5970    }
5971}
5972
5973#[doc(hidden)]
5974impl<'de> serde::de::Deserialize<'de> for SqlInstancesExportRequest {
5975    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5976    where
5977        D: serde::Deserializer<'de>,
5978    {
5979        #[allow(non_camel_case_types)]
5980        #[doc(hidden)]
5981        #[derive(PartialEq, Eq, Hash)]
5982        enum __FieldTag {
5983            __instance,
5984            __project,
5985            __body,
5986            Unknown(std::string::String),
5987        }
5988        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5989            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5990            where
5991                D: serde::Deserializer<'de>,
5992            {
5993                struct Visitor;
5994                impl<'de> serde::de::Visitor<'de> for Visitor {
5995                    type Value = __FieldTag;
5996                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5997                        formatter.write_str("a field name for SqlInstancesExportRequest")
5998                    }
5999                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6000                    where
6001                        E: serde::de::Error,
6002                    {
6003                        use std::result::Result::Ok;
6004                        use std::string::ToString;
6005                        match value {
6006                            "instance" => Ok(__FieldTag::__instance),
6007                            "project" => Ok(__FieldTag::__project),
6008                            "body" => Ok(__FieldTag::__body),
6009                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6010                        }
6011                    }
6012                }
6013                deserializer.deserialize_identifier(Visitor)
6014            }
6015        }
6016        struct Visitor;
6017        impl<'de> serde::de::Visitor<'de> for Visitor {
6018            type Value = SqlInstancesExportRequest;
6019            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6020                formatter.write_str("struct SqlInstancesExportRequest")
6021            }
6022            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6023            where
6024                A: serde::de::MapAccess<'de>,
6025            {
6026                #[allow(unused_imports)]
6027                use serde::de::Error;
6028                use std::option::Option::Some;
6029                let mut fields = std::collections::HashSet::new();
6030                let mut result = Self::Value::new();
6031                while let Some(tag) = map.next_key::<__FieldTag>()? {
6032                    #[allow(clippy::match_single_binding)]
6033                    match tag {
6034                        __FieldTag::__instance => {
6035                            if !fields.insert(__FieldTag::__instance) {
6036                                return std::result::Result::Err(A::Error::duplicate_field(
6037                                    "multiple values for instance",
6038                                ));
6039                            }
6040                            result.instance = map
6041                                .next_value::<std::option::Option<std::string::String>>()?
6042                                .unwrap_or_default();
6043                        }
6044                        __FieldTag::__project => {
6045                            if !fields.insert(__FieldTag::__project) {
6046                                return std::result::Result::Err(A::Error::duplicate_field(
6047                                    "multiple values for project",
6048                                ));
6049                            }
6050                            result.project = map
6051                                .next_value::<std::option::Option<std::string::String>>()?
6052                                .unwrap_or_default();
6053                        }
6054                        __FieldTag::__body => {
6055                            if !fields.insert(__FieldTag::__body) {
6056                                return std::result::Result::Err(A::Error::duplicate_field(
6057                                    "multiple values for body",
6058                                ));
6059                            }
6060                            result.body = map.next_value::<std::option::Option<crate::model::InstancesExportRequest>>()?
6061                                ;
6062                        }
6063                        __FieldTag::Unknown(key) => {
6064                            let value = map.next_value::<serde_json::Value>()?;
6065                            result._unknown_fields.insert(key, value);
6066                        }
6067                    }
6068                }
6069                std::result::Result::Ok(result)
6070            }
6071        }
6072        deserializer.deserialize_any(Visitor)
6073    }
6074}
6075
6076#[doc(hidden)]
6077impl serde::ser::Serialize for SqlInstancesExportRequest {
6078    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6079    where
6080        S: serde::ser::Serializer,
6081    {
6082        use serde::ser::SerializeMap;
6083        #[allow(unused_imports)]
6084        use std::option::Option::Some;
6085        let mut state = serializer.serialize_map(std::option::Option::None)?;
6086        if !self.instance.is_empty() {
6087            state.serialize_entry("instance", &self.instance)?;
6088        }
6089        if !self.project.is_empty() {
6090            state.serialize_entry("project", &self.project)?;
6091        }
6092        if self.body.is_some() {
6093            state.serialize_entry("body", &self.body)?;
6094        }
6095        if !self._unknown_fields.is_empty() {
6096            for (key, value) in self._unknown_fields.iter() {
6097                state.serialize_entry(key, &value)?;
6098            }
6099        }
6100        state.end()
6101    }
6102}
6103
6104impl std::fmt::Debug for SqlInstancesExportRequest {
6105    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6106        let mut debug_struct = f.debug_struct("SqlInstancesExportRequest");
6107        debug_struct.field("instance", &self.instance);
6108        debug_struct.field("project", &self.project);
6109        debug_struct.field("body", &self.body);
6110        if !self._unknown_fields.is_empty() {
6111            debug_struct.field("_unknown_fields", &self._unknown_fields);
6112        }
6113        debug_struct.finish()
6114    }
6115}
6116
6117/// Instance failover request.
6118#[derive(Clone, Default, PartialEq)]
6119#[non_exhaustive]
6120pub struct SqlInstancesFailoverRequest {
6121    /// Cloud SQL instance ID. This does not include the project ID.
6122    pub instance: std::string::String,
6123
6124    /// ID of the project that contains the read replica.
6125    pub project: std::string::String,
6126
6127    pub body: std::option::Option<crate::model::InstancesFailoverRequest>,
6128
6129    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6130}
6131
6132impl SqlInstancesFailoverRequest {
6133    pub fn new() -> Self {
6134        std::default::Default::default()
6135    }
6136
6137    /// Sets the value of [instance][crate::model::SqlInstancesFailoverRequest::instance].
6138    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6139        self.instance = v.into();
6140        self
6141    }
6142
6143    /// Sets the value of [project][crate::model::SqlInstancesFailoverRequest::project].
6144    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6145        self.project = v.into();
6146        self
6147    }
6148
6149    /// Sets the value of [body][crate::model::SqlInstancesFailoverRequest::body].
6150    pub fn set_body<T>(mut self, v: T) -> Self
6151    where
6152        T: std::convert::Into<crate::model::InstancesFailoverRequest>,
6153    {
6154        self.body = std::option::Option::Some(v.into());
6155        self
6156    }
6157
6158    /// Sets or clears the value of [body][crate::model::SqlInstancesFailoverRequest::body].
6159    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
6160    where
6161        T: std::convert::Into<crate::model::InstancesFailoverRequest>,
6162    {
6163        self.body = v.map(|x| x.into());
6164        self
6165    }
6166}
6167
6168impl wkt::message::Message for SqlInstancesFailoverRequest {
6169    fn typename() -> &'static str {
6170        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesFailoverRequest"
6171    }
6172}
6173
6174#[doc(hidden)]
6175impl<'de> serde::de::Deserialize<'de> for SqlInstancesFailoverRequest {
6176    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6177    where
6178        D: serde::Deserializer<'de>,
6179    {
6180        #[allow(non_camel_case_types)]
6181        #[doc(hidden)]
6182        #[derive(PartialEq, Eq, Hash)]
6183        enum __FieldTag {
6184            __instance,
6185            __project,
6186            __body,
6187            Unknown(std::string::String),
6188        }
6189        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6190            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6191            where
6192                D: serde::Deserializer<'de>,
6193            {
6194                struct Visitor;
6195                impl<'de> serde::de::Visitor<'de> for Visitor {
6196                    type Value = __FieldTag;
6197                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6198                        formatter.write_str("a field name for SqlInstancesFailoverRequest")
6199                    }
6200                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6201                    where
6202                        E: serde::de::Error,
6203                    {
6204                        use std::result::Result::Ok;
6205                        use std::string::ToString;
6206                        match value {
6207                            "instance" => Ok(__FieldTag::__instance),
6208                            "project" => Ok(__FieldTag::__project),
6209                            "body" => Ok(__FieldTag::__body),
6210                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6211                        }
6212                    }
6213                }
6214                deserializer.deserialize_identifier(Visitor)
6215            }
6216        }
6217        struct Visitor;
6218        impl<'de> serde::de::Visitor<'de> for Visitor {
6219            type Value = SqlInstancesFailoverRequest;
6220            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6221                formatter.write_str("struct SqlInstancesFailoverRequest")
6222            }
6223            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6224            where
6225                A: serde::de::MapAccess<'de>,
6226            {
6227                #[allow(unused_imports)]
6228                use serde::de::Error;
6229                use std::option::Option::Some;
6230                let mut fields = std::collections::HashSet::new();
6231                let mut result = Self::Value::new();
6232                while let Some(tag) = map.next_key::<__FieldTag>()? {
6233                    #[allow(clippy::match_single_binding)]
6234                    match tag {
6235                        __FieldTag::__instance => {
6236                            if !fields.insert(__FieldTag::__instance) {
6237                                return std::result::Result::Err(A::Error::duplicate_field(
6238                                    "multiple values for instance",
6239                                ));
6240                            }
6241                            result.instance = map
6242                                .next_value::<std::option::Option<std::string::String>>()?
6243                                .unwrap_or_default();
6244                        }
6245                        __FieldTag::__project => {
6246                            if !fields.insert(__FieldTag::__project) {
6247                                return std::result::Result::Err(A::Error::duplicate_field(
6248                                    "multiple values for project",
6249                                ));
6250                            }
6251                            result.project = map
6252                                .next_value::<std::option::Option<std::string::String>>()?
6253                                .unwrap_or_default();
6254                        }
6255                        __FieldTag::__body => {
6256                            if !fields.insert(__FieldTag::__body) {
6257                                return std::result::Result::Err(A::Error::duplicate_field(
6258                                    "multiple values for body",
6259                                ));
6260                            }
6261                            result.body = map.next_value::<std::option::Option<crate::model::InstancesFailoverRequest>>()?
6262                                ;
6263                        }
6264                        __FieldTag::Unknown(key) => {
6265                            let value = map.next_value::<serde_json::Value>()?;
6266                            result._unknown_fields.insert(key, value);
6267                        }
6268                    }
6269                }
6270                std::result::Result::Ok(result)
6271            }
6272        }
6273        deserializer.deserialize_any(Visitor)
6274    }
6275}
6276
6277#[doc(hidden)]
6278impl serde::ser::Serialize for SqlInstancesFailoverRequest {
6279    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6280    where
6281        S: serde::ser::Serializer,
6282    {
6283        use serde::ser::SerializeMap;
6284        #[allow(unused_imports)]
6285        use std::option::Option::Some;
6286        let mut state = serializer.serialize_map(std::option::Option::None)?;
6287        if !self.instance.is_empty() {
6288            state.serialize_entry("instance", &self.instance)?;
6289        }
6290        if !self.project.is_empty() {
6291            state.serialize_entry("project", &self.project)?;
6292        }
6293        if self.body.is_some() {
6294            state.serialize_entry("body", &self.body)?;
6295        }
6296        if !self._unknown_fields.is_empty() {
6297            for (key, value) in self._unknown_fields.iter() {
6298                state.serialize_entry(key, &value)?;
6299            }
6300        }
6301        state.end()
6302    }
6303}
6304
6305impl std::fmt::Debug for SqlInstancesFailoverRequest {
6306    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6307        let mut debug_struct = f.debug_struct("SqlInstancesFailoverRequest");
6308        debug_struct.field("instance", &self.instance);
6309        debug_struct.field("project", &self.project);
6310        debug_struct.field("body", &self.body);
6311        if !self._unknown_fields.is_empty() {
6312            debug_struct.field("_unknown_fields", &self._unknown_fields);
6313        }
6314        debug_struct.finish()
6315    }
6316}
6317
6318/// Instance get request.
6319#[derive(Clone, Default, PartialEq)]
6320#[non_exhaustive]
6321pub struct SqlInstancesGetRequest {
6322    /// Database instance ID. This does not include the project ID.
6323    pub instance: std::string::String,
6324
6325    /// Project ID of the project that contains the instance.
6326    pub project: std::string::String,
6327
6328    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6329}
6330
6331impl SqlInstancesGetRequest {
6332    pub fn new() -> Self {
6333        std::default::Default::default()
6334    }
6335
6336    /// Sets the value of [instance][crate::model::SqlInstancesGetRequest::instance].
6337    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6338        self.instance = v.into();
6339        self
6340    }
6341
6342    /// Sets the value of [project][crate::model::SqlInstancesGetRequest::project].
6343    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6344        self.project = v.into();
6345        self
6346    }
6347}
6348
6349impl wkt::message::Message for SqlInstancesGetRequest {
6350    fn typename() -> &'static str {
6351        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesGetRequest"
6352    }
6353}
6354
6355#[doc(hidden)]
6356impl<'de> serde::de::Deserialize<'de> for SqlInstancesGetRequest {
6357    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6358    where
6359        D: serde::Deserializer<'de>,
6360    {
6361        #[allow(non_camel_case_types)]
6362        #[doc(hidden)]
6363        #[derive(PartialEq, Eq, Hash)]
6364        enum __FieldTag {
6365            __instance,
6366            __project,
6367            Unknown(std::string::String),
6368        }
6369        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6370            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6371            where
6372                D: serde::Deserializer<'de>,
6373            {
6374                struct Visitor;
6375                impl<'de> serde::de::Visitor<'de> for Visitor {
6376                    type Value = __FieldTag;
6377                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6378                        formatter.write_str("a field name for SqlInstancesGetRequest")
6379                    }
6380                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6381                    where
6382                        E: serde::de::Error,
6383                    {
6384                        use std::result::Result::Ok;
6385                        use std::string::ToString;
6386                        match value {
6387                            "instance" => Ok(__FieldTag::__instance),
6388                            "project" => Ok(__FieldTag::__project),
6389                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6390                        }
6391                    }
6392                }
6393                deserializer.deserialize_identifier(Visitor)
6394            }
6395        }
6396        struct Visitor;
6397        impl<'de> serde::de::Visitor<'de> for Visitor {
6398            type Value = SqlInstancesGetRequest;
6399            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6400                formatter.write_str("struct SqlInstancesGetRequest")
6401            }
6402            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6403            where
6404                A: serde::de::MapAccess<'de>,
6405            {
6406                #[allow(unused_imports)]
6407                use serde::de::Error;
6408                use std::option::Option::Some;
6409                let mut fields = std::collections::HashSet::new();
6410                let mut result = Self::Value::new();
6411                while let Some(tag) = map.next_key::<__FieldTag>()? {
6412                    #[allow(clippy::match_single_binding)]
6413                    match tag {
6414                        __FieldTag::__instance => {
6415                            if !fields.insert(__FieldTag::__instance) {
6416                                return std::result::Result::Err(A::Error::duplicate_field(
6417                                    "multiple values for instance",
6418                                ));
6419                            }
6420                            result.instance = map
6421                                .next_value::<std::option::Option<std::string::String>>()?
6422                                .unwrap_or_default();
6423                        }
6424                        __FieldTag::__project => {
6425                            if !fields.insert(__FieldTag::__project) {
6426                                return std::result::Result::Err(A::Error::duplicate_field(
6427                                    "multiple values for project",
6428                                ));
6429                            }
6430                            result.project = map
6431                                .next_value::<std::option::Option<std::string::String>>()?
6432                                .unwrap_or_default();
6433                        }
6434                        __FieldTag::Unknown(key) => {
6435                            let value = map.next_value::<serde_json::Value>()?;
6436                            result._unknown_fields.insert(key, value);
6437                        }
6438                    }
6439                }
6440                std::result::Result::Ok(result)
6441            }
6442        }
6443        deserializer.deserialize_any(Visitor)
6444    }
6445}
6446
6447#[doc(hidden)]
6448impl serde::ser::Serialize for SqlInstancesGetRequest {
6449    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6450    where
6451        S: serde::ser::Serializer,
6452    {
6453        use serde::ser::SerializeMap;
6454        #[allow(unused_imports)]
6455        use std::option::Option::Some;
6456        let mut state = serializer.serialize_map(std::option::Option::None)?;
6457        if !self.instance.is_empty() {
6458            state.serialize_entry("instance", &self.instance)?;
6459        }
6460        if !self.project.is_empty() {
6461            state.serialize_entry("project", &self.project)?;
6462        }
6463        if !self._unknown_fields.is_empty() {
6464            for (key, value) in self._unknown_fields.iter() {
6465                state.serialize_entry(key, &value)?;
6466            }
6467        }
6468        state.end()
6469    }
6470}
6471
6472impl std::fmt::Debug for SqlInstancesGetRequest {
6473    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6474        let mut debug_struct = f.debug_struct("SqlInstancesGetRequest");
6475        debug_struct.field("instance", &self.instance);
6476        debug_struct.field("project", &self.project);
6477        if !self._unknown_fields.is_empty() {
6478            debug_struct.field("_unknown_fields", &self._unknown_fields);
6479        }
6480        debug_struct.finish()
6481    }
6482}
6483
6484/// Instance import request.
6485#[derive(Clone, Default, PartialEq)]
6486#[non_exhaustive]
6487pub struct SqlInstancesImportRequest {
6488    /// Cloud SQL instance ID. This does not include the project ID.
6489    pub instance: std::string::String,
6490
6491    /// Project ID of the project that contains the instance.
6492    pub project: std::string::String,
6493
6494    pub body: std::option::Option<crate::model::InstancesImportRequest>,
6495
6496    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6497}
6498
6499impl SqlInstancesImportRequest {
6500    pub fn new() -> Self {
6501        std::default::Default::default()
6502    }
6503
6504    /// Sets the value of [instance][crate::model::SqlInstancesImportRequest::instance].
6505    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6506        self.instance = v.into();
6507        self
6508    }
6509
6510    /// Sets the value of [project][crate::model::SqlInstancesImportRequest::project].
6511    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6512        self.project = v.into();
6513        self
6514    }
6515
6516    /// Sets the value of [body][crate::model::SqlInstancesImportRequest::body].
6517    pub fn set_body<T>(mut self, v: T) -> Self
6518    where
6519        T: std::convert::Into<crate::model::InstancesImportRequest>,
6520    {
6521        self.body = std::option::Option::Some(v.into());
6522        self
6523    }
6524
6525    /// Sets or clears the value of [body][crate::model::SqlInstancesImportRequest::body].
6526    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
6527    where
6528        T: std::convert::Into<crate::model::InstancesImportRequest>,
6529    {
6530        self.body = v.map(|x| x.into());
6531        self
6532    }
6533}
6534
6535impl wkt::message::Message for SqlInstancesImportRequest {
6536    fn typename() -> &'static str {
6537        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesImportRequest"
6538    }
6539}
6540
6541#[doc(hidden)]
6542impl<'de> serde::de::Deserialize<'de> for SqlInstancesImportRequest {
6543    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6544    where
6545        D: serde::Deserializer<'de>,
6546    {
6547        #[allow(non_camel_case_types)]
6548        #[doc(hidden)]
6549        #[derive(PartialEq, Eq, Hash)]
6550        enum __FieldTag {
6551            __instance,
6552            __project,
6553            __body,
6554            Unknown(std::string::String),
6555        }
6556        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6557            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6558            where
6559                D: serde::Deserializer<'de>,
6560            {
6561                struct Visitor;
6562                impl<'de> serde::de::Visitor<'de> for Visitor {
6563                    type Value = __FieldTag;
6564                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6565                        formatter.write_str("a field name for SqlInstancesImportRequest")
6566                    }
6567                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6568                    where
6569                        E: serde::de::Error,
6570                    {
6571                        use std::result::Result::Ok;
6572                        use std::string::ToString;
6573                        match value {
6574                            "instance" => Ok(__FieldTag::__instance),
6575                            "project" => Ok(__FieldTag::__project),
6576                            "body" => Ok(__FieldTag::__body),
6577                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6578                        }
6579                    }
6580                }
6581                deserializer.deserialize_identifier(Visitor)
6582            }
6583        }
6584        struct Visitor;
6585        impl<'de> serde::de::Visitor<'de> for Visitor {
6586            type Value = SqlInstancesImportRequest;
6587            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6588                formatter.write_str("struct SqlInstancesImportRequest")
6589            }
6590            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6591            where
6592                A: serde::de::MapAccess<'de>,
6593            {
6594                #[allow(unused_imports)]
6595                use serde::de::Error;
6596                use std::option::Option::Some;
6597                let mut fields = std::collections::HashSet::new();
6598                let mut result = Self::Value::new();
6599                while let Some(tag) = map.next_key::<__FieldTag>()? {
6600                    #[allow(clippy::match_single_binding)]
6601                    match tag {
6602                        __FieldTag::__instance => {
6603                            if !fields.insert(__FieldTag::__instance) {
6604                                return std::result::Result::Err(A::Error::duplicate_field(
6605                                    "multiple values for instance",
6606                                ));
6607                            }
6608                            result.instance = map
6609                                .next_value::<std::option::Option<std::string::String>>()?
6610                                .unwrap_or_default();
6611                        }
6612                        __FieldTag::__project => {
6613                            if !fields.insert(__FieldTag::__project) {
6614                                return std::result::Result::Err(A::Error::duplicate_field(
6615                                    "multiple values for project",
6616                                ));
6617                            }
6618                            result.project = map
6619                                .next_value::<std::option::Option<std::string::String>>()?
6620                                .unwrap_or_default();
6621                        }
6622                        __FieldTag::__body => {
6623                            if !fields.insert(__FieldTag::__body) {
6624                                return std::result::Result::Err(A::Error::duplicate_field(
6625                                    "multiple values for body",
6626                                ));
6627                            }
6628                            result.body = map.next_value::<std::option::Option<crate::model::InstancesImportRequest>>()?
6629                                ;
6630                        }
6631                        __FieldTag::Unknown(key) => {
6632                            let value = map.next_value::<serde_json::Value>()?;
6633                            result._unknown_fields.insert(key, value);
6634                        }
6635                    }
6636                }
6637                std::result::Result::Ok(result)
6638            }
6639        }
6640        deserializer.deserialize_any(Visitor)
6641    }
6642}
6643
6644#[doc(hidden)]
6645impl serde::ser::Serialize for SqlInstancesImportRequest {
6646    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6647    where
6648        S: serde::ser::Serializer,
6649    {
6650        use serde::ser::SerializeMap;
6651        #[allow(unused_imports)]
6652        use std::option::Option::Some;
6653        let mut state = serializer.serialize_map(std::option::Option::None)?;
6654        if !self.instance.is_empty() {
6655            state.serialize_entry("instance", &self.instance)?;
6656        }
6657        if !self.project.is_empty() {
6658            state.serialize_entry("project", &self.project)?;
6659        }
6660        if self.body.is_some() {
6661            state.serialize_entry("body", &self.body)?;
6662        }
6663        if !self._unknown_fields.is_empty() {
6664            for (key, value) in self._unknown_fields.iter() {
6665                state.serialize_entry(key, &value)?;
6666            }
6667        }
6668        state.end()
6669    }
6670}
6671
6672impl std::fmt::Debug for SqlInstancesImportRequest {
6673    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6674        let mut debug_struct = f.debug_struct("SqlInstancesImportRequest");
6675        debug_struct.field("instance", &self.instance);
6676        debug_struct.field("project", &self.project);
6677        debug_struct.field("body", &self.body);
6678        if !self._unknown_fields.is_empty() {
6679            debug_struct.field("_unknown_fields", &self._unknown_fields);
6680        }
6681        debug_struct.finish()
6682    }
6683}
6684
6685/// Instance insert request.
6686#[derive(Clone, Default, PartialEq)]
6687#[non_exhaustive]
6688pub struct SqlInstancesInsertRequest {
6689    /// Project ID of the project to which the newly created Cloud SQL instances
6690    /// should belong.
6691    pub project: std::string::String,
6692
6693    pub body: std::option::Option<crate::model::DatabaseInstance>,
6694
6695    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6696}
6697
6698impl SqlInstancesInsertRequest {
6699    pub fn new() -> Self {
6700        std::default::Default::default()
6701    }
6702
6703    /// Sets the value of [project][crate::model::SqlInstancesInsertRequest::project].
6704    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6705        self.project = v.into();
6706        self
6707    }
6708
6709    /// Sets the value of [body][crate::model::SqlInstancesInsertRequest::body].
6710    pub fn set_body<T>(mut self, v: T) -> Self
6711    where
6712        T: std::convert::Into<crate::model::DatabaseInstance>,
6713    {
6714        self.body = std::option::Option::Some(v.into());
6715        self
6716    }
6717
6718    /// Sets or clears the value of [body][crate::model::SqlInstancesInsertRequest::body].
6719    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
6720    where
6721        T: std::convert::Into<crate::model::DatabaseInstance>,
6722    {
6723        self.body = v.map(|x| x.into());
6724        self
6725    }
6726}
6727
6728impl wkt::message::Message for SqlInstancesInsertRequest {
6729    fn typename() -> &'static str {
6730        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesInsertRequest"
6731    }
6732}
6733
6734#[doc(hidden)]
6735impl<'de> serde::de::Deserialize<'de> for SqlInstancesInsertRequest {
6736    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6737    where
6738        D: serde::Deserializer<'de>,
6739    {
6740        #[allow(non_camel_case_types)]
6741        #[doc(hidden)]
6742        #[derive(PartialEq, Eq, Hash)]
6743        enum __FieldTag {
6744            __project,
6745            __body,
6746            Unknown(std::string::String),
6747        }
6748        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6749            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6750            where
6751                D: serde::Deserializer<'de>,
6752            {
6753                struct Visitor;
6754                impl<'de> serde::de::Visitor<'de> for Visitor {
6755                    type Value = __FieldTag;
6756                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6757                        formatter.write_str("a field name for SqlInstancesInsertRequest")
6758                    }
6759                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6760                    where
6761                        E: serde::de::Error,
6762                    {
6763                        use std::result::Result::Ok;
6764                        use std::string::ToString;
6765                        match value {
6766                            "project" => Ok(__FieldTag::__project),
6767                            "body" => Ok(__FieldTag::__body),
6768                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6769                        }
6770                    }
6771                }
6772                deserializer.deserialize_identifier(Visitor)
6773            }
6774        }
6775        struct Visitor;
6776        impl<'de> serde::de::Visitor<'de> for Visitor {
6777            type Value = SqlInstancesInsertRequest;
6778            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6779                formatter.write_str("struct SqlInstancesInsertRequest")
6780            }
6781            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6782            where
6783                A: serde::de::MapAccess<'de>,
6784            {
6785                #[allow(unused_imports)]
6786                use serde::de::Error;
6787                use std::option::Option::Some;
6788                let mut fields = std::collections::HashSet::new();
6789                let mut result = Self::Value::new();
6790                while let Some(tag) = map.next_key::<__FieldTag>()? {
6791                    #[allow(clippy::match_single_binding)]
6792                    match tag {
6793                        __FieldTag::__project => {
6794                            if !fields.insert(__FieldTag::__project) {
6795                                return std::result::Result::Err(A::Error::duplicate_field(
6796                                    "multiple values for project",
6797                                ));
6798                            }
6799                            result.project = map
6800                                .next_value::<std::option::Option<std::string::String>>()?
6801                                .unwrap_or_default();
6802                        }
6803                        __FieldTag::__body => {
6804                            if !fields.insert(__FieldTag::__body) {
6805                                return std::result::Result::Err(A::Error::duplicate_field(
6806                                    "multiple values for body",
6807                                ));
6808                            }
6809                            result.body = map
6810                                .next_value::<std::option::Option<crate::model::DatabaseInstance>>(
6811                                )?;
6812                        }
6813                        __FieldTag::Unknown(key) => {
6814                            let value = map.next_value::<serde_json::Value>()?;
6815                            result._unknown_fields.insert(key, value);
6816                        }
6817                    }
6818                }
6819                std::result::Result::Ok(result)
6820            }
6821        }
6822        deserializer.deserialize_any(Visitor)
6823    }
6824}
6825
6826#[doc(hidden)]
6827impl serde::ser::Serialize for SqlInstancesInsertRequest {
6828    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6829    where
6830        S: serde::ser::Serializer,
6831    {
6832        use serde::ser::SerializeMap;
6833        #[allow(unused_imports)]
6834        use std::option::Option::Some;
6835        let mut state = serializer.serialize_map(std::option::Option::None)?;
6836        if !self.project.is_empty() {
6837            state.serialize_entry("project", &self.project)?;
6838        }
6839        if self.body.is_some() {
6840            state.serialize_entry("body", &self.body)?;
6841        }
6842        if !self._unknown_fields.is_empty() {
6843            for (key, value) in self._unknown_fields.iter() {
6844                state.serialize_entry(key, &value)?;
6845            }
6846        }
6847        state.end()
6848    }
6849}
6850
6851impl std::fmt::Debug for SqlInstancesInsertRequest {
6852    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6853        let mut debug_struct = f.debug_struct("SqlInstancesInsertRequest");
6854        debug_struct.field("project", &self.project);
6855        debug_struct.field("body", &self.body);
6856        if !self._unknown_fields.is_empty() {
6857            debug_struct.field("_unknown_fields", &self._unknown_fields);
6858        }
6859        debug_struct.finish()
6860    }
6861}
6862
6863/// Instance list request.
6864#[derive(Clone, Default, PartialEq)]
6865#[non_exhaustive]
6866pub struct SqlInstancesListRequest {
6867    /// A filter expression that filters resources listed in the response.
6868    /// The expression is in the form of field:value. For example,
6869    /// 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per
6870    /// their JSON representation, such as 'settings.userLabels.auto_start:true'.
6871    ///
6872    /// Multiple filter queries are space-separated. For example.
6873    /// 'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each
6874    /// expression is an AND expression. However, you can include AND and OR
6875    /// expressions explicitly.
6876    pub filter: std::string::String,
6877
6878    /// The maximum number of instances to return. The service may return fewer
6879    /// than this value.
6880    /// If unspecified, at most 500 instances are returned.
6881    /// The maximum value is 1000; values above 1000 are coerced to 1000.
6882    pub max_results: u32,
6883
6884    /// A previously-returned page token representing part of the larger set of
6885    /// results to view.
6886    pub page_token: std::string::String,
6887
6888    /// Project ID of the project for which to list Cloud SQL instances.
6889    pub project: std::string::String,
6890
6891    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6892}
6893
6894impl SqlInstancesListRequest {
6895    pub fn new() -> Self {
6896        std::default::Default::default()
6897    }
6898
6899    /// Sets the value of [filter][crate::model::SqlInstancesListRequest::filter].
6900    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6901        self.filter = v.into();
6902        self
6903    }
6904
6905    /// Sets the value of [max_results][crate::model::SqlInstancesListRequest::max_results].
6906    pub fn set_max_results<T: std::convert::Into<u32>>(mut self, v: T) -> Self {
6907        self.max_results = v.into();
6908        self
6909    }
6910
6911    /// Sets the value of [page_token][crate::model::SqlInstancesListRequest::page_token].
6912    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6913        self.page_token = v.into();
6914        self
6915    }
6916
6917    /// Sets the value of [project][crate::model::SqlInstancesListRequest::project].
6918    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6919        self.project = v.into();
6920        self
6921    }
6922}
6923
6924impl wkt::message::Message for SqlInstancesListRequest {
6925    fn typename() -> &'static str {
6926        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesListRequest"
6927    }
6928}
6929
6930#[doc(hidden)]
6931impl<'de> serde::de::Deserialize<'de> for SqlInstancesListRequest {
6932    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6933    where
6934        D: serde::Deserializer<'de>,
6935    {
6936        #[allow(non_camel_case_types)]
6937        #[doc(hidden)]
6938        #[derive(PartialEq, Eq, Hash)]
6939        enum __FieldTag {
6940            __filter,
6941            __max_results,
6942            __page_token,
6943            __project,
6944            Unknown(std::string::String),
6945        }
6946        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6947            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6948            where
6949                D: serde::Deserializer<'de>,
6950            {
6951                struct Visitor;
6952                impl<'de> serde::de::Visitor<'de> for Visitor {
6953                    type Value = __FieldTag;
6954                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6955                        formatter.write_str("a field name for SqlInstancesListRequest")
6956                    }
6957                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6958                    where
6959                        E: serde::de::Error,
6960                    {
6961                        use std::result::Result::Ok;
6962                        use std::string::ToString;
6963                        match value {
6964                            "filter" => Ok(__FieldTag::__filter),
6965                            "maxResults" => Ok(__FieldTag::__max_results),
6966                            "max_results" => Ok(__FieldTag::__max_results),
6967                            "pageToken" => Ok(__FieldTag::__page_token),
6968                            "page_token" => Ok(__FieldTag::__page_token),
6969                            "project" => Ok(__FieldTag::__project),
6970                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6971                        }
6972                    }
6973                }
6974                deserializer.deserialize_identifier(Visitor)
6975            }
6976        }
6977        struct Visitor;
6978        impl<'de> serde::de::Visitor<'de> for Visitor {
6979            type Value = SqlInstancesListRequest;
6980            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6981                formatter.write_str("struct SqlInstancesListRequest")
6982            }
6983            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6984            where
6985                A: serde::de::MapAccess<'de>,
6986            {
6987                #[allow(unused_imports)]
6988                use serde::de::Error;
6989                use std::option::Option::Some;
6990                let mut fields = std::collections::HashSet::new();
6991                let mut result = Self::Value::new();
6992                while let Some(tag) = map.next_key::<__FieldTag>()? {
6993                    #[allow(clippy::match_single_binding)]
6994                    match tag {
6995                        __FieldTag::__filter => {
6996                            if !fields.insert(__FieldTag::__filter) {
6997                                return std::result::Result::Err(A::Error::duplicate_field(
6998                                    "multiple values for filter",
6999                                ));
7000                            }
7001                            result.filter = map
7002                                .next_value::<std::option::Option<std::string::String>>()?
7003                                .unwrap_or_default();
7004                        }
7005                        __FieldTag::__max_results => {
7006                            if !fields.insert(__FieldTag::__max_results) {
7007                                return std::result::Result::Err(A::Error::duplicate_field(
7008                                    "multiple values for max_results",
7009                                ));
7010                            }
7011                            struct __With(std::option::Option<u32>);
7012                            impl<'de> serde::de::Deserialize<'de> for __With {
7013                                fn deserialize<D>(
7014                                    deserializer: D,
7015                                ) -> std::result::Result<Self, D::Error>
7016                                where
7017                                    D: serde::de::Deserializer<'de>,
7018                                {
7019                                    serde_with::As::< std::option::Option<wkt::internal::U32> >::deserialize(deserializer).map(__With)
7020                                }
7021                            }
7022                            result.max_results = map.next_value::<__With>()?.0.unwrap_or_default();
7023                        }
7024                        __FieldTag::__page_token => {
7025                            if !fields.insert(__FieldTag::__page_token) {
7026                                return std::result::Result::Err(A::Error::duplicate_field(
7027                                    "multiple values for page_token",
7028                                ));
7029                            }
7030                            result.page_token = map
7031                                .next_value::<std::option::Option<std::string::String>>()?
7032                                .unwrap_or_default();
7033                        }
7034                        __FieldTag::__project => {
7035                            if !fields.insert(__FieldTag::__project) {
7036                                return std::result::Result::Err(A::Error::duplicate_field(
7037                                    "multiple values for project",
7038                                ));
7039                            }
7040                            result.project = map
7041                                .next_value::<std::option::Option<std::string::String>>()?
7042                                .unwrap_or_default();
7043                        }
7044                        __FieldTag::Unknown(key) => {
7045                            let value = map.next_value::<serde_json::Value>()?;
7046                            result._unknown_fields.insert(key, value);
7047                        }
7048                    }
7049                }
7050                std::result::Result::Ok(result)
7051            }
7052        }
7053        deserializer.deserialize_any(Visitor)
7054    }
7055}
7056
7057#[doc(hidden)]
7058impl serde::ser::Serialize for SqlInstancesListRequest {
7059    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7060    where
7061        S: serde::ser::Serializer,
7062    {
7063        use serde::ser::SerializeMap;
7064        #[allow(unused_imports)]
7065        use std::option::Option::Some;
7066        let mut state = serializer.serialize_map(std::option::Option::None)?;
7067        if !self.filter.is_empty() {
7068            state.serialize_entry("filter", &self.filter)?;
7069        }
7070        if !wkt::internal::is_default(&self.max_results) {
7071            struct __With<'a>(&'a u32);
7072            impl<'a> serde::ser::Serialize for __With<'a> {
7073                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7074                where
7075                    S: serde::ser::Serializer,
7076                {
7077                    serde_with::As::<wkt::internal::U32>::serialize(self.0, serializer)
7078                }
7079            }
7080            state.serialize_entry("maxResults", &__With(&self.max_results))?;
7081        }
7082        if !self.page_token.is_empty() {
7083            state.serialize_entry("pageToken", &self.page_token)?;
7084        }
7085        if !self.project.is_empty() {
7086            state.serialize_entry("project", &self.project)?;
7087        }
7088        if !self._unknown_fields.is_empty() {
7089            for (key, value) in self._unknown_fields.iter() {
7090                state.serialize_entry(key, &value)?;
7091            }
7092        }
7093        state.end()
7094    }
7095}
7096
7097impl std::fmt::Debug for SqlInstancesListRequest {
7098    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7099        let mut debug_struct = f.debug_struct("SqlInstancesListRequest");
7100        debug_struct.field("filter", &self.filter);
7101        debug_struct.field("max_results", &self.max_results);
7102        debug_struct.field("page_token", &self.page_token);
7103        debug_struct.field("project", &self.project);
7104        if !self._unknown_fields.is_empty() {
7105            debug_struct.field("_unknown_fields", &self._unknown_fields);
7106        }
7107        debug_struct.finish()
7108    }
7109}
7110
7111/// Instance list server CAs request.
7112#[derive(Clone, Default, PartialEq)]
7113#[non_exhaustive]
7114pub struct SqlInstancesListServerCasRequest {
7115    /// Cloud SQL instance ID. This does not include the project ID.
7116    pub instance: std::string::String,
7117
7118    /// Project ID of the project that contains the instance.
7119    pub project: std::string::String,
7120
7121    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7122}
7123
7124impl SqlInstancesListServerCasRequest {
7125    pub fn new() -> Self {
7126        std::default::Default::default()
7127    }
7128
7129    /// Sets the value of [instance][crate::model::SqlInstancesListServerCasRequest::instance].
7130    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7131        self.instance = v.into();
7132        self
7133    }
7134
7135    /// Sets the value of [project][crate::model::SqlInstancesListServerCasRequest::project].
7136    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7137        self.project = v.into();
7138        self
7139    }
7140}
7141
7142impl wkt::message::Message for SqlInstancesListServerCasRequest {
7143    fn typename() -> &'static str {
7144        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesListServerCasRequest"
7145    }
7146}
7147
7148#[doc(hidden)]
7149impl<'de> serde::de::Deserialize<'de> for SqlInstancesListServerCasRequest {
7150    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7151    where
7152        D: serde::Deserializer<'de>,
7153    {
7154        #[allow(non_camel_case_types)]
7155        #[doc(hidden)]
7156        #[derive(PartialEq, Eq, Hash)]
7157        enum __FieldTag {
7158            __instance,
7159            __project,
7160            Unknown(std::string::String),
7161        }
7162        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7163            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7164            where
7165                D: serde::Deserializer<'de>,
7166            {
7167                struct Visitor;
7168                impl<'de> serde::de::Visitor<'de> for Visitor {
7169                    type Value = __FieldTag;
7170                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7171                        formatter.write_str("a field name for SqlInstancesListServerCasRequest")
7172                    }
7173                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7174                    where
7175                        E: serde::de::Error,
7176                    {
7177                        use std::result::Result::Ok;
7178                        use std::string::ToString;
7179                        match value {
7180                            "instance" => Ok(__FieldTag::__instance),
7181                            "project" => Ok(__FieldTag::__project),
7182                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7183                        }
7184                    }
7185                }
7186                deserializer.deserialize_identifier(Visitor)
7187            }
7188        }
7189        struct Visitor;
7190        impl<'de> serde::de::Visitor<'de> for Visitor {
7191            type Value = SqlInstancesListServerCasRequest;
7192            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7193                formatter.write_str("struct SqlInstancesListServerCasRequest")
7194            }
7195            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7196            where
7197                A: serde::de::MapAccess<'de>,
7198            {
7199                #[allow(unused_imports)]
7200                use serde::de::Error;
7201                use std::option::Option::Some;
7202                let mut fields = std::collections::HashSet::new();
7203                let mut result = Self::Value::new();
7204                while let Some(tag) = map.next_key::<__FieldTag>()? {
7205                    #[allow(clippy::match_single_binding)]
7206                    match tag {
7207                        __FieldTag::__instance => {
7208                            if !fields.insert(__FieldTag::__instance) {
7209                                return std::result::Result::Err(A::Error::duplicate_field(
7210                                    "multiple values for instance",
7211                                ));
7212                            }
7213                            result.instance = map
7214                                .next_value::<std::option::Option<std::string::String>>()?
7215                                .unwrap_or_default();
7216                        }
7217                        __FieldTag::__project => {
7218                            if !fields.insert(__FieldTag::__project) {
7219                                return std::result::Result::Err(A::Error::duplicate_field(
7220                                    "multiple values for project",
7221                                ));
7222                            }
7223                            result.project = map
7224                                .next_value::<std::option::Option<std::string::String>>()?
7225                                .unwrap_or_default();
7226                        }
7227                        __FieldTag::Unknown(key) => {
7228                            let value = map.next_value::<serde_json::Value>()?;
7229                            result._unknown_fields.insert(key, value);
7230                        }
7231                    }
7232                }
7233                std::result::Result::Ok(result)
7234            }
7235        }
7236        deserializer.deserialize_any(Visitor)
7237    }
7238}
7239
7240#[doc(hidden)]
7241impl serde::ser::Serialize for SqlInstancesListServerCasRequest {
7242    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7243    where
7244        S: serde::ser::Serializer,
7245    {
7246        use serde::ser::SerializeMap;
7247        #[allow(unused_imports)]
7248        use std::option::Option::Some;
7249        let mut state = serializer.serialize_map(std::option::Option::None)?;
7250        if !self.instance.is_empty() {
7251            state.serialize_entry("instance", &self.instance)?;
7252        }
7253        if !self.project.is_empty() {
7254            state.serialize_entry("project", &self.project)?;
7255        }
7256        if !self._unknown_fields.is_empty() {
7257            for (key, value) in self._unknown_fields.iter() {
7258                state.serialize_entry(key, &value)?;
7259            }
7260        }
7261        state.end()
7262    }
7263}
7264
7265impl std::fmt::Debug for SqlInstancesListServerCasRequest {
7266    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7267        let mut debug_struct = f.debug_struct("SqlInstancesListServerCasRequest");
7268        debug_struct.field("instance", &self.instance);
7269        debug_struct.field("project", &self.project);
7270        if !self._unknown_fields.is_empty() {
7271            debug_struct.field("_unknown_fields", &self._unknown_fields);
7272        }
7273        debug_struct.finish()
7274    }
7275}
7276
7277/// Instance patch request.
7278#[derive(Clone, Default, PartialEq)]
7279#[non_exhaustive]
7280pub struct SqlInstancesPatchRequest {
7281    /// Cloud SQL instance ID. This does not include the project ID.
7282    pub instance: std::string::String,
7283
7284    /// Project ID of the project that contains the instance.
7285    pub project: std::string::String,
7286
7287    pub body: std::option::Option<crate::model::DatabaseInstance>,
7288
7289    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7290}
7291
7292impl SqlInstancesPatchRequest {
7293    pub fn new() -> Self {
7294        std::default::Default::default()
7295    }
7296
7297    /// Sets the value of [instance][crate::model::SqlInstancesPatchRequest::instance].
7298    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7299        self.instance = v.into();
7300        self
7301    }
7302
7303    /// Sets the value of [project][crate::model::SqlInstancesPatchRequest::project].
7304    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7305        self.project = v.into();
7306        self
7307    }
7308
7309    /// Sets the value of [body][crate::model::SqlInstancesPatchRequest::body].
7310    pub fn set_body<T>(mut self, v: T) -> Self
7311    where
7312        T: std::convert::Into<crate::model::DatabaseInstance>,
7313    {
7314        self.body = std::option::Option::Some(v.into());
7315        self
7316    }
7317
7318    /// Sets or clears the value of [body][crate::model::SqlInstancesPatchRequest::body].
7319    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
7320    where
7321        T: std::convert::Into<crate::model::DatabaseInstance>,
7322    {
7323        self.body = v.map(|x| x.into());
7324        self
7325    }
7326}
7327
7328impl wkt::message::Message for SqlInstancesPatchRequest {
7329    fn typename() -> &'static str {
7330        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesPatchRequest"
7331    }
7332}
7333
7334#[doc(hidden)]
7335impl<'de> serde::de::Deserialize<'de> for SqlInstancesPatchRequest {
7336    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7337    where
7338        D: serde::Deserializer<'de>,
7339    {
7340        #[allow(non_camel_case_types)]
7341        #[doc(hidden)]
7342        #[derive(PartialEq, Eq, Hash)]
7343        enum __FieldTag {
7344            __instance,
7345            __project,
7346            __body,
7347            Unknown(std::string::String),
7348        }
7349        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7350            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7351            where
7352                D: serde::Deserializer<'de>,
7353            {
7354                struct Visitor;
7355                impl<'de> serde::de::Visitor<'de> for Visitor {
7356                    type Value = __FieldTag;
7357                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7358                        formatter.write_str("a field name for SqlInstancesPatchRequest")
7359                    }
7360                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7361                    where
7362                        E: serde::de::Error,
7363                    {
7364                        use std::result::Result::Ok;
7365                        use std::string::ToString;
7366                        match value {
7367                            "instance" => Ok(__FieldTag::__instance),
7368                            "project" => Ok(__FieldTag::__project),
7369                            "body" => Ok(__FieldTag::__body),
7370                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7371                        }
7372                    }
7373                }
7374                deserializer.deserialize_identifier(Visitor)
7375            }
7376        }
7377        struct Visitor;
7378        impl<'de> serde::de::Visitor<'de> for Visitor {
7379            type Value = SqlInstancesPatchRequest;
7380            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7381                formatter.write_str("struct SqlInstancesPatchRequest")
7382            }
7383            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7384            where
7385                A: serde::de::MapAccess<'de>,
7386            {
7387                #[allow(unused_imports)]
7388                use serde::de::Error;
7389                use std::option::Option::Some;
7390                let mut fields = std::collections::HashSet::new();
7391                let mut result = Self::Value::new();
7392                while let Some(tag) = map.next_key::<__FieldTag>()? {
7393                    #[allow(clippy::match_single_binding)]
7394                    match tag {
7395                        __FieldTag::__instance => {
7396                            if !fields.insert(__FieldTag::__instance) {
7397                                return std::result::Result::Err(A::Error::duplicate_field(
7398                                    "multiple values for instance",
7399                                ));
7400                            }
7401                            result.instance = map
7402                                .next_value::<std::option::Option<std::string::String>>()?
7403                                .unwrap_or_default();
7404                        }
7405                        __FieldTag::__project => {
7406                            if !fields.insert(__FieldTag::__project) {
7407                                return std::result::Result::Err(A::Error::duplicate_field(
7408                                    "multiple values for project",
7409                                ));
7410                            }
7411                            result.project = map
7412                                .next_value::<std::option::Option<std::string::String>>()?
7413                                .unwrap_or_default();
7414                        }
7415                        __FieldTag::__body => {
7416                            if !fields.insert(__FieldTag::__body) {
7417                                return std::result::Result::Err(A::Error::duplicate_field(
7418                                    "multiple values for body",
7419                                ));
7420                            }
7421                            result.body = map
7422                                .next_value::<std::option::Option<crate::model::DatabaseInstance>>(
7423                                )?;
7424                        }
7425                        __FieldTag::Unknown(key) => {
7426                            let value = map.next_value::<serde_json::Value>()?;
7427                            result._unknown_fields.insert(key, value);
7428                        }
7429                    }
7430                }
7431                std::result::Result::Ok(result)
7432            }
7433        }
7434        deserializer.deserialize_any(Visitor)
7435    }
7436}
7437
7438#[doc(hidden)]
7439impl serde::ser::Serialize for SqlInstancesPatchRequest {
7440    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7441    where
7442        S: serde::ser::Serializer,
7443    {
7444        use serde::ser::SerializeMap;
7445        #[allow(unused_imports)]
7446        use std::option::Option::Some;
7447        let mut state = serializer.serialize_map(std::option::Option::None)?;
7448        if !self.instance.is_empty() {
7449            state.serialize_entry("instance", &self.instance)?;
7450        }
7451        if !self.project.is_empty() {
7452            state.serialize_entry("project", &self.project)?;
7453        }
7454        if self.body.is_some() {
7455            state.serialize_entry("body", &self.body)?;
7456        }
7457        if !self._unknown_fields.is_empty() {
7458            for (key, value) in self._unknown_fields.iter() {
7459                state.serialize_entry(key, &value)?;
7460            }
7461        }
7462        state.end()
7463    }
7464}
7465
7466impl std::fmt::Debug for SqlInstancesPatchRequest {
7467    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7468        let mut debug_struct = f.debug_struct("SqlInstancesPatchRequest");
7469        debug_struct.field("instance", &self.instance);
7470        debug_struct.field("project", &self.project);
7471        debug_struct.field("body", &self.body);
7472        if !self._unknown_fields.is_empty() {
7473            debug_struct.field("_unknown_fields", &self._unknown_fields);
7474        }
7475        debug_struct.finish()
7476    }
7477}
7478
7479/// Instance promote replica request.
7480#[derive(Clone, Default, PartialEq)]
7481#[non_exhaustive]
7482pub struct SqlInstancesPromoteReplicaRequest {
7483    /// Cloud SQL read replica instance name.
7484    pub instance: std::string::String,
7485
7486    /// ID of the project that contains the read replica.
7487    pub project: std::string::String,
7488
7489    /// Set to true to invoke a replica failover to the designated DR
7490    /// replica. As part of replica failover, the promote operation attempts
7491    /// to add the original primary instance as a replica of the promoted
7492    /// DR replica when the original primary instance comes back online.
7493    /// If set to false or not specified, then the original primary
7494    /// instance becomes an independent Cloud SQL primary instance.
7495    /// Only applicable to MySQL.
7496    pub failover: bool,
7497
7498    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7499}
7500
7501impl SqlInstancesPromoteReplicaRequest {
7502    pub fn new() -> Self {
7503        std::default::Default::default()
7504    }
7505
7506    /// Sets the value of [instance][crate::model::SqlInstancesPromoteReplicaRequest::instance].
7507    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7508        self.instance = v.into();
7509        self
7510    }
7511
7512    /// Sets the value of [project][crate::model::SqlInstancesPromoteReplicaRequest::project].
7513    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7514        self.project = v.into();
7515        self
7516    }
7517
7518    /// Sets the value of [failover][crate::model::SqlInstancesPromoteReplicaRequest::failover].
7519    pub fn set_failover<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7520        self.failover = v.into();
7521        self
7522    }
7523}
7524
7525impl wkt::message::Message for SqlInstancesPromoteReplicaRequest {
7526    fn typename() -> &'static str {
7527        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest"
7528    }
7529}
7530
7531#[doc(hidden)]
7532impl<'de> serde::de::Deserialize<'de> for SqlInstancesPromoteReplicaRequest {
7533    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7534    where
7535        D: serde::Deserializer<'de>,
7536    {
7537        #[allow(non_camel_case_types)]
7538        #[doc(hidden)]
7539        #[derive(PartialEq, Eq, Hash)]
7540        enum __FieldTag {
7541            __instance,
7542            __project,
7543            __failover,
7544            Unknown(std::string::String),
7545        }
7546        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7547            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7548            where
7549                D: serde::Deserializer<'de>,
7550            {
7551                struct Visitor;
7552                impl<'de> serde::de::Visitor<'de> for Visitor {
7553                    type Value = __FieldTag;
7554                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7555                        formatter.write_str("a field name for SqlInstancesPromoteReplicaRequest")
7556                    }
7557                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7558                    where
7559                        E: serde::de::Error,
7560                    {
7561                        use std::result::Result::Ok;
7562                        use std::string::ToString;
7563                        match value {
7564                            "instance" => Ok(__FieldTag::__instance),
7565                            "project" => Ok(__FieldTag::__project),
7566                            "failover" => Ok(__FieldTag::__failover),
7567                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7568                        }
7569                    }
7570                }
7571                deserializer.deserialize_identifier(Visitor)
7572            }
7573        }
7574        struct Visitor;
7575        impl<'de> serde::de::Visitor<'de> for Visitor {
7576            type Value = SqlInstancesPromoteReplicaRequest;
7577            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7578                formatter.write_str("struct SqlInstancesPromoteReplicaRequest")
7579            }
7580            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7581            where
7582                A: serde::de::MapAccess<'de>,
7583            {
7584                #[allow(unused_imports)]
7585                use serde::de::Error;
7586                use std::option::Option::Some;
7587                let mut fields = std::collections::HashSet::new();
7588                let mut result = Self::Value::new();
7589                while let Some(tag) = map.next_key::<__FieldTag>()? {
7590                    #[allow(clippy::match_single_binding)]
7591                    match tag {
7592                        __FieldTag::__instance => {
7593                            if !fields.insert(__FieldTag::__instance) {
7594                                return std::result::Result::Err(A::Error::duplicate_field(
7595                                    "multiple values for instance",
7596                                ));
7597                            }
7598                            result.instance = map
7599                                .next_value::<std::option::Option<std::string::String>>()?
7600                                .unwrap_or_default();
7601                        }
7602                        __FieldTag::__project => {
7603                            if !fields.insert(__FieldTag::__project) {
7604                                return std::result::Result::Err(A::Error::duplicate_field(
7605                                    "multiple values for project",
7606                                ));
7607                            }
7608                            result.project = map
7609                                .next_value::<std::option::Option<std::string::String>>()?
7610                                .unwrap_or_default();
7611                        }
7612                        __FieldTag::__failover => {
7613                            if !fields.insert(__FieldTag::__failover) {
7614                                return std::result::Result::Err(A::Error::duplicate_field(
7615                                    "multiple values for failover",
7616                                ));
7617                            }
7618                            result.failover = map
7619                                .next_value::<std::option::Option<bool>>()?
7620                                .unwrap_or_default();
7621                        }
7622                        __FieldTag::Unknown(key) => {
7623                            let value = map.next_value::<serde_json::Value>()?;
7624                            result._unknown_fields.insert(key, value);
7625                        }
7626                    }
7627                }
7628                std::result::Result::Ok(result)
7629            }
7630        }
7631        deserializer.deserialize_any(Visitor)
7632    }
7633}
7634
7635#[doc(hidden)]
7636impl serde::ser::Serialize for SqlInstancesPromoteReplicaRequest {
7637    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7638    where
7639        S: serde::ser::Serializer,
7640    {
7641        use serde::ser::SerializeMap;
7642        #[allow(unused_imports)]
7643        use std::option::Option::Some;
7644        let mut state = serializer.serialize_map(std::option::Option::None)?;
7645        if !self.instance.is_empty() {
7646            state.serialize_entry("instance", &self.instance)?;
7647        }
7648        if !self.project.is_empty() {
7649            state.serialize_entry("project", &self.project)?;
7650        }
7651        if !wkt::internal::is_default(&self.failover) {
7652            state.serialize_entry("failover", &self.failover)?;
7653        }
7654        if !self._unknown_fields.is_empty() {
7655            for (key, value) in self._unknown_fields.iter() {
7656                state.serialize_entry(key, &value)?;
7657            }
7658        }
7659        state.end()
7660    }
7661}
7662
7663impl std::fmt::Debug for SqlInstancesPromoteReplicaRequest {
7664    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7665        let mut debug_struct = f.debug_struct("SqlInstancesPromoteReplicaRequest");
7666        debug_struct.field("instance", &self.instance);
7667        debug_struct.field("project", &self.project);
7668        debug_struct.field("failover", &self.failover);
7669        if !self._unknown_fields.is_empty() {
7670            debug_struct.field("_unknown_fields", &self._unknown_fields);
7671        }
7672        debug_struct.finish()
7673    }
7674}
7675
7676/// Instance switchover request.
7677#[derive(Clone, Default, PartialEq)]
7678#[non_exhaustive]
7679pub struct SqlInstancesSwitchoverRequest {
7680    /// Cloud SQL read replica instance name.
7681    pub instance: std::string::String,
7682
7683    /// ID of the project that contains the replica.
7684    pub project: std::string::String,
7685
7686    /// Optional. (MySQL only) Cloud SQL instance operations timeout, which is a
7687    /// sum of all database operations. Default value is 10 minutes and can be
7688    /// modified to a maximum value of 24 hours.
7689    pub db_timeout: std::option::Option<wkt::Duration>,
7690
7691    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7692}
7693
7694impl SqlInstancesSwitchoverRequest {
7695    pub fn new() -> Self {
7696        std::default::Default::default()
7697    }
7698
7699    /// Sets the value of [instance][crate::model::SqlInstancesSwitchoverRequest::instance].
7700    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7701        self.instance = v.into();
7702        self
7703    }
7704
7705    /// Sets the value of [project][crate::model::SqlInstancesSwitchoverRequest::project].
7706    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7707        self.project = v.into();
7708        self
7709    }
7710
7711    /// Sets the value of [db_timeout][crate::model::SqlInstancesSwitchoverRequest::db_timeout].
7712    pub fn set_db_timeout<T>(mut self, v: T) -> Self
7713    where
7714        T: std::convert::Into<wkt::Duration>,
7715    {
7716        self.db_timeout = std::option::Option::Some(v.into());
7717        self
7718    }
7719
7720    /// Sets or clears the value of [db_timeout][crate::model::SqlInstancesSwitchoverRequest::db_timeout].
7721    pub fn set_or_clear_db_timeout<T>(mut self, v: std::option::Option<T>) -> Self
7722    where
7723        T: std::convert::Into<wkt::Duration>,
7724    {
7725        self.db_timeout = v.map(|x| x.into());
7726        self
7727    }
7728}
7729
7730impl wkt::message::Message for SqlInstancesSwitchoverRequest {
7731    fn typename() -> &'static str {
7732        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesSwitchoverRequest"
7733    }
7734}
7735
7736#[doc(hidden)]
7737impl<'de> serde::de::Deserialize<'de> for SqlInstancesSwitchoverRequest {
7738    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7739    where
7740        D: serde::Deserializer<'de>,
7741    {
7742        #[allow(non_camel_case_types)]
7743        #[doc(hidden)]
7744        #[derive(PartialEq, Eq, Hash)]
7745        enum __FieldTag {
7746            __instance,
7747            __project,
7748            __db_timeout,
7749            Unknown(std::string::String),
7750        }
7751        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7752            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7753            where
7754                D: serde::Deserializer<'de>,
7755            {
7756                struct Visitor;
7757                impl<'de> serde::de::Visitor<'de> for Visitor {
7758                    type Value = __FieldTag;
7759                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7760                        formatter.write_str("a field name for SqlInstancesSwitchoverRequest")
7761                    }
7762                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7763                    where
7764                        E: serde::de::Error,
7765                    {
7766                        use std::result::Result::Ok;
7767                        use std::string::ToString;
7768                        match value {
7769                            "instance" => Ok(__FieldTag::__instance),
7770                            "project" => Ok(__FieldTag::__project),
7771                            "dbTimeout" => Ok(__FieldTag::__db_timeout),
7772                            "db_timeout" => Ok(__FieldTag::__db_timeout),
7773                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7774                        }
7775                    }
7776                }
7777                deserializer.deserialize_identifier(Visitor)
7778            }
7779        }
7780        struct Visitor;
7781        impl<'de> serde::de::Visitor<'de> for Visitor {
7782            type Value = SqlInstancesSwitchoverRequest;
7783            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7784                formatter.write_str("struct SqlInstancesSwitchoverRequest")
7785            }
7786            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7787            where
7788                A: serde::de::MapAccess<'de>,
7789            {
7790                #[allow(unused_imports)]
7791                use serde::de::Error;
7792                use std::option::Option::Some;
7793                let mut fields = std::collections::HashSet::new();
7794                let mut result = Self::Value::new();
7795                while let Some(tag) = map.next_key::<__FieldTag>()? {
7796                    #[allow(clippy::match_single_binding)]
7797                    match tag {
7798                        __FieldTag::__instance => {
7799                            if !fields.insert(__FieldTag::__instance) {
7800                                return std::result::Result::Err(A::Error::duplicate_field(
7801                                    "multiple values for instance",
7802                                ));
7803                            }
7804                            result.instance = map
7805                                .next_value::<std::option::Option<std::string::String>>()?
7806                                .unwrap_or_default();
7807                        }
7808                        __FieldTag::__project => {
7809                            if !fields.insert(__FieldTag::__project) {
7810                                return std::result::Result::Err(A::Error::duplicate_field(
7811                                    "multiple values for project",
7812                                ));
7813                            }
7814                            result.project = map
7815                                .next_value::<std::option::Option<std::string::String>>()?
7816                                .unwrap_or_default();
7817                        }
7818                        __FieldTag::__db_timeout => {
7819                            if !fields.insert(__FieldTag::__db_timeout) {
7820                                return std::result::Result::Err(A::Error::duplicate_field(
7821                                    "multiple values for db_timeout",
7822                                ));
7823                            }
7824                            result.db_timeout =
7825                                map.next_value::<std::option::Option<wkt::Duration>>()?;
7826                        }
7827                        __FieldTag::Unknown(key) => {
7828                            let value = map.next_value::<serde_json::Value>()?;
7829                            result._unknown_fields.insert(key, value);
7830                        }
7831                    }
7832                }
7833                std::result::Result::Ok(result)
7834            }
7835        }
7836        deserializer.deserialize_any(Visitor)
7837    }
7838}
7839
7840#[doc(hidden)]
7841impl serde::ser::Serialize for SqlInstancesSwitchoverRequest {
7842    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7843    where
7844        S: serde::ser::Serializer,
7845    {
7846        use serde::ser::SerializeMap;
7847        #[allow(unused_imports)]
7848        use std::option::Option::Some;
7849        let mut state = serializer.serialize_map(std::option::Option::None)?;
7850        if !self.instance.is_empty() {
7851            state.serialize_entry("instance", &self.instance)?;
7852        }
7853        if !self.project.is_empty() {
7854            state.serialize_entry("project", &self.project)?;
7855        }
7856        if self.db_timeout.is_some() {
7857            state.serialize_entry("dbTimeout", &self.db_timeout)?;
7858        }
7859        if !self._unknown_fields.is_empty() {
7860            for (key, value) in self._unknown_fields.iter() {
7861                state.serialize_entry(key, &value)?;
7862            }
7863        }
7864        state.end()
7865    }
7866}
7867
7868impl std::fmt::Debug for SqlInstancesSwitchoverRequest {
7869    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7870        let mut debug_struct = f.debug_struct("SqlInstancesSwitchoverRequest");
7871        debug_struct.field("instance", &self.instance);
7872        debug_struct.field("project", &self.project);
7873        debug_struct.field("db_timeout", &self.db_timeout);
7874        if !self._unknown_fields.is_empty() {
7875            debug_struct.field("_unknown_fields", &self._unknown_fields);
7876        }
7877        debug_struct.finish()
7878    }
7879}
7880
7881/// Instance reset SSL config request.
7882#[derive(Clone, Default, PartialEq)]
7883#[non_exhaustive]
7884pub struct SqlInstancesResetSslConfigRequest {
7885    /// Cloud SQL instance ID. This does not include the project ID.
7886    pub instance: std::string::String,
7887
7888    /// Project ID of the project that contains the instance.
7889    pub project: std::string::String,
7890
7891    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7892}
7893
7894impl SqlInstancesResetSslConfigRequest {
7895    pub fn new() -> Self {
7896        std::default::Default::default()
7897    }
7898
7899    /// Sets the value of [instance][crate::model::SqlInstancesResetSslConfigRequest::instance].
7900    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7901        self.instance = v.into();
7902        self
7903    }
7904
7905    /// Sets the value of [project][crate::model::SqlInstancesResetSslConfigRequest::project].
7906    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7907        self.project = v.into();
7908        self
7909    }
7910}
7911
7912impl wkt::message::Message for SqlInstancesResetSslConfigRequest {
7913    fn typename() -> &'static str {
7914        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesResetSslConfigRequest"
7915    }
7916}
7917
7918#[doc(hidden)]
7919impl<'de> serde::de::Deserialize<'de> for SqlInstancesResetSslConfigRequest {
7920    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7921    where
7922        D: serde::Deserializer<'de>,
7923    {
7924        #[allow(non_camel_case_types)]
7925        #[doc(hidden)]
7926        #[derive(PartialEq, Eq, Hash)]
7927        enum __FieldTag {
7928            __instance,
7929            __project,
7930            Unknown(std::string::String),
7931        }
7932        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7933            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7934            where
7935                D: serde::Deserializer<'de>,
7936            {
7937                struct Visitor;
7938                impl<'de> serde::de::Visitor<'de> for Visitor {
7939                    type Value = __FieldTag;
7940                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7941                        formatter.write_str("a field name for SqlInstancesResetSslConfigRequest")
7942                    }
7943                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7944                    where
7945                        E: serde::de::Error,
7946                    {
7947                        use std::result::Result::Ok;
7948                        use std::string::ToString;
7949                        match value {
7950                            "instance" => Ok(__FieldTag::__instance),
7951                            "project" => Ok(__FieldTag::__project),
7952                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7953                        }
7954                    }
7955                }
7956                deserializer.deserialize_identifier(Visitor)
7957            }
7958        }
7959        struct Visitor;
7960        impl<'de> serde::de::Visitor<'de> for Visitor {
7961            type Value = SqlInstancesResetSslConfigRequest;
7962            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7963                formatter.write_str("struct SqlInstancesResetSslConfigRequest")
7964            }
7965            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7966            where
7967                A: serde::de::MapAccess<'de>,
7968            {
7969                #[allow(unused_imports)]
7970                use serde::de::Error;
7971                use std::option::Option::Some;
7972                let mut fields = std::collections::HashSet::new();
7973                let mut result = Self::Value::new();
7974                while let Some(tag) = map.next_key::<__FieldTag>()? {
7975                    #[allow(clippy::match_single_binding)]
7976                    match tag {
7977                        __FieldTag::__instance => {
7978                            if !fields.insert(__FieldTag::__instance) {
7979                                return std::result::Result::Err(A::Error::duplicate_field(
7980                                    "multiple values for instance",
7981                                ));
7982                            }
7983                            result.instance = map
7984                                .next_value::<std::option::Option<std::string::String>>()?
7985                                .unwrap_or_default();
7986                        }
7987                        __FieldTag::__project => {
7988                            if !fields.insert(__FieldTag::__project) {
7989                                return std::result::Result::Err(A::Error::duplicate_field(
7990                                    "multiple values for project",
7991                                ));
7992                            }
7993                            result.project = map
7994                                .next_value::<std::option::Option<std::string::String>>()?
7995                                .unwrap_or_default();
7996                        }
7997                        __FieldTag::Unknown(key) => {
7998                            let value = map.next_value::<serde_json::Value>()?;
7999                            result._unknown_fields.insert(key, value);
8000                        }
8001                    }
8002                }
8003                std::result::Result::Ok(result)
8004            }
8005        }
8006        deserializer.deserialize_any(Visitor)
8007    }
8008}
8009
8010#[doc(hidden)]
8011impl serde::ser::Serialize for SqlInstancesResetSslConfigRequest {
8012    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8013    where
8014        S: serde::ser::Serializer,
8015    {
8016        use serde::ser::SerializeMap;
8017        #[allow(unused_imports)]
8018        use std::option::Option::Some;
8019        let mut state = serializer.serialize_map(std::option::Option::None)?;
8020        if !self.instance.is_empty() {
8021            state.serialize_entry("instance", &self.instance)?;
8022        }
8023        if !self.project.is_empty() {
8024            state.serialize_entry("project", &self.project)?;
8025        }
8026        if !self._unknown_fields.is_empty() {
8027            for (key, value) in self._unknown_fields.iter() {
8028                state.serialize_entry(key, &value)?;
8029            }
8030        }
8031        state.end()
8032    }
8033}
8034
8035impl std::fmt::Debug for SqlInstancesResetSslConfigRequest {
8036    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8037        let mut debug_struct = f.debug_struct("SqlInstancesResetSslConfigRequest");
8038        debug_struct.field("instance", &self.instance);
8039        debug_struct.field("project", &self.project);
8040        if !self._unknown_fields.is_empty() {
8041            debug_struct.field("_unknown_fields", &self._unknown_fields);
8042        }
8043        debug_struct.finish()
8044    }
8045}
8046
8047/// Instance restart request.
8048#[derive(Clone, Default, PartialEq)]
8049#[non_exhaustive]
8050pub struct SqlInstancesRestartRequest {
8051    /// Cloud SQL instance ID. This does not include the project ID.
8052    pub instance: std::string::String,
8053
8054    /// Project ID of the project that contains the instance to be restarted.
8055    pub project: std::string::String,
8056
8057    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8058}
8059
8060impl SqlInstancesRestartRequest {
8061    pub fn new() -> Self {
8062        std::default::Default::default()
8063    }
8064
8065    /// Sets the value of [instance][crate::model::SqlInstancesRestartRequest::instance].
8066    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8067        self.instance = v.into();
8068        self
8069    }
8070
8071    /// Sets the value of [project][crate::model::SqlInstancesRestartRequest::project].
8072    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8073        self.project = v.into();
8074        self
8075    }
8076}
8077
8078impl wkt::message::Message for SqlInstancesRestartRequest {
8079    fn typename() -> &'static str {
8080        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesRestartRequest"
8081    }
8082}
8083
8084#[doc(hidden)]
8085impl<'de> serde::de::Deserialize<'de> for SqlInstancesRestartRequest {
8086    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8087    where
8088        D: serde::Deserializer<'de>,
8089    {
8090        #[allow(non_camel_case_types)]
8091        #[doc(hidden)]
8092        #[derive(PartialEq, Eq, Hash)]
8093        enum __FieldTag {
8094            __instance,
8095            __project,
8096            Unknown(std::string::String),
8097        }
8098        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8099            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8100            where
8101                D: serde::Deserializer<'de>,
8102            {
8103                struct Visitor;
8104                impl<'de> serde::de::Visitor<'de> for Visitor {
8105                    type Value = __FieldTag;
8106                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8107                        formatter.write_str("a field name for SqlInstancesRestartRequest")
8108                    }
8109                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8110                    where
8111                        E: serde::de::Error,
8112                    {
8113                        use std::result::Result::Ok;
8114                        use std::string::ToString;
8115                        match value {
8116                            "instance" => Ok(__FieldTag::__instance),
8117                            "project" => Ok(__FieldTag::__project),
8118                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8119                        }
8120                    }
8121                }
8122                deserializer.deserialize_identifier(Visitor)
8123            }
8124        }
8125        struct Visitor;
8126        impl<'de> serde::de::Visitor<'de> for Visitor {
8127            type Value = SqlInstancesRestartRequest;
8128            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8129                formatter.write_str("struct SqlInstancesRestartRequest")
8130            }
8131            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8132            where
8133                A: serde::de::MapAccess<'de>,
8134            {
8135                #[allow(unused_imports)]
8136                use serde::de::Error;
8137                use std::option::Option::Some;
8138                let mut fields = std::collections::HashSet::new();
8139                let mut result = Self::Value::new();
8140                while let Some(tag) = map.next_key::<__FieldTag>()? {
8141                    #[allow(clippy::match_single_binding)]
8142                    match tag {
8143                        __FieldTag::__instance => {
8144                            if !fields.insert(__FieldTag::__instance) {
8145                                return std::result::Result::Err(A::Error::duplicate_field(
8146                                    "multiple values for instance",
8147                                ));
8148                            }
8149                            result.instance = map
8150                                .next_value::<std::option::Option<std::string::String>>()?
8151                                .unwrap_or_default();
8152                        }
8153                        __FieldTag::__project => {
8154                            if !fields.insert(__FieldTag::__project) {
8155                                return std::result::Result::Err(A::Error::duplicate_field(
8156                                    "multiple values for project",
8157                                ));
8158                            }
8159                            result.project = map
8160                                .next_value::<std::option::Option<std::string::String>>()?
8161                                .unwrap_or_default();
8162                        }
8163                        __FieldTag::Unknown(key) => {
8164                            let value = map.next_value::<serde_json::Value>()?;
8165                            result._unknown_fields.insert(key, value);
8166                        }
8167                    }
8168                }
8169                std::result::Result::Ok(result)
8170            }
8171        }
8172        deserializer.deserialize_any(Visitor)
8173    }
8174}
8175
8176#[doc(hidden)]
8177impl serde::ser::Serialize for SqlInstancesRestartRequest {
8178    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8179    where
8180        S: serde::ser::Serializer,
8181    {
8182        use serde::ser::SerializeMap;
8183        #[allow(unused_imports)]
8184        use std::option::Option::Some;
8185        let mut state = serializer.serialize_map(std::option::Option::None)?;
8186        if !self.instance.is_empty() {
8187            state.serialize_entry("instance", &self.instance)?;
8188        }
8189        if !self.project.is_empty() {
8190            state.serialize_entry("project", &self.project)?;
8191        }
8192        if !self._unknown_fields.is_empty() {
8193            for (key, value) in self._unknown_fields.iter() {
8194                state.serialize_entry(key, &value)?;
8195            }
8196        }
8197        state.end()
8198    }
8199}
8200
8201impl std::fmt::Debug for SqlInstancesRestartRequest {
8202    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8203        let mut debug_struct = f.debug_struct("SqlInstancesRestartRequest");
8204        debug_struct.field("instance", &self.instance);
8205        debug_struct.field("project", &self.project);
8206        if !self._unknown_fields.is_empty() {
8207            debug_struct.field("_unknown_fields", &self._unknown_fields);
8208        }
8209        debug_struct.finish()
8210    }
8211}
8212
8213/// Instance restore backup request.
8214#[derive(Clone, Default, PartialEq)]
8215#[non_exhaustive]
8216pub struct SqlInstancesRestoreBackupRequest {
8217    /// Cloud SQL instance ID. This does not include the project ID.
8218    pub instance: std::string::String,
8219
8220    /// Project ID of the project that contains the instance.
8221    pub project: std::string::String,
8222
8223    pub body: std::option::Option<crate::model::InstancesRestoreBackupRequest>,
8224
8225    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8226}
8227
8228impl SqlInstancesRestoreBackupRequest {
8229    pub fn new() -> Self {
8230        std::default::Default::default()
8231    }
8232
8233    /// Sets the value of [instance][crate::model::SqlInstancesRestoreBackupRequest::instance].
8234    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8235        self.instance = v.into();
8236        self
8237    }
8238
8239    /// Sets the value of [project][crate::model::SqlInstancesRestoreBackupRequest::project].
8240    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8241        self.project = v.into();
8242        self
8243    }
8244
8245    /// Sets the value of [body][crate::model::SqlInstancesRestoreBackupRequest::body].
8246    pub fn set_body<T>(mut self, v: T) -> Self
8247    where
8248        T: std::convert::Into<crate::model::InstancesRestoreBackupRequest>,
8249    {
8250        self.body = std::option::Option::Some(v.into());
8251        self
8252    }
8253
8254    /// Sets or clears the value of [body][crate::model::SqlInstancesRestoreBackupRequest::body].
8255    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
8256    where
8257        T: std::convert::Into<crate::model::InstancesRestoreBackupRequest>,
8258    {
8259        self.body = v.map(|x| x.into());
8260        self
8261    }
8262}
8263
8264impl wkt::message::Message for SqlInstancesRestoreBackupRequest {
8265    fn typename() -> &'static str {
8266        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesRestoreBackupRequest"
8267    }
8268}
8269
8270#[doc(hidden)]
8271impl<'de> serde::de::Deserialize<'de> for SqlInstancesRestoreBackupRequest {
8272    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8273    where
8274        D: serde::Deserializer<'de>,
8275    {
8276        #[allow(non_camel_case_types)]
8277        #[doc(hidden)]
8278        #[derive(PartialEq, Eq, Hash)]
8279        enum __FieldTag {
8280            __instance,
8281            __project,
8282            __body,
8283            Unknown(std::string::String),
8284        }
8285        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8286            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8287            where
8288                D: serde::Deserializer<'de>,
8289            {
8290                struct Visitor;
8291                impl<'de> serde::de::Visitor<'de> for Visitor {
8292                    type Value = __FieldTag;
8293                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8294                        formatter.write_str("a field name for SqlInstancesRestoreBackupRequest")
8295                    }
8296                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8297                    where
8298                        E: serde::de::Error,
8299                    {
8300                        use std::result::Result::Ok;
8301                        use std::string::ToString;
8302                        match value {
8303                            "instance" => Ok(__FieldTag::__instance),
8304                            "project" => Ok(__FieldTag::__project),
8305                            "body" => Ok(__FieldTag::__body),
8306                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8307                        }
8308                    }
8309                }
8310                deserializer.deserialize_identifier(Visitor)
8311            }
8312        }
8313        struct Visitor;
8314        impl<'de> serde::de::Visitor<'de> for Visitor {
8315            type Value = SqlInstancesRestoreBackupRequest;
8316            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8317                formatter.write_str("struct SqlInstancesRestoreBackupRequest")
8318            }
8319            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8320            where
8321                A: serde::de::MapAccess<'de>,
8322            {
8323                #[allow(unused_imports)]
8324                use serde::de::Error;
8325                use std::option::Option::Some;
8326                let mut fields = std::collections::HashSet::new();
8327                let mut result = Self::Value::new();
8328                while let Some(tag) = map.next_key::<__FieldTag>()? {
8329                    #[allow(clippy::match_single_binding)]
8330                    match tag {
8331                        __FieldTag::__instance => {
8332                            if !fields.insert(__FieldTag::__instance) {
8333                                return std::result::Result::Err(A::Error::duplicate_field(
8334                                    "multiple values for instance",
8335                                ));
8336                            }
8337                            result.instance = map
8338                                .next_value::<std::option::Option<std::string::String>>()?
8339                                .unwrap_or_default();
8340                        }
8341                        __FieldTag::__project => {
8342                            if !fields.insert(__FieldTag::__project) {
8343                                return std::result::Result::Err(A::Error::duplicate_field(
8344                                    "multiple values for project",
8345                                ));
8346                            }
8347                            result.project = map
8348                                .next_value::<std::option::Option<std::string::String>>()?
8349                                .unwrap_or_default();
8350                        }
8351                        __FieldTag::__body => {
8352                            if !fields.insert(__FieldTag::__body) {
8353                                return std::result::Result::Err(A::Error::duplicate_field(
8354                                    "multiple values for body",
8355                                ));
8356                            }
8357                            result.body =
8358                                map.next_value::<std::option::Option<
8359                                    crate::model::InstancesRestoreBackupRequest,
8360                                >>()?;
8361                        }
8362                        __FieldTag::Unknown(key) => {
8363                            let value = map.next_value::<serde_json::Value>()?;
8364                            result._unknown_fields.insert(key, value);
8365                        }
8366                    }
8367                }
8368                std::result::Result::Ok(result)
8369            }
8370        }
8371        deserializer.deserialize_any(Visitor)
8372    }
8373}
8374
8375#[doc(hidden)]
8376impl serde::ser::Serialize for SqlInstancesRestoreBackupRequest {
8377    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8378    where
8379        S: serde::ser::Serializer,
8380    {
8381        use serde::ser::SerializeMap;
8382        #[allow(unused_imports)]
8383        use std::option::Option::Some;
8384        let mut state = serializer.serialize_map(std::option::Option::None)?;
8385        if !self.instance.is_empty() {
8386            state.serialize_entry("instance", &self.instance)?;
8387        }
8388        if !self.project.is_empty() {
8389            state.serialize_entry("project", &self.project)?;
8390        }
8391        if self.body.is_some() {
8392            state.serialize_entry("body", &self.body)?;
8393        }
8394        if !self._unknown_fields.is_empty() {
8395            for (key, value) in self._unknown_fields.iter() {
8396                state.serialize_entry(key, &value)?;
8397            }
8398        }
8399        state.end()
8400    }
8401}
8402
8403impl std::fmt::Debug for SqlInstancesRestoreBackupRequest {
8404    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8405        let mut debug_struct = f.debug_struct("SqlInstancesRestoreBackupRequest");
8406        debug_struct.field("instance", &self.instance);
8407        debug_struct.field("project", &self.project);
8408        debug_struct.field("body", &self.body);
8409        if !self._unknown_fields.is_empty() {
8410            debug_struct.field("_unknown_fields", &self._unknown_fields);
8411        }
8412        debug_struct.finish()
8413    }
8414}
8415
8416/// Instance rotate server CA request.
8417#[derive(Clone, Default, PartialEq)]
8418#[non_exhaustive]
8419pub struct SqlInstancesRotateServerCaRequest {
8420    /// Cloud SQL instance ID. This does not include the project ID.
8421    pub instance: std::string::String,
8422
8423    /// Project ID of the project that contains the instance.
8424    pub project: std::string::String,
8425
8426    pub body: std::option::Option<crate::model::InstancesRotateServerCaRequest>,
8427
8428    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8429}
8430
8431impl SqlInstancesRotateServerCaRequest {
8432    pub fn new() -> Self {
8433        std::default::Default::default()
8434    }
8435
8436    /// Sets the value of [instance][crate::model::SqlInstancesRotateServerCaRequest::instance].
8437    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8438        self.instance = v.into();
8439        self
8440    }
8441
8442    /// Sets the value of [project][crate::model::SqlInstancesRotateServerCaRequest::project].
8443    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8444        self.project = v.into();
8445        self
8446    }
8447
8448    /// Sets the value of [body][crate::model::SqlInstancesRotateServerCaRequest::body].
8449    pub fn set_body<T>(mut self, v: T) -> Self
8450    where
8451        T: std::convert::Into<crate::model::InstancesRotateServerCaRequest>,
8452    {
8453        self.body = std::option::Option::Some(v.into());
8454        self
8455    }
8456
8457    /// Sets or clears the value of [body][crate::model::SqlInstancesRotateServerCaRequest::body].
8458    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
8459    where
8460        T: std::convert::Into<crate::model::InstancesRotateServerCaRequest>,
8461    {
8462        self.body = v.map(|x| x.into());
8463        self
8464    }
8465}
8466
8467impl wkt::message::Message for SqlInstancesRotateServerCaRequest {
8468    fn typename() -> &'static str {
8469        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesRotateServerCaRequest"
8470    }
8471}
8472
8473#[doc(hidden)]
8474impl<'de> serde::de::Deserialize<'de> for SqlInstancesRotateServerCaRequest {
8475    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8476    where
8477        D: serde::Deserializer<'de>,
8478    {
8479        #[allow(non_camel_case_types)]
8480        #[doc(hidden)]
8481        #[derive(PartialEq, Eq, Hash)]
8482        enum __FieldTag {
8483            __instance,
8484            __project,
8485            __body,
8486            Unknown(std::string::String),
8487        }
8488        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8489            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8490            where
8491                D: serde::Deserializer<'de>,
8492            {
8493                struct Visitor;
8494                impl<'de> serde::de::Visitor<'de> for Visitor {
8495                    type Value = __FieldTag;
8496                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8497                        formatter.write_str("a field name for SqlInstancesRotateServerCaRequest")
8498                    }
8499                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8500                    where
8501                        E: serde::de::Error,
8502                    {
8503                        use std::result::Result::Ok;
8504                        use std::string::ToString;
8505                        match value {
8506                            "instance" => Ok(__FieldTag::__instance),
8507                            "project" => Ok(__FieldTag::__project),
8508                            "body" => Ok(__FieldTag::__body),
8509                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8510                        }
8511                    }
8512                }
8513                deserializer.deserialize_identifier(Visitor)
8514            }
8515        }
8516        struct Visitor;
8517        impl<'de> serde::de::Visitor<'de> for Visitor {
8518            type Value = SqlInstancesRotateServerCaRequest;
8519            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8520                formatter.write_str("struct SqlInstancesRotateServerCaRequest")
8521            }
8522            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8523            where
8524                A: serde::de::MapAccess<'de>,
8525            {
8526                #[allow(unused_imports)]
8527                use serde::de::Error;
8528                use std::option::Option::Some;
8529                let mut fields = std::collections::HashSet::new();
8530                let mut result = Self::Value::new();
8531                while let Some(tag) = map.next_key::<__FieldTag>()? {
8532                    #[allow(clippy::match_single_binding)]
8533                    match tag {
8534                        __FieldTag::__instance => {
8535                            if !fields.insert(__FieldTag::__instance) {
8536                                return std::result::Result::Err(A::Error::duplicate_field(
8537                                    "multiple values for instance",
8538                                ));
8539                            }
8540                            result.instance = map
8541                                .next_value::<std::option::Option<std::string::String>>()?
8542                                .unwrap_or_default();
8543                        }
8544                        __FieldTag::__project => {
8545                            if !fields.insert(__FieldTag::__project) {
8546                                return std::result::Result::Err(A::Error::duplicate_field(
8547                                    "multiple values for project",
8548                                ));
8549                            }
8550                            result.project = map
8551                                .next_value::<std::option::Option<std::string::String>>()?
8552                                .unwrap_or_default();
8553                        }
8554                        __FieldTag::__body => {
8555                            if !fields.insert(__FieldTag::__body) {
8556                                return std::result::Result::Err(A::Error::duplicate_field(
8557                                    "multiple values for body",
8558                                ));
8559                            }
8560                            result.body =
8561                                map.next_value::<std::option::Option<
8562                                    crate::model::InstancesRotateServerCaRequest,
8563                                >>()?;
8564                        }
8565                        __FieldTag::Unknown(key) => {
8566                            let value = map.next_value::<serde_json::Value>()?;
8567                            result._unknown_fields.insert(key, value);
8568                        }
8569                    }
8570                }
8571                std::result::Result::Ok(result)
8572            }
8573        }
8574        deserializer.deserialize_any(Visitor)
8575    }
8576}
8577
8578#[doc(hidden)]
8579impl serde::ser::Serialize for SqlInstancesRotateServerCaRequest {
8580    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8581    where
8582        S: serde::ser::Serializer,
8583    {
8584        use serde::ser::SerializeMap;
8585        #[allow(unused_imports)]
8586        use std::option::Option::Some;
8587        let mut state = serializer.serialize_map(std::option::Option::None)?;
8588        if !self.instance.is_empty() {
8589            state.serialize_entry("instance", &self.instance)?;
8590        }
8591        if !self.project.is_empty() {
8592            state.serialize_entry("project", &self.project)?;
8593        }
8594        if self.body.is_some() {
8595            state.serialize_entry("body", &self.body)?;
8596        }
8597        if !self._unknown_fields.is_empty() {
8598            for (key, value) in self._unknown_fields.iter() {
8599                state.serialize_entry(key, &value)?;
8600            }
8601        }
8602        state.end()
8603    }
8604}
8605
8606impl std::fmt::Debug for SqlInstancesRotateServerCaRequest {
8607    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8608        let mut debug_struct = f.debug_struct("SqlInstancesRotateServerCaRequest");
8609        debug_struct.field("instance", &self.instance);
8610        debug_struct.field("project", &self.project);
8611        debug_struct.field("body", &self.body);
8612        if !self._unknown_fields.is_empty() {
8613            debug_struct.field("_unknown_fields", &self._unknown_fields);
8614        }
8615        debug_struct.finish()
8616    }
8617}
8618
8619/// Instance start replica request.
8620#[derive(Clone, Default, PartialEq)]
8621#[non_exhaustive]
8622pub struct SqlInstancesStartReplicaRequest {
8623    /// Cloud SQL read replica instance name.
8624    pub instance: std::string::String,
8625
8626    /// ID of the project that contains the read replica.
8627    pub project: std::string::String,
8628
8629    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8630}
8631
8632impl SqlInstancesStartReplicaRequest {
8633    pub fn new() -> Self {
8634        std::default::Default::default()
8635    }
8636
8637    /// Sets the value of [instance][crate::model::SqlInstancesStartReplicaRequest::instance].
8638    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8639        self.instance = v.into();
8640        self
8641    }
8642
8643    /// Sets the value of [project][crate::model::SqlInstancesStartReplicaRequest::project].
8644    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8645        self.project = v.into();
8646        self
8647    }
8648}
8649
8650impl wkt::message::Message for SqlInstancesStartReplicaRequest {
8651    fn typename() -> &'static str {
8652        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesStartReplicaRequest"
8653    }
8654}
8655
8656#[doc(hidden)]
8657impl<'de> serde::de::Deserialize<'de> for SqlInstancesStartReplicaRequest {
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            Unknown(std::string::String),
8669        }
8670        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8671            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8672            where
8673                D: serde::Deserializer<'de>,
8674            {
8675                struct Visitor;
8676                impl<'de> serde::de::Visitor<'de> for Visitor {
8677                    type Value = __FieldTag;
8678                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8679                        formatter.write_str("a field name for SqlInstancesStartReplicaRequest")
8680                    }
8681                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8682                    where
8683                        E: serde::de::Error,
8684                    {
8685                        use std::result::Result::Ok;
8686                        use std::string::ToString;
8687                        match value {
8688                            "instance" => Ok(__FieldTag::__instance),
8689                            "project" => Ok(__FieldTag::__project),
8690                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8691                        }
8692                    }
8693                }
8694                deserializer.deserialize_identifier(Visitor)
8695            }
8696        }
8697        struct Visitor;
8698        impl<'de> serde::de::Visitor<'de> for Visitor {
8699            type Value = SqlInstancesStartReplicaRequest;
8700            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8701                formatter.write_str("struct SqlInstancesStartReplicaRequest")
8702            }
8703            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8704            where
8705                A: serde::de::MapAccess<'de>,
8706            {
8707                #[allow(unused_imports)]
8708                use serde::de::Error;
8709                use std::option::Option::Some;
8710                let mut fields = std::collections::HashSet::new();
8711                let mut result = Self::Value::new();
8712                while let Some(tag) = map.next_key::<__FieldTag>()? {
8713                    #[allow(clippy::match_single_binding)]
8714                    match tag {
8715                        __FieldTag::__instance => {
8716                            if !fields.insert(__FieldTag::__instance) {
8717                                return std::result::Result::Err(A::Error::duplicate_field(
8718                                    "multiple values for instance",
8719                                ));
8720                            }
8721                            result.instance = map
8722                                .next_value::<std::option::Option<std::string::String>>()?
8723                                .unwrap_or_default();
8724                        }
8725                        __FieldTag::__project => {
8726                            if !fields.insert(__FieldTag::__project) {
8727                                return std::result::Result::Err(A::Error::duplicate_field(
8728                                    "multiple values for project",
8729                                ));
8730                            }
8731                            result.project = map
8732                                .next_value::<std::option::Option<std::string::String>>()?
8733                                .unwrap_or_default();
8734                        }
8735                        __FieldTag::Unknown(key) => {
8736                            let value = map.next_value::<serde_json::Value>()?;
8737                            result._unknown_fields.insert(key, value);
8738                        }
8739                    }
8740                }
8741                std::result::Result::Ok(result)
8742            }
8743        }
8744        deserializer.deserialize_any(Visitor)
8745    }
8746}
8747
8748#[doc(hidden)]
8749impl serde::ser::Serialize for SqlInstancesStartReplicaRequest {
8750    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8751    where
8752        S: serde::ser::Serializer,
8753    {
8754        use serde::ser::SerializeMap;
8755        #[allow(unused_imports)]
8756        use std::option::Option::Some;
8757        let mut state = serializer.serialize_map(std::option::Option::None)?;
8758        if !self.instance.is_empty() {
8759            state.serialize_entry("instance", &self.instance)?;
8760        }
8761        if !self.project.is_empty() {
8762            state.serialize_entry("project", &self.project)?;
8763        }
8764        if !self._unknown_fields.is_empty() {
8765            for (key, value) in self._unknown_fields.iter() {
8766                state.serialize_entry(key, &value)?;
8767            }
8768        }
8769        state.end()
8770    }
8771}
8772
8773impl std::fmt::Debug for SqlInstancesStartReplicaRequest {
8774    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8775        let mut debug_struct = f.debug_struct("SqlInstancesStartReplicaRequest");
8776        debug_struct.field("instance", &self.instance);
8777        debug_struct.field("project", &self.project);
8778        if !self._unknown_fields.is_empty() {
8779            debug_struct.field("_unknown_fields", &self._unknown_fields);
8780        }
8781        debug_struct.finish()
8782    }
8783}
8784
8785/// Instance stop replica request.
8786#[derive(Clone, Default, PartialEq)]
8787#[non_exhaustive]
8788pub struct SqlInstancesStopReplicaRequest {
8789    /// Cloud SQL read replica instance name.
8790    pub instance: std::string::String,
8791
8792    /// ID of the project that contains the read replica.
8793    pub project: std::string::String,
8794
8795    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8796}
8797
8798impl SqlInstancesStopReplicaRequest {
8799    pub fn new() -> Self {
8800        std::default::Default::default()
8801    }
8802
8803    /// Sets the value of [instance][crate::model::SqlInstancesStopReplicaRequest::instance].
8804    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8805        self.instance = v.into();
8806        self
8807    }
8808
8809    /// Sets the value of [project][crate::model::SqlInstancesStopReplicaRequest::project].
8810    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8811        self.project = v.into();
8812        self
8813    }
8814}
8815
8816impl wkt::message::Message for SqlInstancesStopReplicaRequest {
8817    fn typename() -> &'static str {
8818        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesStopReplicaRequest"
8819    }
8820}
8821
8822#[doc(hidden)]
8823impl<'de> serde::de::Deserialize<'de> for SqlInstancesStopReplicaRequest {
8824    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8825    where
8826        D: serde::Deserializer<'de>,
8827    {
8828        #[allow(non_camel_case_types)]
8829        #[doc(hidden)]
8830        #[derive(PartialEq, Eq, Hash)]
8831        enum __FieldTag {
8832            __instance,
8833            __project,
8834            Unknown(std::string::String),
8835        }
8836        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8837            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8838            where
8839                D: serde::Deserializer<'de>,
8840            {
8841                struct Visitor;
8842                impl<'de> serde::de::Visitor<'de> for Visitor {
8843                    type Value = __FieldTag;
8844                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8845                        formatter.write_str("a field name for SqlInstancesStopReplicaRequest")
8846                    }
8847                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8848                    where
8849                        E: serde::de::Error,
8850                    {
8851                        use std::result::Result::Ok;
8852                        use std::string::ToString;
8853                        match value {
8854                            "instance" => Ok(__FieldTag::__instance),
8855                            "project" => Ok(__FieldTag::__project),
8856                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8857                        }
8858                    }
8859                }
8860                deserializer.deserialize_identifier(Visitor)
8861            }
8862        }
8863        struct Visitor;
8864        impl<'de> serde::de::Visitor<'de> for Visitor {
8865            type Value = SqlInstancesStopReplicaRequest;
8866            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8867                formatter.write_str("struct SqlInstancesStopReplicaRequest")
8868            }
8869            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8870            where
8871                A: serde::de::MapAccess<'de>,
8872            {
8873                #[allow(unused_imports)]
8874                use serde::de::Error;
8875                use std::option::Option::Some;
8876                let mut fields = std::collections::HashSet::new();
8877                let mut result = Self::Value::new();
8878                while let Some(tag) = map.next_key::<__FieldTag>()? {
8879                    #[allow(clippy::match_single_binding)]
8880                    match tag {
8881                        __FieldTag::__instance => {
8882                            if !fields.insert(__FieldTag::__instance) {
8883                                return std::result::Result::Err(A::Error::duplicate_field(
8884                                    "multiple values for instance",
8885                                ));
8886                            }
8887                            result.instance = map
8888                                .next_value::<std::option::Option<std::string::String>>()?
8889                                .unwrap_or_default();
8890                        }
8891                        __FieldTag::__project => {
8892                            if !fields.insert(__FieldTag::__project) {
8893                                return std::result::Result::Err(A::Error::duplicate_field(
8894                                    "multiple values for project",
8895                                ));
8896                            }
8897                            result.project = map
8898                                .next_value::<std::option::Option<std::string::String>>()?
8899                                .unwrap_or_default();
8900                        }
8901                        __FieldTag::Unknown(key) => {
8902                            let value = map.next_value::<serde_json::Value>()?;
8903                            result._unknown_fields.insert(key, value);
8904                        }
8905                    }
8906                }
8907                std::result::Result::Ok(result)
8908            }
8909        }
8910        deserializer.deserialize_any(Visitor)
8911    }
8912}
8913
8914#[doc(hidden)]
8915impl serde::ser::Serialize for SqlInstancesStopReplicaRequest {
8916    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8917    where
8918        S: serde::ser::Serializer,
8919    {
8920        use serde::ser::SerializeMap;
8921        #[allow(unused_imports)]
8922        use std::option::Option::Some;
8923        let mut state = serializer.serialize_map(std::option::Option::None)?;
8924        if !self.instance.is_empty() {
8925            state.serialize_entry("instance", &self.instance)?;
8926        }
8927        if !self.project.is_empty() {
8928            state.serialize_entry("project", &self.project)?;
8929        }
8930        if !self._unknown_fields.is_empty() {
8931            for (key, value) in self._unknown_fields.iter() {
8932                state.serialize_entry(key, &value)?;
8933            }
8934        }
8935        state.end()
8936    }
8937}
8938
8939impl std::fmt::Debug for SqlInstancesStopReplicaRequest {
8940    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8941        let mut debug_struct = f.debug_struct("SqlInstancesStopReplicaRequest");
8942        debug_struct.field("instance", &self.instance);
8943        debug_struct.field("project", &self.project);
8944        if !self._unknown_fields.is_empty() {
8945            debug_struct.field("_unknown_fields", &self._unknown_fields);
8946        }
8947        debug_struct.finish()
8948    }
8949}
8950
8951/// Instance truncate log request.
8952#[derive(Clone, Default, PartialEq)]
8953#[non_exhaustive]
8954pub struct SqlInstancesTruncateLogRequest {
8955    /// Cloud SQL instance ID. This does not include the project ID.
8956    pub instance: std::string::String,
8957
8958    /// Project ID of the Cloud SQL project.
8959    pub project: std::string::String,
8960
8961    pub body: std::option::Option<crate::model::InstancesTruncateLogRequest>,
8962
8963    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8964}
8965
8966impl SqlInstancesTruncateLogRequest {
8967    pub fn new() -> Self {
8968        std::default::Default::default()
8969    }
8970
8971    /// Sets the value of [instance][crate::model::SqlInstancesTruncateLogRequest::instance].
8972    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8973        self.instance = v.into();
8974        self
8975    }
8976
8977    /// Sets the value of [project][crate::model::SqlInstancesTruncateLogRequest::project].
8978    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8979        self.project = v.into();
8980        self
8981    }
8982
8983    /// Sets the value of [body][crate::model::SqlInstancesTruncateLogRequest::body].
8984    pub fn set_body<T>(mut self, v: T) -> Self
8985    where
8986        T: std::convert::Into<crate::model::InstancesTruncateLogRequest>,
8987    {
8988        self.body = std::option::Option::Some(v.into());
8989        self
8990    }
8991
8992    /// Sets or clears the value of [body][crate::model::SqlInstancesTruncateLogRequest::body].
8993    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
8994    where
8995        T: std::convert::Into<crate::model::InstancesTruncateLogRequest>,
8996    {
8997        self.body = v.map(|x| x.into());
8998        self
8999    }
9000}
9001
9002impl wkt::message::Message for SqlInstancesTruncateLogRequest {
9003    fn typename() -> &'static str {
9004        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesTruncateLogRequest"
9005    }
9006}
9007
9008#[doc(hidden)]
9009impl<'de> serde::de::Deserialize<'de> for SqlInstancesTruncateLogRequest {
9010    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9011    where
9012        D: serde::Deserializer<'de>,
9013    {
9014        #[allow(non_camel_case_types)]
9015        #[doc(hidden)]
9016        #[derive(PartialEq, Eq, Hash)]
9017        enum __FieldTag {
9018            __instance,
9019            __project,
9020            __body,
9021            Unknown(std::string::String),
9022        }
9023        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9024            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9025            where
9026                D: serde::Deserializer<'de>,
9027            {
9028                struct Visitor;
9029                impl<'de> serde::de::Visitor<'de> for Visitor {
9030                    type Value = __FieldTag;
9031                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9032                        formatter.write_str("a field name for SqlInstancesTruncateLogRequest")
9033                    }
9034                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9035                    where
9036                        E: serde::de::Error,
9037                    {
9038                        use std::result::Result::Ok;
9039                        use std::string::ToString;
9040                        match value {
9041                            "instance" => Ok(__FieldTag::__instance),
9042                            "project" => Ok(__FieldTag::__project),
9043                            "body" => Ok(__FieldTag::__body),
9044                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9045                        }
9046                    }
9047                }
9048                deserializer.deserialize_identifier(Visitor)
9049            }
9050        }
9051        struct Visitor;
9052        impl<'de> serde::de::Visitor<'de> for Visitor {
9053            type Value = SqlInstancesTruncateLogRequest;
9054            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9055                formatter.write_str("struct SqlInstancesTruncateLogRequest")
9056            }
9057            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9058            where
9059                A: serde::de::MapAccess<'de>,
9060            {
9061                #[allow(unused_imports)]
9062                use serde::de::Error;
9063                use std::option::Option::Some;
9064                let mut fields = std::collections::HashSet::new();
9065                let mut result = Self::Value::new();
9066                while let Some(tag) = map.next_key::<__FieldTag>()? {
9067                    #[allow(clippy::match_single_binding)]
9068                    match tag {
9069                        __FieldTag::__instance => {
9070                            if !fields.insert(__FieldTag::__instance) {
9071                                return std::result::Result::Err(A::Error::duplicate_field(
9072                                    "multiple values for instance",
9073                                ));
9074                            }
9075                            result.instance = map
9076                                .next_value::<std::option::Option<std::string::String>>()?
9077                                .unwrap_or_default();
9078                        }
9079                        __FieldTag::__project => {
9080                            if !fields.insert(__FieldTag::__project) {
9081                                return std::result::Result::Err(A::Error::duplicate_field(
9082                                    "multiple values for project",
9083                                ));
9084                            }
9085                            result.project = map
9086                                .next_value::<std::option::Option<std::string::String>>()?
9087                                .unwrap_or_default();
9088                        }
9089                        __FieldTag::__body => {
9090                            if !fields.insert(__FieldTag::__body) {
9091                                return std::result::Result::Err(A::Error::duplicate_field(
9092                                    "multiple values for body",
9093                                ));
9094                            }
9095                            result.body = map.next_value::<std::option::Option<crate::model::InstancesTruncateLogRequest>>()?
9096                                ;
9097                        }
9098                        __FieldTag::Unknown(key) => {
9099                            let value = map.next_value::<serde_json::Value>()?;
9100                            result._unknown_fields.insert(key, value);
9101                        }
9102                    }
9103                }
9104                std::result::Result::Ok(result)
9105            }
9106        }
9107        deserializer.deserialize_any(Visitor)
9108    }
9109}
9110
9111#[doc(hidden)]
9112impl serde::ser::Serialize for SqlInstancesTruncateLogRequest {
9113    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9114    where
9115        S: serde::ser::Serializer,
9116    {
9117        use serde::ser::SerializeMap;
9118        #[allow(unused_imports)]
9119        use std::option::Option::Some;
9120        let mut state = serializer.serialize_map(std::option::Option::None)?;
9121        if !self.instance.is_empty() {
9122            state.serialize_entry("instance", &self.instance)?;
9123        }
9124        if !self.project.is_empty() {
9125            state.serialize_entry("project", &self.project)?;
9126        }
9127        if self.body.is_some() {
9128            state.serialize_entry("body", &self.body)?;
9129        }
9130        if !self._unknown_fields.is_empty() {
9131            for (key, value) in self._unknown_fields.iter() {
9132                state.serialize_entry(key, &value)?;
9133            }
9134        }
9135        state.end()
9136    }
9137}
9138
9139impl std::fmt::Debug for SqlInstancesTruncateLogRequest {
9140    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9141        let mut debug_struct = f.debug_struct("SqlInstancesTruncateLogRequest");
9142        debug_struct.field("instance", &self.instance);
9143        debug_struct.field("project", &self.project);
9144        debug_struct.field("body", &self.body);
9145        if !self._unknown_fields.is_empty() {
9146            debug_struct.field("_unknown_fields", &self._unknown_fields);
9147        }
9148        debug_struct.finish()
9149    }
9150}
9151
9152/// Instance perform disk shrink request.
9153#[derive(Clone, Default, PartialEq)]
9154#[non_exhaustive]
9155pub struct SqlInstancesPerformDiskShrinkRequest {
9156    /// Cloud SQL instance ID. This does not include the project ID.
9157    pub instance: std::string::String,
9158
9159    /// Project ID of the project that contains the instance.
9160    pub project: std::string::String,
9161
9162    /// Perform disk shrink context.
9163    pub body: std::option::Option<crate::model::PerformDiskShrinkContext>,
9164
9165    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9166}
9167
9168impl SqlInstancesPerformDiskShrinkRequest {
9169    pub fn new() -> Self {
9170        std::default::Default::default()
9171    }
9172
9173    /// Sets the value of [instance][crate::model::SqlInstancesPerformDiskShrinkRequest::instance].
9174    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9175        self.instance = v.into();
9176        self
9177    }
9178
9179    /// Sets the value of [project][crate::model::SqlInstancesPerformDiskShrinkRequest::project].
9180    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9181        self.project = v.into();
9182        self
9183    }
9184
9185    /// Sets the value of [body][crate::model::SqlInstancesPerformDiskShrinkRequest::body].
9186    pub fn set_body<T>(mut self, v: T) -> Self
9187    where
9188        T: std::convert::Into<crate::model::PerformDiskShrinkContext>,
9189    {
9190        self.body = std::option::Option::Some(v.into());
9191        self
9192    }
9193
9194    /// Sets or clears the value of [body][crate::model::SqlInstancesPerformDiskShrinkRequest::body].
9195    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
9196    where
9197        T: std::convert::Into<crate::model::PerformDiskShrinkContext>,
9198    {
9199        self.body = v.map(|x| x.into());
9200        self
9201    }
9202}
9203
9204impl wkt::message::Message for SqlInstancesPerformDiskShrinkRequest {
9205    fn typename() -> &'static str {
9206        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest"
9207    }
9208}
9209
9210#[doc(hidden)]
9211impl<'de> serde::de::Deserialize<'de> for SqlInstancesPerformDiskShrinkRequest {
9212    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9213    where
9214        D: serde::Deserializer<'de>,
9215    {
9216        #[allow(non_camel_case_types)]
9217        #[doc(hidden)]
9218        #[derive(PartialEq, Eq, Hash)]
9219        enum __FieldTag {
9220            __instance,
9221            __project,
9222            __body,
9223            Unknown(std::string::String),
9224        }
9225        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9226            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9227            where
9228                D: serde::Deserializer<'de>,
9229            {
9230                struct Visitor;
9231                impl<'de> serde::de::Visitor<'de> for Visitor {
9232                    type Value = __FieldTag;
9233                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9234                        formatter.write_str("a field name for SqlInstancesPerformDiskShrinkRequest")
9235                    }
9236                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9237                    where
9238                        E: serde::de::Error,
9239                    {
9240                        use std::result::Result::Ok;
9241                        use std::string::ToString;
9242                        match value {
9243                            "instance" => Ok(__FieldTag::__instance),
9244                            "project" => Ok(__FieldTag::__project),
9245                            "body" => Ok(__FieldTag::__body),
9246                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9247                        }
9248                    }
9249                }
9250                deserializer.deserialize_identifier(Visitor)
9251            }
9252        }
9253        struct Visitor;
9254        impl<'de> serde::de::Visitor<'de> for Visitor {
9255            type Value = SqlInstancesPerformDiskShrinkRequest;
9256            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9257                formatter.write_str("struct SqlInstancesPerformDiskShrinkRequest")
9258            }
9259            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9260            where
9261                A: serde::de::MapAccess<'de>,
9262            {
9263                #[allow(unused_imports)]
9264                use serde::de::Error;
9265                use std::option::Option::Some;
9266                let mut fields = std::collections::HashSet::new();
9267                let mut result = Self::Value::new();
9268                while let Some(tag) = map.next_key::<__FieldTag>()? {
9269                    #[allow(clippy::match_single_binding)]
9270                    match tag {
9271                        __FieldTag::__instance => {
9272                            if !fields.insert(__FieldTag::__instance) {
9273                                return std::result::Result::Err(A::Error::duplicate_field(
9274                                    "multiple values for instance",
9275                                ));
9276                            }
9277                            result.instance = map
9278                                .next_value::<std::option::Option<std::string::String>>()?
9279                                .unwrap_or_default();
9280                        }
9281                        __FieldTag::__project => {
9282                            if !fields.insert(__FieldTag::__project) {
9283                                return std::result::Result::Err(A::Error::duplicate_field(
9284                                    "multiple values for project",
9285                                ));
9286                            }
9287                            result.project = map
9288                                .next_value::<std::option::Option<std::string::String>>()?
9289                                .unwrap_or_default();
9290                        }
9291                        __FieldTag::__body => {
9292                            if !fields.insert(__FieldTag::__body) {
9293                                return std::result::Result::Err(A::Error::duplicate_field(
9294                                    "multiple values for body",
9295                                ));
9296                            }
9297                            result.body = map.next_value::<std::option::Option<crate::model::PerformDiskShrinkContext>>()?
9298                                ;
9299                        }
9300                        __FieldTag::Unknown(key) => {
9301                            let value = map.next_value::<serde_json::Value>()?;
9302                            result._unknown_fields.insert(key, value);
9303                        }
9304                    }
9305                }
9306                std::result::Result::Ok(result)
9307            }
9308        }
9309        deserializer.deserialize_any(Visitor)
9310    }
9311}
9312
9313#[doc(hidden)]
9314impl serde::ser::Serialize for SqlInstancesPerformDiskShrinkRequest {
9315    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9316    where
9317        S: serde::ser::Serializer,
9318    {
9319        use serde::ser::SerializeMap;
9320        #[allow(unused_imports)]
9321        use std::option::Option::Some;
9322        let mut state = serializer.serialize_map(std::option::Option::None)?;
9323        if !self.instance.is_empty() {
9324            state.serialize_entry("instance", &self.instance)?;
9325        }
9326        if !self.project.is_empty() {
9327            state.serialize_entry("project", &self.project)?;
9328        }
9329        if self.body.is_some() {
9330            state.serialize_entry("body", &self.body)?;
9331        }
9332        if !self._unknown_fields.is_empty() {
9333            for (key, value) in self._unknown_fields.iter() {
9334                state.serialize_entry(key, &value)?;
9335            }
9336        }
9337        state.end()
9338    }
9339}
9340
9341impl std::fmt::Debug for SqlInstancesPerformDiskShrinkRequest {
9342    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9343        let mut debug_struct = f.debug_struct("SqlInstancesPerformDiskShrinkRequest");
9344        debug_struct.field("instance", &self.instance);
9345        debug_struct.field("project", &self.project);
9346        debug_struct.field("body", &self.body);
9347        if !self._unknown_fields.is_empty() {
9348            debug_struct.field("_unknown_fields", &self._unknown_fields);
9349        }
9350        debug_struct.finish()
9351    }
9352}
9353
9354/// Instance update request.
9355#[derive(Clone, Default, PartialEq)]
9356#[non_exhaustive]
9357pub struct SqlInstancesUpdateRequest {
9358    /// Cloud SQL instance ID. This does not include the project ID.
9359    pub instance: std::string::String,
9360
9361    /// Project ID of the project that contains the instance.
9362    pub project: std::string::String,
9363
9364    pub body: std::option::Option<crate::model::DatabaseInstance>,
9365
9366    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9367}
9368
9369impl SqlInstancesUpdateRequest {
9370    pub fn new() -> Self {
9371        std::default::Default::default()
9372    }
9373
9374    /// Sets the value of [instance][crate::model::SqlInstancesUpdateRequest::instance].
9375    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9376        self.instance = v.into();
9377        self
9378    }
9379
9380    /// Sets the value of [project][crate::model::SqlInstancesUpdateRequest::project].
9381    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9382        self.project = v.into();
9383        self
9384    }
9385
9386    /// Sets the value of [body][crate::model::SqlInstancesUpdateRequest::body].
9387    pub fn set_body<T>(mut self, v: T) -> Self
9388    where
9389        T: std::convert::Into<crate::model::DatabaseInstance>,
9390    {
9391        self.body = std::option::Option::Some(v.into());
9392        self
9393    }
9394
9395    /// Sets or clears the value of [body][crate::model::SqlInstancesUpdateRequest::body].
9396    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
9397    where
9398        T: std::convert::Into<crate::model::DatabaseInstance>,
9399    {
9400        self.body = v.map(|x| x.into());
9401        self
9402    }
9403}
9404
9405impl wkt::message::Message for SqlInstancesUpdateRequest {
9406    fn typename() -> &'static str {
9407        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesUpdateRequest"
9408    }
9409}
9410
9411#[doc(hidden)]
9412impl<'de> serde::de::Deserialize<'de> for SqlInstancesUpdateRequest {
9413    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9414    where
9415        D: serde::Deserializer<'de>,
9416    {
9417        #[allow(non_camel_case_types)]
9418        #[doc(hidden)]
9419        #[derive(PartialEq, Eq, Hash)]
9420        enum __FieldTag {
9421            __instance,
9422            __project,
9423            __body,
9424            Unknown(std::string::String),
9425        }
9426        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9427            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9428            where
9429                D: serde::Deserializer<'de>,
9430            {
9431                struct Visitor;
9432                impl<'de> serde::de::Visitor<'de> for Visitor {
9433                    type Value = __FieldTag;
9434                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9435                        formatter.write_str("a field name for SqlInstancesUpdateRequest")
9436                    }
9437                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9438                    where
9439                        E: serde::de::Error,
9440                    {
9441                        use std::result::Result::Ok;
9442                        use std::string::ToString;
9443                        match value {
9444                            "instance" => Ok(__FieldTag::__instance),
9445                            "project" => Ok(__FieldTag::__project),
9446                            "body" => Ok(__FieldTag::__body),
9447                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9448                        }
9449                    }
9450                }
9451                deserializer.deserialize_identifier(Visitor)
9452            }
9453        }
9454        struct Visitor;
9455        impl<'de> serde::de::Visitor<'de> for Visitor {
9456            type Value = SqlInstancesUpdateRequest;
9457            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9458                formatter.write_str("struct SqlInstancesUpdateRequest")
9459            }
9460            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9461            where
9462                A: serde::de::MapAccess<'de>,
9463            {
9464                #[allow(unused_imports)]
9465                use serde::de::Error;
9466                use std::option::Option::Some;
9467                let mut fields = std::collections::HashSet::new();
9468                let mut result = Self::Value::new();
9469                while let Some(tag) = map.next_key::<__FieldTag>()? {
9470                    #[allow(clippy::match_single_binding)]
9471                    match tag {
9472                        __FieldTag::__instance => {
9473                            if !fields.insert(__FieldTag::__instance) {
9474                                return std::result::Result::Err(A::Error::duplicate_field(
9475                                    "multiple values for instance",
9476                                ));
9477                            }
9478                            result.instance = map
9479                                .next_value::<std::option::Option<std::string::String>>()?
9480                                .unwrap_or_default();
9481                        }
9482                        __FieldTag::__project => {
9483                            if !fields.insert(__FieldTag::__project) {
9484                                return std::result::Result::Err(A::Error::duplicate_field(
9485                                    "multiple values for project",
9486                                ));
9487                            }
9488                            result.project = map
9489                                .next_value::<std::option::Option<std::string::String>>()?
9490                                .unwrap_or_default();
9491                        }
9492                        __FieldTag::__body => {
9493                            if !fields.insert(__FieldTag::__body) {
9494                                return std::result::Result::Err(A::Error::duplicate_field(
9495                                    "multiple values for body",
9496                                ));
9497                            }
9498                            result.body = map
9499                                .next_value::<std::option::Option<crate::model::DatabaseInstance>>(
9500                                )?;
9501                        }
9502                        __FieldTag::Unknown(key) => {
9503                            let value = map.next_value::<serde_json::Value>()?;
9504                            result._unknown_fields.insert(key, value);
9505                        }
9506                    }
9507                }
9508                std::result::Result::Ok(result)
9509            }
9510        }
9511        deserializer.deserialize_any(Visitor)
9512    }
9513}
9514
9515#[doc(hidden)]
9516impl serde::ser::Serialize for SqlInstancesUpdateRequest {
9517    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9518    where
9519        S: serde::ser::Serializer,
9520    {
9521        use serde::ser::SerializeMap;
9522        #[allow(unused_imports)]
9523        use std::option::Option::Some;
9524        let mut state = serializer.serialize_map(std::option::Option::None)?;
9525        if !self.instance.is_empty() {
9526            state.serialize_entry("instance", &self.instance)?;
9527        }
9528        if !self.project.is_empty() {
9529            state.serialize_entry("project", &self.project)?;
9530        }
9531        if self.body.is_some() {
9532            state.serialize_entry("body", &self.body)?;
9533        }
9534        if !self._unknown_fields.is_empty() {
9535            for (key, value) in self._unknown_fields.iter() {
9536                state.serialize_entry(key, &value)?;
9537            }
9538        }
9539        state.end()
9540    }
9541}
9542
9543impl std::fmt::Debug for SqlInstancesUpdateRequest {
9544    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9545        let mut debug_struct = f.debug_struct("SqlInstancesUpdateRequest");
9546        debug_struct.field("instance", &self.instance);
9547        debug_struct.field("project", &self.project);
9548        debug_struct.field("body", &self.body);
9549        if !self._unknown_fields.is_empty() {
9550            debug_struct.field("_unknown_fields", &self._unknown_fields);
9551        }
9552        debug_struct.finish()
9553    }
9554}
9555
9556/// Instance reschedule maintenance request.
9557#[derive(Clone, Default, PartialEq)]
9558#[non_exhaustive]
9559pub struct SqlInstancesRescheduleMaintenanceRequest {
9560    /// Cloud SQL instance ID. This does not include the project ID.
9561    pub instance: std::string::String,
9562
9563    /// ID of the project that contains the instance.
9564    pub project: std::string::String,
9565
9566    pub body: std::option::Option<crate::model::SqlInstancesRescheduleMaintenanceRequestBody>,
9567
9568    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9569}
9570
9571impl SqlInstancesRescheduleMaintenanceRequest {
9572    pub fn new() -> Self {
9573        std::default::Default::default()
9574    }
9575
9576    /// Sets the value of [instance][crate::model::SqlInstancesRescheduleMaintenanceRequest::instance].
9577    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9578        self.instance = v.into();
9579        self
9580    }
9581
9582    /// Sets the value of [project][crate::model::SqlInstancesRescheduleMaintenanceRequest::project].
9583    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9584        self.project = v.into();
9585        self
9586    }
9587
9588    /// Sets the value of [body][crate::model::SqlInstancesRescheduleMaintenanceRequest::body].
9589    pub fn set_body<T>(mut self, v: T) -> Self
9590    where
9591        T: std::convert::Into<crate::model::SqlInstancesRescheduleMaintenanceRequestBody>,
9592    {
9593        self.body = std::option::Option::Some(v.into());
9594        self
9595    }
9596
9597    /// Sets or clears the value of [body][crate::model::SqlInstancesRescheduleMaintenanceRequest::body].
9598    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
9599    where
9600        T: std::convert::Into<crate::model::SqlInstancesRescheduleMaintenanceRequestBody>,
9601    {
9602        self.body = v.map(|x| x.into());
9603        self
9604    }
9605}
9606
9607impl wkt::message::Message for SqlInstancesRescheduleMaintenanceRequest {
9608    fn typename() -> &'static str {
9609        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest"
9610    }
9611}
9612
9613#[doc(hidden)]
9614impl<'de> serde::de::Deserialize<'de> for SqlInstancesRescheduleMaintenanceRequest {
9615    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9616    where
9617        D: serde::Deserializer<'de>,
9618    {
9619        #[allow(non_camel_case_types)]
9620        #[doc(hidden)]
9621        #[derive(PartialEq, Eq, Hash)]
9622        enum __FieldTag {
9623            __instance,
9624            __project,
9625            __body,
9626            Unknown(std::string::String),
9627        }
9628        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9629            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9630            where
9631                D: serde::Deserializer<'de>,
9632            {
9633                struct Visitor;
9634                impl<'de> serde::de::Visitor<'de> for Visitor {
9635                    type Value = __FieldTag;
9636                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9637                        formatter
9638                            .write_str("a field name for SqlInstancesRescheduleMaintenanceRequest")
9639                    }
9640                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9641                    where
9642                        E: serde::de::Error,
9643                    {
9644                        use std::result::Result::Ok;
9645                        use std::string::ToString;
9646                        match value {
9647                            "instance" => Ok(__FieldTag::__instance),
9648                            "project" => Ok(__FieldTag::__project),
9649                            "body" => Ok(__FieldTag::__body),
9650                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9651                        }
9652                    }
9653                }
9654                deserializer.deserialize_identifier(Visitor)
9655            }
9656        }
9657        struct Visitor;
9658        impl<'de> serde::de::Visitor<'de> for Visitor {
9659            type Value = SqlInstancesRescheduleMaintenanceRequest;
9660            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9661                formatter.write_str("struct SqlInstancesRescheduleMaintenanceRequest")
9662            }
9663            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9664            where
9665                A: serde::de::MapAccess<'de>,
9666            {
9667                #[allow(unused_imports)]
9668                use serde::de::Error;
9669                use std::option::Option::Some;
9670                let mut fields = std::collections::HashSet::new();
9671                let mut result = Self::Value::new();
9672                while let Some(tag) = map.next_key::<__FieldTag>()? {
9673                    #[allow(clippy::match_single_binding)]
9674                    match tag {
9675                        __FieldTag::__instance => {
9676                            if !fields.insert(__FieldTag::__instance) {
9677                                return std::result::Result::Err(A::Error::duplicate_field(
9678                                    "multiple values for instance",
9679                                ));
9680                            }
9681                            result.instance = map
9682                                .next_value::<std::option::Option<std::string::String>>()?
9683                                .unwrap_or_default();
9684                        }
9685                        __FieldTag::__project => {
9686                            if !fields.insert(__FieldTag::__project) {
9687                                return std::result::Result::Err(A::Error::duplicate_field(
9688                                    "multiple values for project",
9689                                ));
9690                            }
9691                            result.project = map
9692                                .next_value::<std::option::Option<std::string::String>>()?
9693                                .unwrap_or_default();
9694                        }
9695                        __FieldTag::__body => {
9696                            if !fields.insert(__FieldTag::__body) {
9697                                return std::result::Result::Err(A::Error::duplicate_field(
9698                                    "multiple values for body",
9699                                ));
9700                            }
9701                            result.body = map.next_value::<std::option::Option<
9702                                crate::model::SqlInstancesRescheduleMaintenanceRequestBody,
9703                            >>()?;
9704                        }
9705                        __FieldTag::Unknown(key) => {
9706                            let value = map.next_value::<serde_json::Value>()?;
9707                            result._unknown_fields.insert(key, value);
9708                        }
9709                    }
9710                }
9711                std::result::Result::Ok(result)
9712            }
9713        }
9714        deserializer.deserialize_any(Visitor)
9715    }
9716}
9717
9718#[doc(hidden)]
9719impl serde::ser::Serialize for SqlInstancesRescheduleMaintenanceRequest {
9720    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9721    where
9722        S: serde::ser::Serializer,
9723    {
9724        use serde::ser::SerializeMap;
9725        #[allow(unused_imports)]
9726        use std::option::Option::Some;
9727        let mut state = serializer.serialize_map(std::option::Option::None)?;
9728        if !self.instance.is_empty() {
9729            state.serialize_entry("instance", &self.instance)?;
9730        }
9731        if !self.project.is_empty() {
9732            state.serialize_entry("project", &self.project)?;
9733        }
9734        if self.body.is_some() {
9735            state.serialize_entry("body", &self.body)?;
9736        }
9737        if !self._unknown_fields.is_empty() {
9738            for (key, value) in self._unknown_fields.iter() {
9739                state.serialize_entry(key, &value)?;
9740            }
9741        }
9742        state.end()
9743    }
9744}
9745
9746impl std::fmt::Debug for SqlInstancesRescheduleMaintenanceRequest {
9747    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9748        let mut debug_struct = f.debug_struct("SqlInstancesRescheduleMaintenanceRequest");
9749        debug_struct.field("instance", &self.instance);
9750        debug_struct.field("project", &self.project);
9751        debug_struct.field("body", &self.body);
9752        if !self._unknown_fields.is_empty() {
9753            debug_struct.field("_unknown_fields", &self._unknown_fields);
9754        }
9755        debug_struct.finish()
9756    }
9757}
9758
9759/// Instance reencrypt request.
9760#[derive(Clone, Default, PartialEq)]
9761#[non_exhaustive]
9762pub struct SqlInstancesReencryptRequest {
9763    /// Cloud SQL instance ID. This does not include the project ID.
9764    pub instance: std::string::String,
9765
9766    /// ID of the project that contains the instance.
9767    pub project: std::string::String,
9768
9769    /// Reencrypt body that users request
9770    pub body: std::option::Option<crate::model::InstancesReencryptRequest>,
9771
9772    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9773}
9774
9775impl SqlInstancesReencryptRequest {
9776    pub fn new() -> Self {
9777        std::default::Default::default()
9778    }
9779
9780    /// Sets the value of [instance][crate::model::SqlInstancesReencryptRequest::instance].
9781    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9782        self.instance = v.into();
9783        self
9784    }
9785
9786    /// Sets the value of [project][crate::model::SqlInstancesReencryptRequest::project].
9787    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9788        self.project = v.into();
9789        self
9790    }
9791
9792    /// Sets the value of [body][crate::model::SqlInstancesReencryptRequest::body].
9793    pub fn set_body<T>(mut self, v: T) -> Self
9794    where
9795        T: std::convert::Into<crate::model::InstancesReencryptRequest>,
9796    {
9797        self.body = std::option::Option::Some(v.into());
9798        self
9799    }
9800
9801    /// Sets or clears the value of [body][crate::model::SqlInstancesReencryptRequest::body].
9802    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
9803    where
9804        T: std::convert::Into<crate::model::InstancesReencryptRequest>,
9805    {
9806        self.body = v.map(|x| x.into());
9807        self
9808    }
9809}
9810
9811impl wkt::message::Message for SqlInstancesReencryptRequest {
9812    fn typename() -> &'static str {
9813        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesReencryptRequest"
9814    }
9815}
9816
9817#[doc(hidden)]
9818impl<'de> serde::de::Deserialize<'de> for SqlInstancesReencryptRequest {
9819    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9820    where
9821        D: serde::Deserializer<'de>,
9822    {
9823        #[allow(non_camel_case_types)]
9824        #[doc(hidden)]
9825        #[derive(PartialEq, Eq, Hash)]
9826        enum __FieldTag {
9827            __instance,
9828            __project,
9829            __body,
9830            Unknown(std::string::String),
9831        }
9832        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9833            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9834            where
9835                D: serde::Deserializer<'de>,
9836            {
9837                struct Visitor;
9838                impl<'de> serde::de::Visitor<'de> for Visitor {
9839                    type Value = __FieldTag;
9840                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9841                        formatter.write_str("a field name for SqlInstancesReencryptRequest")
9842                    }
9843                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9844                    where
9845                        E: serde::de::Error,
9846                    {
9847                        use std::result::Result::Ok;
9848                        use std::string::ToString;
9849                        match value {
9850                            "instance" => Ok(__FieldTag::__instance),
9851                            "project" => Ok(__FieldTag::__project),
9852                            "body" => Ok(__FieldTag::__body),
9853                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9854                        }
9855                    }
9856                }
9857                deserializer.deserialize_identifier(Visitor)
9858            }
9859        }
9860        struct Visitor;
9861        impl<'de> serde::de::Visitor<'de> for Visitor {
9862            type Value = SqlInstancesReencryptRequest;
9863            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9864                formatter.write_str("struct SqlInstancesReencryptRequest")
9865            }
9866            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9867            where
9868                A: serde::de::MapAccess<'de>,
9869            {
9870                #[allow(unused_imports)]
9871                use serde::de::Error;
9872                use std::option::Option::Some;
9873                let mut fields = std::collections::HashSet::new();
9874                let mut result = Self::Value::new();
9875                while let Some(tag) = map.next_key::<__FieldTag>()? {
9876                    #[allow(clippy::match_single_binding)]
9877                    match tag {
9878                        __FieldTag::__instance => {
9879                            if !fields.insert(__FieldTag::__instance) {
9880                                return std::result::Result::Err(A::Error::duplicate_field(
9881                                    "multiple values for instance",
9882                                ));
9883                            }
9884                            result.instance = map
9885                                .next_value::<std::option::Option<std::string::String>>()?
9886                                .unwrap_or_default();
9887                        }
9888                        __FieldTag::__project => {
9889                            if !fields.insert(__FieldTag::__project) {
9890                                return std::result::Result::Err(A::Error::duplicate_field(
9891                                    "multiple values for project",
9892                                ));
9893                            }
9894                            result.project = map
9895                                .next_value::<std::option::Option<std::string::String>>()?
9896                                .unwrap_or_default();
9897                        }
9898                        __FieldTag::__body => {
9899                            if !fields.insert(__FieldTag::__body) {
9900                                return std::result::Result::Err(A::Error::duplicate_field(
9901                                    "multiple values for body",
9902                                ));
9903                            }
9904                            result.body = map.next_value::<std::option::Option<crate::model::InstancesReencryptRequest>>()?
9905                                ;
9906                        }
9907                        __FieldTag::Unknown(key) => {
9908                            let value = map.next_value::<serde_json::Value>()?;
9909                            result._unknown_fields.insert(key, value);
9910                        }
9911                    }
9912                }
9913                std::result::Result::Ok(result)
9914            }
9915        }
9916        deserializer.deserialize_any(Visitor)
9917    }
9918}
9919
9920#[doc(hidden)]
9921impl serde::ser::Serialize for SqlInstancesReencryptRequest {
9922    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9923    where
9924        S: serde::ser::Serializer,
9925    {
9926        use serde::ser::SerializeMap;
9927        #[allow(unused_imports)]
9928        use std::option::Option::Some;
9929        let mut state = serializer.serialize_map(std::option::Option::None)?;
9930        if !self.instance.is_empty() {
9931            state.serialize_entry("instance", &self.instance)?;
9932        }
9933        if !self.project.is_empty() {
9934            state.serialize_entry("project", &self.project)?;
9935        }
9936        if self.body.is_some() {
9937            state.serialize_entry("body", &self.body)?;
9938        }
9939        if !self._unknown_fields.is_empty() {
9940            for (key, value) in self._unknown_fields.iter() {
9941                state.serialize_entry(key, &value)?;
9942            }
9943        }
9944        state.end()
9945    }
9946}
9947
9948impl std::fmt::Debug for SqlInstancesReencryptRequest {
9949    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9950        let mut debug_struct = f.debug_struct("SqlInstancesReencryptRequest");
9951        debug_struct.field("instance", &self.instance);
9952        debug_struct.field("project", &self.project);
9953        debug_struct.field("body", &self.body);
9954        if !self._unknown_fields.is_empty() {
9955            debug_struct.field("_unknown_fields", &self._unknown_fields);
9956        }
9957        debug_struct.finish()
9958    }
9959}
9960
9961/// Database Instance reencrypt request.
9962#[derive(Clone, Default, PartialEq)]
9963#[non_exhaustive]
9964pub struct InstancesReencryptRequest {
9965    /// Configuration specific to backup re-encryption
9966    pub backup_reencryption_config: std::option::Option<crate::model::BackupReencryptionConfig>,
9967
9968    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9969}
9970
9971impl InstancesReencryptRequest {
9972    pub fn new() -> Self {
9973        std::default::Default::default()
9974    }
9975
9976    /// Sets the value of [backup_reencryption_config][crate::model::InstancesReencryptRequest::backup_reencryption_config].
9977    pub fn set_backup_reencryption_config<T>(mut self, v: T) -> Self
9978    where
9979        T: std::convert::Into<crate::model::BackupReencryptionConfig>,
9980    {
9981        self.backup_reencryption_config = std::option::Option::Some(v.into());
9982        self
9983    }
9984
9985    /// Sets or clears the value of [backup_reencryption_config][crate::model::InstancesReencryptRequest::backup_reencryption_config].
9986    pub fn set_or_clear_backup_reencryption_config<T>(mut self, v: std::option::Option<T>) -> Self
9987    where
9988        T: std::convert::Into<crate::model::BackupReencryptionConfig>,
9989    {
9990        self.backup_reencryption_config = v.map(|x| x.into());
9991        self
9992    }
9993}
9994
9995impl wkt::message::Message for InstancesReencryptRequest {
9996    fn typename() -> &'static str {
9997        "type.googleapis.com/google.cloud.sql.v1.InstancesReencryptRequest"
9998    }
9999}
10000
10001#[doc(hidden)]
10002impl<'de> serde::de::Deserialize<'de> for InstancesReencryptRequest {
10003    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10004    where
10005        D: serde::Deserializer<'de>,
10006    {
10007        #[allow(non_camel_case_types)]
10008        #[doc(hidden)]
10009        #[derive(PartialEq, Eq, Hash)]
10010        enum __FieldTag {
10011            __backup_reencryption_config,
10012            Unknown(std::string::String),
10013        }
10014        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10015            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10016            where
10017                D: serde::Deserializer<'de>,
10018            {
10019                struct Visitor;
10020                impl<'de> serde::de::Visitor<'de> for Visitor {
10021                    type Value = __FieldTag;
10022                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10023                        formatter.write_str("a field name for InstancesReencryptRequest")
10024                    }
10025                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10026                    where
10027                        E: serde::de::Error,
10028                    {
10029                        use std::result::Result::Ok;
10030                        use std::string::ToString;
10031                        match value {
10032                            "backupReencryptionConfig" => {
10033                                Ok(__FieldTag::__backup_reencryption_config)
10034                            }
10035                            "backup_reencryption_config" => {
10036                                Ok(__FieldTag::__backup_reencryption_config)
10037                            }
10038                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10039                        }
10040                    }
10041                }
10042                deserializer.deserialize_identifier(Visitor)
10043            }
10044        }
10045        struct Visitor;
10046        impl<'de> serde::de::Visitor<'de> for Visitor {
10047            type Value = InstancesReencryptRequest;
10048            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10049                formatter.write_str("struct InstancesReencryptRequest")
10050            }
10051            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10052            where
10053                A: serde::de::MapAccess<'de>,
10054            {
10055                #[allow(unused_imports)]
10056                use serde::de::Error;
10057                use std::option::Option::Some;
10058                let mut fields = std::collections::HashSet::new();
10059                let mut result = Self::Value::new();
10060                while let Some(tag) = map.next_key::<__FieldTag>()? {
10061                    #[allow(clippy::match_single_binding)]
10062                    match tag {
10063                        __FieldTag::__backup_reencryption_config => {
10064                            if !fields.insert(__FieldTag::__backup_reencryption_config) {
10065                                return std::result::Result::Err(A::Error::duplicate_field(
10066                                    "multiple values for backup_reencryption_config",
10067                                ));
10068                            }
10069                            result.backup_reencryption_config = map.next_value::<std::option::Option<crate::model::BackupReencryptionConfig>>()?
10070                                ;
10071                        }
10072                        __FieldTag::Unknown(key) => {
10073                            let value = map.next_value::<serde_json::Value>()?;
10074                            result._unknown_fields.insert(key, value);
10075                        }
10076                    }
10077                }
10078                std::result::Result::Ok(result)
10079            }
10080        }
10081        deserializer.deserialize_any(Visitor)
10082    }
10083}
10084
10085#[doc(hidden)]
10086impl serde::ser::Serialize for InstancesReencryptRequest {
10087    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10088    where
10089        S: serde::ser::Serializer,
10090    {
10091        use serde::ser::SerializeMap;
10092        #[allow(unused_imports)]
10093        use std::option::Option::Some;
10094        let mut state = serializer.serialize_map(std::option::Option::None)?;
10095        if self.backup_reencryption_config.is_some() {
10096            state.serialize_entry("backupReencryptionConfig", &self.backup_reencryption_config)?;
10097        }
10098        if !self._unknown_fields.is_empty() {
10099            for (key, value) in self._unknown_fields.iter() {
10100                state.serialize_entry(key, &value)?;
10101            }
10102        }
10103        state.end()
10104    }
10105}
10106
10107impl std::fmt::Debug for InstancesReencryptRequest {
10108    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10109        let mut debug_struct = f.debug_struct("InstancesReencryptRequest");
10110        debug_struct.field(
10111            "backup_reencryption_config",
10112            &self.backup_reencryption_config,
10113        );
10114        if !self._unknown_fields.is_empty() {
10115            debug_struct.field("_unknown_fields", &self._unknown_fields);
10116        }
10117        debug_struct.finish()
10118    }
10119}
10120
10121/// Backup Reencryption Config
10122#[derive(Clone, Default, PartialEq)]
10123#[non_exhaustive]
10124pub struct BackupReencryptionConfig {
10125    /// Backup re-encryption limit
10126    pub backup_limit: std::option::Option<i32>,
10127
10128    /// Type of backups users want to re-encrypt.
10129    pub backup_type: std::option::Option<crate::model::backup_reencryption_config::BackupType>,
10130
10131    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10132}
10133
10134impl BackupReencryptionConfig {
10135    pub fn new() -> Self {
10136        std::default::Default::default()
10137    }
10138
10139    /// Sets the value of [backup_limit][crate::model::BackupReencryptionConfig::backup_limit].
10140    pub fn set_backup_limit<T>(mut self, v: T) -> Self
10141    where
10142        T: std::convert::Into<i32>,
10143    {
10144        self.backup_limit = std::option::Option::Some(v.into());
10145        self
10146    }
10147
10148    /// Sets or clears the value of [backup_limit][crate::model::BackupReencryptionConfig::backup_limit].
10149    pub fn set_or_clear_backup_limit<T>(mut self, v: std::option::Option<T>) -> Self
10150    where
10151        T: std::convert::Into<i32>,
10152    {
10153        self.backup_limit = v.map(|x| x.into());
10154        self
10155    }
10156
10157    /// Sets the value of [backup_type][crate::model::BackupReencryptionConfig::backup_type].
10158    pub fn set_backup_type<T>(mut self, v: T) -> Self
10159    where
10160        T: std::convert::Into<crate::model::backup_reencryption_config::BackupType>,
10161    {
10162        self.backup_type = std::option::Option::Some(v.into());
10163        self
10164    }
10165
10166    /// Sets or clears the value of [backup_type][crate::model::BackupReencryptionConfig::backup_type].
10167    pub fn set_or_clear_backup_type<T>(mut self, v: std::option::Option<T>) -> Self
10168    where
10169        T: std::convert::Into<crate::model::backup_reencryption_config::BackupType>,
10170    {
10171        self.backup_type = v.map(|x| x.into());
10172        self
10173    }
10174}
10175
10176impl wkt::message::Message for BackupReencryptionConfig {
10177    fn typename() -> &'static str {
10178        "type.googleapis.com/google.cloud.sql.v1.BackupReencryptionConfig"
10179    }
10180}
10181
10182#[doc(hidden)]
10183impl<'de> serde::de::Deserialize<'de> for BackupReencryptionConfig {
10184    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10185    where
10186        D: serde::Deserializer<'de>,
10187    {
10188        #[allow(non_camel_case_types)]
10189        #[doc(hidden)]
10190        #[derive(PartialEq, Eq, Hash)]
10191        enum __FieldTag {
10192            __backup_limit,
10193            __backup_type,
10194            Unknown(std::string::String),
10195        }
10196        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10197            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10198            where
10199                D: serde::Deserializer<'de>,
10200            {
10201                struct Visitor;
10202                impl<'de> serde::de::Visitor<'de> for Visitor {
10203                    type Value = __FieldTag;
10204                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10205                        formatter.write_str("a field name for BackupReencryptionConfig")
10206                    }
10207                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10208                    where
10209                        E: serde::de::Error,
10210                    {
10211                        use std::result::Result::Ok;
10212                        use std::string::ToString;
10213                        match value {
10214                            "backupLimit" => Ok(__FieldTag::__backup_limit),
10215                            "backup_limit" => Ok(__FieldTag::__backup_limit),
10216                            "backupType" => Ok(__FieldTag::__backup_type),
10217                            "backup_type" => Ok(__FieldTag::__backup_type),
10218                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10219                        }
10220                    }
10221                }
10222                deserializer.deserialize_identifier(Visitor)
10223            }
10224        }
10225        struct Visitor;
10226        impl<'de> serde::de::Visitor<'de> for Visitor {
10227            type Value = BackupReencryptionConfig;
10228            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10229                formatter.write_str("struct BackupReencryptionConfig")
10230            }
10231            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10232            where
10233                A: serde::de::MapAccess<'de>,
10234            {
10235                #[allow(unused_imports)]
10236                use serde::de::Error;
10237                use std::option::Option::Some;
10238                let mut fields = std::collections::HashSet::new();
10239                let mut result = Self::Value::new();
10240                while let Some(tag) = map.next_key::<__FieldTag>()? {
10241                    #[allow(clippy::match_single_binding)]
10242                    match tag {
10243                        __FieldTag::__backup_limit => {
10244                            if !fields.insert(__FieldTag::__backup_limit) {
10245                                return std::result::Result::Err(A::Error::duplicate_field(
10246                                    "multiple values for backup_limit",
10247                                ));
10248                            }
10249                            struct __With(std::option::Option<i32>);
10250                            impl<'de> serde::de::Deserialize<'de> for __With {
10251                                fn deserialize<D>(
10252                                    deserializer: D,
10253                                ) -> std::result::Result<Self, D::Error>
10254                                where
10255                                    D: serde::de::Deserializer<'de>,
10256                                {
10257                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
10258                                }
10259                            }
10260                            result.backup_limit = map.next_value::<__With>()?.0;
10261                        }
10262                        __FieldTag::__backup_type => {
10263                            if !fields.insert(__FieldTag::__backup_type) {
10264                                return std::result::Result::Err(A::Error::duplicate_field(
10265                                    "multiple values for backup_type",
10266                                ));
10267                            }
10268                            result.backup_type = map.next_value::<std::option::Option<
10269                                crate::model::backup_reencryption_config::BackupType,
10270                            >>()?;
10271                        }
10272                        __FieldTag::Unknown(key) => {
10273                            let value = map.next_value::<serde_json::Value>()?;
10274                            result._unknown_fields.insert(key, value);
10275                        }
10276                    }
10277                }
10278                std::result::Result::Ok(result)
10279            }
10280        }
10281        deserializer.deserialize_any(Visitor)
10282    }
10283}
10284
10285#[doc(hidden)]
10286impl serde::ser::Serialize for BackupReencryptionConfig {
10287    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10288    where
10289        S: serde::ser::Serializer,
10290    {
10291        use serde::ser::SerializeMap;
10292        #[allow(unused_imports)]
10293        use std::option::Option::Some;
10294        let mut state = serializer.serialize_map(std::option::Option::None)?;
10295        if self.backup_limit.is_some() {
10296            struct __With<'a>(&'a std::option::Option<i32>);
10297            impl<'a> serde::ser::Serialize for __With<'a> {
10298                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10299                where
10300                    S: serde::ser::Serializer,
10301                {
10302                    serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
10303                        self.0, serializer,
10304                    )
10305                }
10306            }
10307            state.serialize_entry("backupLimit", &__With(&self.backup_limit))?;
10308        }
10309        if self.backup_type.is_some() {
10310            state.serialize_entry("backupType", &self.backup_type)?;
10311        }
10312        if !self._unknown_fields.is_empty() {
10313            for (key, value) in self._unknown_fields.iter() {
10314                state.serialize_entry(key, &value)?;
10315            }
10316        }
10317        state.end()
10318    }
10319}
10320
10321impl std::fmt::Debug for BackupReencryptionConfig {
10322    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10323        let mut debug_struct = f.debug_struct("BackupReencryptionConfig");
10324        debug_struct.field("backup_limit", &self.backup_limit);
10325        debug_struct.field("backup_type", &self.backup_type);
10326        if !self._unknown_fields.is_empty() {
10327            debug_struct.field("_unknown_fields", &self._unknown_fields);
10328        }
10329        debug_struct.finish()
10330    }
10331}
10332
10333/// Defines additional types related to [BackupReencryptionConfig].
10334pub mod backup_reencryption_config {
10335    #[allow(unused_imports)]
10336    use super::*;
10337
10338    /// Backup type for re-encryption
10339    ///
10340    /// # Working with unknown values
10341    ///
10342    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10343    /// additional enum variants at any time. Adding new variants is not considered
10344    /// a breaking change. Applications should write their code in anticipation of:
10345    ///
10346    /// - New values appearing in future releases of the client library, **and**
10347    /// - New values received dynamically, without application changes.
10348    ///
10349    /// Please consult the [Working with enums] section in the user guide for some
10350    /// guidelines.
10351    ///
10352    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10353    #[derive(Clone, Debug, PartialEq)]
10354    #[non_exhaustive]
10355    pub enum BackupType {
10356        /// Unknown backup type, will be defaulted to AUTOMATIC backup type
10357        Unspecified,
10358        /// Reencrypt automatic backups
10359        Automated,
10360        /// Reencrypt on-demand backups
10361        OnDemand,
10362        /// If set, the enum was initialized with an unknown value.
10363        ///
10364        /// Applications can examine the value using [BackupType::value] or
10365        /// [BackupType::name].
10366        UnknownValue(backup_type::UnknownValue),
10367    }
10368
10369    #[doc(hidden)]
10370    pub mod backup_type {
10371        #[allow(unused_imports)]
10372        use super::*;
10373        #[derive(Clone, Debug, PartialEq)]
10374        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10375    }
10376
10377    impl BackupType {
10378        /// Gets the enum value.
10379        ///
10380        /// Returns `None` if the enum contains an unknown value deserialized from
10381        /// the string representation of enums.
10382        pub fn value(&self) -> std::option::Option<i32> {
10383            match self {
10384                Self::Unspecified => std::option::Option::Some(0),
10385                Self::Automated => std::option::Option::Some(1),
10386                Self::OnDemand => std::option::Option::Some(2),
10387                Self::UnknownValue(u) => u.0.value(),
10388            }
10389        }
10390
10391        /// Gets the enum value as a string.
10392        ///
10393        /// Returns `None` if the enum contains an unknown value deserialized from
10394        /// the integer representation of enums.
10395        pub fn name(&self) -> std::option::Option<&str> {
10396            match self {
10397                Self::Unspecified => std::option::Option::Some("BACKUP_TYPE_UNSPECIFIED"),
10398                Self::Automated => std::option::Option::Some("AUTOMATED"),
10399                Self::OnDemand => std::option::Option::Some("ON_DEMAND"),
10400                Self::UnknownValue(u) => u.0.name(),
10401            }
10402        }
10403    }
10404
10405    impl std::default::Default for BackupType {
10406        fn default() -> Self {
10407            use std::convert::From;
10408            Self::from(0)
10409        }
10410    }
10411
10412    impl std::fmt::Display for BackupType {
10413        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10414            wkt::internal::display_enum(f, self.name(), self.value())
10415        }
10416    }
10417
10418    impl std::convert::From<i32> for BackupType {
10419        fn from(value: i32) -> Self {
10420            match value {
10421                0 => Self::Unspecified,
10422                1 => Self::Automated,
10423                2 => Self::OnDemand,
10424                _ => Self::UnknownValue(backup_type::UnknownValue(
10425                    wkt::internal::UnknownEnumValue::Integer(value),
10426                )),
10427            }
10428        }
10429    }
10430
10431    impl std::convert::From<&str> for BackupType {
10432        fn from(value: &str) -> Self {
10433            use std::string::ToString;
10434            match value {
10435                "BACKUP_TYPE_UNSPECIFIED" => Self::Unspecified,
10436                "AUTOMATED" => Self::Automated,
10437                "ON_DEMAND" => Self::OnDemand,
10438                _ => Self::UnknownValue(backup_type::UnknownValue(
10439                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10440                )),
10441            }
10442        }
10443    }
10444
10445    impl serde::ser::Serialize for BackupType {
10446        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10447        where
10448            S: serde::Serializer,
10449        {
10450            match self {
10451                Self::Unspecified => serializer.serialize_i32(0),
10452                Self::Automated => serializer.serialize_i32(1),
10453                Self::OnDemand => serializer.serialize_i32(2),
10454                Self::UnknownValue(u) => u.0.serialize(serializer),
10455            }
10456        }
10457    }
10458
10459    impl<'de> serde::de::Deserialize<'de> for BackupType {
10460        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10461        where
10462            D: serde::Deserializer<'de>,
10463        {
10464            deserializer.deserialize_any(wkt::internal::EnumVisitor::<BackupType>::new(
10465                ".google.cloud.sql.v1.BackupReencryptionConfig.BackupType",
10466            ))
10467        }
10468    }
10469}
10470
10471/// Instance get disk shrink config request.
10472#[derive(Clone, Default, PartialEq)]
10473#[non_exhaustive]
10474pub struct SqlInstancesGetDiskShrinkConfigRequest {
10475    /// Cloud SQL instance ID. This does not include the project ID.
10476    pub instance: std::string::String,
10477
10478    /// Project ID of the project that contains the instance.
10479    pub project: std::string::String,
10480
10481    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10482}
10483
10484impl SqlInstancesGetDiskShrinkConfigRequest {
10485    pub fn new() -> Self {
10486        std::default::Default::default()
10487    }
10488
10489    /// Sets the value of [instance][crate::model::SqlInstancesGetDiskShrinkConfigRequest::instance].
10490    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10491        self.instance = v.into();
10492        self
10493    }
10494
10495    /// Sets the value of [project][crate::model::SqlInstancesGetDiskShrinkConfigRequest::project].
10496    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10497        self.project = v.into();
10498        self
10499    }
10500}
10501
10502impl wkt::message::Message for SqlInstancesGetDiskShrinkConfigRequest {
10503    fn typename() -> &'static str {
10504        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest"
10505    }
10506}
10507
10508#[doc(hidden)]
10509impl<'de> serde::de::Deserialize<'de> for SqlInstancesGetDiskShrinkConfigRequest {
10510    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10511    where
10512        D: serde::Deserializer<'de>,
10513    {
10514        #[allow(non_camel_case_types)]
10515        #[doc(hidden)]
10516        #[derive(PartialEq, Eq, Hash)]
10517        enum __FieldTag {
10518            __instance,
10519            __project,
10520            Unknown(std::string::String),
10521        }
10522        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10523            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10524            where
10525                D: serde::Deserializer<'de>,
10526            {
10527                struct Visitor;
10528                impl<'de> serde::de::Visitor<'de> for Visitor {
10529                    type Value = __FieldTag;
10530                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10531                        formatter
10532                            .write_str("a field name for SqlInstancesGetDiskShrinkConfigRequest")
10533                    }
10534                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10535                    where
10536                        E: serde::de::Error,
10537                    {
10538                        use std::result::Result::Ok;
10539                        use std::string::ToString;
10540                        match value {
10541                            "instance" => Ok(__FieldTag::__instance),
10542                            "project" => Ok(__FieldTag::__project),
10543                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10544                        }
10545                    }
10546                }
10547                deserializer.deserialize_identifier(Visitor)
10548            }
10549        }
10550        struct Visitor;
10551        impl<'de> serde::de::Visitor<'de> for Visitor {
10552            type Value = SqlInstancesGetDiskShrinkConfigRequest;
10553            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10554                formatter.write_str("struct SqlInstancesGetDiskShrinkConfigRequest")
10555            }
10556            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10557            where
10558                A: serde::de::MapAccess<'de>,
10559            {
10560                #[allow(unused_imports)]
10561                use serde::de::Error;
10562                use std::option::Option::Some;
10563                let mut fields = std::collections::HashSet::new();
10564                let mut result = Self::Value::new();
10565                while let Some(tag) = map.next_key::<__FieldTag>()? {
10566                    #[allow(clippy::match_single_binding)]
10567                    match tag {
10568                        __FieldTag::__instance => {
10569                            if !fields.insert(__FieldTag::__instance) {
10570                                return std::result::Result::Err(A::Error::duplicate_field(
10571                                    "multiple values for instance",
10572                                ));
10573                            }
10574                            result.instance = map
10575                                .next_value::<std::option::Option<std::string::String>>()?
10576                                .unwrap_or_default();
10577                        }
10578                        __FieldTag::__project => {
10579                            if !fields.insert(__FieldTag::__project) {
10580                                return std::result::Result::Err(A::Error::duplicate_field(
10581                                    "multiple values for project",
10582                                ));
10583                            }
10584                            result.project = map
10585                                .next_value::<std::option::Option<std::string::String>>()?
10586                                .unwrap_or_default();
10587                        }
10588                        __FieldTag::Unknown(key) => {
10589                            let value = map.next_value::<serde_json::Value>()?;
10590                            result._unknown_fields.insert(key, value);
10591                        }
10592                    }
10593                }
10594                std::result::Result::Ok(result)
10595            }
10596        }
10597        deserializer.deserialize_any(Visitor)
10598    }
10599}
10600
10601#[doc(hidden)]
10602impl serde::ser::Serialize for SqlInstancesGetDiskShrinkConfigRequest {
10603    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10604    where
10605        S: serde::ser::Serializer,
10606    {
10607        use serde::ser::SerializeMap;
10608        #[allow(unused_imports)]
10609        use std::option::Option::Some;
10610        let mut state = serializer.serialize_map(std::option::Option::None)?;
10611        if !self.instance.is_empty() {
10612            state.serialize_entry("instance", &self.instance)?;
10613        }
10614        if !self.project.is_empty() {
10615            state.serialize_entry("project", &self.project)?;
10616        }
10617        if !self._unknown_fields.is_empty() {
10618            for (key, value) in self._unknown_fields.iter() {
10619                state.serialize_entry(key, &value)?;
10620            }
10621        }
10622        state.end()
10623    }
10624}
10625
10626impl std::fmt::Debug for SqlInstancesGetDiskShrinkConfigRequest {
10627    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10628        let mut debug_struct = f.debug_struct("SqlInstancesGetDiskShrinkConfigRequest");
10629        debug_struct.field("instance", &self.instance);
10630        debug_struct.field("project", &self.project);
10631        if !self._unknown_fields.is_empty() {
10632            debug_struct.field("_unknown_fields", &self._unknown_fields);
10633        }
10634        debug_struct.finish()
10635    }
10636}
10637
10638/// Instance verify external sync settings request.
10639#[derive(Clone, Default, PartialEq)]
10640#[non_exhaustive]
10641pub struct SqlInstancesVerifyExternalSyncSettingsRequest {
10642    /// Cloud SQL instance ID. This does not include the project ID.
10643    pub instance: std::string::String,
10644
10645    /// Project ID of the project that contains the instance.
10646    pub project: std::string::String,
10647
10648    /// Flag to enable verifying connection only
10649    pub verify_connection_only: bool,
10650
10651    /// External sync mode
10652    pub sync_mode:
10653        crate::model::sql_instances_verify_external_sync_settings_request::ExternalSyncMode,
10654
10655    /// Optional. Flag to verify settings required by replication setup only
10656    pub verify_replication_only: bool,
10657
10658    /// Optional. MigrationType configures the migration to use physical files or
10659    /// logical dump files. If not set, then the logical dump file configuration is
10660    /// used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL.
10661    pub migration_type:
10662        crate::model::sql_instances_verify_external_sync_settings_request::MigrationType,
10663
10664    /// Optional. Parallel level for initial data sync. Only applicable for
10665    /// PostgreSQL.
10666    pub sync_parallel_level: crate::model::ExternalSyncParallelLevel,
10667
10668    pub sync_config: std::option::Option<
10669        crate::model::sql_instances_verify_external_sync_settings_request::SyncConfig,
10670    >,
10671
10672    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10673}
10674
10675impl SqlInstancesVerifyExternalSyncSettingsRequest {
10676    pub fn new() -> Self {
10677        std::default::Default::default()
10678    }
10679
10680    /// Sets the value of [instance][crate::model::SqlInstancesVerifyExternalSyncSettingsRequest::instance].
10681    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10682        self.instance = v.into();
10683        self
10684    }
10685
10686    /// Sets the value of [project][crate::model::SqlInstancesVerifyExternalSyncSettingsRequest::project].
10687    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10688        self.project = v.into();
10689        self
10690    }
10691
10692    /// Sets the value of [verify_connection_only][crate::model::SqlInstancesVerifyExternalSyncSettingsRequest::verify_connection_only].
10693    pub fn set_verify_connection_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10694        self.verify_connection_only = v.into();
10695        self
10696    }
10697
10698    /// Sets the value of [sync_mode][crate::model::SqlInstancesVerifyExternalSyncSettingsRequest::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 [verify_replication_only][crate::model::SqlInstancesVerifyExternalSyncSettingsRequest::verify_replication_only].
10712    pub fn set_verify_replication_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10713        self.verify_replication_only = v.into();
10714        self
10715    }
10716
10717    /// Sets the value of [migration_type][crate::model::SqlInstancesVerifyExternalSyncSettingsRequest::migration_type].
10718    pub fn set_migration_type<
10719        T: std::convert::Into<
10720                crate::model::sql_instances_verify_external_sync_settings_request::MigrationType,
10721            >,
10722    >(
10723        mut self,
10724        v: T,
10725    ) -> Self {
10726        self.migration_type = v.into();
10727        self
10728    }
10729
10730    /// Sets the value of [sync_parallel_level][crate::model::SqlInstancesVerifyExternalSyncSettingsRequest::sync_parallel_level].
10731    pub fn set_sync_parallel_level<
10732        T: std::convert::Into<crate::model::ExternalSyncParallelLevel>,
10733    >(
10734        mut self,
10735        v: T,
10736    ) -> Self {
10737        self.sync_parallel_level = v.into();
10738        self
10739    }
10740
10741    /// Sets the value of [sync_config][crate::model::SqlInstancesVerifyExternalSyncSettingsRequest::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_verify_external_sync_settings_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::SqlInstancesVerifyExternalSyncSettingsRequest::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_verify_external_sync_settings_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::SqlInstancesVerifyExternalSyncSettingsRequest::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_verify_external_sync_settings_request::SyncConfig::MysqlSyncConfig(
10785                v.into()
10786            )
10787        );
10788        self
10789    }
10790}
10791
10792impl wkt::message::Message for SqlInstancesVerifyExternalSyncSettingsRequest {
10793    fn typename() -> &'static str {
10794        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest"
10795    }
10796}
10797
10798#[doc(hidden)]
10799impl<'de> serde::de::Deserialize<'de> for SqlInstancesVerifyExternalSyncSettingsRequest {
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            __verify_connection_only,
10811            __sync_mode,
10812            __verify_replication_only,
10813            __mysql_sync_config,
10814            __migration_type,
10815            __sync_parallel_level,
10816            Unknown(std::string::String),
10817        }
10818        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10819            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10820            where
10821                D: serde::Deserializer<'de>,
10822            {
10823                struct Visitor;
10824                impl<'de> serde::de::Visitor<'de> for Visitor {
10825                    type Value = __FieldTag;
10826                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10827                        formatter.write_str(
10828                            "a field name for SqlInstancesVerifyExternalSyncSettingsRequest",
10829                        )
10830                    }
10831                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10832                    where
10833                        E: serde::de::Error,
10834                    {
10835                        use std::result::Result::Ok;
10836                        use std::string::ToString;
10837                        match value {
10838                            "instance" => Ok(__FieldTag::__instance),
10839                            "project" => Ok(__FieldTag::__project),
10840                            "verifyConnectionOnly" => Ok(__FieldTag::__verify_connection_only),
10841                            "verify_connection_only" => Ok(__FieldTag::__verify_connection_only),
10842                            "syncMode" => Ok(__FieldTag::__sync_mode),
10843                            "sync_mode" => Ok(__FieldTag::__sync_mode),
10844                            "verifyReplicationOnly" => Ok(__FieldTag::__verify_replication_only),
10845                            "verify_replication_only" => Ok(__FieldTag::__verify_replication_only),
10846                            "mysqlSyncConfig" => Ok(__FieldTag::__mysql_sync_config),
10847                            "mysql_sync_config" => Ok(__FieldTag::__mysql_sync_config),
10848                            "migrationType" => Ok(__FieldTag::__migration_type),
10849                            "migration_type" => Ok(__FieldTag::__migration_type),
10850                            "syncParallelLevel" => Ok(__FieldTag::__sync_parallel_level),
10851                            "sync_parallel_level" => Ok(__FieldTag::__sync_parallel_level),
10852                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10853                        }
10854                    }
10855                }
10856                deserializer.deserialize_identifier(Visitor)
10857            }
10858        }
10859        struct Visitor;
10860        impl<'de> serde::de::Visitor<'de> for Visitor {
10861            type Value = SqlInstancesVerifyExternalSyncSettingsRequest;
10862            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10863                formatter.write_str("struct SqlInstancesVerifyExternalSyncSettingsRequest")
10864            }
10865            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10866            where
10867                A: serde::de::MapAccess<'de>,
10868            {
10869                #[allow(unused_imports)]
10870                use serde::de::Error;
10871                use std::option::Option::Some;
10872                let mut fields = std::collections::HashSet::new();
10873                let mut result = Self::Value::new();
10874                while let Some(tag) = map.next_key::<__FieldTag>()? {
10875                    #[allow(clippy::match_single_binding)]
10876                    match tag {
10877                        __FieldTag::__instance => {
10878                            if !fields.insert(__FieldTag::__instance) {
10879                                return std::result::Result::Err(A::Error::duplicate_field(
10880                                    "multiple values for instance",
10881                                ));
10882                            }
10883                            result.instance = map
10884                                .next_value::<std::option::Option<std::string::String>>()?
10885                                .unwrap_or_default();
10886                        }
10887                        __FieldTag::__project => {
10888                            if !fields.insert(__FieldTag::__project) {
10889                                return std::result::Result::Err(A::Error::duplicate_field(
10890                                    "multiple values for project",
10891                                ));
10892                            }
10893                            result.project = map
10894                                .next_value::<std::option::Option<std::string::String>>()?
10895                                .unwrap_or_default();
10896                        }
10897                        __FieldTag::__verify_connection_only => {
10898                            if !fields.insert(__FieldTag::__verify_connection_only) {
10899                                return std::result::Result::Err(A::Error::duplicate_field(
10900                                    "multiple values for verify_connection_only",
10901                                ));
10902                            }
10903                            result.verify_connection_only = map
10904                                .next_value::<std::option::Option<bool>>()?
10905                                .unwrap_or_default();
10906                        }
10907                        __FieldTag::__sync_mode => {
10908                            if !fields.insert(__FieldTag::__sync_mode) {
10909                                return std::result::Result::Err(A::Error::duplicate_field(
10910                                    "multiple values for sync_mode",
10911                                ));
10912                            }
10913                            result.sync_mode = map.next_value::<std::option::Option<crate::model::sql_instances_verify_external_sync_settings_request::ExternalSyncMode>>()?.unwrap_or_default();
10914                        }
10915                        __FieldTag::__verify_replication_only => {
10916                            if !fields.insert(__FieldTag::__verify_replication_only) {
10917                                return std::result::Result::Err(A::Error::duplicate_field(
10918                                    "multiple values for verify_replication_only",
10919                                ));
10920                            }
10921                            result.verify_replication_only = map
10922                                .next_value::<std::option::Option<bool>>()?
10923                                .unwrap_or_default();
10924                        }
10925                        __FieldTag::__mysql_sync_config => {
10926                            if !fields.insert(__FieldTag::__mysql_sync_config) {
10927                                return std::result::Result::Err(A::Error::duplicate_field(
10928                                    "multiple values for mysql_sync_config",
10929                                ));
10930                            }
10931                            if result.sync_config.is_some() {
10932                                return std::result::Result::Err(A::Error::duplicate_field(
10933                                    "multiple values for `sync_config`, a oneof with full ID .google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.mysql_sync_config, latest field was mysqlSyncConfig",
10934                                ));
10935                            }
10936                            result.sync_config = std::option::Option::Some(
10937                                crate::model::sql_instances_verify_external_sync_settings_request::SyncConfig::MysqlSyncConfig(
10938                                    map.next_value::<std::option::Option<std::boxed::Box<crate::model::MySqlSyncConfig>>>()?.unwrap_or_default()
10939                                ),
10940                            );
10941                        }
10942                        __FieldTag::__migration_type => {
10943                            if !fields.insert(__FieldTag::__migration_type) {
10944                                return std::result::Result::Err(A::Error::duplicate_field(
10945                                    "multiple values for migration_type",
10946                                ));
10947                            }
10948                            result.migration_type = map.next_value::<std::option::Option<crate::model::sql_instances_verify_external_sync_settings_request::MigrationType>>()?.unwrap_or_default();
10949                        }
10950                        __FieldTag::__sync_parallel_level => {
10951                            if !fields.insert(__FieldTag::__sync_parallel_level) {
10952                                return std::result::Result::Err(A::Error::duplicate_field(
10953                                    "multiple values for sync_parallel_level",
10954                                ));
10955                            }
10956                            result.sync_parallel_level = map.next_value::<std::option::Option<crate::model::ExternalSyncParallelLevel>>()?.unwrap_or_default();
10957                        }
10958                        __FieldTag::Unknown(key) => {
10959                            let value = map.next_value::<serde_json::Value>()?;
10960                            result._unknown_fields.insert(key, value);
10961                        }
10962                    }
10963                }
10964                std::result::Result::Ok(result)
10965            }
10966        }
10967        deserializer.deserialize_any(Visitor)
10968    }
10969}
10970
10971#[doc(hidden)]
10972impl serde::ser::Serialize for SqlInstancesVerifyExternalSyncSettingsRequest {
10973    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10974    where
10975        S: serde::ser::Serializer,
10976    {
10977        use serde::ser::SerializeMap;
10978        #[allow(unused_imports)]
10979        use std::option::Option::Some;
10980        let mut state = serializer.serialize_map(std::option::Option::None)?;
10981        if !self.instance.is_empty() {
10982            state.serialize_entry("instance", &self.instance)?;
10983        }
10984        if !self.project.is_empty() {
10985            state.serialize_entry("project", &self.project)?;
10986        }
10987        if !wkt::internal::is_default(&self.verify_connection_only) {
10988            state.serialize_entry("verifyConnectionOnly", &self.verify_connection_only)?;
10989        }
10990        if !wkt::internal::is_default(&self.sync_mode) {
10991            state.serialize_entry("syncMode", &self.sync_mode)?;
10992        }
10993        if !wkt::internal::is_default(&self.verify_replication_only) {
10994            state.serialize_entry("verifyReplicationOnly", &self.verify_replication_only)?;
10995        }
10996        if let Some(value) = self.mysql_sync_config() {
10997            state.serialize_entry("mysqlSyncConfig", value)?;
10998        }
10999        if !wkt::internal::is_default(&self.migration_type) {
11000            state.serialize_entry("migrationType", &self.migration_type)?;
11001        }
11002        if !wkt::internal::is_default(&self.sync_parallel_level) {
11003            state.serialize_entry("syncParallelLevel", &self.sync_parallel_level)?;
11004        }
11005        if !self._unknown_fields.is_empty() {
11006            for (key, value) in self._unknown_fields.iter() {
11007                state.serialize_entry(key, &value)?;
11008            }
11009        }
11010        state.end()
11011    }
11012}
11013
11014impl std::fmt::Debug for SqlInstancesVerifyExternalSyncSettingsRequest {
11015    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11016        let mut debug_struct = f.debug_struct("SqlInstancesVerifyExternalSyncSettingsRequest");
11017        debug_struct.field("instance", &self.instance);
11018        debug_struct.field("project", &self.project);
11019        debug_struct.field("verify_connection_only", &self.verify_connection_only);
11020        debug_struct.field("sync_mode", &self.sync_mode);
11021        debug_struct.field("verify_replication_only", &self.verify_replication_only);
11022        debug_struct.field("migration_type", &self.migration_type);
11023        debug_struct.field("sync_parallel_level", &self.sync_parallel_level);
11024        debug_struct.field("sync_config", &self.sync_config);
11025        if !self._unknown_fields.is_empty() {
11026            debug_struct.field("_unknown_fields", &self._unknown_fields);
11027        }
11028        debug_struct.finish()
11029    }
11030}
11031
11032/// Defines additional types related to [SqlInstancesVerifyExternalSyncSettingsRequest].
11033pub mod sql_instances_verify_external_sync_settings_request {
11034    #[allow(unused_imports)]
11035    use super::*;
11036
11037    ///
11038    /// # Working with unknown values
11039    ///
11040    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11041    /// additional enum variants at any time. Adding new variants is not considered
11042    /// a breaking change. Applications should write their code in anticipation of:
11043    ///
11044    /// - New values appearing in future releases of the client library, **and**
11045    /// - New values received dynamically, without application changes.
11046    ///
11047    /// Please consult the [Working with enums] section in the user guide for some
11048    /// guidelines.
11049    ///
11050    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11051    #[derive(Clone, Debug, PartialEq)]
11052    #[non_exhaustive]
11053    pub enum ExternalSyncMode {
11054        /// Unknown external sync mode, will be defaulted to ONLINE mode
11055        Unspecified,
11056        /// Online external sync will set up replication after initial data external
11057        /// sync
11058        Online,
11059        /// Offline external sync only dumps and loads a one-time snapshot of
11060        /// the primary instance's data
11061        Offline,
11062        /// If set, the enum was initialized with an unknown value.
11063        ///
11064        /// Applications can examine the value using [ExternalSyncMode::value] or
11065        /// [ExternalSyncMode::name].
11066        UnknownValue(external_sync_mode::UnknownValue),
11067    }
11068
11069    #[doc(hidden)]
11070    pub mod external_sync_mode {
11071        #[allow(unused_imports)]
11072        use super::*;
11073        #[derive(Clone, Debug, PartialEq)]
11074        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11075    }
11076
11077    impl ExternalSyncMode {
11078        /// Gets the enum value.
11079        ///
11080        /// Returns `None` if the enum contains an unknown value deserialized from
11081        /// the string representation of enums.
11082        pub fn value(&self) -> std::option::Option<i32> {
11083            match self {
11084                Self::Unspecified => std::option::Option::Some(0),
11085                Self::Online => std::option::Option::Some(1),
11086                Self::Offline => std::option::Option::Some(2),
11087                Self::UnknownValue(u) => u.0.value(),
11088            }
11089        }
11090
11091        /// Gets the enum value as a string.
11092        ///
11093        /// Returns `None` if the enum contains an unknown value deserialized from
11094        /// the integer representation of enums.
11095        pub fn name(&self) -> std::option::Option<&str> {
11096            match self {
11097                Self::Unspecified => std::option::Option::Some("EXTERNAL_SYNC_MODE_UNSPECIFIED"),
11098                Self::Online => std::option::Option::Some("ONLINE"),
11099                Self::Offline => std::option::Option::Some("OFFLINE"),
11100                Self::UnknownValue(u) => u.0.name(),
11101            }
11102        }
11103    }
11104
11105    impl std::default::Default for ExternalSyncMode {
11106        fn default() -> Self {
11107            use std::convert::From;
11108            Self::from(0)
11109        }
11110    }
11111
11112    impl std::fmt::Display for ExternalSyncMode {
11113        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11114            wkt::internal::display_enum(f, self.name(), self.value())
11115        }
11116    }
11117
11118    impl std::convert::From<i32> for ExternalSyncMode {
11119        fn from(value: i32) -> Self {
11120            match value {
11121                0 => Self::Unspecified,
11122                1 => Self::Online,
11123                2 => Self::Offline,
11124                _ => Self::UnknownValue(external_sync_mode::UnknownValue(
11125                    wkt::internal::UnknownEnumValue::Integer(value),
11126                )),
11127            }
11128        }
11129    }
11130
11131    impl std::convert::From<&str> for ExternalSyncMode {
11132        fn from(value: &str) -> Self {
11133            use std::string::ToString;
11134            match value {
11135                "EXTERNAL_SYNC_MODE_UNSPECIFIED" => Self::Unspecified,
11136                "ONLINE" => Self::Online,
11137                "OFFLINE" => Self::Offline,
11138                _ => Self::UnknownValue(external_sync_mode::UnknownValue(
11139                    wkt::internal::UnknownEnumValue::String(value.to_string()),
11140                )),
11141            }
11142        }
11143    }
11144
11145    impl serde::ser::Serialize for ExternalSyncMode {
11146        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11147        where
11148            S: serde::Serializer,
11149        {
11150            match self {
11151                Self::Unspecified => serializer.serialize_i32(0),
11152                Self::Online => serializer.serialize_i32(1),
11153                Self::Offline => serializer.serialize_i32(2),
11154                Self::UnknownValue(u) => u.0.serialize(serializer),
11155            }
11156        }
11157    }
11158
11159    impl<'de> serde::de::Deserialize<'de> for ExternalSyncMode {
11160        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11161        where
11162            D: serde::Deserializer<'de>,
11163        {
11164            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExternalSyncMode>::new(
11165                ".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode"))
11166        }
11167    }
11168
11169    /// MigrationType determines whether the migration is a physical file-based
11170    /// migration or a logical dump file-based migration.
11171    ///
11172    /// # Working with unknown values
11173    ///
11174    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11175    /// additional enum variants at any time. Adding new variants is not considered
11176    /// a breaking change. Applications should write their code in anticipation of:
11177    ///
11178    /// - New values appearing in future releases of the client library, **and**
11179    /// - New values received dynamically, without application changes.
11180    ///
11181    /// Please consult the [Working with enums] section in the user guide for some
11182    /// guidelines.
11183    ///
11184    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11185    #[derive(Clone, Debug, PartialEq)]
11186    #[non_exhaustive]
11187    pub enum MigrationType {
11188        /// Default value is a logical dump file-based migration
11189        Unspecified,
11190        /// Logical dump file-based migration
11191        Logical,
11192        /// Physical file-based migration
11193        Physical,
11194        /// If set, the enum was initialized with an unknown value.
11195        ///
11196        /// Applications can examine the value using [MigrationType::value] or
11197        /// [MigrationType::name].
11198        UnknownValue(migration_type::UnknownValue),
11199    }
11200
11201    #[doc(hidden)]
11202    pub mod migration_type {
11203        #[allow(unused_imports)]
11204        use super::*;
11205        #[derive(Clone, Debug, PartialEq)]
11206        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11207    }
11208
11209    impl MigrationType {
11210        /// Gets the enum value.
11211        ///
11212        /// Returns `None` if the enum contains an unknown value deserialized from
11213        /// the string representation of enums.
11214        pub fn value(&self) -> std::option::Option<i32> {
11215            match self {
11216                Self::Unspecified => std::option::Option::Some(0),
11217                Self::Logical => std::option::Option::Some(1),
11218                Self::Physical => std::option::Option::Some(2),
11219                Self::UnknownValue(u) => u.0.value(),
11220            }
11221        }
11222
11223        /// Gets the enum value as a string.
11224        ///
11225        /// Returns `None` if the enum contains an unknown value deserialized from
11226        /// the integer representation of enums.
11227        pub fn name(&self) -> std::option::Option<&str> {
11228            match self {
11229                Self::Unspecified => std::option::Option::Some("MIGRATION_TYPE_UNSPECIFIED"),
11230                Self::Logical => std::option::Option::Some("LOGICAL"),
11231                Self::Physical => std::option::Option::Some("PHYSICAL"),
11232                Self::UnknownValue(u) => u.0.name(),
11233            }
11234        }
11235    }
11236
11237    impl std::default::Default for MigrationType {
11238        fn default() -> Self {
11239            use std::convert::From;
11240            Self::from(0)
11241        }
11242    }
11243
11244    impl std::fmt::Display for MigrationType {
11245        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11246            wkt::internal::display_enum(f, self.name(), self.value())
11247        }
11248    }
11249
11250    impl std::convert::From<i32> for MigrationType {
11251        fn from(value: i32) -> Self {
11252            match value {
11253                0 => Self::Unspecified,
11254                1 => Self::Logical,
11255                2 => Self::Physical,
11256                _ => Self::UnknownValue(migration_type::UnknownValue(
11257                    wkt::internal::UnknownEnumValue::Integer(value),
11258                )),
11259            }
11260        }
11261    }
11262
11263    impl std::convert::From<&str> for MigrationType {
11264        fn from(value: &str) -> Self {
11265            use std::string::ToString;
11266            match value {
11267                "MIGRATION_TYPE_UNSPECIFIED" => Self::Unspecified,
11268                "LOGICAL" => Self::Logical,
11269                "PHYSICAL" => Self::Physical,
11270                _ => Self::UnknownValue(migration_type::UnknownValue(
11271                    wkt::internal::UnknownEnumValue::String(value.to_string()),
11272                )),
11273            }
11274        }
11275    }
11276
11277    impl serde::ser::Serialize for MigrationType {
11278        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11279        where
11280            S: serde::Serializer,
11281        {
11282            match self {
11283                Self::Unspecified => serializer.serialize_i32(0),
11284                Self::Logical => serializer.serialize_i32(1),
11285                Self::Physical => serializer.serialize_i32(2),
11286                Self::UnknownValue(u) => u.0.serialize(serializer),
11287            }
11288        }
11289    }
11290
11291    impl<'de> serde::de::Deserialize<'de> for MigrationType {
11292        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11293        where
11294            D: serde::Deserializer<'de>,
11295        {
11296            deserializer.deserialize_any(wkt::internal::EnumVisitor::<MigrationType>::new(
11297                ".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType",
11298            ))
11299        }
11300    }
11301
11302    #[derive(Clone, Debug, PartialEq)]
11303    #[non_exhaustive]
11304    pub enum SyncConfig {
11305        /// Optional. MySQL-specific settings for start external sync.
11306        MysqlSyncConfig(std::boxed::Box<crate::model::MySqlSyncConfig>),
11307    }
11308}
11309
11310/// Instance start external sync request.
11311#[derive(Clone, Default, PartialEq)]
11312#[non_exhaustive]
11313pub struct SqlInstancesStartExternalSyncRequest {
11314    /// Cloud SQL instance ID. This does not include the project ID.
11315    pub instance: std::string::String,
11316
11317    /// ID of the project that contains the instance.
11318    pub project: std::string::String,
11319
11320    /// External sync mode.
11321    pub sync_mode:
11322        crate::model::sql_instances_verify_external_sync_settings_request::ExternalSyncMode,
11323
11324    /// Whether to skip the verification step (VESS).
11325    pub skip_verification: bool,
11326
11327    /// Optional. Parallel level for initial data sync. Currently only applicable
11328    /// for MySQL.
11329    pub sync_parallel_level: crate::model::ExternalSyncParallelLevel,
11330
11331    /// Optional. MigrationType configures the migration to use physical files or
11332    /// logical dump files. If not set, then the logical dump file configuration is
11333    /// used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL.
11334    pub migration_type:
11335        crate::model::sql_instances_verify_external_sync_settings_request::MigrationType,
11336
11337    pub sync_config:
11338        std::option::Option<crate::model::sql_instances_start_external_sync_request::SyncConfig>,
11339
11340    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11341}
11342
11343impl SqlInstancesStartExternalSyncRequest {
11344    pub fn new() -> Self {
11345        std::default::Default::default()
11346    }
11347
11348    /// Sets the value of [instance][crate::model::SqlInstancesStartExternalSyncRequest::instance].
11349    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11350        self.instance = v.into();
11351        self
11352    }
11353
11354    /// Sets the value of [project][crate::model::SqlInstancesStartExternalSyncRequest::project].
11355    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11356        self.project = v.into();
11357        self
11358    }
11359
11360    /// Sets the value of [sync_mode][crate::model::SqlInstancesStartExternalSyncRequest::sync_mode].
11361    pub fn set_sync_mode<
11362        T: std::convert::Into<
11363                crate::model::sql_instances_verify_external_sync_settings_request::ExternalSyncMode,
11364            >,
11365    >(
11366        mut self,
11367        v: T,
11368    ) -> Self {
11369        self.sync_mode = v.into();
11370        self
11371    }
11372
11373    /// Sets the value of [skip_verification][crate::model::SqlInstancesStartExternalSyncRequest::skip_verification].
11374    pub fn set_skip_verification<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11375        self.skip_verification = v.into();
11376        self
11377    }
11378
11379    /// Sets the value of [sync_parallel_level][crate::model::SqlInstancesStartExternalSyncRequest::sync_parallel_level].
11380    pub fn set_sync_parallel_level<
11381        T: std::convert::Into<crate::model::ExternalSyncParallelLevel>,
11382    >(
11383        mut self,
11384        v: T,
11385    ) -> Self {
11386        self.sync_parallel_level = v.into();
11387        self
11388    }
11389
11390    /// Sets the value of [migration_type][crate::model::SqlInstancesStartExternalSyncRequest::migration_type].
11391    pub fn set_migration_type<
11392        T: std::convert::Into<
11393                crate::model::sql_instances_verify_external_sync_settings_request::MigrationType,
11394            >,
11395    >(
11396        mut self,
11397        v: T,
11398    ) -> Self {
11399        self.migration_type = v.into();
11400        self
11401    }
11402
11403    /// Sets the value of [sync_config][crate::model::SqlInstancesStartExternalSyncRequest::sync_config].
11404    ///
11405    /// Note that all the setters affecting `sync_config` are mutually
11406    /// exclusive.
11407    pub fn set_sync_config<
11408        T: std::convert::Into<
11409                std::option::Option<
11410                    crate::model::sql_instances_start_external_sync_request::SyncConfig,
11411                >,
11412            >,
11413    >(
11414        mut self,
11415        v: T,
11416    ) -> Self {
11417        self.sync_config = v.into();
11418        self
11419    }
11420
11421    /// The value of [sync_config][crate::model::SqlInstancesStartExternalSyncRequest::sync_config]
11422    /// if it holds a `MysqlSyncConfig`, `None` if the field is not set or
11423    /// holds a different branch.
11424    pub fn mysql_sync_config(
11425        &self,
11426    ) -> std::option::Option<&std::boxed::Box<crate::model::MySqlSyncConfig>> {
11427        #[allow(unreachable_patterns)]
11428        self.sync_config.as_ref().and_then(|v| match v {
11429            crate::model::sql_instances_start_external_sync_request::SyncConfig::MysqlSyncConfig(v) => std::option::Option::Some(v),
11430            _ => std::option::Option::None,
11431        })
11432    }
11433
11434    /// Sets the value of [sync_config][crate::model::SqlInstancesStartExternalSyncRequest::sync_config]
11435    /// to hold a `MysqlSyncConfig`.
11436    ///
11437    /// Note that all the setters affecting `sync_config` are
11438    /// mutually exclusive.
11439    pub fn set_mysql_sync_config<
11440        T: std::convert::Into<std::boxed::Box<crate::model::MySqlSyncConfig>>,
11441    >(
11442        mut self,
11443        v: T,
11444    ) -> Self {
11445        self.sync_config = std::option::Option::Some(
11446            crate::model::sql_instances_start_external_sync_request::SyncConfig::MysqlSyncConfig(
11447                v.into(),
11448            ),
11449        );
11450        self
11451    }
11452}
11453
11454impl wkt::message::Message for SqlInstancesStartExternalSyncRequest {
11455    fn typename() -> &'static str {
11456        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest"
11457    }
11458}
11459
11460#[doc(hidden)]
11461impl<'de> serde::de::Deserialize<'de> for SqlInstancesStartExternalSyncRequest {
11462    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11463    where
11464        D: serde::Deserializer<'de>,
11465    {
11466        #[allow(non_camel_case_types)]
11467        #[doc(hidden)]
11468        #[derive(PartialEq, Eq, Hash)]
11469        enum __FieldTag {
11470            __instance,
11471            __project,
11472            __sync_mode,
11473            __skip_verification,
11474            __mysql_sync_config,
11475            __sync_parallel_level,
11476            __migration_type,
11477            Unknown(std::string::String),
11478        }
11479        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11480            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11481            where
11482                D: serde::Deserializer<'de>,
11483            {
11484                struct Visitor;
11485                impl<'de> serde::de::Visitor<'de> for Visitor {
11486                    type Value = __FieldTag;
11487                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11488                        formatter.write_str("a field name for SqlInstancesStartExternalSyncRequest")
11489                    }
11490                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11491                    where
11492                        E: serde::de::Error,
11493                    {
11494                        use std::result::Result::Ok;
11495                        use std::string::ToString;
11496                        match value {
11497                            "instance" => Ok(__FieldTag::__instance),
11498                            "project" => Ok(__FieldTag::__project),
11499                            "syncMode" => Ok(__FieldTag::__sync_mode),
11500                            "sync_mode" => Ok(__FieldTag::__sync_mode),
11501                            "skipVerification" => Ok(__FieldTag::__skip_verification),
11502                            "skip_verification" => Ok(__FieldTag::__skip_verification),
11503                            "mysqlSyncConfig" => Ok(__FieldTag::__mysql_sync_config),
11504                            "mysql_sync_config" => Ok(__FieldTag::__mysql_sync_config),
11505                            "syncParallelLevel" => Ok(__FieldTag::__sync_parallel_level),
11506                            "sync_parallel_level" => Ok(__FieldTag::__sync_parallel_level),
11507                            "migrationType" => Ok(__FieldTag::__migration_type),
11508                            "migration_type" => Ok(__FieldTag::__migration_type),
11509                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11510                        }
11511                    }
11512                }
11513                deserializer.deserialize_identifier(Visitor)
11514            }
11515        }
11516        struct Visitor;
11517        impl<'de> serde::de::Visitor<'de> for Visitor {
11518            type Value = SqlInstancesStartExternalSyncRequest;
11519            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11520                formatter.write_str("struct SqlInstancesStartExternalSyncRequest")
11521            }
11522            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11523            where
11524                A: serde::de::MapAccess<'de>,
11525            {
11526                #[allow(unused_imports)]
11527                use serde::de::Error;
11528                use std::option::Option::Some;
11529                let mut fields = std::collections::HashSet::new();
11530                let mut result = Self::Value::new();
11531                while let Some(tag) = map.next_key::<__FieldTag>()? {
11532                    #[allow(clippy::match_single_binding)]
11533                    match tag {
11534                        __FieldTag::__instance => {
11535                            if !fields.insert(__FieldTag::__instance) {
11536                                return std::result::Result::Err(A::Error::duplicate_field(
11537                                    "multiple values for instance",
11538                                ));
11539                            }
11540                            result.instance = map
11541                                .next_value::<std::option::Option<std::string::String>>()?
11542                                .unwrap_or_default();
11543                        }
11544                        __FieldTag::__project => {
11545                            if !fields.insert(__FieldTag::__project) {
11546                                return std::result::Result::Err(A::Error::duplicate_field(
11547                                    "multiple values for project",
11548                                ));
11549                            }
11550                            result.project = map
11551                                .next_value::<std::option::Option<std::string::String>>()?
11552                                .unwrap_or_default();
11553                        }
11554                        __FieldTag::__sync_mode => {
11555                            if !fields.insert(__FieldTag::__sync_mode) {
11556                                return std::result::Result::Err(A::Error::duplicate_field(
11557                                    "multiple values for sync_mode",
11558                                ));
11559                            }
11560                            result.sync_mode = map.next_value::<std::option::Option<crate::model::sql_instances_verify_external_sync_settings_request::ExternalSyncMode>>()?.unwrap_or_default();
11561                        }
11562                        __FieldTag::__skip_verification => {
11563                            if !fields.insert(__FieldTag::__skip_verification) {
11564                                return std::result::Result::Err(A::Error::duplicate_field(
11565                                    "multiple values for skip_verification",
11566                                ));
11567                            }
11568                            result.skip_verification = map
11569                                .next_value::<std::option::Option<bool>>()?
11570                                .unwrap_or_default();
11571                        }
11572                        __FieldTag::__mysql_sync_config => {
11573                            if !fields.insert(__FieldTag::__mysql_sync_config) {
11574                                return std::result::Result::Err(A::Error::duplicate_field(
11575                                    "multiple values for mysql_sync_config",
11576                                ));
11577                            }
11578                            if result.sync_config.is_some() {
11579                                return std::result::Result::Err(A::Error::duplicate_field(
11580                                    "multiple values for `sync_config`, a oneof with full ID .google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest.mysql_sync_config, latest field was mysqlSyncConfig",
11581                                ));
11582                            }
11583                            result.sync_config = std::option::Option::Some(
11584                                crate::model::sql_instances_start_external_sync_request::SyncConfig::MysqlSyncConfig(
11585                                    map.next_value::<std::option::Option<std::boxed::Box<crate::model::MySqlSyncConfig>>>()?.unwrap_or_default()
11586                                ),
11587                            );
11588                        }
11589                        __FieldTag::__sync_parallel_level => {
11590                            if !fields.insert(__FieldTag::__sync_parallel_level) {
11591                                return std::result::Result::Err(A::Error::duplicate_field(
11592                                    "multiple values for sync_parallel_level",
11593                                ));
11594                            }
11595                            result.sync_parallel_level = map.next_value::<std::option::Option<crate::model::ExternalSyncParallelLevel>>()?.unwrap_or_default();
11596                        }
11597                        __FieldTag::__migration_type => {
11598                            if !fields.insert(__FieldTag::__migration_type) {
11599                                return std::result::Result::Err(A::Error::duplicate_field(
11600                                    "multiple values for migration_type",
11601                                ));
11602                            }
11603                            result.migration_type = map.next_value::<std::option::Option<crate::model::sql_instances_verify_external_sync_settings_request::MigrationType>>()?.unwrap_or_default();
11604                        }
11605                        __FieldTag::Unknown(key) => {
11606                            let value = map.next_value::<serde_json::Value>()?;
11607                            result._unknown_fields.insert(key, value);
11608                        }
11609                    }
11610                }
11611                std::result::Result::Ok(result)
11612            }
11613        }
11614        deserializer.deserialize_any(Visitor)
11615    }
11616}
11617
11618#[doc(hidden)]
11619impl serde::ser::Serialize for SqlInstancesStartExternalSyncRequest {
11620    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11621    where
11622        S: serde::ser::Serializer,
11623    {
11624        use serde::ser::SerializeMap;
11625        #[allow(unused_imports)]
11626        use std::option::Option::Some;
11627        let mut state = serializer.serialize_map(std::option::Option::None)?;
11628        if !self.instance.is_empty() {
11629            state.serialize_entry("instance", &self.instance)?;
11630        }
11631        if !self.project.is_empty() {
11632            state.serialize_entry("project", &self.project)?;
11633        }
11634        if !wkt::internal::is_default(&self.sync_mode) {
11635            state.serialize_entry("syncMode", &self.sync_mode)?;
11636        }
11637        if !wkt::internal::is_default(&self.skip_verification) {
11638            state.serialize_entry("skipVerification", &self.skip_verification)?;
11639        }
11640        if let Some(value) = self.mysql_sync_config() {
11641            state.serialize_entry("mysqlSyncConfig", value)?;
11642        }
11643        if !wkt::internal::is_default(&self.sync_parallel_level) {
11644            state.serialize_entry("syncParallelLevel", &self.sync_parallel_level)?;
11645        }
11646        if !wkt::internal::is_default(&self.migration_type) {
11647            state.serialize_entry("migrationType", &self.migration_type)?;
11648        }
11649        if !self._unknown_fields.is_empty() {
11650            for (key, value) in self._unknown_fields.iter() {
11651                state.serialize_entry(key, &value)?;
11652            }
11653        }
11654        state.end()
11655    }
11656}
11657
11658impl std::fmt::Debug for SqlInstancesStartExternalSyncRequest {
11659    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11660        let mut debug_struct = f.debug_struct("SqlInstancesStartExternalSyncRequest");
11661        debug_struct.field("instance", &self.instance);
11662        debug_struct.field("project", &self.project);
11663        debug_struct.field("sync_mode", &self.sync_mode);
11664        debug_struct.field("skip_verification", &self.skip_verification);
11665        debug_struct.field("sync_parallel_level", &self.sync_parallel_level);
11666        debug_struct.field("migration_type", &self.migration_type);
11667        debug_struct.field("sync_config", &self.sync_config);
11668        if !self._unknown_fields.is_empty() {
11669            debug_struct.field("_unknown_fields", &self._unknown_fields);
11670        }
11671        debug_struct.finish()
11672    }
11673}
11674
11675/// Defines additional types related to [SqlInstancesStartExternalSyncRequest].
11676pub mod sql_instances_start_external_sync_request {
11677    #[allow(unused_imports)]
11678    use super::*;
11679
11680    #[derive(Clone, Debug, PartialEq)]
11681    #[non_exhaustive]
11682    pub enum SyncConfig {
11683        /// MySQL-specific settings for start external sync.
11684        MysqlSyncConfig(std::boxed::Box<crate::model::MySqlSyncConfig>),
11685    }
11686}
11687
11688/// Instance reset replica size request.
11689#[derive(Clone, Default, PartialEq)]
11690#[non_exhaustive]
11691pub struct SqlInstancesResetReplicaSizeRequest {
11692    /// Cloud SQL read replica instance name.
11693    pub instance: std::string::String,
11694
11695    /// ID of the project that contains the read replica.
11696    pub project: std::string::String,
11697
11698    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11699}
11700
11701impl SqlInstancesResetReplicaSizeRequest {
11702    pub fn new() -> Self {
11703        std::default::Default::default()
11704    }
11705
11706    /// Sets the value of [instance][crate::model::SqlInstancesResetReplicaSizeRequest::instance].
11707    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11708        self.instance = v.into();
11709        self
11710    }
11711
11712    /// Sets the value of [project][crate::model::SqlInstancesResetReplicaSizeRequest::project].
11713    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11714        self.project = v.into();
11715        self
11716    }
11717}
11718
11719impl wkt::message::Message for SqlInstancesResetReplicaSizeRequest {
11720    fn typename() -> &'static str {
11721        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest"
11722    }
11723}
11724
11725#[doc(hidden)]
11726impl<'de> serde::de::Deserialize<'de> for SqlInstancesResetReplicaSizeRequest {
11727    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11728    where
11729        D: serde::Deserializer<'de>,
11730    {
11731        #[allow(non_camel_case_types)]
11732        #[doc(hidden)]
11733        #[derive(PartialEq, Eq, Hash)]
11734        enum __FieldTag {
11735            __instance,
11736            __project,
11737            Unknown(std::string::String),
11738        }
11739        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11740            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11741            where
11742                D: serde::Deserializer<'de>,
11743            {
11744                struct Visitor;
11745                impl<'de> serde::de::Visitor<'de> for Visitor {
11746                    type Value = __FieldTag;
11747                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11748                        formatter.write_str("a field name for SqlInstancesResetReplicaSizeRequest")
11749                    }
11750                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11751                    where
11752                        E: serde::de::Error,
11753                    {
11754                        use std::result::Result::Ok;
11755                        use std::string::ToString;
11756                        match value {
11757                            "instance" => Ok(__FieldTag::__instance),
11758                            "project" => Ok(__FieldTag::__project),
11759                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11760                        }
11761                    }
11762                }
11763                deserializer.deserialize_identifier(Visitor)
11764            }
11765        }
11766        struct Visitor;
11767        impl<'de> serde::de::Visitor<'de> for Visitor {
11768            type Value = SqlInstancesResetReplicaSizeRequest;
11769            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11770                formatter.write_str("struct SqlInstancesResetReplicaSizeRequest")
11771            }
11772            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11773            where
11774                A: serde::de::MapAccess<'de>,
11775            {
11776                #[allow(unused_imports)]
11777                use serde::de::Error;
11778                use std::option::Option::Some;
11779                let mut fields = std::collections::HashSet::new();
11780                let mut result = Self::Value::new();
11781                while let Some(tag) = map.next_key::<__FieldTag>()? {
11782                    #[allow(clippy::match_single_binding)]
11783                    match tag {
11784                        __FieldTag::__instance => {
11785                            if !fields.insert(__FieldTag::__instance) {
11786                                return std::result::Result::Err(A::Error::duplicate_field(
11787                                    "multiple values for instance",
11788                                ));
11789                            }
11790                            result.instance = map
11791                                .next_value::<std::option::Option<std::string::String>>()?
11792                                .unwrap_or_default();
11793                        }
11794                        __FieldTag::__project => {
11795                            if !fields.insert(__FieldTag::__project) {
11796                                return std::result::Result::Err(A::Error::duplicate_field(
11797                                    "multiple values for project",
11798                                ));
11799                            }
11800                            result.project = map
11801                                .next_value::<std::option::Option<std::string::String>>()?
11802                                .unwrap_or_default();
11803                        }
11804                        __FieldTag::Unknown(key) => {
11805                            let value = map.next_value::<serde_json::Value>()?;
11806                            result._unknown_fields.insert(key, value);
11807                        }
11808                    }
11809                }
11810                std::result::Result::Ok(result)
11811            }
11812        }
11813        deserializer.deserialize_any(Visitor)
11814    }
11815}
11816
11817#[doc(hidden)]
11818impl serde::ser::Serialize for SqlInstancesResetReplicaSizeRequest {
11819    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11820    where
11821        S: serde::ser::Serializer,
11822    {
11823        use serde::ser::SerializeMap;
11824        #[allow(unused_imports)]
11825        use std::option::Option::Some;
11826        let mut state = serializer.serialize_map(std::option::Option::None)?;
11827        if !self.instance.is_empty() {
11828            state.serialize_entry("instance", &self.instance)?;
11829        }
11830        if !self.project.is_empty() {
11831            state.serialize_entry("project", &self.project)?;
11832        }
11833        if !self._unknown_fields.is_empty() {
11834            for (key, value) in self._unknown_fields.iter() {
11835                state.serialize_entry(key, &value)?;
11836            }
11837        }
11838        state.end()
11839    }
11840}
11841
11842impl std::fmt::Debug for SqlInstancesResetReplicaSizeRequest {
11843    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11844        let mut debug_struct = f.debug_struct("SqlInstancesResetReplicaSizeRequest");
11845        debug_struct.field("instance", &self.instance);
11846        debug_struct.field("project", &self.project);
11847        if !self._unknown_fields.is_empty() {
11848            debug_struct.field("_unknown_fields", &self._unknown_fields);
11849        }
11850        debug_struct.finish()
11851    }
11852}
11853
11854/// Instance create ephemeral certificate request.
11855#[derive(Clone, Default, PartialEq)]
11856#[non_exhaustive]
11857pub struct SqlInstancesCreateEphemeralCertRequest {
11858    /// Cloud SQL instance ID. This does not include the project ID.
11859    pub instance: std::string::String,
11860
11861    /// Project ID of the Cloud SQL project.
11862    pub project: std::string::String,
11863
11864    pub body: std::option::Option<crate::model::SslCertsCreateEphemeralRequest>,
11865
11866    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11867}
11868
11869impl SqlInstancesCreateEphemeralCertRequest {
11870    pub fn new() -> Self {
11871        std::default::Default::default()
11872    }
11873
11874    /// Sets the value of [instance][crate::model::SqlInstancesCreateEphemeralCertRequest::instance].
11875    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11876        self.instance = v.into();
11877        self
11878    }
11879
11880    /// Sets the value of [project][crate::model::SqlInstancesCreateEphemeralCertRequest::project].
11881    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11882        self.project = v.into();
11883        self
11884    }
11885
11886    /// Sets the value of [body][crate::model::SqlInstancesCreateEphemeralCertRequest::body].
11887    pub fn set_body<T>(mut self, v: T) -> Self
11888    where
11889        T: std::convert::Into<crate::model::SslCertsCreateEphemeralRequest>,
11890    {
11891        self.body = std::option::Option::Some(v.into());
11892        self
11893    }
11894
11895    /// Sets or clears the value of [body][crate::model::SqlInstancesCreateEphemeralCertRequest::body].
11896    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
11897    where
11898        T: std::convert::Into<crate::model::SslCertsCreateEphemeralRequest>,
11899    {
11900        self.body = v.map(|x| x.into());
11901        self
11902    }
11903}
11904
11905impl wkt::message::Message for SqlInstancesCreateEphemeralCertRequest {
11906    fn typename() -> &'static str {
11907        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest"
11908    }
11909}
11910
11911#[doc(hidden)]
11912impl<'de> serde::de::Deserialize<'de> for SqlInstancesCreateEphemeralCertRequest {
11913    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11914    where
11915        D: serde::Deserializer<'de>,
11916    {
11917        #[allow(non_camel_case_types)]
11918        #[doc(hidden)]
11919        #[derive(PartialEq, Eq, Hash)]
11920        enum __FieldTag {
11921            __instance,
11922            __project,
11923            __body,
11924            Unknown(std::string::String),
11925        }
11926        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11927            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11928            where
11929                D: serde::Deserializer<'de>,
11930            {
11931                struct Visitor;
11932                impl<'de> serde::de::Visitor<'de> for Visitor {
11933                    type Value = __FieldTag;
11934                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11935                        formatter
11936                            .write_str("a field name for SqlInstancesCreateEphemeralCertRequest")
11937                    }
11938                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11939                    where
11940                        E: serde::de::Error,
11941                    {
11942                        use std::result::Result::Ok;
11943                        use std::string::ToString;
11944                        match value {
11945                            "instance" => Ok(__FieldTag::__instance),
11946                            "project" => Ok(__FieldTag::__project),
11947                            "body" => Ok(__FieldTag::__body),
11948                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11949                        }
11950                    }
11951                }
11952                deserializer.deserialize_identifier(Visitor)
11953            }
11954        }
11955        struct Visitor;
11956        impl<'de> serde::de::Visitor<'de> for Visitor {
11957            type Value = SqlInstancesCreateEphemeralCertRequest;
11958            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11959                formatter.write_str("struct SqlInstancesCreateEphemeralCertRequest")
11960            }
11961            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11962            where
11963                A: serde::de::MapAccess<'de>,
11964            {
11965                #[allow(unused_imports)]
11966                use serde::de::Error;
11967                use std::option::Option::Some;
11968                let mut fields = std::collections::HashSet::new();
11969                let mut result = Self::Value::new();
11970                while let Some(tag) = map.next_key::<__FieldTag>()? {
11971                    #[allow(clippy::match_single_binding)]
11972                    match tag {
11973                        __FieldTag::__instance => {
11974                            if !fields.insert(__FieldTag::__instance) {
11975                                return std::result::Result::Err(A::Error::duplicate_field(
11976                                    "multiple values for instance",
11977                                ));
11978                            }
11979                            result.instance = map
11980                                .next_value::<std::option::Option<std::string::String>>()?
11981                                .unwrap_or_default();
11982                        }
11983                        __FieldTag::__project => {
11984                            if !fields.insert(__FieldTag::__project) {
11985                                return std::result::Result::Err(A::Error::duplicate_field(
11986                                    "multiple values for project",
11987                                ));
11988                            }
11989                            result.project = map
11990                                .next_value::<std::option::Option<std::string::String>>()?
11991                                .unwrap_or_default();
11992                        }
11993                        __FieldTag::__body => {
11994                            if !fields.insert(__FieldTag::__body) {
11995                                return std::result::Result::Err(A::Error::duplicate_field(
11996                                    "multiple values for body",
11997                                ));
11998                            }
11999                            result.body =
12000                                map.next_value::<std::option::Option<
12001                                    crate::model::SslCertsCreateEphemeralRequest,
12002                                >>()?;
12003                        }
12004                        __FieldTag::Unknown(key) => {
12005                            let value = map.next_value::<serde_json::Value>()?;
12006                            result._unknown_fields.insert(key, value);
12007                        }
12008                    }
12009                }
12010                std::result::Result::Ok(result)
12011            }
12012        }
12013        deserializer.deserialize_any(Visitor)
12014    }
12015}
12016
12017#[doc(hidden)]
12018impl serde::ser::Serialize for SqlInstancesCreateEphemeralCertRequest {
12019    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12020    where
12021        S: serde::ser::Serializer,
12022    {
12023        use serde::ser::SerializeMap;
12024        #[allow(unused_imports)]
12025        use std::option::Option::Some;
12026        let mut state = serializer.serialize_map(std::option::Option::None)?;
12027        if !self.instance.is_empty() {
12028            state.serialize_entry("instance", &self.instance)?;
12029        }
12030        if !self.project.is_empty() {
12031            state.serialize_entry("project", &self.project)?;
12032        }
12033        if self.body.is_some() {
12034            state.serialize_entry("body", &self.body)?;
12035        }
12036        if !self._unknown_fields.is_empty() {
12037            for (key, value) in self._unknown_fields.iter() {
12038                state.serialize_entry(key, &value)?;
12039            }
12040        }
12041        state.end()
12042    }
12043}
12044
12045impl std::fmt::Debug for SqlInstancesCreateEphemeralCertRequest {
12046    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12047        let mut debug_struct = f.debug_struct("SqlInstancesCreateEphemeralCertRequest");
12048        debug_struct.field("instance", &self.instance);
12049        debug_struct.field("project", &self.project);
12050        debug_struct.field("body", &self.body);
12051        if !self._unknown_fields.is_empty() {
12052            debug_struct.field("_unknown_fields", &self._unknown_fields);
12053        }
12054        debug_struct.finish()
12055    }
12056}
12057
12058/// Database instance clone request.
12059#[derive(Clone, Default, PartialEq)]
12060#[non_exhaustive]
12061pub struct InstancesCloneRequest {
12062    /// Contains details about the clone operation.
12063    pub clone_context: std::option::Option<crate::model::CloneContext>,
12064
12065    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12066}
12067
12068impl InstancesCloneRequest {
12069    pub fn new() -> Self {
12070        std::default::Default::default()
12071    }
12072
12073    /// Sets the value of [clone_context][crate::model::InstancesCloneRequest::clone_context].
12074    pub fn set_clone_context<T>(mut self, v: T) -> Self
12075    where
12076        T: std::convert::Into<crate::model::CloneContext>,
12077    {
12078        self.clone_context = std::option::Option::Some(v.into());
12079        self
12080    }
12081
12082    /// Sets or clears the value of [clone_context][crate::model::InstancesCloneRequest::clone_context].
12083    pub fn set_or_clear_clone_context<T>(mut self, v: std::option::Option<T>) -> Self
12084    where
12085        T: std::convert::Into<crate::model::CloneContext>,
12086    {
12087        self.clone_context = v.map(|x| x.into());
12088        self
12089    }
12090}
12091
12092impl wkt::message::Message for InstancesCloneRequest {
12093    fn typename() -> &'static str {
12094        "type.googleapis.com/google.cloud.sql.v1.InstancesCloneRequest"
12095    }
12096}
12097
12098#[doc(hidden)]
12099impl<'de> serde::de::Deserialize<'de> for InstancesCloneRequest {
12100    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12101    where
12102        D: serde::Deserializer<'de>,
12103    {
12104        #[allow(non_camel_case_types)]
12105        #[doc(hidden)]
12106        #[derive(PartialEq, Eq, Hash)]
12107        enum __FieldTag {
12108            __clone_context,
12109            Unknown(std::string::String),
12110        }
12111        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12112            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12113            where
12114                D: serde::Deserializer<'de>,
12115            {
12116                struct Visitor;
12117                impl<'de> serde::de::Visitor<'de> for Visitor {
12118                    type Value = __FieldTag;
12119                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12120                        formatter.write_str("a field name for InstancesCloneRequest")
12121                    }
12122                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12123                    where
12124                        E: serde::de::Error,
12125                    {
12126                        use std::result::Result::Ok;
12127                        use std::string::ToString;
12128                        match value {
12129                            "cloneContext" => Ok(__FieldTag::__clone_context),
12130                            "clone_context" => Ok(__FieldTag::__clone_context),
12131                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12132                        }
12133                    }
12134                }
12135                deserializer.deserialize_identifier(Visitor)
12136            }
12137        }
12138        struct Visitor;
12139        impl<'de> serde::de::Visitor<'de> for Visitor {
12140            type Value = InstancesCloneRequest;
12141            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12142                formatter.write_str("struct InstancesCloneRequest")
12143            }
12144            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12145            where
12146                A: serde::de::MapAccess<'de>,
12147            {
12148                #[allow(unused_imports)]
12149                use serde::de::Error;
12150                use std::option::Option::Some;
12151                let mut fields = std::collections::HashSet::new();
12152                let mut result = Self::Value::new();
12153                while let Some(tag) = map.next_key::<__FieldTag>()? {
12154                    #[allow(clippy::match_single_binding)]
12155                    match tag {
12156                        __FieldTag::__clone_context => {
12157                            if !fields.insert(__FieldTag::__clone_context) {
12158                                return std::result::Result::Err(A::Error::duplicate_field(
12159                                    "multiple values for clone_context",
12160                                ));
12161                            }
12162                            result.clone_context = map
12163                                .next_value::<std::option::Option<crate::model::CloneContext>>()?;
12164                        }
12165                        __FieldTag::Unknown(key) => {
12166                            let value = map.next_value::<serde_json::Value>()?;
12167                            result._unknown_fields.insert(key, value);
12168                        }
12169                    }
12170                }
12171                std::result::Result::Ok(result)
12172            }
12173        }
12174        deserializer.deserialize_any(Visitor)
12175    }
12176}
12177
12178#[doc(hidden)]
12179impl serde::ser::Serialize for InstancesCloneRequest {
12180    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12181    where
12182        S: serde::ser::Serializer,
12183    {
12184        use serde::ser::SerializeMap;
12185        #[allow(unused_imports)]
12186        use std::option::Option::Some;
12187        let mut state = serializer.serialize_map(std::option::Option::None)?;
12188        if self.clone_context.is_some() {
12189            state.serialize_entry("cloneContext", &self.clone_context)?;
12190        }
12191        if !self._unknown_fields.is_empty() {
12192            for (key, value) in self._unknown_fields.iter() {
12193                state.serialize_entry(key, &value)?;
12194            }
12195        }
12196        state.end()
12197    }
12198}
12199
12200impl std::fmt::Debug for InstancesCloneRequest {
12201    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12202        let mut debug_struct = f.debug_struct("InstancesCloneRequest");
12203        debug_struct.field("clone_context", &self.clone_context);
12204        if !self._unknown_fields.is_empty() {
12205            debug_struct.field("_unknown_fields", &self._unknown_fields);
12206        }
12207        debug_struct.finish()
12208    }
12209}
12210
12211/// Database demote primary instance request.
12212#[derive(Clone, Default, PartialEq)]
12213#[non_exhaustive]
12214pub struct InstancesDemoteMasterRequest {
12215    /// Contains details about the demoteMaster operation.
12216    pub demote_master_context: std::option::Option<crate::model::DemoteMasterContext>,
12217
12218    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12219}
12220
12221impl InstancesDemoteMasterRequest {
12222    pub fn new() -> Self {
12223        std::default::Default::default()
12224    }
12225
12226    /// Sets the value of [demote_master_context][crate::model::InstancesDemoteMasterRequest::demote_master_context].
12227    pub fn set_demote_master_context<T>(mut self, v: T) -> Self
12228    where
12229        T: std::convert::Into<crate::model::DemoteMasterContext>,
12230    {
12231        self.demote_master_context = std::option::Option::Some(v.into());
12232        self
12233    }
12234
12235    /// Sets or clears the value of [demote_master_context][crate::model::InstancesDemoteMasterRequest::demote_master_context].
12236    pub fn set_or_clear_demote_master_context<T>(mut self, v: std::option::Option<T>) -> Self
12237    where
12238        T: std::convert::Into<crate::model::DemoteMasterContext>,
12239    {
12240        self.demote_master_context = v.map(|x| x.into());
12241        self
12242    }
12243}
12244
12245impl wkt::message::Message for InstancesDemoteMasterRequest {
12246    fn typename() -> &'static str {
12247        "type.googleapis.com/google.cloud.sql.v1.InstancesDemoteMasterRequest"
12248    }
12249}
12250
12251#[doc(hidden)]
12252impl<'de> serde::de::Deserialize<'de> for InstancesDemoteMasterRequest {
12253    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12254    where
12255        D: serde::Deserializer<'de>,
12256    {
12257        #[allow(non_camel_case_types)]
12258        #[doc(hidden)]
12259        #[derive(PartialEq, Eq, Hash)]
12260        enum __FieldTag {
12261            __demote_master_context,
12262            Unknown(std::string::String),
12263        }
12264        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12265            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12266            where
12267                D: serde::Deserializer<'de>,
12268            {
12269                struct Visitor;
12270                impl<'de> serde::de::Visitor<'de> for Visitor {
12271                    type Value = __FieldTag;
12272                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12273                        formatter.write_str("a field name for InstancesDemoteMasterRequest")
12274                    }
12275                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12276                    where
12277                        E: serde::de::Error,
12278                    {
12279                        use std::result::Result::Ok;
12280                        use std::string::ToString;
12281                        match value {
12282                            "demoteMasterContext" => Ok(__FieldTag::__demote_master_context),
12283                            "demote_master_context" => Ok(__FieldTag::__demote_master_context),
12284                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12285                        }
12286                    }
12287                }
12288                deserializer.deserialize_identifier(Visitor)
12289            }
12290        }
12291        struct Visitor;
12292        impl<'de> serde::de::Visitor<'de> for Visitor {
12293            type Value = InstancesDemoteMasterRequest;
12294            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12295                formatter.write_str("struct InstancesDemoteMasterRequest")
12296            }
12297            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12298            where
12299                A: serde::de::MapAccess<'de>,
12300            {
12301                #[allow(unused_imports)]
12302                use serde::de::Error;
12303                use std::option::Option::Some;
12304                let mut fields = std::collections::HashSet::new();
12305                let mut result = Self::Value::new();
12306                while let Some(tag) = map.next_key::<__FieldTag>()? {
12307                    #[allow(clippy::match_single_binding)]
12308                    match tag {
12309                        __FieldTag::__demote_master_context => {
12310                            if !fields.insert(__FieldTag::__demote_master_context) {
12311                                return std::result::Result::Err(A::Error::duplicate_field(
12312                                    "multiple values for demote_master_context",
12313                                ));
12314                            }
12315                            result.demote_master_context = map.next_value::<std::option::Option<crate::model::DemoteMasterContext>>()?
12316                                ;
12317                        }
12318                        __FieldTag::Unknown(key) => {
12319                            let value = map.next_value::<serde_json::Value>()?;
12320                            result._unknown_fields.insert(key, value);
12321                        }
12322                    }
12323                }
12324                std::result::Result::Ok(result)
12325            }
12326        }
12327        deserializer.deserialize_any(Visitor)
12328    }
12329}
12330
12331#[doc(hidden)]
12332impl serde::ser::Serialize for InstancesDemoteMasterRequest {
12333    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12334    where
12335        S: serde::ser::Serializer,
12336    {
12337        use serde::ser::SerializeMap;
12338        #[allow(unused_imports)]
12339        use std::option::Option::Some;
12340        let mut state = serializer.serialize_map(std::option::Option::None)?;
12341        if self.demote_master_context.is_some() {
12342            state.serialize_entry("demoteMasterContext", &self.demote_master_context)?;
12343        }
12344        if !self._unknown_fields.is_empty() {
12345            for (key, value) in self._unknown_fields.iter() {
12346                state.serialize_entry(key, &value)?;
12347            }
12348        }
12349        state.end()
12350    }
12351}
12352
12353impl std::fmt::Debug for InstancesDemoteMasterRequest {
12354    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12355        let mut debug_struct = f.debug_struct("InstancesDemoteMasterRequest");
12356        debug_struct.field("demote_master_context", &self.demote_master_context);
12357        if !self._unknown_fields.is_empty() {
12358            debug_struct.field("_unknown_fields", &self._unknown_fields);
12359        }
12360        debug_struct.finish()
12361    }
12362}
12363
12364/// This request is used to demote an existing standalone instance to be a
12365/// Cloud SQL read replica for an external database server.
12366#[derive(Clone, Default, PartialEq)]
12367#[non_exhaustive]
12368pub struct InstancesDemoteRequest {
12369    /// Required. Contains details about the demote operation.
12370    pub demote_context: std::option::Option<crate::model::DemoteContext>,
12371
12372    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12373}
12374
12375impl InstancesDemoteRequest {
12376    pub fn new() -> Self {
12377        std::default::Default::default()
12378    }
12379
12380    /// Sets the value of [demote_context][crate::model::InstancesDemoteRequest::demote_context].
12381    pub fn set_demote_context<T>(mut self, v: T) -> Self
12382    where
12383        T: std::convert::Into<crate::model::DemoteContext>,
12384    {
12385        self.demote_context = std::option::Option::Some(v.into());
12386        self
12387    }
12388
12389    /// Sets or clears the value of [demote_context][crate::model::InstancesDemoteRequest::demote_context].
12390    pub fn set_or_clear_demote_context<T>(mut self, v: std::option::Option<T>) -> Self
12391    where
12392        T: std::convert::Into<crate::model::DemoteContext>,
12393    {
12394        self.demote_context = v.map(|x| x.into());
12395        self
12396    }
12397}
12398
12399impl wkt::message::Message for InstancesDemoteRequest {
12400    fn typename() -> &'static str {
12401        "type.googleapis.com/google.cloud.sql.v1.InstancesDemoteRequest"
12402    }
12403}
12404
12405#[doc(hidden)]
12406impl<'de> serde::de::Deserialize<'de> for InstancesDemoteRequest {
12407    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12408    where
12409        D: serde::Deserializer<'de>,
12410    {
12411        #[allow(non_camel_case_types)]
12412        #[doc(hidden)]
12413        #[derive(PartialEq, Eq, Hash)]
12414        enum __FieldTag {
12415            __demote_context,
12416            Unknown(std::string::String),
12417        }
12418        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12419            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12420            where
12421                D: serde::Deserializer<'de>,
12422            {
12423                struct Visitor;
12424                impl<'de> serde::de::Visitor<'de> for Visitor {
12425                    type Value = __FieldTag;
12426                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12427                        formatter.write_str("a field name for InstancesDemoteRequest")
12428                    }
12429                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12430                    where
12431                        E: serde::de::Error,
12432                    {
12433                        use std::result::Result::Ok;
12434                        use std::string::ToString;
12435                        match value {
12436                            "demoteContext" => Ok(__FieldTag::__demote_context),
12437                            "demote_context" => Ok(__FieldTag::__demote_context),
12438                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12439                        }
12440                    }
12441                }
12442                deserializer.deserialize_identifier(Visitor)
12443            }
12444        }
12445        struct Visitor;
12446        impl<'de> serde::de::Visitor<'de> for Visitor {
12447            type Value = InstancesDemoteRequest;
12448            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12449                formatter.write_str("struct InstancesDemoteRequest")
12450            }
12451            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12452            where
12453                A: serde::de::MapAccess<'de>,
12454            {
12455                #[allow(unused_imports)]
12456                use serde::de::Error;
12457                use std::option::Option::Some;
12458                let mut fields = std::collections::HashSet::new();
12459                let mut result = Self::Value::new();
12460                while let Some(tag) = map.next_key::<__FieldTag>()? {
12461                    #[allow(clippy::match_single_binding)]
12462                    match tag {
12463                        __FieldTag::__demote_context => {
12464                            if !fields.insert(__FieldTag::__demote_context) {
12465                                return std::result::Result::Err(A::Error::duplicate_field(
12466                                    "multiple values for demote_context",
12467                                ));
12468                            }
12469                            result.demote_context = map
12470                                .next_value::<std::option::Option<crate::model::DemoteContext>>()?;
12471                        }
12472                        __FieldTag::Unknown(key) => {
12473                            let value = map.next_value::<serde_json::Value>()?;
12474                            result._unknown_fields.insert(key, value);
12475                        }
12476                    }
12477                }
12478                std::result::Result::Ok(result)
12479            }
12480        }
12481        deserializer.deserialize_any(Visitor)
12482    }
12483}
12484
12485#[doc(hidden)]
12486impl serde::ser::Serialize for InstancesDemoteRequest {
12487    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12488    where
12489        S: serde::ser::Serializer,
12490    {
12491        use serde::ser::SerializeMap;
12492        #[allow(unused_imports)]
12493        use std::option::Option::Some;
12494        let mut state = serializer.serialize_map(std::option::Option::None)?;
12495        if self.demote_context.is_some() {
12496            state.serialize_entry("demoteContext", &self.demote_context)?;
12497        }
12498        if !self._unknown_fields.is_empty() {
12499            for (key, value) in self._unknown_fields.iter() {
12500                state.serialize_entry(key, &value)?;
12501            }
12502        }
12503        state.end()
12504    }
12505}
12506
12507impl std::fmt::Debug for InstancesDemoteRequest {
12508    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12509        let mut debug_struct = f.debug_struct("InstancesDemoteRequest");
12510        debug_struct.field("demote_context", &self.demote_context);
12511        if !self._unknown_fields.is_empty() {
12512            debug_struct.field("_unknown_fields", &self._unknown_fields);
12513        }
12514        debug_struct.finish()
12515    }
12516}
12517
12518/// Database instance export request.
12519#[derive(Clone, Default, PartialEq)]
12520#[non_exhaustive]
12521pub struct InstancesExportRequest {
12522    /// Contains details about the export operation.
12523    pub export_context: std::option::Option<crate::model::ExportContext>,
12524
12525    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12526}
12527
12528impl InstancesExportRequest {
12529    pub fn new() -> Self {
12530        std::default::Default::default()
12531    }
12532
12533    /// Sets the value of [export_context][crate::model::InstancesExportRequest::export_context].
12534    pub fn set_export_context<T>(mut self, v: T) -> Self
12535    where
12536        T: std::convert::Into<crate::model::ExportContext>,
12537    {
12538        self.export_context = std::option::Option::Some(v.into());
12539        self
12540    }
12541
12542    /// Sets or clears the value of [export_context][crate::model::InstancesExportRequest::export_context].
12543    pub fn set_or_clear_export_context<T>(mut self, v: std::option::Option<T>) -> Self
12544    where
12545        T: std::convert::Into<crate::model::ExportContext>,
12546    {
12547        self.export_context = v.map(|x| x.into());
12548        self
12549    }
12550}
12551
12552impl wkt::message::Message for InstancesExportRequest {
12553    fn typename() -> &'static str {
12554        "type.googleapis.com/google.cloud.sql.v1.InstancesExportRequest"
12555    }
12556}
12557
12558#[doc(hidden)]
12559impl<'de> serde::de::Deserialize<'de> for InstancesExportRequest {
12560    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12561    where
12562        D: serde::Deserializer<'de>,
12563    {
12564        #[allow(non_camel_case_types)]
12565        #[doc(hidden)]
12566        #[derive(PartialEq, Eq, Hash)]
12567        enum __FieldTag {
12568            __export_context,
12569            Unknown(std::string::String),
12570        }
12571        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12572            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12573            where
12574                D: serde::Deserializer<'de>,
12575            {
12576                struct Visitor;
12577                impl<'de> serde::de::Visitor<'de> for Visitor {
12578                    type Value = __FieldTag;
12579                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12580                        formatter.write_str("a field name for InstancesExportRequest")
12581                    }
12582                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12583                    where
12584                        E: serde::de::Error,
12585                    {
12586                        use std::result::Result::Ok;
12587                        use std::string::ToString;
12588                        match value {
12589                            "exportContext" => Ok(__FieldTag::__export_context),
12590                            "export_context" => Ok(__FieldTag::__export_context),
12591                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12592                        }
12593                    }
12594                }
12595                deserializer.deserialize_identifier(Visitor)
12596            }
12597        }
12598        struct Visitor;
12599        impl<'de> serde::de::Visitor<'de> for Visitor {
12600            type Value = InstancesExportRequest;
12601            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12602                formatter.write_str("struct InstancesExportRequest")
12603            }
12604            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12605            where
12606                A: serde::de::MapAccess<'de>,
12607            {
12608                #[allow(unused_imports)]
12609                use serde::de::Error;
12610                use std::option::Option::Some;
12611                let mut fields = std::collections::HashSet::new();
12612                let mut result = Self::Value::new();
12613                while let Some(tag) = map.next_key::<__FieldTag>()? {
12614                    #[allow(clippy::match_single_binding)]
12615                    match tag {
12616                        __FieldTag::__export_context => {
12617                            if !fields.insert(__FieldTag::__export_context) {
12618                                return std::result::Result::Err(A::Error::duplicate_field(
12619                                    "multiple values for export_context",
12620                                ));
12621                            }
12622                            result.export_context = map
12623                                .next_value::<std::option::Option<crate::model::ExportContext>>()?;
12624                        }
12625                        __FieldTag::Unknown(key) => {
12626                            let value = map.next_value::<serde_json::Value>()?;
12627                            result._unknown_fields.insert(key, value);
12628                        }
12629                    }
12630                }
12631                std::result::Result::Ok(result)
12632            }
12633        }
12634        deserializer.deserialize_any(Visitor)
12635    }
12636}
12637
12638#[doc(hidden)]
12639impl serde::ser::Serialize for InstancesExportRequest {
12640    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12641    where
12642        S: serde::ser::Serializer,
12643    {
12644        use serde::ser::SerializeMap;
12645        #[allow(unused_imports)]
12646        use std::option::Option::Some;
12647        let mut state = serializer.serialize_map(std::option::Option::None)?;
12648        if self.export_context.is_some() {
12649            state.serialize_entry("exportContext", &self.export_context)?;
12650        }
12651        if !self._unknown_fields.is_empty() {
12652            for (key, value) in self._unknown_fields.iter() {
12653                state.serialize_entry(key, &value)?;
12654            }
12655        }
12656        state.end()
12657    }
12658}
12659
12660impl std::fmt::Debug for InstancesExportRequest {
12661    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12662        let mut debug_struct = f.debug_struct("InstancesExportRequest");
12663        debug_struct.field("export_context", &self.export_context);
12664        if !self._unknown_fields.is_empty() {
12665            debug_struct.field("_unknown_fields", &self._unknown_fields);
12666        }
12667        debug_struct.finish()
12668    }
12669}
12670
12671/// Instance failover request.
12672#[derive(Clone, Default, PartialEq)]
12673#[non_exhaustive]
12674pub struct InstancesFailoverRequest {
12675    /// Failover Context.
12676    pub failover_context: std::option::Option<crate::model::FailoverContext>,
12677
12678    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12679}
12680
12681impl InstancesFailoverRequest {
12682    pub fn new() -> Self {
12683        std::default::Default::default()
12684    }
12685
12686    /// Sets the value of [failover_context][crate::model::InstancesFailoverRequest::failover_context].
12687    pub fn set_failover_context<T>(mut self, v: T) -> Self
12688    where
12689        T: std::convert::Into<crate::model::FailoverContext>,
12690    {
12691        self.failover_context = std::option::Option::Some(v.into());
12692        self
12693    }
12694
12695    /// Sets or clears the value of [failover_context][crate::model::InstancesFailoverRequest::failover_context].
12696    pub fn set_or_clear_failover_context<T>(mut self, v: std::option::Option<T>) -> Self
12697    where
12698        T: std::convert::Into<crate::model::FailoverContext>,
12699    {
12700        self.failover_context = v.map(|x| x.into());
12701        self
12702    }
12703}
12704
12705impl wkt::message::Message for InstancesFailoverRequest {
12706    fn typename() -> &'static str {
12707        "type.googleapis.com/google.cloud.sql.v1.InstancesFailoverRequest"
12708    }
12709}
12710
12711#[doc(hidden)]
12712impl<'de> serde::de::Deserialize<'de> for InstancesFailoverRequest {
12713    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12714    where
12715        D: serde::Deserializer<'de>,
12716    {
12717        #[allow(non_camel_case_types)]
12718        #[doc(hidden)]
12719        #[derive(PartialEq, Eq, Hash)]
12720        enum __FieldTag {
12721            __failover_context,
12722            Unknown(std::string::String),
12723        }
12724        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12725            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12726            where
12727                D: serde::Deserializer<'de>,
12728            {
12729                struct Visitor;
12730                impl<'de> serde::de::Visitor<'de> for Visitor {
12731                    type Value = __FieldTag;
12732                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12733                        formatter.write_str("a field name for InstancesFailoverRequest")
12734                    }
12735                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12736                    where
12737                        E: serde::de::Error,
12738                    {
12739                        use std::result::Result::Ok;
12740                        use std::string::ToString;
12741                        match value {
12742                            "failoverContext" => Ok(__FieldTag::__failover_context),
12743                            "failover_context" => Ok(__FieldTag::__failover_context),
12744                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12745                        }
12746                    }
12747                }
12748                deserializer.deserialize_identifier(Visitor)
12749            }
12750        }
12751        struct Visitor;
12752        impl<'de> serde::de::Visitor<'de> for Visitor {
12753            type Value = InstancesFailoverRequest;
12754            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12755                formatter.write_str("struct InstancesFailoverRequest")
12756            }
12757            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12758            where
12759                A: serde::de::MapAccess<'de>,
12760            {
12761                #[allow(unused_imports)]
12762                use serde::de::Error;
12763                use std::option::Option::Some;
12764                let mut fields = std::collections::HashSet::new();
12765                let mut result = Self::Value::new();
12766                while let Some(tag) = map.next_key::<__FieldTag>()? {
12767                    #[allow(clippy::match_single_binding)]
12768                    match tag {
12769                        __FieldTag::__failover_context => {
12770                            if !fields.insert(__FieldTag::__failover_context) {
12771                                return std::result::Result::Err(A::Error::duplicate_field(
12772                                    "multiple values for failover_context",
12773                                ));
12774                            }
12775                            result.failover_context = map
12776                                .next_value::<std::option::Option<crate::model::FailoverContext>>(
12777                                )?;
12778                        }
12779                        __FieldTag::Unknown(key) => {
12780                            let value = map.next_value::<serde_json::Value>()?;
12781                            result._unknown_fields.insert(key, value);
12782                        }
12783                    }
12784                }
12785                std::result::Result::Ok(result)
12786            }
12787        }
12788        deserializer.deserialize_any(Visitor)
12789    }
12790}
12791
12792#[doc(hidden)]
12793impl serde::ser::Serialize for InstancesFailoverRequest {
12794    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12795    where
12796        S: serde::ser::Serializer,
12797    {
12798        use serde::ser::SerializeMap;
12799        #[allow(unused_imports)]
12800        use std::option::Option::Some;
12801        let mut state = serializer.serialize_map(std::option::Option::None)?;
12802        if self.failover_context.is_some() {
12803            state.serialize_entry("failoverContext", &self.failover_context)?;
12804        }
12805        if !self._unknown_fields.is_empty() {
12806            for (key, value) in self._unknown_fields.iter() {
12807                state.serialize_entry(key, &value)?;
12808            }
12809        }
12810        state.end()
12811    }
12812}
12813
12814impl std::fmt::Debug for InstancesFailoverRequest {
12815    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12816        let mut debug_struct = f.debug_struct("InstancesFailoverRequest");
12817        debug_struct.field("failover_context", &self.failover_context);
12818        if !self._unknown_fields.is_empty() {
12819            debug_struct.field("_unknown_fields", &self._unknown_fields);
12820        }
12821        debug_struct.finish()
12822    }
12823}
12824
12825/// SslCerts create ephemeral certificate request.
12826#[derive(Clone, Default, PartialEq)]
12827#[non_exhaustive]
12828pub struct SslCertsCreateEphemeralRequest {
12829    /// PEM encoded public key to include in the signed certificate.
12830    pub public_key: std::string::String,
12831
12832    /// Access token to include in the signed certificate.
12833    pub access_token: std::string::String,
12834
12835    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12836}
12837
12838impl SslCertsCreateEphemeralRequest {
12839    pub fn new() -> Self {
12840        std::default::Default::default()
12841    }
12842
12843    /// Sets the value of [public_key][crate::model::SslCertsCreateEphemeralRequest::public_key].
12844    pub fn set_public_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12845        self.public_key = v.into();
12846        self
12847    }
12848
12849    /// Sets the value of [access_token][crate::model::SslCertsCreateEphemeralRequest::access_token].
12850    pub fn set_access_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12851        self.access_token = v.into();
12852        self
12853    }
12854}
12855
12856impl wkt::message::Message for SslCertsCreateEphemeralRequest {
12857    fn typename() -> &'static str {
12858        "type.googleapis.com/google.cloud.sql.v1.SslCertsCreateEphemeralRequest"
12859    }
12860}
12861
12862#[doc(hidden)]
12863impl<'de> serde::de::Deserialize<'de> for SslCertsCreateEphemeralRequest {
12864    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12865    where
12866        D: serde::Deserializer<'de>,
12867    {
12868        #[allow(non_camel_case_types)]
12869        #[doc(hidden)]
12870        #[derive(PartialEq, Eq, Hash)]
12871        enum __FieldTag {
12872            __public_key,
12873            __access_token,
12874            Unknown(std::string::String),
12875        }
12876        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12877            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12878            where
12879                D: serde::Deserializer<'de>,
12880            {
12881                struct Visitor;
12882                impl<'de> serde::de::Visitor<'de> for Visitor {
12883                    type Value = __FieldTag;
12884                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12885                        formatter.write_str("a field name for SslCertsCreateEphemeralRequest")
12886                    }
12887                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12888                    where
12889                        E: serde::de::Error,
12890                    {
12891                        use std::result::Result::Ok;
12892                        use std::string::ToString;
12893                        match value {
12894                            "public_key" => Ok(__FieldTag::__public_key),
12895                            "access_token" => Ok(__FieldTag::__access_token),
12896                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12897                        }
12898                    }
12899                }
12900                deserializer.deserialize_identifier(Visitor)
12901            }
12902        }
12903        struct Visitor;
12904        impl<'de> serde::de::Visitor<'de> for Visitor {
12905            type Value = SslCertsCreateEphemeralRequest;
12906            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12907                formatter.write_str("struct SslCertsCreateEphemeralRequest")
12908            }
12909            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12910            where
12911                A: serde::de::MapAccess<'de>,
12912            {
12913                #[allow(unused_imports)]
12914                use serde::de::Error;
12915                use std::option::Option::Some;
12916                let mut fields = std::collections::HashSet::new();
12917                let mut result = Self::Value::new();
12918                while let Some(tag) = map.next_key::<__FieldTag>()? {
12919                    #[allow(clippy::match_single_binding)]
12920                    match tag {
12921                        __FieldTag::__public_key => {
12922                            if !fields.insert(__FieldTag::__public_key) {
12923                                return std::result::Result::Err(A::Error::duplicate_field(
12924                                    "multiple values for public_key",
12925                                ));
12926                            }
12927                            result.public_key = map
12928                                .next_value::<std::option::Option<std::string::String>>()?
12929                                .unwrap_or_default();
12930                        }
12931                        __FieldTag::__access_token => {
12932                            if !fields.insert(__FieldTag::__access_token) {
12933                                return std::result::Result::Err(A::Error::duplicate_field(
12934                                    "multiple values for access_token",
12935                                ));
12936                            }
12937                            result.access_token = map
12938                                .next_value::<std::option::Option<std::string::String>>()?
12939                                .unwrap_or_default();
12940                        }
12941                        __FieldTag::Unknown(key) => {
12942                            let value = map.next_value::<serde_json::Value>()?;
12943                            result._unknown_fields.insert(key, value);
12944                        }
12945                    }
12946                }
12947                std::result::Result::Ok(result)
12948            }
12949        }
12950        deserializer.deserialize_any(Visitor)
12951    }
12952}
12953
12954#[doc(hidden)]
12955impl serde::ser::Serialize for SslCertsCreateEphemeralRequest {
12956    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12957    where
12958        S: serde::ser::Serializer,
12959    {
12960        use serde::ser::SerializeMap;
12961        #[allow(unused_imports)]
12962        use std::option::Option::Some;
12963        let mut state = serializer.serialize_map(std::option::Option::None)?;
12964        if !self.public_key.is_empty() {
12965            state.serialize_entry("public_key", &self.public_key)?;
12966        }
12967        if !self.access_token.is_empty() {
12968            state.serialize_entry("access_token", &self.access_token)?;
12969        }
12970        if !self._unknown_fields.is_empty() {
12971            for (key, value) in self._unknown_fields.iter() {
12972                state.serialize_entry(key, &value)?;
12973            }
12974        }
12975        state.end()
12976    }
12977}
12978
12979impl std::fmt::Debug for SslCertsCreateEphemeralRequest {
12980    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12981        let mut debug_struct = f.debug_struct("SslCertsCreateEphemeralRequest");
12982        debug_struct.field("public_key", &self.public_key);
12983        debug_struct.field("access_token", &self.access_token);
12984        if !self._unknown_fields.is_empty() {
12985            debug_struct.field("_unknown_fields", &self._unknown_fields);
12986        }
12987        debug_struct.finish()
12988    }
12989}
12990
12991/// Database instance import request.
12992#[derive(Clone, Default, PartialEq)]
12993#[non_exhaustive]
12994pub struct InstancesImportRequest {
12995    /// Contains details about the import operation.
12996    pub import_context: std::option::Option<crate::model::ImportContext>,
12997
12998    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12999}
13000
13001impl InstancesImportRequest {
13002    pub fn new() -> Self {
13003        std::default::Default::default()
13004    }
13005
13006    /// Sets the value of [import_context][crate::model::InstancesImportRequest::import_context].
13007    pub fn set_import_context<T>(mut self, v: T) -> Self
13008    where
13009        T: std::convert::Into<crate::model::ImportContext>,
13010    {
13011        self.import_context = std::option::Option::Some(v.into());
13012        self
13013    }
13014
13015    /// Sets or clears the value of [import_context][crate::model::InstancesImportRequest::import_context].
13016    pub fn set_or_clear_import_context<T>(mut self, v: std::option::Option<T>) -> Self
13017    where
13018        T: std::convert::Into<crate::model::ImportContext>,
13019    {
13020        self.import_context = v.map(|x| x.into());
13021        self
13022    }
13023}
13024
13025impl wkt::message::Message for InstancesImportRequest {
13026    fn typename() -> &'static str {
13027        "type.googleapis.com/google.cloud.sql.v1.InstancesImportRequest"
13028    }
13029}
13030
13031#[doc(hidden)]
13032impl<'de> serde::de::Deserialize<'de> for InstancesImportRequest {
13033    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13034    where
13035        D: serde::Deserializer<'de>,
13036    {
13037        #[allow(non_camel_case_types)]
13038        #[doc(hidden)]
13039        #[derive(PartialEq, Eq, Hash)]
13040        enum __FieldTag {
13041            __import_context,
13042            Unknown(std::string::String),
13043        }
13044        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13045            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13046            where
13047                D: serde::Deserializer<'de>,
13048            {
13049                struct Visitor;
13050                impl<'de> serde::de::Visitor<'de> for Visitor {
13051                    type Value = __FieldTag;
13052                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13053                        formatter.write_str("a field name for InstancesImportRequest")
13054                    }
13055                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13056                    where
13057                        E: serde::de::Error,
13058                    {
13059                        use std::result::Result::Ok;
13060                        use std::string::ToString;
13061                        match value {
13062                            "importContext" => Ok(__FieldTag::__import_context),
13063                            "import_context" => Ok(__FieldTag::__import_context),
13064                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13065                        }
13066                    }
13067                }
13068                deserializer.deserialize_identifier(Visitor)
13069            }
13070        }
13071        struct Visitor;
13072        impl<'de> serde::de::Visitor<'de> for Visitor {
13073            type Value = InstancesImportRequest;
13074            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13075                formatter.write_str("struct InstancesImportRequest")
13076            }
13077            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13078            where
13079                A: serde::de::MapAccess<'de>,
13080            {
13081                #[allow(unused_imports)]
13082                use serde::de::Error;
13083                use std::option::Option::Some;
13084                let mut fields = std::collections::HashSet::new();
13085                let mut result = Self::Value::new();
13086                while let Some(tag) = map.next_key::<__FieldTag>()? {
13087                    #[allow(clippy::match_single_binding)]
13088                    match tag {
13089                        __FieldTag::__import_context => {
13090                            if !fields.insert(__FieldTag::__import_context) {
13091                                return std::result::Result::Err(A::Error::duplicate_field(
13092                                    "multiple values for import_context",
13093                                ));
13094                            }
13095                            result.import_context = map
13096                                .next_value::<std::option::Option<crate::model::ImportContext>>()?;
13097                        }
13098                        __FieldTag::Unknown(key) => {
13099                            let value = map.next_value::<serde_json::Value>()?;
13100                            result._unknown_fields.insert(key, value);
13101                        }
13102                    }
13103                }
13104                std::result::Result::Ok(result)
13105            }
13106        }
13107        deserializer.deserialize_any(Visitor)
13108    }
13109}
13110
13111#[doc(hidden)]
13112impl serde::ser::Serialize for InstancesImportRequest {
13113    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13114    where
13115        S: serde::ser::Serializer,
13116    {
13117        use serde::ser::SerializeMap;
13118        #[allow(unused_imports)]
13119        use std::option::Option::Some;
13120        let mut state = serializer.serialize_map(std::option::Option::None)?;
13121        if self.import_context.is_some() {
13122            state.serialize_entry("importContext", &self.import_context)?;
13123        }
13124        if !self._unknown_fields.is_empty() {
13125            for (key, value) in self._unknown_fields.iter() {
13126                state.serialize_entry(key, &value)?;
13127            }
13128        }
13129        state.end()
13130    }
13131}
13132
13133impl std::fmt::Debug for InstancesImportRequest {
13134    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13135        let mut debug_struct = f.debug_struct("InstancesImportRequest");
13136        debug_struct.field("import_context", &self.import_context);
13137        if !self._unknown_fields.is_empty() {
13138            debug_struct.field("_unknown_fields", &self._unknown_fields);
13139        }
13140        debug_struct.finish()
13141    }
13142}
13143
13144/// Database instances list response.
13145#[derive(Clone, Default, PartialEq)]
13146#[non_exhaustive]
13147pub struct InstancesListResponse {
13148    /// This is always `sql#instancesList`.
13149    pub kind: std::string::String,
13150
13151    /// List of warnings that occurred while handling the request.
13152    pub warnings: std::vec::Vec<crate::model::ApiWarning>,
13153
13154    /// List of database instance resources.
13155    pub items: std::vec::Vec<crate::model::DatabaseInstance>,
13156
13157    /// The continuation token, used to page through large result sets. Provide
13158    /// this value in a subsequent request to return the next page of results.
13159    pub next_page_token: std::string::String,
13160
13161    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13162}
13163
13164impl InstancesListResponse {
13165    pub fn new() -> Self {
13166        std::default::Default::default()
13167    }
13168
13169    /// Sets the value of [kind][crate::model::InstancesListResponse::kind].
13170    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13171        self.kind = v.into();
13172        self
13173    }
13174
13175    /// Sets the value of [warnings][crate::model::InstancesListResponse::warnings].
13176    pub fn set_warnings<T, V>(mut self, v: T) -> Self
13177    where
13178        T: std::iter::IntoIterator<Item = V>,
13179        V: std::convert::Into<crate::model::ApiWarning>,
13180    {
13181        use std::iter::Iterator;
13182        self.warnings = v.into_iter().map(|i| i.into()).collect();
13183        self
13184    }
13185
13186    /// Sets the value of [items][crate::model::InstancesListResponse::items].
13187    pub fn set_items<T, V>(mut self, v: T) -> Self
13188    where
13189        T: std::iter::IntoIterator<Item = V>,
13190        V: std::convert::Into<crate::model::DatabaseInstance>,
13191    {
13192        use std::iter::Iterator;
13193        self.items = v.into_iter().map(|i| i.into()).collect();
13194        self
13195    }
13196
13197    /// Sets the value of [next_page_token][crate::model::InstancesListResponse::next_page_token].
13198    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13199        self.next_page_token = v.into();
13200        self
13201    }
13202}
13203
13204impl wkt::message::Message for InstancesListResponse {
13205    fn typename() -> &'static str {
13206        "type.googleapis.com/google.cloud.sql.v1.InstancesListResponse"
13207    }
13208}
13209
13210#[doc(hidden)]
13211impl gax::paginator::internal::PageableResponse for InstancesListResponse {
13212    type PageItem = crate::model::DatabaseInstance;
13213
13214    fn items(self) -> std::vec::Vec<Self::PageItem> {
13215        self.items
13216    }
13217
13218    fn next_page_token(&self) -> std::string::String {
13219        use std::clone::Clone;
13220        self.next_page_token.clone()
13221    }
13222}
13223
13224#[doc(hidden)]
13225impl<'de> serde::de::Deserialize<'de> for InstancesListResponse {
13226    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13227    where
13228        D: serde::Deserializer<'de>,
13229    {
13230        #[allow(non_camel_case_types)]
13231        #[doc(hidden)]
13232        #[derive(PartialEq, Eq, Hash)]
13233        enum __FieldTag {
13234            __kind,
13235            __warnings,
13236            __items,
13237            __next_page_token,
13238            Unknown(std::string::String),
13239        }
13240        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13241            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13242            where
13243                D: serde::Deserializer<'de>,
13244            {
13245                struct Visitor;
13246                impl<'de> serde::de::Visitor<'de> for Visitor {
13247                    type Value = __FieldTag;
13248                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13249                        formatter.write_str("a field name for InstancesListResponse")
13250                    }
13251                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13252                    where
13253                        E: serde::de::Error,
13254                    {
13255                        use std::result::Result::Ok;
13256                        use std::string::ToString;
13257                        match value {
13258                            "kind" => Ok(__FieldTag::__kind),
13259                            "warnings" => Ok(__FieldTag::__warnings),
13260                            "items" => Ok(__FieldTag::__items),
13261                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
13262                            "next_page_token" => Ok(__FieldTag::__next_page_token),
13263                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13264                        }
13265                    }
13266                }
13267                deserializer.deserialize_identifier(Visitor)
13268            }
13269        }
13270        struct Visitor;
13271        impl<'de> serde::de::Visitor<'de> for Visitor {
13272            type Value = InstancesListResponse;
13273            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13274                formatter.write_str("struct InstancesListResponse")
13275            }
13276            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13277            where
13278                A: serde::de::MapAccess<'de>,
13279            {
13280                #[allow(unused_imports)]
13281                use serde::de::Error;
13282                use std::option::Option::Some;
13283                let mut fields = std::collections::HashSet::new();
13284                let mut result = Self::Value::new();
13285                while let Some(tag) = map.next_key::<__FieldTag>()? {
13286                    #[allow(clippy::match_single_binding)]
13287                    match tag {
13288                        __FieldTag::__kind => {
13289                            if !fields.insert(__FieldTag::__kind) {
13290                                return std::result::Result::Err(A::Error::duplicate_field(
13291                                    "multiple values for kind",
13292                                ));
13293                            }
13294                            result.kind = map
13295                                .next_value::<std::option::Option<std::string::String>>()?
13296                                .unwrap_or_default();
13297                        }
13298                        __FieldTag::__warnings => {
13299                            if !fields.insert(__FieldTag::__warnings) {
13300                                return std::result::Result::Err(A::Error::duplicate_field(
13301                                    "multiple values for warnings",
13302                                ));
13303                            }
13304                            result.warnings = map.next_value::<std::option::Option<std::vec::Vec<crate::model::ApiWarning>>>()?.unwrap_or_default();
13305                        }
13306                        __FieldTag::__items => {
13307                            if !fields.insert(__FieldTag::__items) {
13308                                return std::result::Result::Err(A::Error::duplicate_field(
13309                                    "multiple values for items",
13310                                ));
13311                            }
13312                            result.items =
13313                                map.next_value::<std::option::Option<
13314                                    std::vec::Vec<crate::model::DatabaseInstance>,
13315                                >>()?
13316                                .unwrap_or_default();
13317                        }
13318                        __FieldTag::__next_page_token => {
13319                            if !fields.insert(__FieldTag::__next_page_token) {
13320                                return std::result::Result::Err(A::Error::duplicate_field(
13321                                    "multiple values for next_page_token",
13322                                ));
13323                            }
13324                            result.next_page_token = map
13325                                .next_value::<std::option::Option<std::string::String>>()?
13326                                .unwrap_or_default();
13327                        }
13328                        __FieldTag::Unknown(key) => {
13329                            let value = map.next_value::<serde_json::Value>()?;
13330                            result._unknown_fields.insert(key, value);
13331                        }
13332                    }
13333                }
13334                std::result::Result::Ok(result)
13335            }
13336        }
13337        deserializer.deserialize_any(Visitor)
13338    }
13339}
13340
13341#[doc(hidden)]
13342impl serde::ser::Serialize for InstancesListResponse {
13343    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13344    where
13345        S: serde::ser::Serializer,
13346    {
13347        use serde::ser::SerializeMap;
13348        #[allow(unused_imports)]
13349        use std::option::Option::Some;
13350        let mut state = serializer.serialize_map(std::option::Option::None)?;
13351        if !self.kind.is_empty() {
13352            state.serialize_entry("kind", &self.kind)?;
13353        }
13354        if !self.warnings.is_empty() {
13355            state.serialize_entry("warnings", &self.warnings)?;
13356        }
13357        if !self.items.is_empty() {
13358            state.serialize_entry("items", &self.items)?;
13359        }
13360        if !self.next_page_token.is_empty() {
13361            state.serialize_entry("nextPageToken", &self.next_page_token)?;
13362        }
13363        if !self._unknown_fields.is_empty() {
13364            for (key, value) in self._unknown_fields.iter() {
13365                state.serialize_entry(key, &value)?;
13366            }
13367        }
13368        state.end()
13369    }
13370}
13371
13372impl std::fmt::Debug for InstancesListResponse {
13373    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13374        let mut debug_struct = f.debug_struct("InstancesListResponse");
13375        debug_struct.field("kind", &self.kind);
13376        debug_struct.field("warnings", &self.warnings);
13377        debug_struct.field("items", &self.items);
13378        debug_struct.field("next_page_token", &self.next_page_token);
13379        if !self._unknown_fields.is_empty() {
13380            debug_struct.field("_unknown_fields", &self._unknown_fields);
13381        }
13382        debug_struct.finish()
13383    }
13384}
13385
13386/// Instances ListServerCas response.
13387#[derive(Clone, Default, PartialEq)]
13388#[non_exhaustive]
13389pub struct InstancesListServerCasResponse {
13390    /// List of server CA certificates for the instance.
13391    pub certs: std::vec::Vec<crate::model::SslCert>,
13392
13393    pub active_version: std::string::String,
13394
13395    /// This is always `sql#instancesListServerCas`.
13396    pub kind: std::string::String,
13397
13398    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13399}
13400
13401impl InstancesListServerCasResponse {
13402    pub fn new() -> Self {
13403        std::default::Default::default()
13404    }
13405
13406    /// Sets the value of [certs][crate::model::InstancesListServerCasResponse::certs].
13407    pub fn set_certs<T, V>(mut self, v: T) -> Self
13408    where
13409        T: std::iter::IntoIterator<Item = V>,
13410        V: std::convert::Into<crate::model::SslCert>,
13411    {
13412        use std::iter::Iterator;
13413        self.certs = v.into_iter().map(|i| i.into()).collect();
13414        self
13415    }
13416
13417    /// Sets the value of [active_version][crate::model::InstancesListServerCasResponse::active_version].
13418    pub fn set_active_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13419        self.active_version = v.into();
13420        self
13421    }
13422
13423    /// Sets the value of [kind][crate::model::InstancesListServerCasResponse::kind].
13424    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13425        self.kind = v.into();
13426        self
13427    }
13428}
13429
13430impl wkt::message::Message for InstancesListServerCasResponse {
13431    fn typename() -> &'static str {
13432        "type.googleapis.com/google.cloud.sql.v1.InstancesListServerCasResponse"
13433    }
13434}
13435
13436#[doc(hidden)]
13437impl<'de> serde::de::Deserialize<'de> for InstancesListServerCasResponse {
13438    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13439    where
13440        D: serde::Deserializer<'de>,
13441    {
13442        #[allow(non_camel_case_types)]
13443        #[doc(hidden)]
13444        #[derive(PartialEq, Eq, Hash)]
13445        enum __FieldTag {
13446            __certs,
13447            __active_version,
13448            __kind,
13449            Unknown(std::string::String),
13450        }
13451        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13452            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13453            where
13454                D: serde::Deserializer<'de>,
13455            {
13456                struct Visitor;
13457                impl<'de> serde::de::Visitor<'de> for Visitor {
13458                    type Value = __FieldTag;
13459                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13460                        formatter.write_str("a field name for InstancesListServerCasResponse")
13461                    }
13462                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13463                    where
13464                        E: serde::de::Error,
13465                    {
13466                        use std::result::Result::Ok;
13467                        use std::string::ToString;
13468                        match value {
13469                            "certs" => Ok(__FieldTag::__certs),
13470                            "activeVersion" => Ok(__FieldTag::__active_version),
13471                            "active_version" => Ok(__FieldTag::__active_version),
13472                            "kind" => Ok(__FieldTag::__kind),
13473                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13474                        }
13475                    }
13476                }
13477                deserializer.deserialize_identifier(Visitor)
13478            }
13479        }
13480        struct Visitor;
13481        impl<'de> serde::de::Visitor<'de> for Visitor {
13482            type Value = InstancesListServerCasResponse;
13483            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13484                formatter.write_str("struct InstancesListServerCasResponse")
13485            }
13486            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13487            where
13488                A: serde::de::MapAccess<'de>,
13489            {
13490                #[allow(unused_imports)]
13491                use serde::de::Error;
13492                use std::option::Option::Some;
13493                let mut fields = std::collections::HashSet::new();
13494                let mut result = Self::Value::new();
13495                while let Some(tag) = map.next_key::<__FieldTag>()? {
13496                    #[allow(clippy::match_single_binding)]
13497                    match tag {
13498                        __FieldTag::__certs => {
13499                            if !fields.insert(__FieldTag::__certs) {
13500                                return std::result::Result::Err(A::Error::duplicate_field(
13501                                    "multiple values for certs",
13502                                ));
13503                            }
13504                            result.certs = map.next_value::<std::option::Option<std::vec::Vec<crate::model::SslCert>>>()?.unwrap_or_default();
13505                        }
13506                        __FieldTag::__active_version => {
13507                            if !fields.insert(__FieldTag::__active_version) {
13508                                return std::result::Result::Err(A::Error::duplicate_field(
13509                                    "multiple values for active_version",
13510                                ));
13511                            }
13512                            result.active_version = map
13513                                .next_value::<std::option::Option<std::string::String>>()?
13514                                .unwrap_or_default();
13515                        }
13516                        __FieldTag::__kind => {
13517                            if !fields.insert(__FieldTag::__kind) {
13518                                return std::result::Result::Err(A::Error::duplicate_field(
13519                                    "multiple values for kind",
13520                                ));
13521                            }
13522                            result.kind = map
13523                                .next_value::<std::option::Option<std::string::String>>()?
13524                                .unwrap_or_default();
13525                        }
13526                        __FieldTag::Unknown(key) => {
13527                            let value = map.next_value::<serde_json::Value>()?;
13528                            result._unknown_fields.insert(key, value);
13529                        }
13530                    }
13531                }
13532                std::result::Result::Ok(result)
13533            }
13534        }
13535        deserializer.deserialize_any(Visitor)
13536    }
13537}
13538
13539#[doc(hidden)]
13540impl serde::ser::Serialize for InstancesListServerCasResponse {
13541    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13542    where
13543        S: serde::ser::Serializer,
13544    {
13545        use serde::ser::SerializeMap;
13546        #[allow(unused_imports)]
13547        use std::option::Option::Some;
13548        let mut state = serializer.serialize_map(std::option::Option::None)?;
13549        if !self.certs.is_empty() {
13550            state.serialize_entry("certs", &self.certs)?;
13551        }
13552        if !self.active_version.is_empty() {
13553            state.serialize_entry("activeVersion", &self.active_version)?;
13554        }
13555        if !self.kind.is_empty() {
13556            state.serialize_entry("kind", &self.kind)?;
13557        }
13558        if !self._unknown_fields.is_empty() {
13559            for (key, value) in self._unknown_fields.iter() {
13560                state.serialize_entry(key, &value)?;
13561            }
13562        }
13563        state.end()
13564    }
13565}
13566
13567impl std::fmt::Debug for InstancesListServerCasResponse {
13568    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13569        let mut debug_struct = f.debug_struct("InstancesListServerCasResponse");
13570        debug_struct.field("certs", &self.certs);
13571        debug_struct.field("active_version", &self.active_version);
13572        debug_struct.field("kind", &self.kind);
13573        if !self._unknown_fields.is_empty() {
13574            debug_struct.field("_unknown_fields", &self._unknown_fields);
13575        }
13576        debug_struct.finish()
13577    }
13578}
13579
13580/// Database instance restore backup request.
13581#[derive(Clone, Default, PartialEq)]
13582#[non_exhaustive]
13583pub struct InstancesRestoreBackupRequest {
13584    /// Parameters required to perform the restore backup operation.
13585    pub restore_backup_context: std::option::Option<crate::model::RestoreBackupContext>,
13586
13587    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13588}
13589
13590impl InstancesRestoreBackupRequest {
13591    pub fn new() -> Self {
13592        std::default::Default::default()
13593    }
13594
13595    /// Sets the value of [restore_backup_context][crate::model::InstancesRestoreBackupRequest::restore_backup_context].
13596    pub fn set_restore_backup_context<T>(mut self, v: T) -> Self
13597    where
13598        T: std::convert::Into<crate::model::RestoreBackupContext>,
13599    {
13600        self.restore_backup_context = std::option::Option::Some(v.into());
13601        self
13602    }
13603
13604    /// Sets or clears the value of [restore_backup_context][crate::model::InstancesRestoreBackupRequest::restore_backup_context].
13605    pub fn set_or_clear_restore_backup_context<T>(mut self, v: std::option::Option<T>) -> Self
13606    where
13607        T: std::convert::Into<crate::model::RestoreBackupContext>,
13608    {
13609        self.restore_backup_context = v.map(|x| x.into());
13610        self
13611    }
13612}
13613
13614impl wkt::message::Message for InstancesRestoreBackupRequest {
13615    fn typename() -> &'static str {
13616        "type.googleapis.com/google.cloud.sql.v1.InstancesRestoreBackupRequest"
13617    }
13618}
13619
13620#[doc(hidden)]
13621impl<'de> serde::de::Deserialize<'de> for InstancesRestoreBackupRequest {
13622    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13623    where
13624        D: serde::Deserializer<'de>,
13625    {
13626        #[allow(non_camel_case_types)]
13627        #[doc(hidden)]
13628        #[derive(PartialEq, Eq, Hash)]
13629        enum __FieldTag {
13630            __restore_backup_context,
13631            Unknown(std::string::String),
13632        }
13633        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13634            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13635            where
13636                D: serde::Deserializer<'de>,
13637            {
13638                struct Visitor;
13639                impl<'de> serde::de::Visitor<'de> for Visitor {
13640                    type Value = __FieldTag;
13641                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13642                        formatter.write_str("a field name for InstancesRestoreBackupRequest")
13643                    }
13644                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13645                    where
13646                        E: serde::de::Error,
13647                    {
13648                        use std::result::Result::Ok;
13649                        use std::string::ToString;
13650                        match value {
13651                            "restoreBackupContext" => Ok(__FieldTag::__restore_backup_context),
13652                            "restore_backup_context" => Ok(__FieldTag::__restore_backup_context),
13653                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13654                        }
13655                    }
13656                }
13657                deserializer.deserialize_identifier(Visitor)
13658            }
13659        }
13660        struct Visitor;
13661        impl<'de> serde::de::Visitor<'de> for Visitor {
13662            type Value = InstancesRestoreBackupRequest;
13663            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13664                formatter.write_str("struct InstancesRestoreBackupRequest")
13665            }
13666            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13667            where
13668                A: serde::de::MapAccess<'de>,
13669            {
13670                #[allow(unused_imports)]
13671                use serde::de::Error;
13672                use std::option::Option::Some;
13673                let mut fields = std::collections::HashSet::new();
13674                let mut result = Self::Value::new();
13675                while let Some(tag) = map.next_key::<__FieldTag>()? {
13676                    #[allow(clippy::match_single_binding)]
13677                    match tag {
13678                        __FieldTag::__restore_backup_context => {
13679                            if !fields.insert(__FieldTag::__restore_backup_context) {
13680                                return std::result::Result::Err(A::Error::duplicate_field(
13681                                    "multiple values for restore_backup_context",
13682                                ));
13683                            }
13684                            result.restore_backup_context = map.next_value::<std::option::Option<crate::model::RestoreBackupContext>>()?
13685                                ;
13686                        }
13687                        __FieldTag::Unknown(key) => {
13688                            let value = map.next_value::<serde_json::Value>()?;
13689                            result._unknown_fields.insert(key, value);
13690                        }
13691                    }
13692                }
13693                std::result::Result::Ok(result)
13694            }
13695        }
13696        deserializer.deserialize_any(Visitor)
13697    }
13698}
13699
13700#[doc(hidden)]
13701impl serde::ser::Serialize for InstancesRestoreBackupRequest {
13702    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13703    where
13704        S: serde::ser::Serializer,
13705    {
13706        use serde::ser::SerializeMap;
13707        #[allow(unused_imports)]
13708        use std::option::Option::Some;
13709        let mut state = serializer.serialize_map(std::option::Option::None)?;
13710        if self.restore_backup_context.is_some() {
13711            state.serialize_entry("restoreBackupContext", &self.restore_backup_context)?;
13712        }
13713        if !self._unknown_fields.is_empty() {
13714            for (key, value) in self._unknown_fields.iter() {
13715                state.serialize_entry(key, &value)?;
13716            }
13717        }
13718        state.end()
13719    }
13720}
13721
13722impl std::fmt::Debug for InstancesRestoreBackupRequest {
13723    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13724        let mut debug_struct = f.debug_struct("InstancesRestoreBackupRequest");
13725        debug_struct.field("restore_backup_context", &self.restore_backup_context);
13726        if !self._unknown_fields.is_empty() {
13727            debug_struct.field("_unknown_fields", &self._unknown_fields);
13728        }
13729        debug_struct.finish()
13730    }
13731}
13732
13733/// Rotate server CA request.
13734#[derive(Clone, Default, PartialEq)]
13735#[non_exhaustive]
13736pub struct InstancesRotateServerCaRequest {
13737    /// Contains details about the rotate server CA operation.
13738    pub rotate_server_ca_context: std::option::Option<crate::model::RotateServerCaContext>,
13739
13740    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13741}
13742
13743impl InstancesRotateServerCaRequest {
13744    pub fn new() -> Self {
13745        std::default::Default::default()
13746    }
13747
13748    /// Sets the value of [rotate_server_ca_context][crate::model::InstancesRotateServerCaRequest::rotate_server_ca_context].
13749    pub fn set_rotate_server_ca_context<T>(mut self, v: T) -> Self
13750    where
13751        T: std::convert::Into<crate::model::RotateServerCaContext>,
13752    {
13753        self.rotate_server_ca_context = std::option::Option::Some(v.into());
13754        self
13755    }
13756
13757    /// Sets or clears the value of [rotate_server_ca_context][crate::model::InstancesRotateServerCaRequest::rotate_server_ca_context].
13758    pub fn set_or_clear_rotate_server_ca_context<T>(mut self, v: std::option::Option<T>) -> Self
13759    where
13760        T: std::convert::Into<crate::model::RotateServerCaContext>,
13761    {
13762        self.rotate_server_ca_context = v.map(|x| x.into());
13763        self
13764    }
13765}
13766
13767impl wkt::message::Message for InstancesRotateServerCaRequest {
13768    fn typename() -> &'static str {
13769        "type.googleapis.com/google.cloud.sql.v1.InstancesRotateServerCaRequest"
13770    }
13771}
13772
13773#[doc(hidden)]
13774impl<'de> serde::de::Deserialize<'de> for InstancesRotateServerCaRequest {
13775    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13776    where
13777        D: serde::Deserializer<'de>,
13778    {
13779        #[allow(non_camel_case_types)]
13780        #[doc(hidden)]
13781        #[derive(PartialEq, Eq, Hash)]
13782        enum __FieldTag {
13783            __rotate_server_ca_context,
13784            Unknown(std::string::String),
13785        }
13786        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13787            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13788            where
13789                D: serde::Deserializer<'de>,
13790            {
13791                struct Visitor;
13792                impl<'de> serde::de::Visitor<'de> for Visitor {
13793                    type Value = __FieldTag;
13794                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13795                        formatter.write_str("a field name for InstancesRotateServerCaRequest")
13796                    }
13797                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13798                    where
13799                        E: serde::de::Error,
13800                    {
13801                        use std::result::Result::Ok;
13802                        use std::string::ToString;
13803                        match value {
13804                            "rotateServerCaContext" => Ok(__FieldTag::__rotate_server_ca_context),
13805                            "rotate_server_ca_context" => {
13806                                Ok(__FieldTag::__rotate_server_ca_context)
13807                            }
13808                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13809                        }
13810                    }
13811                }
13812                deserializer.deserialize_identifier(Visitor)
13813            }
13814        }
13815        struct Visitor;
13816        impl<'de> serde::de::Visitor<'de> for Visitor {
13817            type Value = InstancesRotateServerCaRequest;
13818            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13819                formatter.write_str("struct InstancesRotateServerCaRequest")
13820            }
13821            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13822            where
13823                A: serde::de::MapAccess<'de>,
13824            {
13825                #[allow(unused_imports)]
13826                use serde::de::Error;
13827                use std::option::Option::Some;
13828                let mut fields = std::collections::HashSet::new();
13829                let mut result = Self::Value::new();
13830                while let Some(tag) = map.next_key::<__FieldTag>()? {
13831                    #[allow(clippy::match_single_binding)]
13832                    match tag {
13833                        __FieldTag::__rotate_server_ca_context => {
13834                            if !fields.insert(__FieldTag::__rotate_server_ca_context) {
13835                                return std::result::Result::Err(A::Error::duplicate_field(
13836                                    "multiple values for rotate_server_ca_context",
13837                                ));
13838                            }
13839                            result.rotate_server_ca_context = map.next_value::<std::option::Option<crate::model::RotateServerCaContext>>()?
13840                                ;
13841                        }
13842                        __FieldTag::Unknown(key) => {
13843                            let value = map.next_value::<serde_json::Value>()?;
13844                            result._unknown_fields.insert(key, value);
13845                        }
13846                    }
13847                }
13848                std::result::Result::Ok(result)
13849            }
13850        }
13851        deserializer.deserialize_any(Visitor)
13852    }
13853}
13854
13855#[doc(hidden)]
13856impl serde::ser::Serialize for InstancesRotateServerCaRequest {
13857    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13858    where
13859        S: serde::ser::Serializer,
13860    {
13861        use serde::ser::SerializeMap;
13862        #[allow(unused_imports)]
13863        use std::option::Option::Some;
13864        let mut state = serializer.serialize_map(std::option::Option::None)?;
13865        if self.rotate_server_ca_context.is_some() {
13866            state.serialize_entry("rotateServerCaContext", &self.rotate_server_ca_context)?;
13867        }
13868        if !self._unknown_fields.is_empty() {
13869            for (key, value) in self._unknown_fields.iter() {
13870                state.serialize_entry(key, &value)?;
13871            }
13872        }
13873        state.end()
13874    }
13875}
13876
13877impl std::fmt::Debug for InstancesRotateServerCaRequest {
13878    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13879        let mut debug_struct = f.debug_struct("InstancesRotateServerCaRequest");
13880        debug_struct.field("rotate_server_ca_context", &self.rotate_server_ca_context);
13881        if !self._unknown_fields.is_empty() {
13882            debug_struct.field("_unknown_fields", &self._unknown_fields);
13883        }
13884        debug_struct.finish()
13885    }
13886}
13887
13888/// Instance truncate log request.
13889#[derive(Clone, Default, PartialEq)]
13890#[non_exhaustive]
13891pub struct InstancesTruncateLogRequest {
13892    /// Contains details about the truncate log operation.
13893    pub truncate_log_context: std::option::Option<crate::model::TruncateLogContext>,
13894
13895    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13896}
13897
13898impl InstancesTruncateLogRequest {
13899    pub fn new() -> Self {
13900        std::default::Default::default()
13901    }
13902
13903    /// Sets the value of [truncate_log_context][crate::model::InstancesTruncateLogRequest::truncate_log_context].
13904    pub fn set_truncate_log_context<T>(mut self, v: T) -> Self
13905    where
13906        T: std::convert::Into<crate::model::TruncateLogContext>,
13907    {
13908        self.truncate_log_context = std::option::Option::Some(v.into());
13909        self
13910    }
13911
13912    /// Sets or clears the value of [truncate_log_context][crate::model::InstancesTruncateLogRequest::truncate_log_context].
13913    pub fn set_or_clear_truncate_log_context<T>(mut self, v: std::option::Option<T>) -> Self
13914    where
13915        T: std::convert::Into<crate::model::TruncateLogContext>,
13916    {
13917        self.truncate_log_context = v.map(|x| x.into());
13918        self
13919    }
13920}
13921
13922impl wkt::message::Message for InstancesTruncateLogRequest {
13923    fn typename() -> &'static str {
13924        "type.googleapis.com/google.cloud.sql.v1.InstancesTruncateLogRequest"
13925    }
13926}
13927
13928#[doc(hidden)]
13929impl<'de> serde::de::Deserialize<'de> for InstancesTruncateLogRequest {
13930    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13931    where
13932        D: serde::Deserializer<'de>,
13933    {
13934        #[allow(non_camel_case_types)]
13935        #[doc(hidden)]
13936        #[derive(PartialEq, Eq, Hash)]
13937        enum __FieldTag {
13938            __truncate_log_context,
13939            Unknown(std::string::String),
13940        }
13941        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13942            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13943            where
13944                D: serde::Deserializer<'de>,
13945            {
13946                struct Visitor;
13947                impl<'de> serde::de::Visitor<'de> for Visitor {
13948                    type Value = __FieldTag;
13949                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13950                        formatter.write_str("a field name for InstancesTruncateLogRequest")
13951                    }
13952                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13953                    where
13954                        E: serde::de::Error,
13955                    {
13956                        use std::result::Result::Ok;
13957                        use std::string::ToString;
13958                        match value {
13959                            "truncateLogContext" => Ok(__FieldTag::__truncate_log_context),
13960                            "truncate_log_context" => Ok(__FieldTag::__truncate_log_context),
13961                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13962                        }
13963                    }
13964                }
13965                deserializer.deserialize_identifier(Visitor)
13966            }
13967        }
13968        struct Visitor;
13969        impl<'de> serde::de::Visitor<'de> for Visitor {
13970            type Value = InstancesTruncateLogRequest;
13971            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13972                formatter.write_str("struct InstancesTruncateLogRequest")
13973            }
13974            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13975            where
13976                A: serde::de::MapAccess<'de>,
13977            {
13978                #[allow(unused_imports)]
13979                use serde::de::Error;
13980                use std::option::Option::Some;
13981                let mut fields = std::collections::HashSet::new();
13982                let mut result = Self::Value::new();
13983                while let Some(tag) = map.next_key::<__FieldTag>()? {
13984                    #[allow(clippy::match_single_binding)]
13985                    match tag {
13986                        __FieldTag::__truncate_log_context => {
13987                            if !fields.insert(__FieldTag::__truncate_log_context) {
13988                                return std::result::Result::Err(A::Error::duplicate_field(
13989                                    "multiple values for truncate_log_context",
13990                                ));
13991                            }
13992                            result.truncate_log_context = map.next_value::<std::option::Option<crate::model::TruncateLogContext>>()?
13993                                ;
13994                        }
13995                        __FieldTag::Unknown(key) => {
13996                            let value = map.next_value::<serde_json::Value>()?;
13997                            result._unknown_fields.insert(key, value);
13998                        }
13999                    }
14000                }
14001                std::result::Result::Ok(result)
14002            }
14003        }
14004        deserializer.deserialize_any(Visitor)
14005    }
14006}
14007
14008#[doc(hidden)]
14009impl serde::ser::Serialize for InstancesTruncateLogRequest {
14010    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14011    where
14012        S: serde::ser::Serializer,
14013    {
14014        use serde::ser::SerializeMap;
14015        #[allow(unused_imports)]
14016        use std::option::Option::Some;
14017        let mut state = serializer.serialize_map(std::option::Option::None)?;
14018        if self.truncate_log_context.is_some() {
14019            state.serialize_entry("truncateLogContext", &self.truncate_log_context)?;
14020        }
14021        if !self._unknown_fields.is_empty() {
14022            for (key, value) in self._unknown_fields.iter() {
14023                state.serialize_entry(key, &value)?;
14024            }
14025        }
14026        state.end()
14027    }
14028}
14029
14030impl std::fmt::Debug for InstancesTruncateLogRequest {
14031    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14032        let mut debug_struct = f.debug_struct("InstancesTruncateLogRequest");
14033        debug_struct.field("truncate_log_context", &self.truncate_log_context);
14034        if !self._unknown_fields.is_empty() {
14035            debug_struct.field("_unknown_fields", &self._unknown_fields);
14036        }
14037        debug_struct.finish()
14038    }
14039}
14040
14041/// Request to acquire a lease for SSRS.
14042#[derive(Clone, Default, PartialEq)]
14043#[non_exhaustive]
14044pub struct InstancesAcquireSsrsLeaseRequest {
14045    /// Contains details about the acquire SSRS lease operation.
14046    pub acquire_ssrs_lease_context: std::option::Option<crate::model::AcquireSsrsLeaseContext>,
14047
14048    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14049}
14050
14051impl InstancesAcquireSsrsLeaseRequest {
14052    pub fn new() -> Self {
14053        std::default::Default::default()
14054    }
14055
14056    /// Sets the value of [acquire_ssrs_lease_context][crate::model::InstancesAcquireSsrsLeaseRequest::acquire_ssrs_lease_context].
14057    pub fn set_acquire_ssrs_lease_context<T>(mut self, v: T) -> Self
14058    where
14059        T: std::convert::Into<crate::model::AcquireSsrsLeaseContext>,
14060    {
14061        self.acquire_ssrs_lease_context = std::option::Option::Some(v.into());
14062        self
14063    }
14064
14065    /// Sets or clears the value of [acquire_ssrs_lease_context][crate::model::InstancesAcquireSsrsLeaseRequest::acquire_ssrs_lease_context].
14066    pub fn set_or_clear_acquire_ssrs_lease_context<T>(mut self, v: std::option::Option<T>) -> Self
14067    where
14068        T: std::convert::Into<crate::model::AcquireSsrsLeaseContext>,
14069    {
14070        self.acquire_ssrs_lease_context = v.map(|x| x.into());
14071        self
14072    }
14073}
14074
14075impl wkt::message::Message for InstancesAcquireSsrsLeaseRequest {
14076    fn typename() -> &'static str {
14077        "type.googleapis.com/google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest"
14078    }
14079}
14080
14081#[doc(hidden)]
14082impl<'de> serde::de::Deserialize<'de> for InstancesAcquireSsrsLeaseRequest {
14083    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14084    where
14085        D: serde::Deserializer<'de>,
14086    {
14087        #[allow(non_camel_case_types)]
14088        #[doc(hidden)]
14089        #[derive(PartialEq, Eq, Hash)]
14090        enum __FieldTag {
14091            __acquire_ssrs_lease_context,
14092            Unknown(std::string::String),
14093        }
14094        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14095            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14096            where
14097                D: serde::Deserializer<'de>,
14098            {
14099                struct Visitor;
14100                impl<'de> serde::de::Visitor<'de> for Visitor {
14101                    type Value = __FieldTag;
14102                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14103                        formatter.write_str("a field name for InstancesAcquireSsrsLeaseRequest")
14104                    }
14105                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14106                    where
14107                        E: serde::de::Error,
14108                    {
14109                        use std::result::Result::Ok;
14110                        use std::string::ToString;
14111                        match value {
14112                            "acquireSsrsLeaseContext" => {
14113                                Ok(__FieldTag::__acquire_ssrs_lease_context)
14114                            }
14115                            "acquire_ssrs_lease_context" => {
14116                                Ok(__FieldTag::__acquire_ssrs_lease_context)
14117                            }
14118                            _ => Ok(__FieldTag::Unknown(value.to_string())),
14119                        }
14120                    }
14121                }
14122                deserializer.deserialize_identifier(Visitor)
14123            }
14124        }
14125        struct Visitor;
14126        impl<'de> serde::de::Visitor<'de> for Visitor {
14127            type Value = InstancesAcquireSsrsLeaseRequest;
14128            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14129                formatter.write_str("struct InstancesAcquireSsrsLeaseRequest")
14130            }
14131            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14132            where
14133                A: serde::de::MapAccess<'de>,
14134            {
14135                #[allow(unused_imports)]
14136                use serde::de::Error;
14137                use std::option::Option::Some;
14138                let mut fields = std::collections::HashSet::new();
14139                let mut result = Self::Value::new();
14140                while let Some(tag) = map.next_key::<__FieldTag>()? {
14141                    #[allow(clippy::match_single_binding)]
14142                    match tag {
14143                        __FieldTag::__acquire_ssrs_lease_context => {
14144                            if !fields.insert(__FieldTag::__acquire_ssrs_lease_context) {
14145                                return std::result::Result::Err(A::Error::duplicate_field(
14146                                    "multiple values for acquire_ssrs_lease_context",
14147                                ));
14148                            }
14149                            result.acquire_ssrs_lease_context = map.next_value::<std::option::Option<crate::model::AcquireSsrsLeaseContext>>()?
14150                                ;
14151                        }
14152                        __FieldTag::Unknown(key) => {
14153                            let value = map.next_value::<serde_json::Value>()?;
14154                            result._unknown_fields.insert(key, value);
14155                        }
14156                    }
14157                }
14158                std::result::Result::Ok(result)
14159            }
14160        }
14161        deserializer.deserialize_any(Visitor)
14162    }
14163}
14164
14165#[doc(hidden)]
14166impl serde::ser::Serialize for InstancesAcquireSsrsLeaseRequest {
14167    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14168    where
14169        S: serde::ser::Serializer,
14170    {
14171        use serde::ser::SerializeMap;
14172        #[allow(unused_imports)]
14173        use std::option::Option::Some;
14174        let mut state = serializer.serialize_map(std::option::Option::None)?;
14175        if self.acquire_ssrs_lease_context.is_some() {
14176            state.serialize_entry("acquireSsrsLeaseContext", &self.acquire_ssrs_lease_context)?;
14177        }
14178        if !self._unknown_fields.is_empty() {
14179            for (key, value) in self._unknown_fields.iter() {
14180                state.serialize_entry(key, &value)?;
14181            }
14182        }
14183        state.end()
14184    }
14185}
14186
14187impl std::fmt::Debug for InstancesAcquireSsrsLeaseRequest {
14188    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14189        let mut debug_struct = f.debug_struct("InstancesAcquireSsrsLeaseRequest");
14190        debug_struct.field(
14191            "acquire_ssrs_lease_context",
14192            &self.acquire_ssrs_lease_context,
14193        );
14194        if !self._unknown_fields.is_empty() {
14195            debug_struct.field("_unknown_fields", &self._unknown_fields);
14196        }
14197        debug_struct.finish()
14198    }
14199}
14200
14201/// Instance verify external sync settings response.
14202#[derive(Clone, Default, PartialEq)]
14203#[non_exhaustive]
14204pub struct SqlInstancesVerifyExternalSyncSettingsResponse {
14205    /// This is always `sql#migrationSettingErrorList`.
14206    pub kind: std::string::String,
14207
14208    /// List of migration violations.
14209    pub errors: std::vec::Vec<crate::model::SqlExternalSyncSettingError>,
14210
14211    /// List of migration warnings.
14212    pub warnings: std::vec::Vec<crate::model::SqlExternalSyncSettingError>,
14213
14214    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14215}
14216
14217impl SqlInstancesVerifyExternalSyncSettingsResponse {
14218    pub fn new() -> Self {
14219        std::default::Default::default()
14220    }
14221
14222    /// Sets the value of [kind][crate::model::SqlInstancesVerifyExternalSyncSettingsResponse::kind].
14223    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14224        self.kind = v.into();
14225        self
14226    }
14227
14228    /// Sets the value of [errors][crate::model::SqlInstancesVerifyExternalSyncSettingsResponse::errors].
14229    pub fn set_errors<T, V>(mut self, v: T) -> Self
14230    where
14231        T: std::iter::IntoIterator<Item = V>,
14232        V: std::convert::Into<crate::model::SqlExternalSyncSettingError>,
14233    {
14234        use std::iter::Iterator;
14235        self.errors = v.into_iter().map(|i| i.into()).collect();
14236        self
14237    }
14238
14239    /// Sets the value of [warnings][crate::model::SqlInstancesVerifyExternalSyncSettingsResponse::warnings].
14240    pub fn set_warnings<T, V>(mut self, v: T) -> Self
14241    where
14242        T: std::iter::IntoIterator<Item = V>,
14243        V: std::convert::Into<crate::model::SqlExternalSyncSettingError>,
14244    {
14245        use std::iter::Iterator;
14246        self.warnings = v.into_iter().map(|i| i.into()).collect();
14247        self
14248    }
14249}
14250
14251impl wkt::message::Message for SqlInstancesVerifyExternalSyncSettingsResponse {
14252    fn typename() -> &'static str {
14253        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse"
14254    }
14255}
14256
14257#[doc(hidden)]
14258impl<'de> serde::de::Deserialize<'de> for SqlInstancesVerifyExternalSyncSettingsResponse {
14259    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14260    where
14261        D: serde::Deserializer<'de>,
14262    {
14263        #[allow(non_camel_case_types)]
14264        #[doc(hidden)]
14265        #[derive(PartialEq, Eq, Hash)]
14266        enum __FieldTag {
14267            __kind,
14268            __errors,
14269            __warnings,
14270            Unknown(std::string::String),
14271        }
14272        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14273            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14274            where
14275                D: serde::Deserializer<'de>,
14276            {
14277                struct Visitor;
14278                impl<'de> serde::de::Visitor<'de> for Visitor {
14279                    type Value = __FieldTag;
14280                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14281                        formatter.write_str(
14282                            "a field name for SqlInstancesVerifyExternalSyncSettingsResponse",
14283                        )
14284                    }
14285                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14286                    where
14287                        E: serde::de::Error,
14288                    {
14289                        use std::result::Result::Ok;
14290                        use std::string::ToString;
14291                        match value {
14292                            "kind" => Ok(__FieldTag::__kind),
14293                            "errors" => Ok(__FieldTag::__errors),
14294                            "warnings" => Ok(__FieldTag::__warnings),
14295                            _ => Ok(__FieldTag::Unknown(value.to_string())),
14296                        }
14297                    }
14298                }
14299                deserializer.deserialize_identifier(Visitor)
14300            }
14301        }
14302        struct Visitor;
14303        impl<'de> serde::de::Visitor<'de> for Visitor {
14304            type Value = SqlInstancesVerifyExternalSyncSettingsResponse;
14305            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14306                formatter.write_str("struct SqlInstancesVerifyExternalSyncSettingsResponse")
14307            }
14308            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14309            where
14310                A: serde::de::MapAccess<'de>,
14311            {
14312                #[allow(unused_imports)]
14313                use serde::de::Error;
14314                use std::option::Option::Some;
14315                let mut fields = std::collections::HashSet::new();
14316                let mut result = Self::Value::new();
14317                while let Some(tag) = map.next_key::<__FieldTag>()? {
14318                    #[allow(clippy::match_single_binding)]
14319                    match tag {
14320                        __FieldTag::__kind => {
14321                            if !fields.insert(__FieldTag::__kind) {
14322                                return std::result::Result::Err(A::Error::duplicate_field(
14323                                    "multiple values for kind",
14324                                ));
14325                            }
14326                            result.kind = map
14327                                .next_value::<std::option::Option<std::string::String>>()?
14328                                .unwrap_or_default();
14329                        }
14330                        __FieldTag::__errors => {
14331                            if !fields.insert(__FieldTag::__errors) {
14332                                return std::result::Result::Err(A::Error::duplicate_field(
14333                                    "multiple values for errors",
14334                                ));
14335                            }
14336                            result.errors = map
14337                                .next_value::<std::option::Option<
14338                                    std::vec::Vec<crate::model::SqlExternalSyncSettingError>,
14339                                >>()?
14340                                .unwrap_or_default();
14341                        }
14342                        __FieldTag::__warnings => {
14343                            if !fields.insert(__FieldTag::__warnings) {
14344                                return std::result::Result::Err(A::Error::duplicate_field(
14345                                    "multiple values for warnings",
14346                                ));
14347                            }
14348                            result.warnings = map
14349                                .next_value::<std::option::Option<
14350                                    std::vec::Vec<crate::model::SqlExternalSyncSettingError>,
14351                                >>()?
14352                                .unwrap_or_default();
14353                        }
14354                        __FieldTag::Unknown(key) => {
14355                            let value = map.next_value::<serde_json::Value>()?;
14356                            result._unknown_fields.insert(key, value);
14357                        }
14358                    }
14359                }
14360                std::result::Result::Ok(result)
14361            }
14362        }
14363        deserializer.deserialize_any(Visitor)
14364    }
14365}
14366
14367#[doc(hidden)]
14368impl serde::ser::Serialize for SqlInstancesVerifyExternalSyncSettingsResponse {
14369    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14370    where
14371        S: serde::ser::Serializer,
14372    {
14373        use serde::ser::SerializeMap;
14374        #[allow(unused_imports)]
14375        use std::option::Option::Some;
14376        let mut state = serializer.serialize_map(std::option::Option::None)?;
14377        if !self.kind.is_empty() {
14378            state.serialize_entry("kind", &self.kind)?;
14379        }
14380        if !self.errors.is_empty() {
14381            state.serialize_entry("errors", &self.errors)?;
14382        }
14383        if !self.warnings.is_empty() {
14384            state.serialize_entry("warnings", &self.warnings)?;
14385        }
14386        if !self._unknown_fields.is_empty() {
14387            for (key, value) in self._unknown_fields.iter() {
14388                state.serialize_entry(key, &value)?;
14389            }
14390        }
14391        state.end()
14392    }
14393}
14394
14395impl std::fmt::Debug for SqlInstancesVerifyExternalSyncSettingsResponse {
14396    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14397        let mut debug_struct = f.debug_struct("SqlInstancesVerifyExternalSyncSettingsResponse");
14398        debug_struct.field("kind", &self.kind);
14399        debug_struct.field("errors", &self.errors);
14400        debug_struct.field("warnings", &self.warnings);
14401        if !self._unknown_fields.is_empty() {
14402            debug_struct.field("_unknown_fields", &self._unknown_fields);
14403        }
14404        debug_struct.finish()
14405    }
14406}
14407
14408/// Instance get disk shrink config response.
14409#[derive(Clone, Default, PartialEq)]
14410#[non_exhaustive]
14411pub struct SqlInstancesGetDiskShrinkConfigResponse {
14412    /// This is always `sql#getDiskShrinkConfig`.
14413    pub kind: std::string::String,
14414
14415    /// The minimum size to which a disk can be shrunk in GigaBytes.
14416    pub minimal_target_size_gb: i64,
14417
14418    /// Additional message to customers.
14419    pub message: std::string::String,
14420
14421    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14422}
14423
14424impl SqlInstancesGetDiskShrinkConfigResponse {
14425    pub fn new() -> Self {
14426        std::default::Default::default()
14427    }
14428
14429    /// Sets the value of [kind][crate::model::SqlInstancesGetDiskShrinkConfigResponse::kind].
14430    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14431        self.kind = v.into();
14432        self
14433    }
14434
14435    /// Sets the value of [minimal_target_size_gb][crate::model::SqlInstancesGetDiskShrinkConfigResponse::minimal_target_size_gb].
14436    pub fn set_minimal_target_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
14437        self.minimal_target_size_gb = v.into();
14438        self
14439    }
14440
14441    /// Sets the value of [message][crate::model::SqlInstancesGetDiskShrinkConfigResponse::message].
14442    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14443        self.message = v.into();
14444        self
14445    }
14446}
14447
14448impl wkt::message::Message for SqlInstancesGetDiskShrinkConfigResponse {
14449    fn typename() -> &'static str {
14450        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse"
14451    }
14452}
14453
14454#[doc(hidden)]
14455impl<'de> serde::de::Deserialize<'de> for SqlInstancesGetDiskShrinkConfigResponse {
14456    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14457    where
14458        D: serde::Deserializer<'de>,
14459    {
14460        #[allow(non_camel_case_types)]
14461        #[doc(hidden)]
14462        #[derive(PartialEq, Eq, Hash)]
14463        enum __FieldTag {
14464            __kind,
14465            __minimal_target_size_gb,
14466            __message,
14467            Unknown(std::string::String),
14468        }
14469        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14470            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14471            where
14472                D: serde::Deserializer<'de>,
14473            {
14474                struct Visitor;
14475                impl<'de> serde::de::Visitor<'de> for Visitor {
14476                    type Value = __FieldTag;
14477                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14478                        formatter
14479                            .write_str("a field name for SqlInstancesGetDiskShrinkConfigResponse")
14480                    }
14481                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14482                    where
14483                        E: serde::de::Error,
14484                    {
14485                        use std::result::Result::Ok;
14486                        use std::string::ToString;
14487                        match value {
14488                            "kind" => Ok(__FieldTag::__kind),
14489                            "minimalTargetSizeGb" => Ok(__FieldTag::__minimal_target_size_gb),
14490                            "minimal_target_size_gb" => Ok(__FieldTag::__minimal_target_size_gb),
14491                            "message" => Ok(__FieldTag::__message),
14492                            _ => Ok(__FieldTag::Unknown(value.to_string())),
14493                        }
14494                    }
14495                }
14496                deserializer.deserialize_identifier(Visitor)
14497            }
14498        }
14499        struct Visitor;
14500        impl<'de> serde::de::Visitor<'de> for Visitor {
14501            type Value = SqlInstancesGetDiskShrinkConfigResponse;
14502            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14503                formatter.write_str("struct SqlInstancesGetDiskShrinkConfigResponse")
14504            }
14505            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14506            where
14507                A: serde::de::MapAccess<'de>,
14508            {
14509                #[allow(unused_imports)]
14510                use serde::de::Error;
14511                use std::option::Option::Some;
14512                let mut fields = std::collections::HashSet::new();
14513                let mut result = Self::Value::new();
14514                while let Some(tag) = map.next_key::<__FieldTag>()? {
14515                    #[allow(clippy::match_single_binding)]
14516                    match tag {
14517                        __FieldTag::__kind => {
14518                            if !fields.insert(__FieldTag::__kind) {
14519                                return std::result::Result::Err(A::Error::duplicate_field(
14520                                    "multiple values for kind",
14521                                ));
14522                            }
14523                            result.kind = map
14524                                .next_value::<std::option::Option<std::string::String>>()?
14525                                .unwrap_or_default();
14526                        }
14527                        __FieldTag::__minimal_target_size_gb => {
14528                            if !fields.insert(__FieldTag::__minimal_target_size_gb) {
14529                                return std::result::Result::Err(A::Error::duplicate_field(
14530                                    "multiple values for minimal_target_size_gb",
14531                                ));
14532                            }
14533                            struct __With(std::option::Option<i64>);
14534                            impl<'de> serde::de::Deserialize<'de> for __With {
14535                                fn deserialize<D>(
14536                                    deserializer: D,
14537                                ) -> std::result::Result<Self, D::Error>
14538                                where
14539                                    D: serde::de::Deserializer<'de>,
14540                                {
14541                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
14542                                }
14543                            }
14544                            result.minimal_target_size_gb =
14545                                map.next_value::<__With>()?.0.unwrap_or_default();
14546                        }
14547                        __FieldTag::__message => {
14548                            if !fields.insert(__FieldTag::__message) {
14549                                return std::result::Result::Err(A::Error::duplicate_field(
14550                                    "multiple values for message",
14551                                ));
14552                            }
14553                            result.message = map
14554                                .next_value::<std::option::Option<std::string::String>>()?
14555                                .unwrap_or_default();
14556                        }
14557                        __FieldTag::Unknown(key) => {
14558                            let value = map.next_value::<serde_json::Value>()?;
14559                            result._unknown_fields.insert(key, value);
14560                        }
14561                    }
14562                }
14563                std::result::Result::Ok(result)
14564            }
14565        }
14566        deserializer.deserialize_any(Visitor)
14567    }
14568}
14569
14570#[doc(hidden)]
14571impl serde::ser::Serialize for SqlInstancesGetDiskShrinkConfigResponse {
14572    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14573    where
14574        S: serde::ser::Serializer,
14575    {
14576        use serde::ser::SerializeMap;
14577        #[allow(unused_imports)]
14578        use std::option::Option::Some;
14579        let mut state = serializer.serialize_map(std::option::Option::None)?;
14580        if !self.kind.is_empty() {
14581            state.serialize_entry("kind", &self.kind)?;
14582        }
14583        if !wkt::internal::is_default(&self.minimal_target_size_gb) {
14584            struct __With<'a>(&'a i64);
14585            impl<'a> serde::ser::Serialize for __With<'a> {
14586                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14587                where
14588                    S: serde::ser::Serializer,
14589                {
14590                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
14591                }
14592            }
14593            state.serialize_entry("minimalTargetSizeGb", &__With(&self.minimal_target_size_gb))?;
14594        }
14595        if !self.message.is_empty() {
14596            state.serialize_entry("message", &self.message)?;
14597        }
14598        if !self._unknown_fields.is_empty() {
14599            for (key, value) in self._unknown_fields.iter() {
14600                state.serialize_entry(key, &value)?;
14601            }
14602        }
14603        state.end()
14604    }
14605}
14606
14607impl std::fmt::Debug for SqlInstancesGetDiskShrinkConfigResponse {
14608    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14609        let mut debug_struct = f.debug_struct("SqlInstancesGetDiskShrinkConfigResponse");
14610        debug_struct.field("kind", &self.kind);
14611        debug_struct.field("minimal_target_size_gb", &self.minimal_target_size_gb);
14612        debug_struct.field("message", &self.message);
14613        if !self._unknown_fields.is_empty() {
14614            debug_struct.field("_unknown_fields", &self._unknown_fields);
14615        }
14616        debug_struct.finish()
14617    }
14618}
14619
14620/// Instance get latest recovery time request.
14621#[derive(Clone, Default, PartialEq)]
14622#[non_exhaustive]
14623pub struct SqlInstancesGetLatestRecoveryTimeRequest {
14624    /// Cloud SQL instance ID. This does not include the project ID.
14625    pub instance: std::string::String,
14626
14627    /// Project ID of the project that contains the instance.
14628    pub project: std::string::String,
14629
14630    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14631}
14632
14633impl SqlInstancesGetLatestRecoveryTimeRequest {
14634    pub fn new() -> Self {
14635        std::default::Default::default()
14636    }
14637
14638    /// Sets the value of [instance][crate::model::SqlInstancesGetLatestRecoveryTimeRequest::instance].
14639    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14640        self.instance = v.into();
14641        self
14642    }
14643
14644    /// Sets the value of [project][crate::model::SqlInstancesGetLatestRecoveryTimeRequest::project].
14645    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14646        self.project = v.into();
14647        self
14648    }
14649}
14650
14651impl wkt::message::Message for SqlInstancesGetLatestRecoveryTimeRequest {
14652    fn typename() -> &'static str {
14653        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest"
14654    }
14655}
14656
14657#[doc(hidden)]
14658impl<'de> serde::de::Deserialize<'de> for SqlInstancesGetLatestRecoveryTimeRequest {
14659    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14660    where
14661        D: serde::Deserializer<'de>,
14662    {
14663        #[allow(non_camel_case_types)]
14664        #[doc(hidden)]
14665        #[derive(PartialEq, Eq, Hash)]
14666        enum __FieldTag {
14667            __instance,
14668            __project,
14669            Unknown(std::string::String),
14670        }
14671        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14672            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14673            where
14674                D: serde::Deserializer<'de>,
14675            {
14676                struct Visitor;
14677                impl<'de> serde::de::Visitor<'de> for Visitor {
14678                    type Value = __FieldTag;
14679                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14680                        formatter
14681                            .write_str("a field name for SqlInstancesGetLatestRecoveryTimeRequest")
14682                    }
14683                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14684                    where
14685                        E: serde::de::Error,
14686                    {
14687                        use std::result::Result::Ok;
14688                        use std::string::ToString;
14689                        match value {
14690                            "instance" => Ok(__FieldTag::__instance),
14691                            "project" => Ok(__FieldTag::__project),
14692                            _ => Ok(__FieldTag::Unknown(value.to_string())),
14693                        }
14694                    }
14695                }
14696                deserializer.deserialize_identifier(Visitor)
14697            }
14698        }
14699        struct Visitor;
14700        impl<'de> serde::de::Visitor<'de> for Visitor {
14701            type Value = SqlInstancesGetLatestRecoveryTimeRequest;
14702            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14703                formatter.write_str("struct SqlInstancesGetLatestRecoveryTimeRequest")
14704            }
14705            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14706            where
14707                A: serde::de::MapAccess<'de>,
14708            {
14709                #[allow(unused_imports)]
14710                use serde::de::Error;
14711                use std::option::Option::Some;
14712                let mut fields = std::collections::HashSet::new();
14713                let mut result = Self::Value::new();
14714                while let Some(tag) = map.next_key::<__FieldTag>()? {
14715                    #[allow(clippy::match_single_binding)]
14716                    match tag {
14717                        __FieldTag::__instance => {
14718                            if !fields.insert(__FieldTag::__instance) {
14719                                return std::result::Result::Err(A::Error::duplicate_field(
14720                                    "multiple values for instance",
14721                                ));
14722                            }
14723                            result.instance = map
14724                                .next_value::<std::option::Option<std::string::String>>()?
14725                                .unwrap_or_default();
14726                        }
14727                        __FieldTag::__project => {
14728                            if !fields.insert(__FieldTag::__project) {
14729                                return std::result::Result::Err(A::Error::duplicate_field(
14730                                    "multiple values for project",
14731                                ));
14732                            }
14733                            result.project = map
14734                                .next_value::<std::option::Option<std::string::String>>()?
14735                                .unwrap_or_default();
14736                        }
14737                        __FieldTag::Unknown(key) => {
14738                            let value = map.next_value::<serde_json::Value>()?;
14739                            result._unknown_fields.insert(key, value);
14740                        }
14741                    }
14742                }
14743                std::result::Result::Ok(result)
14744            }
14745        }
14746        deserializer.deserialize_any(Visitor)
14747    }
14748}
14749
14750#[doc(hidden)]
14751impl serde::ser::Serialize for SqlInstancesGetLatestRecoveryTimeRequest {
14752    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14753    where
14754        S: serde::ser::Serializer,
14755    {
14756        use serde::ser::SerializeMap;
14757        #[allow(unused_imports)]
14758        use std::option::Option::Some;
14759        let mut state = serializer.serialize_map(std::option::Option::None)?;
14760        if !self.instance.is_empty() {
14761            state.serialize_entry("instance", &self.instance)?;
14762        }
14763        if !self.project.is_empty() {
14764            state.serialize_entry("project", &self.project)?;
14765        }
14766        if !self._unknown_fields.is_empty() {
14767            for (key, value) in self._unknown_fields.iter() {
14768                state.serialize_entry(key, &value)?;
14769            }
14770        }
14771        state.end()
14772    }
14773}
14774
14775impl std::fmt::Debug for SqlInstancesGetLatestRecoveryTimeRequest {
14776    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14777        let mut debug_struct = f.debug_struct("SqlInstancesGetLatestRecoveryTimeRequest");
14778        debug_struct.field("instance", &self.instance);
14779        debug_struct.field("project", &self.project);
14780        if !self._unknown_fields.is_empty() {
14781            debug_struct.field("_unknown_fields", &self._unknown_fields);
14782        }
14783        debug_struct.finish()
14784    }
14785}
14786
14787/// Instance get latest recovery time response.
14788#[derive(Clone, Default, PartialEq)]
14789#[non_exhaustive]
14790pub struct SqlInstancesGetLatestRecoveryTimeResponse {
14791    /// This is always `sql#getLatestRecoveryTime`.
14792    pub kind: std::string::String,
14793
14794    /// Timestamp, identifies the latest recovery time of the source instance.
14795    pub latest_recovery_time: std::option::Option<wkt::Timestamp>,
14796
14797    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14798}
14799
14800impl SqlInstancesGetLatestRecoveryTimeResponse {
14801    pub fn new() -> Self {
14802        std::default::Default::default()
14803    }
14804
14805    /// Sets the value of [kind][crate::model::SqlInstancesGetLatestRecoveryTimeResponse::kind].
14806    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14807        self.kind = v.into();
14808        self
14809    }
14810
14811    /// Sets the value of [latest_recovery_time][crate::model::SqlInstancesGetLatestRecoveryTimeResponse::latest_recovery_time].
14812    pub fn set_latest_recovery_time<T>(mut self, v: T) -> Self
14813    where
14814        T: std::convert::Into<wkt::Timestamp>,
14815    {
14816        self.latest_recovery_time = std::option::Option::Some(v.into());
14817        self
14818    }
14819
14820    /// Sets or clears the value of [latest_recovery_time][crate::model::SqlInstancesGetLatestRecoveryTimeResponse::latest_recovery_time].
14821    pub fn set_or_clear_latest_recovery_time<T>(mut self, v: std::option::Option<T>) -> Self
14822    where
14823        T: std::convert::Into<wkt::Timestamp>,
14824    {
14825        self.latest_recovery_time = v.map(|x| x.into());
14826        self
14827    }
14828}
14829
14830impl wkt::message::Message for SqlInstancesGetLatestRecoveryTimeResponse {
14831    fn typename() -> &'static str {
14832        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse"
14833    }
14834}
14835
14836#[doc(hidden)]
14837impl<'de> serde::de::Deserialize<'de> for SqlInstancesGetLatestRecoveryTimeResponse {
14838    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14839    where
14840        D: serde::Deserializer<'de>,
14841    {
14842        #[allow(non_camel_case_types)]
14843        #[doc(hidden)]
14844        #[derive(PartialEq, Eq, Hash)]
14845        enum __FieldTag {
14846            __kind,
14847            __latest_recovery_time,
14848            Unknown(std::string::String),
14849        }
14850        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14851            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14852            where
14853                D: serde::Deserializer<'de>,
14854            {
14855                struct Visitor;
14856                impl<'de> serde::de::Visitor<'de> for Visitor {
14857                    type Value = __FieldTag;
14858                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14859                        formatter
14860                            .write_str("a field name for SqlInstancesGetLatestRecoveryTimeResponse")
14861                    }
14862                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14863                    where
14864                        E: serde::de::Error,
14865                    {
14866                        use std::result::Result::Ok;
14867                        use std::string::ToString;
14868                        match value {
14869                            "kind" => Ok(__FieldTag::__kind),
14870                            "latestRecoveryTime" => Ok(__FieldTag::__latest_recovery_time),
14871                            "latest_recovery_time" => Ok(__FieldTag::__latest_recovery_time),
14872                            _ => Ok(__FieldTag::Unknown(value.to_string())),
14873                        }
14874                    }
14875                }
14876                deserializer.deserialize_identifier(Visitor)
14877            }
14878        }
14879        struct Visitor;
14880        impl<'de> serde::de::Visitor<'de> for Visitor {
14881            type Value = SqlInstancesGetLatestRecoveryTimeResponse;
14882            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14883                formatter.write_str("struct SqlInstancesGetLatestRecoveryTimeResponse")
14884            }
14885            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14886            where
14887                A: serde::de::MapAccess<'de>,
14888            {
14889                #[allow(unused_imports)]
14890                use serde::de::Error;
14891                use std::option::Option::Some;
14892                let mut fields = std::collections::HashSet::new();
14893                let mut result = Self::Value::new();
14894                while let Some(tag) = map.next_key::<__FieldTag>()? {
14895                    #[allow(clippy::match_single_binding)]
14896                    match tag {
14897                        __FieldTag::__kind => {
14898                            if !fields.insert(__FieldTag::__kind) {
14899                                return std::result::Result::Err(A::Error::duplicate_field(
14900                                    "multiple values for kind",
14901                                ));
14902                            }
14903                            result.kind = map
14904                                .next_value::<std::option::Option<std::string::String>>()?
14905                                .unwrap_or_default();
14906                        }
14907                        __FieldTag::__latest_recovery_time => {
14908                            if !fields.insert(__FieldTag::__latest_recovery_time) {
14909                                return std::result::Result::Err(A::Error::duplicate_field(
14910                                    "multiple values for latest_recovery_time",
14911                                ));
14912                            }
14913                            result.latest_recovery_time =
14914                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
14915                        }
14916                        __FieldTag::Unknown(key) => {
14917                            let value = map.next_value::<serde_json::Value>()?;
14918                            result._unknown_fields.insert(key, value);
14919                        }
14920                    }
14921                }
14922                std::result::Result::Ok(result)
14923            }
14924        }
14925        deserializer.deserialize_any(Visitor)
14926    }
14927}
14928
14929#[doc(hidden)]
14930impl serde::ser::Serialize for SqlInstancesGetLatestRecoveryTimeResponse {
14931    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14932    where
14933        S: serde::ser::Serializer,
14934    {
14935        use serde::ser::SerializeMap;
14936        #[allow(unused_imports)]
14937        use std::option::Option::Some;
14938        let mut state = serializer.serialize_map(std::option::Option::None)?;
14939        if !self.kind.is_empty() {
14940            state.serialize_entry("kind", &self.kind)?;
14941        }
14942        if self.latest_recovery_time.is_some() {
14943            state.serialize_entry("latestRecoveryTime", &self.latest_recovery_time)?;
14944        }
14945        if !self._unknown_fields.is_empty() {
14946            for (key, value) in self._unknown_fields.iter() {
14947                state.serialize_entry(key, &value)?;
14948            }
14949        }
14950        state.end()
14951    }
14952}
14953
14954impl std::fmt::Debug for SqlInstancesGetLatestRecoveryTimeResponse {
14955    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14956        let mut debug_struct = f.debug_struct("SqlInstancesGetLatestRecoveryTimeResponse");
14957        debug_struct.field("kind", &self.kind);
14958        debug_struct.field("latest_recovery_time", &self.latest_recovery_time);
14959        if !self._unknown_fields.is_empty() {
14960            debug_struct.field("_unknown_fields", &self._unknown_fields);
14961        }
14962        debug_struct.finish()
14963    }
14964}
14965
14966/// Database instance clone context.
14967#[derive(Clone, Default, PartialEq)]
14968#[non_exhaustive]
14969pub struct CloneContext {
14970    /// This is always `sql#cloneContext`.
14971    pub kind: std::string::String,
14972
14973    /// Reserved for future use.
14974    pub pitr_timestamp_ms: i64,
14975
14976    /// Name of the Cloud SQL instance to be created as a clone.
14977    pub destination_instance_name: std::string::String,
14978
14979    /// Binary log coordinates, if specified, identify the position up to which the
14980    /// source instance is cloned. If not specified, the source instance is
14981    /// cloned up to the most recent binary log coordinates.
14982    pub bin_log_coordinates: std::option::Option<crate::model::BinLogCoordinates>,
14983
14984    /// Timestamp, if specified, identifies the time to which the source instance
14985    /// is cloned.
14986    pub point_in_time: std::option::Option<wkt::Timestamp>,
14987
14988    /// The name of the allocated ip range for the private ip Cloud SQL instance.
14989    /// For example: "google-managed-services-default". If set, the cloned instance
14990    /// ip will be created in the allocated range. The range name must comply with
14991    /// [RFC 1035](https://tools.ietf.org/html/rfc1035). Specifically, the name
14992    /// must be 1-63 characters long and match the regular expression
14993    /// [a-z]([-a-z0-9]*[a-z0-9])?.
14994    /// Reserved for future use.
14995    pub allocated_ip_range: std::string::String,
14996
14997    /// (SQL Server only) Clone only the specified databases from the source
14998    /// instance. Clone all databases if empty.
14999    pub database_names: std::vec::Vec<std::string::String>,
15000
15001    /// Optional. Copy clone and point-in-time recovery clone of an instance to the
15002    /// specified zone. If no zone is specified, clone to the same primary zone as
15003    /// the source instance. This field applies to all DB types.
15004    pub preferred_zone: std::option::Option<std::string::String>,
15005
15006    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15007}
15008
15009impl CloneContext {
15010    pub fn new() -> Self {
15011        std::default::Default::default()
15012    }
15013
15014    /// Sets the value of [kind][crate::model::CloneContext::kind].
15015    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15016        self.kind = v.into();
15017        self
15018    }
15019
15020    /// Sets the value of [pitr_timestamp_ms][crate::model::CloneContext::pitr_timestamp_ms].
15021    pub fn set_pitr_timestamp_ms<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
15022        self.pitr_timestamp_ms = v.into();
15023        self
15024    }
15025
15026    /// Sets the value of [destination_instance_name][crate::model::CloneContext::destination_instance_name].
15027    pub fn set_destination_instance_name<T: std::convert::Into<std::string::String>>(
15028        mut self,
15029        v: T,
15030    ) -> Self {
15031        self.destination_instance_name = v.into();
15032        self
15033    }
15034
15035    /// Sets the value of [bin_log_coordinates][crate::model::CloneContext::bin_log_coordinates].
15036    pub fn set_bin_log_coordinates<T>(mut self, v: T) -> Self
15037    where
15038        T: std::convert::Into<crate::model::BinLogCoordinates>,
15039    {
15040        self.bin_log_coordinates = std::option::Option::Some(v.into());
15041        self
15042    }
15043
15044    /// Sets or clears the value of [bin_log_coordinates][crate::model::CloneContext::bin_log_coordinates].
15045    pub fn set_or_clear_bin_log_coordinates<T>(mut self, v: std::option::Option<T>) -> Self
15046    where
15047        T: std::convert::Into<crate::model::BinLogCoordinates>,
15048    {
15049        self.bin_log_coordinates = v.map(|x| x.into());
15050        self
15051    }
15052
15053    /// Sets the value of [point_in_time][crate::model::CloneContext::point_in_time].
15054    pub fn set_point_in_time<T>(mut self, v: T) -> Self
15055    where
15056        T: std::convert::Into<wkt::Timestamp>,
15057    {
15058        self.point_in_time = std::option::Option::Some(v.into());
15059        self
15060    }
15061
15062    /// Sets or clears the value of [point_in_time][crate::model::CloneContext::point_in_time].
15063    pub fn set_or_clear_point_in_time<T>(mut self, v: std::option::Option<T>) -> Self
15064    where
15065        T: std::convert::Into<wkt::Timestamp>,
15066    {
15067        self.point_in_time = v.map(|x| x.into());
15068        self
15069    }
15070
15071    /// Sets the value of [allocated_ip_range][crate::model::CloneContext::allocated_ip_range].
15072    pub fn set_allocated_ip_range<T: std::convert::Into<std::string::String>>(
15073        mut self,
15074        v: T,
15075    ) -> Self {
15076        self.allocated_ip_range = v.into();
15077        self
15078    }
15079
15080    /// Sets the value of [database_names][crate::model::CloneContext::database_names].
15081    pub fn set_database_names<T, V>(mut self, v: T) -> Self
15082    where
15083        T: std::iter::IntoIterator<Item = V>,
15084        V: std::convert::Into<std::string::String>,
15085    {
15086        use std::iter::Iterator;
15087        self.database_names = v.into_iter().map(|i| i.into()).collect();
15088        self
15089    }
15090
15091    /// Sets the value of [preferred_zone][crate::model::CloneContext::preferred_zone].
15092    pub fn set_preferred_zone<T>(mut self, v: T) -> Self
15093    where
15094        T: std::convert::Into<std::string::String>,
15095    {
15096        self.preferred_zone = std::option::Option::Some(v.into());
15097        self
15098    }
15099
15100    /// Sets or clears the value of [preferred_zone][crate::model::CloneContext::preferred_zone].
15101    pub fn set_or_clear_preferred_zone<T>(mut self, v: std::option::Option<T>) -> Self
15102    where
15103        T: std::convert::Into<std::string::String>,
15104    {
15105        self.preferred_zone = v.map(|x| x.into());
15106        self
15107    }
15108}
15109
15110impl wkt::message::Message for CloneContext {
15111    fn typename() -> &'static str {
15112        "type.googleapis.com/google.cloud.sql.v1.CloneContext"
15113    }
15114}
15115
15116#[doc(hidden)]
15117impl<'de> serde::de::Deserialize<'de> for CloneContext {
15118    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15119    where
15120        D: serde::Deserializer<'de>,
15121    {
15122        #[allow(non_camel_case_types)]
15123        #[doc(hidden)]
15124        #[derive(PartialEq, Eq, Hash)]
15125        enum __FieldTag {
15126            __kind,
15127            __pitr_timestamp_ms,
15128            __destination_instance_name,
15129            __bin_log_coordinates,
15130            __point_in_time,
15131            __allocated_ip_range,
15132            __database_names,
15133            __preferred_zone,
15134            Unknown(std::string::String),
15135        }
15136        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15137            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15138            where
15139                D: serde::Deserializer<'de>,
15140            {
15141                struct Visitor;
15142                impl<'de> serde::de::Visitor<'de> for Visitor {
15143                    type Value = __FieldTag;
15144                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15145                        formatter.write_str("a field name for CloneContext")
15146                    }
15147                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
15148                    where
15149                        E: serde::de::Error,
15150                    {
15151                        use std::result::Result::Ok;
15152                        use std::string::ToString;
15153                        match value {
15154                            "kind" => Ok(__FieldTag::__kind),
15155                            "pitrTimestampMs" => Ok(__FieldTag::__pitr_timestamp_ms),
15156                            "pitr_timestamp_ms" => Ok(__FieldTag::__pitr_timestamp_ms),
15157                            "destinationInstanceName" => {
15158                                Ok(__FieldTag::__destination_instance_name)
15159                            }
15160                            "destination_instance_name" => {
15161                                Ok(__FieldTag::__destination_instance_name)
15162                            }
15163                            "binLogCoordinates" => Ok(__FieldTag::__bin_log_coordinates),
15164                            "bin_log_coordinates" => Ok(__FieldTag::__bin_log_coordinates),
15165                            "pointInTime" => Ok(__FieldTag::__point_in_time),
15166                            "point_in_time" => Ok(__FieldTag::__point_in_time),
15167                            "allocatedIpRange" => Ok(__FieldTag::__allocated_ip_range),
15168                            "allocated_ip_range" => Ok(__FieldTag::__allocated_ip_range),
15169                            "databaseNames" => Ok(__FieldTag::__database_names),
15170                            "database_names" => Ok(__FieldTag::__database_names),
15171                            "preferredZone" => Ok(__FieldTag::__preferred_zone),
15172                            "preferred_zone" => Ok(__FieldTag::__preferred_zone),
15173                            _ => Ok(__FieldTag::Unknown(value.to_string())),
15174                        }
15175                    }
15176                }
15177                deserializer.deserialize_identifier(Visitor)
15178            }
15179        }
15180        struct Visitor;
15181        impl<'de> serde::de::Visitor<'de> for Visitor {
15182            type Value = CloneContext;
15183            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15184                formatter.write_str("struct CloneContext")
15185            }
15186            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15187            where
15188                A: serde::de::MapAccess<'de>,
15189            {
15190                #[allow(unused_imports)]
15191                use serde::de::Error;
15192                use std::option::Option::Some;
15193                let mut fields = std::collections::HashSet::new();
15194                let mut result = Self::Value::new();
15195                while let Some(tag) = map.next_key::<__FieldTag>()? {
15196                    #[allow(clippy::match_single_binding)]
15197                    match tag {
15198                        __FieldTag::__kind => {
15199                            if !fields.insert(__FieldTag::__kind) {
15200                                return std::result::Result::Err(A::Error::duplicate_field(
15201                                    "multiple values for kind",
15202                                ));
15203                            }
15204                            result.kind = map
15205                                .next_value::<std::option::Option<std::string::String>>()?
15206                                .unwrap_or_default();
15207                        }
15208                        __FieldTag::__pitr_timestamp_ms => {
15209                            if !fields.insert(__FieldTag::__pitr_timestamp_ms) {
15210                                return std::result::Result::Err(A::Error::duplicate_field(
15211                                    "multiple values for pitr_timestamp_ms",
15212                                ));
15213                            }
15214                            struct __With(std::option::Option<i64>);
15215                            impl<'de> serde::de::Deserialize<'de> for __With {
15216                                fn deserialize<D>(
15217                                    deserializer: D,
15218                                ) -> std::result::Result<Self, D::Error>
15219                                where
15220                                    D: serde::de::Deserializer<'de>,
15221                                {
15222                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
15223                                }
15224                            }
15225                            result.pitr_timestamp_ms =
15226                                map.next_value::<__With>()?.0.unwrap_or_default();
15227                        }
15228                        __FieldTag::__destination_instance_name => {
15229                            if !fields.insert(__FieldTag::__destination_instance_name) {
15230                                return std::result::Result::Err(A::Error::duplicate_field(
15231                                    "multiple values for destination_instance_name",
15232                                ));
15233                            }
15234                            result.destination_instance_name = map
15235                                .next_value::<std::option::Option<std::string::String>>()?
15236                                .unwrap_or_default();
15237                        }
15238                        __FieldTag::__bin_log_coordinates => {
15239                            if !fields.insert(__FieldTag::__bin_log_coordinates) {
15240                                return std::result::Result::Err(A::Error::duplicate_field(
15241                                    "multiple values for bin_log_coordinates",
15242                                ));
15243                            }
15244                            result.bin_log_coordinates = map
15245                                .next_value::<std::option::Option<crate::model::BinLogCoordinates>>(
15246                                )?;
15247                        }
15248                        __FieldTag::__point_in_time => {
15249                            if !fields.insert(__FieldTag::__point_in_time) {
15250                                return std::result::Result::Err(A::Error::duplicate_field(
15251                                    "multiple values for point_in_time",
15252                                ));
15253                            }
15254                            result.point_in_time =
15255                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
15256                        }
15257                        __FieldTag::__allocated_ip_range => {
15258                            if !fields.insert(__FieldTag::__allocated_ip_range) {
15259                                return std::result::Result::Err(A::Error::duplicate_field(
15260                                    "multiple values for allocated_ip_range",
15261                                ));
15262                            }
15263                            result.allocated_ip_range = map
15264                                .next_value::<std::option::Option<std::string::String>>()?
15265                                .unwrap_or_default();
15266                        }
15267                        __FieldTag::__database_names => {
15268                            if !fields.insert(__FieldTag::__database_names) {
15269                                return std::result::Result::Err(A::Error::duplicate_field(
15270                                    "multiple values for database_names",
15271                                ));
15272                            }
15273                            result.database_names = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
15274                        }
15275                        __FieldTag::__preferred_zone => {
15276                            if !fields.insert(__FieldTag::__preferred_zone) {
15277                                return std::result::Result::Err(A::Error::duplicate_field(
15278                                    "multiple values for preferred_zone",
15279                                ));
15280                            }
15281                            result.preferred_zone =
15282                                map.next_value::<std::option::Option<std::string::String>>()?;
15283                        }
15284                        __FieldTag::Unknown(key) => {
15285                            let value = map.next_value::<serde_json::Value>()?;
15286                            result._unknown_fields.insert(key, value);
15287                        }
15288                    }
15289                }
15290                std::result::Result::Ok(result)
15291            }
15292        }
15293        deserializer.deserialize_any(Visitor)
15294    }
15295}
15296
15297#[doc(hidden)]
15298impl serde::ser::Serialize for CloneContext {
15299    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15300    where
15301        S: serde::ser::Serializer,
15302    {
15303        use serde::ser::SerializeMap;
15304        #[allow(unused_imports)]
15305        use std::option::Option::Some;
15306        let mut state = serializer.serialize_map(std::option::Option::None)?;
15307        if !self.kind.is_empty() {
15308            state.serialize_entry("kind", &self.kind)?;
15309        }
15310        if !wkt::internal::is_default(&self.pitr_timestamp_ms) {
15311            struct __With<'a>(&'a i64);
15312            impl<'a> serde::ser::Serialize for __With<'a> {
15313                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15314                where
15315                    S: serde::ser::Serializer,
15316                {
15317                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
15318                }
15319            }
15320            state.serialize_entry("pitrTimestampMs", &__With(&self.pitr_timestamp_ms))?;
15321        }
15322        if !self.destination_instance_name.is_empty() {
15323            state.serialize_entry("destinationInstanceName", &self.destination_instance_name)?;
15324        }
15325        if self.bin_log_coordinates.is_some() {
15326            state.serialize_entry("binLogCoordinates", &self.bin_log_coordinates)?;
15327        }
15328        if self.point_in_time.is_some() {
15329            state.serialize_entry("pointInTime", &self.point_in_time)?;
15330        }
15331        if !self.allocated_ip_range.is_empty() {
15332            state.serialize_entry("allocatedIpRange", &self.allocated_ip_range)?;
15333        }
15334        if !self.database_names.is_empty() {
15335            state.serialize_entry("databaseNames", &self.database_names)?;
15336        }
15337        if self.preferred_zone.is_some() {
15338            state.serialize_entry("preferredZone", &self.preferred_zone)?;
15339        }
15340        if !self._unknown_fields.is_empty() {
15341            for (key, value) in self._unknown_fields.iter() {
15342                state.serialize_entry(key, &value)?;
15343            }
15344        }
15345        state.end()
15346    }
15347}
15348
15349impl std::fmt::Debug for CloneContext {
15350    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15351        let mut debug_struct = f.debug_struct("CloneContext");
15352        debug_struct.field("kind", &self.kind);
15353        debug_struct.field("pitr_timestamp_ms", &self.pitr_timestamp_ms);
15354        debug_struct.field("destination_instance_name", &self.destination_instance_name);
15355        debug_struct.field("bin_log_coordinates", &self.bin_log_coordinates);
15356        debug_struct.field("point_in_time", &self.point_in_time);
15357        debug_struct.field("allocated_ip_range", &self.allocated_ip_range);
15358        debug_struct.field("database_names", &self.database_names);
15359        debug_struct.field("preferred_zone", &self.preferred_zone);
15360        if !self._unknown_fields.is_empty() {
15361            debug_struct.field("_unknown_fields", &self._unknown_fields);
15362        }
15363        debug_struct.finish()
15364    }
15365}
15366
15367/// Binary log coordinates.
15368#[derive(Clone, Default, PartialEq)]
15369#[non_exhaustive]
15370pub struct BinLogCoordinates {
15371    /// Name of the binary log file for a Cloud SQL instance.
15372    pub bin_log_file_name: std::string::String,
15373
15374    /// Position (offset) within the binary log file.
15375    pub bin_log_position: i64,
15376
15377    /// This is always `sql#binLogCoordinates`.
15378    pub kind: std::string::String,
15379
15380    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15381}
15382
15383impl BinLogCoordinates {
15384    pub fn new() -> Self {
15385        std::default::Default::default()
15386    }
15387
15388    /// Sets the value of [bin_log_file_name][crate::model::BinLogCoordinates::bin_log_file_name].
15389    pub fn set_bin_log_file_name<T: std::convert::Into<std::string::String>>(
15390        mut self,
15391        v: T,
15392    ) -> Self {
15393        self.bin_log_file_name = v.into();
15394        self
15395    }
15396
15397    /// Sets the value of [bin_log_position][crate::model::BinLogCoordinates::bin_log_position].
15398    pub fn set_bin_log_position<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
15399        self.bin_log_position = v.into();
15400        self
15401    }
15402
15403    /// Sets the value of [kind][crate::model::BinLogCoordinates::kind].
15404    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15405        self.kind = v.into();
15406        self
15407    }
15408}
15409
15410impl wkt::message::Message for BinLogCoordinates {
15411    fn typename() -> &'static str {
15412        "type.googleapis.com/google.cloud.sql.v1.BinLogCoordinates"
15413    }
15414}
15415
15416#[doc(hidden)]
15417impl<'de> serde::de::Deserialize<'de> for BinLogCoordinates {
15418    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15419    where
15420        D: serde::Deserializer<'de>,
15421    {
15422        #[allow(non_camel_case_types)]
15423        #[doc(hidden)]
15424        #[derive(PartialEq, Eq, Hash)]
15425        enum __FieldTag {
15426            __bin_log_file_name,
15427            __bin_log_position,
15428            __kind,
15429            Unknown(std::string::String),
15430        }
15431        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15432            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15433            where
15434                D: serde::Deserializer<'de>,
15435            {
15436                struct Visitor;
15437                impl<'de> serde::de::Visitor<'de> for Visitor {
15438                    type Value = __FieldTag;
15439                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15440                        formatter.write_str("a field name for BinLogCoordinates")
15441                    }
15442                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
15443                    where
15444                        E: serde::de::Error,
15445                    {
15446                        use std::result::Result::Ok;
15447                        use std::string::ToString;
15448                        match value {
15449                            "binLogFileName" => Ok(__FieldTag::__bin_log_file_name),
15450                            "bin_log_file_name" => Ok(__FieldTag::__bin_log_file_name),
15451                            "binLogPosition" => Ok(__FieldTag::__bin_log_position),
15452                            "bin_log_position" => Ok(__FieldTag::__bin_log_position),
15453                            "kind" => Ok(__FieldTag::__kind),
15454                            _ => Ok(__FieldTag::Unknown(value.to_string())),
15455                        }
15456                    }
15457                }
15458                deserializer.deserialize_identifier(Visitor)
15459            }
15460        }
15461        struct Visitor;
15462        impl<'de> serde::de::Visitor<'de> for Visitor {
15463            type Value = BinLogCoordinates;
15464            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15465                formatter.write_str("struct BinLogCoordinates")
15466            }
15467            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15468            where
15469                A: serde::de::MapAccess<'de>,
15470            {
15471                #[allow(unused_imports)]
15472                use serde::de::Error;
15473                use std::option::Option::Some;
15474                let mut fields = std::collections::HashSet::new();
15475                let mut result = Self::Value::new();
15476                while let Some(tag) = map.next_key::<__FieldTag>()? {
15477                    #[allow(clippy::match_single_binding)]
15478                    match tag {
15479                        __FieldTag::__bin_log_file_name => {
15480                            if !fields.insert(__FieldTag::__bin_log_file_name) {
15481                                return std::result::Result::Err(A::Error::duplicate_field(
15482                                    "multiple values for bin_log_file_name",
15483                                ));
15484                            }
15485                            result.bin_log_file_name = map
15486                                .next_value::<std::option::Option<std::string::String>>()?
15487                                .unwrap_or_default();
15488                        }
15489                        __FieldTag::__bin_log_position => {
15490                            if !fields.insert(__FieldTag::__bin_log_position) {
15491                                return std::result::Result::Err(A::Error::duplicate_field(
15492                                    "multiple values for bin_log_position",
15493                                ));
15494                            }
15495                            struct __With(std::option::Option<i64>);
15496                            impl<'de> serde::de::Deserialize<'de> for __With {
15497                                fn deserialize<D>(
15498                                    deserializer: D,
15499                                ) -> std::result::Result<Self, D::Error>
15500                                where
15501                                    D: serde::de::Deserializer<'de>,
15502                                {
15503                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
15504                                }
15505                            }
15506                            result.bin_log_position =
15507                                map.next_value::<__With>()?.0.unwrap_or_default();
15508                        }
15509                        __FieldTag::__kind => {
15510                            if !fields.insert(__FieldTag::__kind) {
15511                                return std::result::Result::Err(A::Error::duplicate_field(
15512                                    "multiple values for kind",
15513                                ));
15514                            }
15515                            result.kind = map
15516                                .next_value::<std::option::Option<std::string::String>>()?
15517                                .unwrap_or_default();
15518                        }
15519                        __FieldTag::Unknown(key) => {
15520                            let value = map.next_value::<serde_json::Value>()?;
15521                            result._unknown_fields.insert(key, value);
15522                        }
15523                    }
15524                }
15525                std::result::Result::Ok(result)
15526            }
15527        }
15528        deserializer.deserialize_any(Visitor)
15529    }
15530}
15531
15532#[doc(hidden)]
15533impl serde::ser::Serialize for BinLogCoordinates {
15534    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15535    where
15536        S: serde::ser::Serializer,
15537    {
15538        use serde::ser::SerializeMap;
15539        #[allow(unused_imports)]
15540        use std::option::Option::Some;
15541        let mut state = serializer.serialize_map(std::option::Option::None)?;
15542        if !self.bin_log_file_name.is_empty() {
15543            state.serialize_entry("binLogFileName", &self.bin_log_file_name)?;
15544        }
15545        if !wkt::internal::is_default(&self.bin_log_position) {
15546            struct __With<'a>(&'a i64);
15547            impl<'a> serde::ser::Serialize for __With<'a> {
15548                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15549                where
15550                    S: serde::ser::Serializer,
15551                {
15552                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
15553                }
15554            }
15555            state.serialize_entry("binLogPosition", &__With(&self.bin_log_position))?;
15556        }
15557        if !self.kind.is_empty() {
15558            state.serialize_entry("kind", &self.kind)?;
15559        }
15560        if !self._unknown_fields.is_empty() {
15561            for (key, value) in self._unknown_fields.iter() {
15562                state.serialize_entry(key, &value)?;
15563            }
15564        }
15565        state.end()
15566    }
15567}
15568
15569impl std::fmt::Debug for BinLogCoordinates {
15570    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15571        let mut debug_struct = f.debug_struct("BinLogCoordinates");
15572        debug_struct.field("bin_log_file_name", &self.bin_log_file_name);
15573        debug_struct.field("bin_log_position", &self.bin_log_position);
15574        debug_struct.field("kind", &self.kind);
15575        if !self._unknown_fields.is_empty() {
15576            debug_struct.field("_unknown_fields", &self._unknown_fields);
15577        }
15578        debug_struct.finish()
15579    }
15580}
15581
15582/// A Cloud SQL instance resource.
15583#[derive(Clone, Default, PartialEq)]
15584#[non_exhaustive]
15585pub struct DatabaseInstance {
15586    /// This is always `sql#instance`.
15587    pub kind: std::string::String,
15588
15589    /// The current serving state of the Cloud SQL instance.
15590    pub state: crate::model::database_instance::SqlInstanceState,
15591
15592    /// The database engine type and version. The `databaseVersion` field cannot
15593    /// be changed after instance creation.
15594    pub database_version: crate::model::SqlDatabaseVersion,
15595
15596    /// The user settings.
15597    pub settings: std::option::Option<crate::model::Settings>,
15598
15599    /// This field is deprecated and will be removed from a future version of the
15600    /// API. Use the `settings.settingsVersion` field instead.
15601    pub etag: std::string::String,
15602
15603    /// The name and status of the failover replica.
15604    pub failover_replica: std::option::Option<crate::model::database_instance::SqlFailoverReplica>,
15605
15606    /// The name of the instance which will act as primary in the replication
15607    /// setup.
15608    pub master_instance_name: std::string::String,
15609
15610    /// The replicas of the instance.
15611    pub replica_names: std::vec::Vec<std::string::String>,
15612
15613    /// The maximum disk size of the instance in bytes.
15614    #[deprecated]
15615    pub max_disk_size: std::option::Option<wkt::Int64Value>,
15616
15617    /// The current disk usage of the instance in bytes. This property has been
15618    /// deprecated. Use the
15619    /// "cloudsql.googleapis.com/database/disk/bytes_used" metric in Cloud
15620    /// Monitoring API instead. Please see [this
15621    /// announcement](https://groups.google.com/d/msg/google-cloud-sql-announce/I_7-F9EBhT0/BtvFtdFeAgAJ)
15622    /// for details.
15623    #[deprecated]
15624    pub current_disk_size: std::option::Option<wkt::Int64Value>,
15625
15626    /// The assigned IP addresses for the instance.
15627    pub ip_addresses: std::vec::Vec<crate::model::IpMapping>,
15628
15629    /// SSL configuration.
15630    pub server_ca_cert: std::option::Option<crate::model::SslCert>,
15631
15632    /// The instance type.
15633    pub instance_type: crate::model::SqlInstanceType,
15634
15635    /// The project ID of the project containing the Cloud SQL instance. The Google
15636    /// apps domain is prefixed if applicable.
15637    pub project: std::string::String,
15638
15639    /// The IPv6 address assigned to the instance.
15640    /// (Deprecated) This property was applicable only
15641    /// to First Generation instances.
15642    #[deprecated]
15643    pub ipv6_address: std::string::String,
15644
15645    /// The service account email address assigned to the instance.\This
15646    /// property is read-only.
15647    pub service_account_email_address: std::string::String,
15648
15649    /// Configuration specific to on-premises instances.
15650    pub on_premises_configuration: std::option::Option<crate::model::OnPremisesConfiguration>,
15651
15652    /// Configuration specific to failover replicas and read replicas.
15653    pub replica_configuration: std::option::Option<crate::model::ReplicaConfiguration>,
15654
15655    /// The backend type.
15656    /// `SECOND_GEN`: Cloud SQL database instance.
15657    /// `EXTERNAL`: A database server that is not managed by Google.
15658    ///
15659    /// This property is read-only; use the `tier` property in the `settings`
15660    /// object to determine the database type.
15661    pub backend_type: crate::model::SqlBackendType,
15662
15663    /// The URI of this resource.
15664    pub self_link: std::string::String,
15665
15666    /// If the instance state is SUSPENDED, the reason for the suspension.
15667    pub suspension_reason: std::vec::Vec<crate::model::SqlSuspensionReason>,
15668
15669    /// Connection name of the Cloud SQL instance used in connection strings.
15670    pub connection_name: std::string::String,
15671
15672    /// Name of the Cloud SQL instance. This does not include the project ID.
15673    pub name: std::string::String,
15674
15675    /// The geographical region of the Cloud SQL instance.
15676    ///
15677    /// It can be one of the
15678    /// [regions](https://cloud.google.com/sql/docs/mysql/locations#location-r)
15679    /// where Cloud SQL operates:
15680    ///
15681    /// For example,  `asia-east1`, `europe-west1`, and  `us-central1`.
15682    /// The default value is `us-central1`.
15683    pub region: std::string::String,
15684
15685    /// The Compute Engine zone that the instance is currently serving from. This
15686    /// value could be different from the zone that was specified when the instance
15687    /// was created if the instance has failed over to its secondary zone. WARNING:
15688    /// Changing this might restart the instance.
15689    pub gce_zone: std::string::String,
15690
15691    /// The Compute Engine zone that the failover instance is currently serving
15692    /// from for a regional instance. This value could be different
15693    /// from the zone that was specified when the instance
15694    /// was created if the instance has failed over to its secondary/failover zone.
15695    pub secondary_gce_zone: std::string::String,
15696
15697    /// Disk encryption configuration specific to an instance.
15698    pub disk_encryption_configuration:
15699        std::option::Option<crate::model::DiskEncryptionConfiguration>,
15700
15701    /// Disk encryption status specific to an instance.
15702    pub disk_encryption_status: std::option::Option<crate::model::DiskEncryptionStatus>,
15703
15704    /// Initial root password. Use only on creation. You must set root passwords
15705    /// before you can connect to PostgreSQL instances.
15706    pub root_password: std::string::String,
15707
15708    /// The start time of any upcoming scheduled maintenance for this instance.
15709    pub scheduled_maintenance:
15710        std::option::Option<crate::model::database_instance::SqlScheduledMaintenance>,
15711
15712    /// This status indicates whether the instance satisfies PZS.
15713    ///
15714    /// The status is reserved for future use.
15715    pub satisfies_pzs: std::option::Option<wkt::BoolValue>,
15716
15717    /// Output only. Stores the current database version running on the instance
15718    /// including minor version such as `MYSQL_8_0_18`.
15719    pub database_installed_version: std::string::String,
15720
15721    /// This field represents the report generated by the proactive database
15722    /// wellness job for OutOfDisk issues.
15723    ///
15724    /// * Writers:
15725    /// * the proactive database wellness job for OOD.
15726    /// * Readers:
15727    /// * the proactive database wellness job
15728    pub out_of_disk_report:
15729        std::option::Option<crate::model::database_instance::SqlOutOfDiskReport>,
15730
15731    /// Output only. The time when the instance was created in
15732    /// [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example
15733    /// `2012-11-15T16:19:00.094Z`.
15734    pub create_time: std::option::Option<wkt::Timestamp>,
15735
15736    /// Output only. List all maintenance versions applicable on the instance
15737    pub available_maintenance_versions: std::vec::Vec<std::string::String>,
15738
15739    /// The current software version on the instance.
15740    pub maintenance_version: std::string::String,
15741
15742    /// Output only. All database versions that are available for upgrade.
15743    pub upgradable_database_versions: std::vec::Vec<crate::model::AvailableDatabaseVersion>,
15744
15745    pub sql_network_architecture:
15746        std::option::Option<crate::model::database_instance::SqlNetworkArchitecture>,
15747
15748    /// Output only. The link to service attachment of PSC instance.
15749    pub psc_service_attachment_link: std::option::Option<std::string::String>,
15750
15751    /// Output only. The dns name of the instance.
15752    pub dns_name: std::option::Option<std::string::String>,
15753
15754    /// Output only. DEPRECATED: please use write_endpoint instead.
15755    #[deprecated]
15756    pub primary_dns_name: std::option::Option<std::string::String>,
15757
15758    /// Output only. The dns name of the primary instance in a replication group.
15759    pub write_endpoint: std::option::Option<std::string::String>,
15760
15761    /// Optional. A primary instance and disaster recovery (DR) replica pair.
15762    /// A DR replica is a cross-region replica that you designate
15763    /// for failover in the event that the primary instance
15764    /// experiences regional failure. Only applicable to MySQL.
15765    pub replication_cluster: std::option::Option<crate::model::ReplicationCluster>,
15766
15767    /// Gemini instance configuration.
15768    pub gemini_config: std::option::Option<crate::model::GeminiInstanceConfig>,
15769
15770    /// Output only. This status indicates whether the instance satisfies PZI.
15771    ///
15772    /// The status is reserved for future use.
15773    pub satisfies_pzi: std::option::Option<wkt::BoolValue>,
15774
15775    /// Input only. Whether Cloud SQL is enabled to switch storing point-in-time
15776    /// recovery log files from a data disk to Cloud Storage.
15777    pub switch_transaction_logs_to_cloud_storage_enabled: std::option::Option<wkt::BoolValue>,
15778
15779    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15780}
15781
15782impl DatabaseInstance {
15783    pub fn new() -> Self {
15784        std::default::Default::default()
15785    }
15786
15787    /// Sets the value of [kind][crate::model::DatabaseInstance::kind].
15788    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15789        self.kind = v.into();
15790        self
15791    }
15792
15793    /// Sets the value of [state][crate::model::DatabaseInstance::state].
15794    pub fn set_state<T: std::convert::Into<crate::model::database_instance::SqlInstanceState>>(
15795        mut self,
15796        v: T,
15797    ) -> Self {
15798        self.state = v.into();
15799        self
15800    }
15801
15802    /// Sets the value of [database_version][crate::model::DatabaseInstance::database_version].
15803    pub fn set_database_version<T: std::convert::Into<crate::model::SqlDatabaseVersion>>(
15804        mut self,
15805        v: T,
15806    ) -> Self {
15807        self.database_version = v.into();
15808        self
15809    }
15810
15811    /// Sets the value of [settings][crate::model::DatabaseInstance::settings].
15812    pub fn set_settings<T>(mut self, v: T) -> Self
15813    where
15814        T: std::convert::Into<crate::model::Settings>,
15815    {
15816        self.settings = std::option::Option::Some(v.into());
15817        self
15818    }
15819
15820    /// Sets or clears the value of [settings][crate::model::DatabaseInstance::settings].
15821    pub fn set_or_clear_settings<T>(mut self, v: std::option::Option<T>) -> Self
15822    where
15823        T: std::convert::Into<crate::model::Settings>,
15824    {
15825        self.settings = v.map(|x| x.into());
15826        self
15827    }
15828
15829    /// Sets the value of [etag][crate::model::DatabaseInstance::etag].
15830    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15831        self.etag = v.into();
15832        self
15833    }
15834
15835    /// Sets the value of [failover_replica][crate::model::DatabaseInstance::failover_replica].
15836    pub fn set_failover_replica<T>(mut self, v: T) -> Self
15837    where
15838        T: std::convert::Into<crate::model::database_instance::SqlFailoverReplica>,
15839    {
15840        self.failover_replica = std::option::Option::Some(v.into());
15841        self
15842    }
15843
15844    /// Sets or clears the value of [failover_replica][crate::model::DatabaseInstance::failover_replica].
15845    pub fn set_or_clear_failover_replica<T>(mut self, v: std::option::Option<T>) -> Self
15846    where
15847        T: std::convert::Into<crate::model::database_instance::SqlFailoverReplica>,
15848    {
15849        self.failover_replica = v.map(|x| x.into());
15850        self
15851    }
15852
15853    /// Sets the value of [master_instance_name][crate::model::DatabaseInstance::master_instance_name].
15854    pub fn set_master_instance_name<T: std::convert::Into<std::string::String>>(
15855        mut self,
15856        v: T,
15857    ) -> Self {
15858        self.master_instance_name = v.into();
15859        self
15860    }
15861
15862    /// Sets the value of [replica_names][crate::model::DatabaseInstance::replica_names].
15863    pub fn set_replica_names<T, V>(mut self, v: T) -> Self
15864    where
15865        T: std::iter::IntoIterator<Item = V>,
15866        V: std::convert::Into<std::string::String>,
15867    {
15868        use std::iter::Iterator;
15869        self.replica_names = v.into_iter().map(|i| i.into()).collect();
15870        self
15871    }
15872
15873    /// Sets the value of [max_disk_size][crate::model::DatabaseInstance::max_disk_size].
15874    #[deprecated]
15875    pub fn set_max_disk_size<T>(mut self, v: T) -> Self
15876    where
15877        T: std::convert::Into<wkt::Int64Value>,
15878    {
15879        self.max_disk_size = std::option::Option::Some(v.into());
15880        self
15881    }
15882
15883    /// Sets or clears the value of [max_disk_size][crate::model::DatabaseInstance::max_disk_size].
15884    #[deprecated]
15885    pub fn set_or_clear_max_disk_size<T>(mut self, v: std::option::Option<T>) -> Self
15886    where
15887        T: std::convert::Into<wkt::Int64Value>,
15888    {
15889        self.max_disk_size = v.map(|x| x.into());
15890        self
15891    }
15892
15893    /// Sets the value of [current_disk_size][crate::model::DatabaseInstance::current_disk_size].
15894    #[deprecated]
15895    pub fn set_current_disk_size<T>(mut self, v: T) -> Self
15896    where
15897        T: std::convert::Into<wkt::Int64Value>,
15898    {
15899        self.current_disk_size = std::option::Option::Some(v.into());
15900        self
15901    }
15902
15903    /// Sets or clears the value of [current_disk_size][crate::model::DatabaseInstance::current_disk_size].
15904    #[deprecated]
15905    pub fn set_or_clear_current_disk_size<T>(mut self, v: std::option::Option<T>) -> Self
15906    where
15907        T: std::convert::Into<wkt::Int64Value>,
15908    {
15909        self.current_disk_size = v.map(|x| x.into());
15910        self
15911    }
15912
15913    /// Sets the value of [ip_addresses][crate::model::DatabaseInstance::ip_addresses].
15914    pub fn set_ip_addresses<T, V>(mut self, v: T) -> Self
15915    where
15916        T: std::iter::IntoIterator<Item = V>,
15917        V: std::convert::Into<crate::model::IpMapping>,
15918    {
15919        use std::iter::Iterator;
15920        self.ip_addresses = v.into_iter().map(|i| i.into()).collect();
15921        self
15922    }
15923
15924    /// Sets the value of [server_ca_cert][crate::model::DatabaseInstance::server_ca_cert].
15925    pub fn set_server_ca_cert<T>(mut self, v: T) -> Self
15926    where
15927        T: std::convert::Into<crate::model::SslCert>,
15928    {
15929        self.server_ca_cert = std::option::Option::Some(v.into());
15930        self
15931    }
15932
15933    /// Sets or clears the value of [server_ca_cert][crate::model::DatabaseInstance::server_ca_cert].
15934    pub fn set_or_clear_server_ca_cert<T>(mut self, v: std::option::Option<T>) -> Self
15935    where
15936        T: std::convert::Into<crate::model::SslCert>,
15937    {
15938        self.server_ca_cert = v.map(|x| x.into());
15939        self
15940    }
15941
15942    /// Sets the value of [instance_type][crate::model::DatabaseInstance::instance_type].
15943    pub fn set_instance_type<T: std::convert::Into<crate::model::SqlInstanceType>>(
15944        mut self,
15945        v: T,
15946    ) -> Self {
15947        self.instance_type = v.into();
15948        self
15949    }
15950
15951    /// Sets the value of [project][crate::model::DatabaseInstance::project].
15952    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15953        self.project = v.into();
15954        self
15955    }
15956
15957    /// Sets the value of [ipv6_address][crate::model::DatabaseInstance::ipv6_address].
15958    #[deprecated]
15959    pub fn set_ipv6_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15960        self.ipv6_address = v.into();
15961        self
15962    }
15963
15964    /// Sets the value of [service_account_email_address][crate::model::DatabaseInstance::service_account_email_address].
15965    pub fn set_service_account_email_address<T: std::convert::Into<std::string::String>>(
15966        mut self,
15967        v: T,
15968    ) -> Self {
15969        self.service_account_email_address = v.into();
15970        self
15971    }
15972
15973    /// Sets the value of [on_premises_configuration][crate::model::DatabaseInstance::on_premises_configuration].
15974    pub fn set_on_premises_configuration<T>(mut self, v: T) -> Self
15975    where
15976        T: std::convert::Into<crate::model::OnPremisesConfiguration>,
15977    {
15978        self.on_premises_configuration = std::option::Option::Some(v.into());
15979        self
15980    }
15981
15982    /// Sets or clears the value of [on_premises_configuration][crate::model::DatabaseInstance::on_premises_configuration].
15983    pub fn set_or_clear_on_premises_configuration<T>(mut self, v: std::option::Option<T>) -> Self
15984    where
15985        T: std::convert::Into<crate::model::OnPremisesConfiguration>,
15986    {
15987        self.on_premises_configuration = v.map(|x| x.into());
15988        self
15989    }
15990
15991    /// Sets the value of [replica_configuration][crate::model::DatabaseInstance::replica_configuration].
15992    pub fn set_replica_configuration<T>(mut self, v: T) -> Self
15993    where
15994        T: std::convert::Into<crate::model::ReplicaConfiguration>,
15995    {
15996        self.replica_configuration = std::option::Option::Some(v.into());
15997        self
15998    }
15999
16000    /// Sets or clears the value of [replica_configuration][crate::model::DatabaseInstance::replica_configuration].
16001    pub fn set_or_clear_replica_configuration<T>(mut self, v: std::option::Option<T>) -> Self
16002    where
16003        T: std::convert::Into<crate::model::ReplicaConfiguration>,
16004    {
16005        self.replica_configuration = v.map(|x| x.into());
16006        self
16007    }
16008
16009    /// Sets the value of [backend_type][crate::model::DatabaseInstance::backend_type].
16010    pub fn set_backend_type<T: std::convert::Into<crate::model::SqlBackendType>>(
16011        mut self,
16012        v: T,
16013    ) -> Self {
16014        self.backend_type = v.into();
16015        self
16016    }
16017
16018    /// Sets the value of [self_link][crate::model::DatabaseInstance::self_link].
16019    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16020        self.self_link = v.into();
16021        self
16022    }
16023
16024    /// Sets the value of [suspension_reason][crate::model::DatabaseInstance::suspension_reason].
16025    pub fn set_suspension_reason<T, V>(mut self, v: T) -> Self
16026    where
16027        T: std::iter::IntoIterator<Item = V>,
16028        V: std::convert::Into<crate::model::SqlSuspensionReason>,
16029    {
16030        use std::iter::Iterator;
16031        self.suspension_reason = v.into_iter().map(|i| i.into()).collect();
16032        self
16033    }
16034
16035    /// Sets the value of [connection_name][crate::model::DatabaseInstance::connection_name].
16036    pub fn set_connection_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16037        self.connection_name = v.into();
16038        self
16039    }
16040
16041    /// Sets the value of [name][crate::model::DatabaseInstance::name].
16042    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16043        self.name = v.into();
16044        self
16045    }
16046
16047    /// Sets the value of [region][crate::model::DatabaseInstance::region].
16048    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16049        self.region = v.into();
16050        self
16051    }
16052
16053    /// Sets the value of [gce_zone][crate::model::DatabaseInstance::gce_zone].
16054    pub fn set_gce_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16055        self.gce_zone = v.into();
16056        self
16057    }
16058
16059    /// Sets the value of [secondary_gce_zone][crate::model::DatabaseInstance::secondary_gce_zone].
16060    pub fn set_secondary_gce_zone<T: std::convert::Into<std::string::String>>(
16061        mut self,
16062        v: T,
16063    ) -> Self {
16064        self.secondary_gce_zone = v.into();
16065        self
16066    }
16067
16068    /// Sets the value of [disk_encryption_configuration][crate::model::DatabaseInstance::disk_encryption_configuration].
16069    pub fn set_disk_encryption_configuration<T>(mut self, v: T) -> Self
16070    where
16071        T: std::convert::Into<crate::model::DiskEncryptionConfiguration>,
16072    {
16073        self.disk_encryption_configuration = std::option::Option::Some(v.into());
16074        self
16075    }
16076
16077    /// Sets or clears the value of [disk_encryption_configuration][crate::model::DatabaseInstance::disk_encryption_configuration].
16078    pub fn set_or_clear_disk_encryption_configuration<T>(
16079        mut self,
16080        v: std::option::Option<T>,
16081    ) -> Self
16082    where
16083        T: std::convert::Into<crate::model::DiskEncryptionConfiguration>,
16084    {
16085        self.disk_encryption_configuration = v.map(|x| x.into());
16086        self
16087    }
16088
16089    /// Sets the value of [disk_encryption_status][crate::model::DatabaseInstance::disk_encryption_status].
16090    pub fn set_disk_encryption_status<T>(mut self, v: T) -> Self
16091    where
16092        T: std::convert::Into<crate::model::DiskEncryptionStatus>,
16093    {
16094        self.disk_encryption_status = std::option::Option::Some(v.into());
16095        self
16096    }
16097
16098    /// Sets or clears the value of [disk_encryption_status][crate::model::DatabaseInstance::disk_encryption_status].
16099    pub fn set_or_clear_disk_encryption_status<T>(mut self, v: std::option::Option<T>) -> Self
16100    where
16101        T: std::convert::Into<crate::model::DiskEncryptionStatus>,
16102    {
16103        self.disk_encryption_status = v.map(|x| x.into());
16104        self
16105    }
16106
16107    /// Sets the value of [root_password][crate::model::DatabaseInstance::root_password].
16108    pub fn set_root_password<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16109        self.root_password = v.into();
16110        self
16111    }
16112
16113    /// Sets the value of [scheduled_maintenance][crate::model::DatabaseInstance::scheduled_maintenance].
16114    pub fn set_scheduled_maintenance<T>(mut self, v: T) -> Self
16115    where
16116        T: std::convert::Into<crate::model::database_instance::SqlScheduledMaintenance>,
16117    {
16118        self.scheduled_maintenance = std::option::Option::Some(v.into());
16119        self
16120    }
16121
16122    /// Sets or clears the value of [scheduled_maintenance][crate::model::DatabaseInstance::scheduled_maintenance].
16123    pub fn set_or_clear_scheduled_maintenance<T>(mut self, v: std::option::Option<T>) -> Self
16124    where
16125        T: std::convert::Into<crate::model::database_instance::SqlScheduledMaintenance>,
16126    {
16127        self.scheduled_maintenance = v.map(|x| x.into());
16128        self
16129    }
16130
16131    /// Sets the value of [satisfies_pzs][crate::model::DatabaseInstance::satisfies_pzs].
16132    pub fn set_satisfies_pzs<T>(mut self, v: T) -> Self
16133    where
16134        T: std::convert::Into<wkt::BoolValue>,
16135    {
16136        self.satisfies_pzs = std::option::Option::Some(v.into());
16137        self
16138    }
16139
16140    /// Sets or clears the value of [satisfies_pzs][crate::model::DatabaseInstance::satisfies_pzs].
16141    pub fn set_or_clear_satisfies_pzs<T>(mut self, v: std::option::Option<T>) -> Self
16142    where
16143        T: std::convert::Into<wkt::BoolValue>,
16144    {
16145        self.satisfies_pzs = v.map(|x| x.into());
16146        self
16147    }
16148
16149    /// Sets the value of [database_installed_version][crate::model::DatabaseInstance::database_installed_version].
16150    pub fn set_database_installed_version<T: std::convert::Into<std::string::String>>(
16151        mut self,
16152        v: T,
16153    ) -> Self {
16154        self.database_installed_version = v.into();
16155        self
16156    }
16157
16158    /// Sets the value of [out_of_disk_report][crate::model::DatabaseInstance::out_of_disk_report].
16159    pub fn set_out_of_disk_report<T>(mut self, v: T) -> Self
16160    where
16161        T: std::convert::Into<crate::model::database_instance::SqlOutOfDiskReport>,
16162    {
16163        self.out_of_disk_report = std::option::Option::Some(v.into());
16164        self
16165    }
16166
16167    /// Sets or clears the value of [out_of_disk_report][crate::model::DatabaseInstance::out_of_disk_report].
16168    pub fn set_or_clear_out_of_disk_report<T>(mut self, v: std::option::Option<T>) -> Self
16169    where
16170        T: std::convert::Into<crate::model::database_instance::SqlOutOfDiskReport>,
16171    {
16172        self.out_of_disk_report = v.map(|x| x.into());
16173        self
16174    }
16175
16176    /// Sets the value of [create_time][crate::model::DatabaseInstance::create_time].
16177    pub fn set_create_time<T>(mut self, v: T) -> Self
16178    where
16179        T: std::convert::Into<wkt::Timestamp>,
16180    {
16181        self.create_time = std::option::Option::Some(v.into());
16182        self
16183    }
16184
16185    /// Sets or clears the value of [create_time][crate::model::DatabaseInstance::create_time].
16186    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
16187    where
16188        T: std::convert::Into<wkt::Timestamp>,
16189    {
16190        self.create_time = v.map(|x| x.into());
16191        self
16192    }
16193
16194    /// Sets the value of [available_maintenance_versions][crate::model::DatabaseInstance::available_maintenance_versions].
16195    pub fn set_available_maintenance_versions<T, V>(mut self, v: T) -> Self
16196    where
16197        T: std::iter::IntoIterator<Item = V>,
16198        V: std::convert::Into<std::string::String>,
16199    {
16200        use std::iter::Iterator;
16201        self.available_maintenance_versions = v.into_iter().map(|i| i.into()).collect();
16202        self
16203    }
16204
16205    /// Sets the value of [maintenance_version][crate::model::DatabaseInstance::maintenance_version].
16206    pub fn set_maintenance_version<T: std::convert::Into<std::string::String>>(
16207        mut self,
16208        v: T,
16209    ) -> Self {
16210        self.maintenance_version = v.into();
16211        self
16212    }
16213
16214    /// Sets the value of [upgradable_database_versions][crate::model::DatabaseInstance::upgradable_database_versions].
16215    pub fn set_upgradable_database_versions<T, V>(mut self, v: T) -> Self
16216    where
16217        T: std::iter::IntoIterator<Item = V>,
16218        V: std::convert::Into<crate::model::AvailableDatabaseVersion>,
16219    {
16220        use std::iter::Iterator;
16221        self.upgradable_database_versions = v.into_iter().map(|i| i.into()).collect();
16222        self
16223    }
16224
16225    /// Sets the value of [sql_network_architecture][crate::model::DatabaseInstance::sql_network_architecture].
16226    pub fn set_sql_network_architecture<T>(mut self, v: T) -> Self
16227    where
16228        T: std::convert::Into<crate::model::database_instance::SqlNetworkArchitecture>,
16229    {
16230        self.sql_network_architecture = std::option::Option::Some(v.into());
16231        self
16232    }
16233
16234    /// Sets or clears the value of [sql_network_architecture][crate::model::DatabaseInstance::sql_network_architecture].
16235    pub fn set_or_clear_sql_network_architecture<T>(mut self, v: std::option::Option<T>) -> Self
16236    where
16237        T: std::convert::Into<crate::model::database_instance::SqlNetworkArchitecture>,
16238    {
16239        self.sql_network_architecture = v.map(|x| x.into());
16240        self
16241    }
16242
16243    /// Sets the value of [psc_service_attachment_link][crate::model::DatabaseInstance::psc_service_attachment_link].
16244    pub fn set_psc_service_attachment_link<T>(mut self, v: T) -> Self
16245    where
16246        T: std::convert::Into<std::string::String>,
16247    {
16248        self.psc_service_attachment_link = std::option::Option::Some(v.into());
16249        self
16250    }
16251
16252    /// Sets or clears the value of [psc_service_attachment_link][crate::model::DatabaseInstance::psc_service_attachment_link].
16253    pub fn set_or_clear_psc_service_attachment_link<T>(mut self, v: std::option::Option<T>) -> Self
16254    where
16255        T: std::convert::Into<std::string::String>,
16256    {
16257        self.psc_service_attachment_link = v.map(|x| x.into());
16258        self
16259    }
16260
16261    /// Sets the value of [dns_name][crate::model::DatabaseInstance::dns_name].
16262    pub fn set_dns_name<T>(mut self, v: T) -> Self
16263    where
16264        T: std::convert::Into<std::string::String>,
16265    {
16266        self.dns_name = std::option::Option::Some(v.into());
16267        self
16268    }
16269
16270    /// Sets or clears the value of [dns_name][crate::model::DatabaseInstance::dns_name].
16271    pub fn set_or_clear_dns_name<T>(mut self, v: std::option::Option<T>) -> Self
16272    where
16273        T: std::convert::Into<std::string::String>,
16274    {
16275        self.dns_name = v.map(|x| x.into());
16276        self
16277    }
16278
16279    /// Sets the value of [primary_dns_name][crate::model::DatabaseInstance::primary_dns_name].
16280    #[deprecated]
16281    pub fn set_primary_dns_name<T>(mut self, v: T) -> Self
16282    where
16283        T: std::convert::Into<std::string::String>,
16284    {
16285        self.primary_dns_name = std::option::Option::Some(v.into());
16286        self
16287    }
16288
16289    /// Sets or clears the value of [primary_dns_name][crate::model::DatabaseInstance::primary_dns_name].
16290    #[deprecated]
16291    pub fn set_or_clear_primary_dns_name<T>(mut self, v: std::option::Option<T>) -> Self
16292    where
16293        T: std::convert::Into<std::string::String>,
16294    {
16295        self.primary_dns_name = v.map(|x| x.into());
16296        self
16297    }
16298
16299    /// Sets the value of [write_endpoint][crate::model::DatabaseInstance::write_endpoint].
16300    pub fn set_write_endpoint<T>(mut self, v: T) -> Self
16301    where
16302        T: std::convert::Into<std::string::String>,
16303    {
16304        self.write_endpoint = std::option::Option::Some(v.into());
16305        self
16306    }
16307
16308    /// Sets or clears the value of [write_endpoint][crate::model::DatabaseInstance::write_endpoint].
16309    pub fn set_or_clear_write_endpoint<T>(mut self, v: std::option::Option<T>) -> Self
16310    where
16311        T: std::convert::Into<std::string::String>,
16312    {
16313        self.write_endpoint = v.map(|x| x.into());
16314        self
16315    }
16316
16317    /// Sets the value of [replication_cluster][crate::model::DatabaseInstance::replication_cluster].
16318    pub fn set_replication_cluster<T>(mut self, v: T) -> Self
16319    where
16320        T: std::convert::Into<crate::model::ReplicationCluster>,
16321    {
16322        self.replication_cluster = std::option::Option::Some(v.into());
16323        self
16324    }
16325
16326    /// Sets or clears the value of [replication_cluster][crate::model::DatabaseInstance::replication_cluster].
16327    pub fn set_or_clear_replication_cluster<T>(mut self, v: std::option::Option<T>) -> Self
16328    where
16329        T: std::convert::Into<crate::model::ReplicationCluster>,
16330    {
16331        self.replication_cluster = v.map(|x| x.into());
16332        self
16333    }
16334
16335    /// Sets the value of [gemini_config][crate::model::DatabaseInstance::gemini_config].
16336    pub fn set_gemini_config<T>(mut self, v: T) -> Self
16337    where
16338        T: std::convert::Into<crate::model::GeminiInstanceConfig>,
16339    {
16340        self.gemini_config = std::option::Option::Some(v.into());
16341        self
16342    }
16343
16344    /// Sets or clears the value of [gemini_config][crate::model::DatabaseInstance::gemini_config].
16345    pub fn set_or_clear_gemini_config<T>(mut self, v: std::option::Option<T>) -> Self
16346    where
16347        T: std::convert::Into<crate::model::GeminiInstanceConfig>,
16348    {
16349        self.gemini_config = v.map(|x| x.into());
16350        self
16351    }
16352
16353    /// Sets the value of [satisfies_pzi][crate::model::DatabaseInstance::satisfies_pzi].
16354    pub fn set_satisfies_pzi<T>(mut self, v: T) -> Self
16355    where
16356        T: std::convert::Into<wkt::BoolValue>,
16357    {
16358        self.satisfies_pzi = std::option::Option::Some(v.into());
16359        self
16360    }
16361
16362    /// Sets or clears the value of [satisfies_pzi][crate::model::DatabaseInstance::satisfies_pzi].
16363    pub fn set_or_clear_satisfies_pzi<T>(mut self, v: std::option::Option<T>) -> Self
16364    where
16365        T: std::convert::Into<wkt::BoolValue>,
16366    {
16367        self.satisfies_pzi = v.map(|x| x.into());
16368        self
16369    }
16370
16371    /// Sets the value of [switch_transaction_logs_to_cloud_storage_enabled][crate::model::DatabaseInstance::switch_transaction_logs_to_cloud_storage_enabled].
16372    pub fn set_switch_transaction_logs_to_cloud_storage_enabled<T>(mut self, v: T) -> Self
16373    where
16374        T: std::convert::Into<wkt::BoolValue>,
16375    {
16376        self.switch_transaction_logs_to_cloud_storage_enabled = std::option::Option::Some(v.into());
16377        self
16378    }
16379
16380    /// Sets or clears the value of [switch_transaction_logs_to_cloud_storage_enabled][crate::model::DatabaseInstance::switch_transaction_logs_to_cloud_storage_enabled].
16381    pub fn set_or_clear_switch_transaction_logs_to_cloud_storage_enabled<T>(
16382        mut self,
16383        v: std::option::Option<T>,
16384    ) -> Self
16385    where
16386        T: std::convert::Into<wkt::BoolValue>,
16387    {
16388        self.switch_transaction_logs_to_cloud_storage_enabled = v.map(|x| x.into());
16389        self
16390    }
16391}
16392
16393impl wkt::message::Message for DatabaseInstance {
16394    fn typename() -> &'static str {
16395        "type.googleapis.com/google.cloud.sql.v1.DatabaseInstance"
16396    }
16397}
16398
16399#[doc(hidden)]
16400impl<'de> serde::de::Deserialize<'de> for DatabaseInstance {
16401    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16402    where
16403        D: serde::Deserializer<'de>,
16404    {
16405        #[allow(non_camel_case_types)]
16406        #[doc(hidden)]
16407        #[derive(PartialEq, Eq, Hash)]
16408        enum __FieldTag {
16409            __kind,
16410            __state,
16411            __database_version,
16412            __settings,
16413            __etag,
16414            __failover_replica,
16415            __master_instance_name,
16416            __replica_names,
16417            __max_disk_size,
16418            __current_disk_size,
16419            __ip_addresses,
16420            __server_ca_cert,
16421            __instance_type,
16422            __project,
16423            __ipv6_address,
16424            __service_account_email_address,
16425            __on_premises_configuration,
16426            __replica_configuration,
16427            __backend_type,
16428            __self_link,
16429            __suspension_reason,
16430            __connection_name,
16431            __name,
16432            __region,
16433            __gce_zone,
16434            __secondary_gce_zone,
16435            __disk_encryption_configuration,
16436            __disk_encryption_status,
16437            __root_password,
16438            __scheduled_maintenance,
16439            __satisfies_pzs,
16440            __database_installed_version,
16441            __out_of_disk_report,
16442            __create_time,
16443            __available_maintenance_versions,
16444            __maintenance_version,
16445            __upgradable_database_versions,
16446            __sql_network_architecture,
16447            __psc_service_attachment_link,
16448            __dns_name,
16449            __primary_dns_name,
16450            __write_endpoint,
16451            __replication_cluster,
16452            __gemini_config,
16453            __satisfies_pzi,
16454            __switch_transaction_logs_to_cloud_storage_enabled,
16455            Unknown(std::string::String),
16456        }
16457        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16458            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16459            where
16460                D: serde::Deserializer<'de>,
16461            {
16462                struct Visitor;
16463                impl<'de> serde::de::Visitor<'de> for Visitor {
16464                    type Value = __FieldTag;
16465                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16466                        formatter.write_str("a field name for DatabaseInstance")
16467                    }
16468                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16469                    where
16470                        E: serde::de::Error,
16471                    {
16472                        use std::result::Result::Ok;
16473                        use std::string::ToString;
16474                        match value {
16475                            "kind" => Ok(__FieldTag::__kind),
16476                            "state" => Ok(__FieldTag::__state),
16477                            "databaseVersion" => Ok(__FieldTag::__database_version),
16478                            "database_version" => Ok(__FieldTag::__database_version),
16479                            "settings" => Ok(__FieldTag::__settings),
16480                            "etag" => Ok(__FieldTag::__etag),
16481                            "failoverReplica" => Ok(__FieldTag::__failover_replica),
16482                            "failover_replica" => Ok(__FieldTag::__failover_replica),
16483                            "masterInstanceName" => Ok(__FieldTag::__master_instance_name),
16484                            "master_instance_name" => Ok(__FieldTag::__master_instance_name),
16485                            "replicaNames" => Ok(__FieldTag::__replica_names),
16486                            "replica_names" => Ok(__FieldTag::__replica_names),
16487                            "maxDiskSize" => Ok(__FieldTag::__max_disk_size),
16488                            "max_disk_size" => Ok(__FieldTag::__max_disk_size),
16489                            "currentDiskSize" => Ok(__FieldTag::__current_disk_size),
16490                            "current_disk_size" => Ok(__FieldTag::__current_disk_size),
16491                            "ipAddresses" => Ok(__FieldTag::__ip_addresses),
16492                            "ip_addresses" => Ok(__FieldTag::__ip_addresses),
16493                            "serverCaCert" => Ok(__FieldTag::__server_ca_cert),
16494                            "server_ca_cert" => Ok(__FieldTag::__server_ca_cert),
16495                            "instanceType" => Ok(__FieldTag::__instance_type),
16496                            "instance_type" => Ok(__FieldTag::__instance_type),
16497                            "project" => Ok(__FieldTag::__project),
16498                            "ipv6Address" => Ok(__FieldTag::__ipv6_address),
16499                            "ipv6_address" => Ok(__FieldTag::__ipv6_address),
16500                            "serviceAccountEmailAddress" => {
16501                                Ok(__FieldTag::__service_account_email_address)
16502                            }
16503                            "service_account_email_address" => {
16504                                Ok(__FieldTag::__service_account_email_address)
16505                            }
16506                            "onPremisesConfiguration" => {
16507                                Ok(__FieldTag::__on_premises_configuration)
16508                            }
16509                            "on_premises_configuration" => {
16510                                Ok(__FieldTag::__on_premises_configuration)
16511                            }
16512                            "replicaConfiguration" => Ok(__FieldTag::__replica_configuration),
16513                            "replica_configuration" => Ok(__FieldTag::__replica_configuration),
16514                            "backendType" => Ok(__FieldTag::__backend_type),
16515                            "backend_type" => Ok(__FieldTag::__backend_type),
16516                            "selfLink" => Ok(__FieldTag::__self_link),
16517                            "self_link" => Ok(__FieldTag::__self_link),
16518                            "suspensionReason" => Ok(__FieldTag::__suspension_reason),
16519                            "suspension_reason" => Ok(__FieldTag::__suspension_reason),
16520                            "connectionName" => Ok(__FieldTag::__connection_name),
16521                            "connection_name" => Ok(__FieldTag::__connection_name),
16522                            "name" => Ok(__FieldTag::__name),
16523                            "region" => Ok(__FieldTag::__region),
16524                            "gceZone" => Ok(__FieldTag::__gce_zone),
16525                            "gce_zone" => Ok(__FieldTag::__gce_zone),
16526                            "secondaryGceZone" => Ok(__FieldTag::__secondary_gce_zone),
16527                            "secondary_gce_zone" => Ok(__FieldTag::__secondary_gce_zone),
16528                            "diskEncryptionConfiguration" => {
16529                                Ok(__FieldTag::__disk_encryption_configuration)
16530                            }
16531                            "disk_encryption_configuration" => {
16532                                Ok(__FieldTag::__disk_encryption_configuration)
16533                            }
16534                            "diskEncryptionStatus" => Ok(__FieldTag::__disk_encryption_status),
16535                            "disk_encryption_status" => Ok(__FieldTag::__disk_encryption_status),
16536                            "rootPassword" => Ok(__FieldTag::__root_password),
16537                            "root_password" => Ok(__FieldTag::__root_password),
16538                            "scheduledMaintenance" => Ok(__FieldTag::__scheduled_maintenance),
16539                            "scheduled_maintenance" => Ok(__FieldTag::__scheduled_maintenance),
16540                            "satisfiesPzs" => Ok(__FieldTag::__satisfies_pzs),
16541                            "satisfies_pzs" => Ok(__FieldTag::__satisfies_pzs),
16542                            "databaseInstalledVersion" => {
16543                                Ok(__FieldTag::__database_installed_version)
16544                            }
16545                            "database_installed_version" => {
16546                                Ok(__FieldTag::__database_installed_version)
16547                            }
16548                            "outOfDiskReport" => Ok(__FieldTag::__out_of_disk_report),
16549                            "out_of_disk_report" => Ok(__FieldTag::__out_of_disk_report),
16550                            "createTime" => Ok(__FieldTag::__create_time),
16551                            "create_time" => Ok(__FieldTag::__create_time),
16552                            "availableMaintenanceVersions" => {
16553                                Ok(__FieldTag::__available_maintenance_versions)
16554                            }
16555                            "available_maintenance_versions" => {
16556                                Ok(__FieldTag::__available_maintenance_versions)
16557                            }
16558                            "maintenanceVersion" => Ok(__FieldTag::__maintenance_version),
16559                            "maintenance_version" => Ok(__FieldTag::__maintenance_version),
16560                            "upgradableDatabaseVersions" => {
16561                                Ok(__FieldTag::__upgradable_database_versions)
16562                            }
16563                            "upgradable_database_versions" => {
16564                                Ok(__FieldTag::__upgradable_database_versions)
16565                            }
16566                            "sqlNetworkArchitecture" => Ok(__FieldTag::__sql_network_architecture),
16567                            "sql_network_architecture" => {
16568                                Ok(__FieldTag::__sql_network_architecture)
16569                            }
16570                            "pscServiceAttachmentLink" => {
16571                                Ok(__FieldTag::__psc_service_attachment_link)
16572                            }
16573                            "psc_service_attachment_link" => {
16574                                Ok(__FieldTag::__psc_service_attachment_link)
16575                            }
16576                            "dnsName" => Ok(__FieldTag::__dns_name),
16577                            "dns_name" => Ok(__FieldTag::__dns_name),
16578                            "primaryDnsName" => Ok(__FieldTag::__primary_dns_name),
16579                            "primary_dns_name" => Ok(__FieldTag::__primary_dns_name),
16580                            "writeEndpoint" => Ok(__FieldTag::__write_endpoint),
16581                            "write_endpoint" => Ok(__FieldTag::__write_endpoint),
16582                            "replicationCluster" => Ok(__FieldTag::__replication_cluster),
16583                            "replication_cluster" => Ok(__FieldTag::__replication_cluster),
16584                            "geminiConfig" => Ok(__FieldTag::__gemini_config),
16585                            "gemini_config" => Ok(__FieldTag::__gemini_config),
16586                            "satisfiesPzi" => Ok(__FieldTag::__satisfies_pzi),
16587                            "satisfies_pzi" => Ok(__FieldTag::__satisfies_pzi),
16588                            "switchTransactionLogsToCloudStorageEnabled" => {
16589                                Ok(__FieldTag::__switch_transaction_logs_to_cloud_storage_enabled)
16590                            }
16591                            "switch_transaction_logs_to_cloud_storage_enabled" => {
16592                                Ok(__FieldTag::__switch_transaction_logs_to_cloud_storage_enabled)
16593                            }
16594                            _ => Ok(__FieldTag::Unknown(value.to_string())),
16595                        }
16596                    }
16597                }
16598                deserializer.deserialize_identifier(Visitor)
16599            }
16600        }
16601        struct Visitor;
16602        impl<'de> serde::de::Visitor<'de> for Visitor {
16603            type Value = DatabaseInstance;
16604            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16605                formatter.write_str("struct DatabaseInstance")
16606            }
16607            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16608            where
16609                A: serde::de::MapAccess<'de>,
16610            {
16611                #[allow(unused_imports)]
16612                use serde::de::Error;
16613                use std::option::Option::Some;
16614                let mut fields = std::collections::HashSet::new();
16615                let mut result = Self::Value::new();
16616                while let Some(tag) = map.next_key::<__FieldTag>()? {
16617                    #[allow(clippy::match_single_binding)]
16618                    match tag {
16619                        __FieldTag::__kind => {
16620                            if !fields.insert(__FieldTag::__kind) {
16621                                return std::result::Result::Err(A::Error::duplicate_field(
16622                                    "multiple values for kind",
16623                                ));
16624                            }
16625                            result.kind = map
16626                                .next_value::<std::option::Option<std::string::String>>()?
16627                                .unwrap_or_default();
16628                        }
16629                        __FieldTag::__state => {
16630                            if !fields.insert(__FieldTag::__state) {
16631                                return std::result::Result::Err(A::Error::duplicate_field(
16632                                    "multiple values for state",
16633                                ));
16634                            }
16635                            result.state = map
16636                                .next_value::<std::option::Option<
16637                                    crate::model::database_instance::SqlInstanceState,
16638                                >>()?
16639                                .unwrap_or_default();
16640                        }
16641                        __FieldTag::__database_version => {
16642                            if !fields.insert(__FieldTag::__database_version) {
16643                                return std::result::Result::Err(A::Error::duplicate_field(
16644                                    "multiple values for database_version",
16645                                ));
16646                            }
16647                            result.database_version = map.next_value::<std::option::Option<crate::model::SqlDatabaseVersion>>()?.unwrap_or_default();
16648                        }
16649                        __FieldTag::__settings => {
16650                            if !fields.insert(__FieldTag::__settings) {
16651                                return std::result::Result::Err(A::Error::duplicate_field(
16652                                    "multiple values for settings",
16653                                ));
16654                            }
16655                            result.settings =
16656                                map.next_value::<std::option::Option<crate::model::Settings>>()?;
16657                        }
16658                        __FieldTag::__etag => {
16659                            if !fields.insert(__FieldTag::__etag) {
16660                                return std::result::Result::Err(A::Error::duplicate_field(
16661                                    "multiple values for etag",
16662                                ));
16663                            }
16664                            result.etag = map
16665                                .next_value::<std::option::Option<std::string::String>>()?
16666                                .unwrap_or_default();
16667                        }
16668                        __FieldTag::__failover_replica => {
16669                            if !fields.insert(__FieldTag::__failover_replica) {
16670                                return std::result::Result::Err(A::Error::duplicate_field(
16671                                    "multiple values for failover_replica",
16672                                ));
16673                            }
16674                            result.failover_replica = map.next_value::<std::option::Option<
16675                                crate::model::database_instance::SqlFailoverReplica,
16676                            >>()?;
16677                        }
16678                        __FieldTag::__master_instance_name => {
16679                            if !fields.insert(__FieldTag::__master_instance_name) {
16680                                return std::result::Result::Err(A::Error::duplicate_field(
16681                                    "multiple values for master_instance_name",
16682                                ));
16683                            }
16684                            result.master_instance_name = map
16685                                .next_value::<std::option::Option<std::string::String>>()?
16686                                .unwrap_or_default();
16687                        }
16688                        __FieldTag::__replica_names => {
16689                            if !fields.insert(__FieldTag::__replica_names) {
16690                                return std::result::Result::Err(A::Error::duplicate_field(
16691                                    "multiple values for replica_names",
16692                                ));
16693                            }
16694                            result.replica_names = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
16695                        }
16696                        __FieldTag::__max_disk_size => {
16697                            if !fields.insert(__FieldTag::__max_disk_size) {
16698                                return std::result::Result::Err(A::Error::duplicate_field(
16699                                    "multiple values for max_disk_size",
16700                                ));
16701                            }
16702                            struct __With(std::option::Option<wkt::Int64Value>);
16703                            impl<'de> serde::de::Deserialize<'de> for __With {
16704                                fn deserialize<D>(
16705                                    deserializer: D,
16706                                ) -> std::result::Result<Self, D::Error>
16707                                where
16708                                    D: serde::de::Deserializer<'de>,
16709                                {
16710                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
16711                                }
16712                            }
16713                            result.max_disk_size = map.next_value::<__With>()?.0;
16714                        }
16715                        __FieldTag::__current_disk_size => {
16716                            if !fields.insert(__FieldTag::__current_disk_size) {
16717                                return std::result::Result::Err(A::Error::duplicate_field(
16718                                    "multiple values for current_disk_size",
16719                                ));
16720                            }
16721                            struct __With(std::option::Option<wkt::Int64Value>);
16722                            impl<'de> serde::de::Deserialize<'de> for __With {
16723                                fn deserialize<D>(
16724                                    deserializer: D,
16725                                ) -> std::result::Result<Self, D::Error>
16726                                where
16727                                    D: serde::de::Deserializer<'de>,
16728                                {
16729                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
16730                                }
16731                            }
16732                            result.current_disk_size = map.next_value::<__With>()?.0;
16733                        }
16734                        __FieldTag::__ip_addresses => {
16735                            if !fields.insert(__FieldTag::__ip_addresses) {
16736                                return std::result::Result::Err(A::Error::duplicate_field(
16737                                    "multiple values for ip_addresses",
16738                                ));
16739                            }
16740                            result.ip_addresses = map.next_value::<std::option::Option<std::vec::Vec<crate::model::IpMapping>>>()?.unwrap_or_default();
16741                        }
16742                        __FieldTag::__server_ca_cert => {
16743                            if !fields.insert(__FieldTag::__server_ca_cert) {
16744                                return std::result::Result::Err(A::Error::duplicate_field(
16745                                    "multiple values for server_ca_cert",
16746                                ));
16747                            }
16748                            result.server_ca_cert =
16749                                map.next_value::<std::option::Option<crate::model::SslCert>>()?;
16750                        }
16751                        __FieldTag::__instance_type => {
16752                            if !fields.insert(__FieldTag::__instance_type) {
16753                                return std::result::Result::Err(A::Error::duplicate_field(
16754                                    "multiple values for instance_type",
16755                                ));
16756                            }
16757                            result.instance_type = map
16758                                .next_value::<std::option::Option<crate::model::SqlInstanceType>>()?
16759                                .unwrap_or_default();
16760                        }
16761                        __FieldTag::__project => {
16762                            if !fields.insert(__FieldTag::__project) {
16763                                return std::result::Result::Err(A::Error::duplicate_field(
16764                                    "multiple values for project",
16765                                ));
16766                            }
16767                            result.project = map
16768                                .next_value::<std::option::Option<std::string::String>>()?
16769                                .unwrap_or_default();
16770                        }
16771                        __FieldTag::__ipv6_address => {
16772                            if !fields.insert(__FieldTag::__ipv6_address) {
16773                                return std::result::Result::Err(A::Error::duplicate_field(
16774                                    "multiple values for ipv6_address",
16775                                ));
16776                            }
16777                            result.ipv6_address = map
16778                                .next_value::<std::option::Option<std::string::String>>()?
16779                                .unwrap_or_default();
16780                        }
16781                        __FieldTag::__service_account_email_address => {
16782                            if !fields.insert(__FieldTag::__service_account_email_address) {
16783                                return std::result::Result::Err(A::Error::duplicate_field(
16784                                    "multiple values for service_account_email_address",
16785                                ));
16786                            }
16787                            result.service_account_email_address = map
16788                                .next_value::<std::option::Option<std::string::String>>()?
16789                                .unwrap_or_default();
16790                        }
16791                        __FieldTag::__on_premises_configuration => {
16792                            if !fields.insert(__FieldTag::__on_premises_configuration) {
16793                                return std::result::Result::Err(A::Error::duplicate_field(
16794                                    "multiple values for on_premises_configuration",
16795                                ));
16796                            }
16797                            result.on_premises_configuration = map.next_value::<std::option::Option<crate::model::OnPremisesConfiguration>>()?
16798                                ;
16799                        }
16800                        __FieldTag::__replica_configuration => {
16801                            if !fields.insert(__FieldTag::__replica_configuration) {
16802                                return std::result::Result::Err(A::Error::duplicate_field(
16803                                    "multiple values for replica_configuration",
16804                                ));
16805                            }
16806                            result.replica_configuration = map.next_value::<std::option::Option<crate::model::ReplicaConfiguration>>()?
16807                                ;
16808                        }
16809                        __FieldTag::__backend_type => {
16810                            if !fields.insert(__FieldTag::__backend_type) {
16811                                return std::result::Result::Err(A::Error::duplicate_field(
16812                                    "multiple values for backend_type",
16813                                ));
16814                            }
16815                            result.backend_type = map
16816                                .next_value::<std::option::Option<crate::model::SqlBackendType>>()?
16817                                .unwrap_or_default();
16818                        }
16819                        __FieldTag::__self_link => {
16820                            if !fields.insert(__FieldTag::__self_link) {
16821                                return std::result::Result::Err(A::Error::duplicate_field(
16822                                    "multiple values for self_link",
16823                                ));
16824                            }
16825                            result.self_link = map
16826                                .next_value::<std::option::Option<std::string::String>>()?
16827                                .unwrap_or_default();
16828                        }
16829                        __FieldTag::__suspension_reason => {
16830                            if !fields.insert(__FieldTag::__suspension_reason) {
16831                                return std::result::Result::Err(A::Error::duplicate_field(
16832                                    "multiple values for suspension_reason",
16833                                ));
16834                            }
16835                            result.suspension_reason = map
16836                                .next_value::<std::option::Option<
16837                                    std::vec::Vec<crate::model::SqlSuspensionReason>,
16838                                >>()?
16839                                .unwrap_or_default();
16840                        }
16841                        __FieldTag::__connection_name => {
16842                            if !fields.insert(__FieldTag::__connection_name) {
16843                                return std::result::Result::Err(A::Error::duplicate_field(
16844                                    "multiple values for connection_name",
16845                                ));
16846                            }
16847                            result.connection_name = map
16848                                .next_value::<std::option::Option<std::string::String>>()?
16849                                .unwrap_or_default();
16850                        }
16851                        __FieldTag::__name => {
16852                            if !fields.insert(__FieldTag::__name) {
16853                                return std::result::Result::Err(A::Error::duplicate_field(
16854                                    "multiple values for name",
16855                                ));
16856                            }
16857                            result.name = map
16858                                .next_value::<std::option::Option<std::string::String>>()?
16859                                .unwrap_or_default();
16860                        }
16861                        __FieldTag::__region => {
16862                            if !fields.insert(__FieldTag::__region) {
16863                                return std::result::Result::Err(A::Error::duplicate_field(
16864                                    "multiple values for region",
16865                                ));
16866                            }
16867                            result.region = map
16868                                .next_value::<std::option::Option<std::string::String>>()?
16869                                .unwrap_or_default();
16870                        }
16871                        __FieldTag::__gce_zone => {
16872                            if !fields.insert(__FieldTag::__gce_zone) {
16873                                return std::result::Result::Err(A::Error::duplicate_field(
16874                                    "multiple values for gce_zone",
16875                                ));
16876                            }
16877                            result.gce_zone = map
16878                                .next_value::<std::option::Option<std::string::String>>()?
16879                                .unwrap_or_default();
16880                        }
16881                        __FieldTag::__secondary_gce_zone => {
16882                            if !fields.insert(__FieldTag::__secondary_gce_zone) {
16883                                return std::result::Result::Err(A::Error::duplicate_field(
16884                                    "multiple values for secondary_gce_zone",
16885                                ));
16886                            }
16887                            result.secondary_gce_zone = map
16888                                .next_value::<std::option::Option<std::string::String>>()?
16889                                .unwrap_or_default();
16890                        }
16891                        __FieldTag::__disk_encryption_configuration => {
16892                            if !fields.insert(__FieldTag::__disk_encryption_configuration) {
16893                                return std::result::Result::Err(A::Error::duplicate_field(
16894                                    "multiple values for disk_encryption_configuration",
16895                                ));
16896                            }
16897                            result.disk_encryption_configuration = map.next_value::<std::option::Option<crate::model::DiskEncryptionConfiguration>>()?
16898                                ;
16899                        }
16900                        __FieldTag::__disk_encryption_status => {
16901                            if !fields.insert(__FieldTag::__disk_encryption_status) {
16902                                return std::result::Result::Err(A::Error::duplicate_field(
16903                                    "multiple values for disk_encryption_status",
16904                                ));
16905                            }
16906                            result.disk_encryption_status = map.next_value::<std::option::Option<crate::model::DiskEncryptionStatus>>()?
16907                                ;
16908                        }
16909                        __FieldTag::__root_password => {
16910                            if !fields.insert(__FieldTag::__root_password) {
16911                                return std::result::Result::Err(A::Error::duplicate_field(
16912                                    "multiple values for root_password",
16913                                ));
16914                            }
16915                            result.root_password = map
16916                                .next_value::<std::option::Option<std::string::String>>()?
16917                                .unwrap_or_default();
16918                        }
16919                        __FieldTag::__scheduled_maintenance => {
16920                            if !fields.insert(__FieldTag::__scheduled_maintenance) {
16921                                return std::result::Result::Err(A::Error::duplicate_field(
16922                                    "multiple values for scheduled_maintenance",
16923                                ));
16924                            }
16925                            result.scheduled_maintenance = map.next_value::<std::option::Option<
16926                                crate::model::database_instance::SqlScheduledMaintenance,
16927                            >>()?;
16928                        }
16929                        __FieldTag::__satisfies_pzs => {
16930                            if !fields.insert(__FieldTag::__satisfies_pzs) {
16931                                return std::result::Result::Err(A::Error::duplicate_field(
16932                                    "multiple values for satisfies_pzs",
16933                                ));
16934                            }
16935                            result.satisfies_pzs =
16936                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
16937                        }
16938                        __FieldTag::__database_installed_version => {
16939                            if !fields.insert(__FieldTag::__database_installed_version) {
16940                                return std::result::Result::Err(A::Error::duplicate_field(
16941                                    "multiple values for database_installed_version",
16942                                ));
16943                            }
16944                            result.database_installed_version = map
16945                                .next_value::<std::option::Option<std::string::String>>()?
16946                                .unwrap_or_default();
16947                        }
16948                        __FieldTag::__out_of_disk_report => {
16949                            if !fields.insert(__FieldTag::__out_of_disk_report) {
16950                                return std::result::Result::Err(A::Error::duplicate_field(
16951                                    "multiple values for out_of_disk_report",
16952                                ));
16953                            }
16954                            result.out_of_disk_report = map.next_value::<std::option::Option<
16955                                crate::model::database_instance::SqlOutOfDiskReport,
16956                            >>()?;
16957                        }
16958                        __FieldTag::__create_time => {
16959                            if !fields.insert(__FieldTag::__create_time) {
16960                                return std::result::Result::Err(A::Error::duplicate_field(
16961                                    "multiple values for create_time",
16962                                ));
16963                            }
16964                            result.create_time =
16965                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
16966                        }
16967                        __FieldTag::__available_maintenance_versions => {
16968                            if !fields.insert(__FieldTag::__available_maintenance_versions) {
16969                                return std::result::Result::Err(A::Error::duplicate_field(
16970                                    "multiple values for available_maintenance_versions",
16971                                ));
16972                            }
16973                            result.available_maintenance_versions = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
16974                        }
16975                        __FieldTag::__maintenance_version => {
16976                            if !fields.insert(__FieldTag::__maintenance_version) {
16977                                return std::result::Result::Err(A::Error::duplicate_field(
16978                                    "multiple values for maintenance_version",
16979                                ));
16980                            }
16981                            result.maintenance_version = map
16982                                .next_value::<std::option::Option<std::string::String>>()?
16983                                .unwrap_or_default();
16984                        }
16985                        __FieldTag::__upgradable_database_versions => {
16986                            if !fields.insert(__FieldTag::__upgradable_database_versions) {
16987                                return std::result::Result::Err(A::Error::duplicate_field(
16988                                    "multiple values for upgradable_database_versions",
16989                                ));
16990                            }
16991                            result.upgradable_database_versions = map
16992                                .next_value::<std::option::Option<
16993                                    std::vec::Vec<crate::model::AvailableDatabaseVersion>,
16994                                >>()?
16995                                .unwrap_or_default();
16996                        }
16997                        __FieldTag::__sql_network_architecture => {
16998                            if !fields.insert(__FieldTag::__sql_network_architecture) {
16999                                return std::result::Result::Err(A::Error::duplicate_field(
17000                                    "multiple values for sql_network_architecture",
17001                                ));
17002                            }
17003                            result.sql_network_architecture = map
17004                                .next_value::<std::option::Option<
17005                                    crate::model::database_instance::SqlNetworkArchitecture,
17006                                >>()?;
17007                        }
17008                        __FieldTag::__psc_service_attachment_link => {
17009                            if !fields.insert(__FieldTag::__psc_service_attachment_link) {
17010                                return std::result::Result::Err(A::Error::duplicate_field(
17011                                    "multiple values for psc_service_attachment_link",
17012                                ));
17013                            }
17014                            result.psc_service_attachment_link =
17015                                map.next_value::<std::option::Option<std::string::String>>()?;
17016                        }
17017                        __FieldTag::__dns_name => {
17018                            if !fields.insert(__FieldTag::__dns_name) {
17019                                return std::result::Result::Err(A::Error::duplicate_field(
17020                                    "multiple values for dns_name",
17021                                ));
17022                            }
17023                            result.dns_name =
17024                                map.next_value::<std::option::Option<std::string::String>>()?;
17025                        }
17026                        __FieldTag::__primary_dns_name => {
17027                            if !fields.insert(__FieldTag::__primary_dns_name) {
17028                                return std::result::Result::Err(A::Error::duplicate_field(
17029                                    "multiple values for primary_dns_name",
17030                                ));
17031                            }
17032                            result.primary_dns_name =
17033                                map.next_value::<std::option::Option<std::string::String>>()?;
17034                        }
17035                        __FieldTag::__write_endpoint => {
17036                            if !fields.insert(__FieldTag::__write_endpoint) {
17037                                return std::result::Result::Err(A::Error::duplicate_field(
17038                                    "multiple values for write_endpoint",
17039                                ));
17040                            }
17041                            result.write_endpoint =
17042                                map.next_value::<std::option::Option<std::string::String>>()?;
17043                        }
17044                        __FieldTag::__replication_cluster => {
17045                            if !fields.insert(__FieldTag::__replication_cluster) {
17046                                return std::result::Result::Err(A::Error::duplicate_field(
17047                                    "multiple values for replication_cluster",
17048                                ));
17049                            }
17050                            result.replication_cluster = map.next_value::<std::option::Option<crate::model::ReplicationCluster>>()?
17051                                ;
17052                        }
17053                        __FieldTag::__gemini_config => {
17054                            if !fields.insert(__FieldTag::__gemini_config) {
17055                                return std::result::Result::Err(A::Error::duplicate_field(
17056                                    "multiple values for gemini_config",
17057                                ));
17058                            }
17059                            result.gemini_config = map.next_value::<std::option::Option<crate::model::GeminiInstanceConfig>>()?
17060                                ;
17061                        }
17062                        __FieldTag::__satisfies_pzi => {
17063                            if !fields.insert(__FieldTag::__satisfies_pzi) {
17064                                return std::result::Result::Err(A::Error::duplicate_field(
17065                                    "multiple values for satisfies_pzi",
17066                                ));
17067                            }
17068                            result.satisfies_pzi =
17069                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
17070                        }
17071                        __FieldTag::__switch_transaction_logs_to_cloud_storage_enabled => {
17072                            if !fields.insert(
17073                                __FieldTag::__switch_transaction_logs_to_cloud_storage_enabled,
17074                            ) {
17075                                return std::result::Result::Err(A::Error::duplicate_field(
17076                                    "multiple values for switch_transaction_logs_to_cloud_storage_enabled",
17077                                ));
17078                            }
17079                            result.switch_transaction_logs_to_cloud_storage_enabled =
17080                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
17081                        }
17082                        __FieldTag::Unknown(key) => {
17083                            let value = map.next_value::<serde_json::Value>()?;
17084                            result._unknown_fields.insert(key, value);
17085                        }
17086                    }
17087                }
17088                std::result::Result::Ok(result)
17089            }
17090        }
17091        deserializer.deserialize_any(Visitor)
17092    }
17093}
17094
17095#[doc(hidden)]
17096impl serde::ser::Serialize for DatabaseInstance {
17097    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17098    where
17099        S: serde::ser::Serializer,
17100    {
17101        use serde::ser::SerializeMap;
17102        #[allow(unused_imports)]
17103        use std::option::Option::Some;
17104        let mut state = serializer.serialize_map(std::option::Option::None)?;
17105        if !self.kind.is_empty() {
17106            state.serialize_entry("kind", &self.kind)?;
17107        }
17108        if !wkt::internal::is_default(&self.state) {
17109            state.serialize_entry("state", &self.state)?;
17110        }
17111        if !wkt::internal::is_default(&self.database_version) {
17112            state.serialize_entry("databaseVersion", &self.database_version)?;
17113        }
17114        if self.settings.is_some() {
17115            state.serialize_entry("settings", &self.settings)?;
17116        }
17117        if !self.etag.is_empty() {
17118            state.serialize_entry("etag", &self.etag)?;
17119        }
17120        if self.failover_replica.is_some() {
17121            state.serialize_entry("failoverReplica", &self.failover_replica)?;
17122        }
17123        if !self.master_instance_name.is_empty() {
17124            state.serialize_entry("masterInstanceName", &self.master_instance_name)?;
17125        }
17126        if !self.replica_names.is_empty() {
17127            state.serialize_entry("replicaNames", &self.replica_names)?;
17128        }
17129        if self.max_disk_size.is_some() {
17130            struct __With<'a>(&'a std::option::Option<wkt::Int64Value>);
17131            impl<'a> serde::ser::Serialize for __With<'a> {
17132                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17133                where
17134                    S: serde::ser::Serializer,
17135                {
17136                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
17137                        self.0, serializer,
17138                    )
17139                }
17140            }
17141            state.serialize_entry("maxDiskSize", &__With(&self.max_disk_size))?;
17142        }
17143        if self.current_disk_size.is_some() {
17144            struct __With<'a>(&'a std::option::Option<wkt::Int64Value>);
17145            impl<'a> serde::ser::Serialize for __With<'a> {
17146                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17147                where
17148                    S: serde::ser::Serializer,
17149                {
17150                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
17151                        self.0, serializer,
17152                    )
17153                }
17154            }
17155            state.serialize_entry("currentDiskSize", &__With(&self.current_disk_size))?;
17156        }
17157        if !self.ip_addresses.is_empty() {
17158            state.serialize_entry("ipAddresses", &self.ip_addresses)?;
17159        }
17160        if self.server_ca_cert.is_some() {
17161            state.serialize_entry("serverCaCert", &self.server_ca_cert)?;
17162        }
17163        if !wkt::internal::is_default(&self.instance_type) {
17164            state.serialize_entry("instanceType", &self.instance_type)?;
17165        }
17166        if !self.project.is_empty() {
17167            state.serialize_entry("project", &self.project)?;
17168        }
17169        if !self.ipv6_address.is_empty() {
17170            state.serialize_entry("ipv6Address", &self.ipv6_address)?;
17171        }
17172        if !self.service_account_email_address.is_empty() {
17173            state.serialize_entry(
17174                "serviceAccountEmailAddress",
17175                &self.service_account_email_address,
17176            )?;
17177        }
17178        if self.on_premises_configuration.is_some() {
17179            state.serialize_entry("onPremisesConfiguration", &self.on_premises_configuration)?;
17180        }
17181        if self.replica_configuration.is_some() {
17182            state.serialize_entry("replicaConfiguration", &self.replica_configuration)?;
17183        }
17184        if !wkt::internal::is_default(&self.backend_type) {
17185            state.serialize_entry("backendType", &self.backend_type)?;
17186        }
17187        if !self.self_link.is_empty() {
17188            state.serialize_entry("selfLink", &self.self_link)?;
17189        }
17190        if !self.suspension_reason.is_empty() {
17191            state.serialize_entry("suspensionReason", &self.suspension_reason)?;
17192        }
17193        if !self.connection_name.is_empty() {
17194            state.serialize_entry("connectionName", &self.connection_name)?;
17195        }
17196        if !self.name.is_empty() {
17197            state.serialize_entry("name", &self.name)?;
17198        }
17199        if !self.region.is_empty() {
17200            state.serialize_entry("region", &self.region)?;
17201        }
17202        if !self.gce_zone.is_empty() {
17203            state.serialize_entry("gceZone", &self.gce_zone)?;
17204        }
17205        if !self.secondary_gce_zone.is_empty() {
17206            state.serialize_entry("secondaryGceZone", &self.secondary_gce_zone)?;
17207        }
17208        if self.disk_encryption_configuration.is_some() {
17209            state.serialize_entry(
17210                "diskEncryptionConfiguration",
17211                &self.disk_encryption_configuration,
17212            )?;
17213        }
17214        if self.disk_encryption_status.is_some() {
17215            state.serialize_entry("diskEncryptionStatus", &self.disk_encryption_status)?;
17216        }
17217        if !self.root_password.is_empty() {
17218            state.serialize_entry("rootPassword", &self.root_password)?;
17219        }
17220        if self.scheduled_maintenance.is_some() {
17221            state.serialize_entry("scheduledMaintenance", &self.scheduled_maintenance)?;
17222        }
17223        if self.satisfies_pzs.is_some() {
17224            state.serialize_entry("satisfiesPzs", &self.satisfies_pzs)?;
17225        }
17226        if !self.database_installed_version.is_empty() {
17227            state.serialize_entry("databaseInstalledVersion", &self.database_installed_version)?;
17228        }
17229        if self.out_of_disk_report.is_some() {
17230            state.serialize_entry("outOfDiskReport", &self.out_of_disk_report)?;
17231        }
17232        if self.create_time.is_some() {
17233            state.serialize_entry("createTime", &self.create_time)?;
17234        }
17235        if !self.available_maintenance_versions.is_empty() {
17236            state.serialize_entry(
17237                "availableMaintenanceVersions",
17238                &self.available_maintenance_versions,
17239            )?;
17240        }
17241        if !self.maintenance_version.is_empty() {
17242            state.serialize_entry("maintenanceVersion", &self.maintenance_version)?;
17243        }
17244        if !self.upgradable_database_versions.is_empty() {
17245            state.serialize_entry(
17246                "upgradableDatabaseVersions",
17247                &self.upgradable_database_versions,
17248            )?;
17249        }
17250        if self.sql_network_architecture.is_some() {
17251            state.serialize_entry("sqlNetworkArchitecture", &self.sql_network_architecture)?;
17252        }
17253        if self.psc_service_attachment_link.is_some() {
17254            state.serialize_entry(
17255                "pscServiceAttachmentLink",
17256                &self.psc_service_attachment_link,
17257            )?;
17258        }
17259        if self.dns_name.is_some() {
17260            state.serialize_entry("dnsName", &self.dns_name)?;
17261        }
17262        if self.primary_dns_name.is_some() {
17263            state.serialize_entry("primaryDnsName", &self.primary_dns_name)?;
17264        }
17265        if self.write_endpoint.is_some() {
17266            state.serialize_entry("writeEndpoint", &self.write_endpoint)?;
17267        }
17268        if self.replication_cluster.is_some() {
17269            state.serialize_entry("replicationCluster", &self.replication_cluster)?;
17270        }
17271        if self.gemini_config.is_some() {
17272            state.serialize_entry("geminiConfig", &self.gemini_config)?;
17273        }
17274        if self.satisfies_pzi.is_some() {
17275            state.serialize_entry("satisfiesPzi", &self.satisfies_pzi)?;
17276        }
17277        if self
17278            .switch_transaction_logs_to_cloud_storage_enabled
17279            .is_some()
17280        {
17281            state.serialize_entry(
17282                "switchTransactionLogsToCloudStorageEnabled",
17283                &self.switch_transaction_logs_to_cloud_storage_enabled,
17284            )?;
17285        }
17286        if !self._unknown_fields.is_empty() {
17287            for (key, value) in self._unknown_fields.iter() {
17288                state.serialize_entry(key, &value)?;
17289            }
17290        }
17291        state.end()
17292    }
17293}
17294
17295impl std::fmt::Debug for DatabaseInstance {
17296    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17297        let mut debug_struct = f.debug_struct("DatabaseInstance");
17298        debug_struct.field("kind", &self.kind);
17299        debug_struct.field("state", &self.state);
17300        debug_struct.field("database_version", &self.database_version);
17301        debug_struct.field("settings", &self.settings);
17302        debug_struct.field("etag", &self.etag);
17303        debug_struct.field("failover_replica", &self.failover_replica);
17304        debug_struct.field("master_instance_name", &self.master_instance_name);
17305        debug_struct.field("replica_names", &self.replica_names);
17306        debug_struct.field("max_disk_size", &self.max_disk_size);
17307        debug_struct.field("current_disk_size", &self.current_disk_size);
17308        debug_struct.field("ip_addresses", &self.ip_addresses);
17309        debug_struct.field("server_ca_cert", &self.server_ca_cert);
17310        debug_struct.field("instance_type", &self.instance_type);
17311        debug_struct.field("project", &self.project);
17312        debug_struct.field("ipv6_address", &self.ipv6_address);
17313        debug_struct.field(
17314            "service_account_email_address",
17315            &self.service_account_email_address,
17316        );
17317        debug_struct.field("on_premises_configuration", &self.on_premises_configuration);
17318        debug_struct.field("replica_configuration", &self.replica_configuration);
17319        debug_struct.field("backend_type", &self.backend_type);
17320        debug_struct.field("self_link", &self.self_link);
17321        debug_struct.field("suspension_reason", &self.suspension_reason);
17322        debug_struct.field("connection_name", &self.connection_name);
17323        debug_struct.field("name", &self.name);
17324        debug_struct.field("region", &self.region);
17325        debug_struct.field("gce_zone", &self.gce_zone);
17326        debug_struct.field("secondary_gce_zone", &self.secondary_gce_zone);
17327        debug_struct.field(
17328            "disk_encryption_configuration",
17329            &self.disk_encryption_configuration,
17330        );
17331        debug_struct.field("disk_encryption_status", &self.disk_encryption_status);
17332        debug_struct.field("root_password", &self.root_password);
17333        debug_struct.field("scheduled_maintenance", &self.scheduled_maintenance);
17334        debug_struct.field("satisfies_pzs", &self.satisfies_pzs);
17335        debug_struct.field(
17336            "database_installed_version",
17337            &self.database_installed_version,
17338        );
17339        debug_struct.field("out_of_disk_report", &self.out_of_disk_report);
17340        debug_struct.field("create_time", &self.create_time);
17341        debug_struct.field(
17342            "available_maintenance_versions",
17343            &self.available_maintenance_versions,
17344        );
17345        debug_struct.field("maintenance_version", &self.maintenance_version);
17346        debug_struct.field(
17347            "upgradable_database_versions",
17348            &self.upgradable_database_versions,
17349        );
17350        debug_struct.field("sql_network_architecture", &self.sql_network_architecture);
17351        debug_struct.field(
17352            "psc_service_attachment_link",
17353            &self.psc_service_attachment_link,
17354        );
17355        debug_struct.field("dns_name", &self.dns_name);
17356        debug_struct.field("primary_dns_name", &self.primary_dns_name);
17357        debug_struct.field("write_endpoint", &self.write_endpoint);
17358        debug_struct.field("replication_cluster", &self.replication_cluster);
17359        debug_struct.field("gemini_config", &self.gemini_config);
17360        debug_struct.field("satisfies_pzi", &self.satisfies_pzi);
17361        debug_struct.field(
17362            "switch_transaction_logs_to_cloud_storage_enabled",
17363            &self.switch_transaction_logs_to_cloud_storage_enabled,
17364        );
17365        if !self._unknown_fields.is_empty() {
17366            debug_struct.field("_unknown_fields", &self._unknown_fields);
17367        }
17368        debug_struct.finish()
17369    }
17370}
17371
17372/// Defines additional types related to [DatabaseInstance].
17373pub mod database_instance {
17374    #[allow(unused_imports)]
17375    use super::*;
17376
17377    #[derive(Clone, Default, PartialEq)]
17378    #[non_exhaustive]
17379    pub struct SqlFailoverReplica {
17380        /// The name of the failover replica. If specified at instance creation, a
17381        /// failover replica is created for the instance. The name
17382        /// doesn't include the project ID.
17383        pub name: std::string::String,
17384
17385        /// The availability status of the failover replica. A false status indicates
17386        /// that the failover replica is out of sync. The primary instance can only
17387        /// failover to the failover replica when the status is true.
17388        pub available: std::option::Option<wkt::BoolValue>,
17389
17390        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17391    }
17392
17393    impl SqlFailoverReplica {
17394        pub fn new() -> Self {
17395            std::default::Default::default()
17396        }
17397
17398        /// Sets the value of [name][crate::model::database_instance::SqlFailoverReplica::name].
17399        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17400            self.name = v.into();
17401            self
17402        }
17403
17404        /// Sets the value of [available][crate::model::database_instance::SqlFailoverReplica::available].
17405        pub fn set_available<T>(mut self, v: T) -> Self
17406        where
17407            T: std::convert::Into<wkt::BoolValue>,
17408        {
17409            self.available = std::option::Option::Some(v.into());
17410            self
17411        }
17412
17413        /// Sets or clears the value of [available][crate::model::database_instance::SqlFailoverReplica::available].
17414        pub fn set_or_clear_available<T>(mut self, v: std::option::Option<T>) -> Self
17415        where
17416            T: std::convert::Into<wkt::BoolValue>,
17417        {
17418            self.available = v.map(|x| x.into());
17419            self
17420        }
17421    }
17422
17423    impl wkt::message::Message for SqlFailoverReplica {
17424        fn typename() -> &'static str {
17425            "type.googleapis.com/google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica"
17426        }
17427    }
17428
17429    #[doc(hidden)]
17430    impl<'de> serde::de::Deserialize<'de> for SqlFailoverReplica {
17431        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17432        where
17433            D: serde::Deserializer<'de>,
17434        {
17435            #[allow(non_camel_case_types)]
17436            #[doc(hidden)]
17437            #[derive(PartialEq, Eq, Hash)]
17438            enum __FieldTag {
17439                __name,
17440                __available,
17441                Unknown(std::string::String),
17442            }
17443            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17444                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17445                where
17446                    D: serde::Deserializer<'de>,
17447                {
17448                    struct Visitor;
17449                    impl<'de> serde::de::Visitor<'de> for Visitor {
17450                        type Value = __FieldTag;
17451                        fn expecting(
17452                            &self,
17453                            formatter: &mut std::fmt::Formatter,
17454                        ) -> std::fmt::Result {
17455                            formatter.write_str("a field name for SqlFailoverReplica")
17456                        }
17457                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17458                        where
17459                            E: serde::de::Error,
17460                        {
17461                            use std::result::Result::Ok;
17462                            use std::string::ToString;
17463                            match value {
17464                                "name" => Ok(__FieldTag::__name),
17465                                "available" => Ok(__FieldTag::__available),
17466                                _ => Ok(__FieldTag::Unknown(value.to_string())),
17467                            }
17468                        }
17469                    }
17470                    deserializer.deserialize_identifier(Visitor)
17471                }
17472            }
17473            struct Visitor;
17474            impl<'de> serde::de::Visitor<'de> for Visitor {
17475                type Value = SqlFailoverReplica;
17476                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17477                    formatter.write_str("struct SqlFailoverReplica")
17478                }
17479                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17480                where
17481                    A: serde::de::MapAccess<'de>,
17482                {
17483                    #[allow(unused_imports)]
17484                    use serde::de::Error;
17485                    use std::option::Option::Some;
17486                    let mut fields = std::collections::HashSet::new();
17487                    let mut result = Self::Value::new();
17488                    while let Some(tag) = map.next_key::<__FieldTag>()? {
17489                        #[allow(clippy::match_single_binding)]
17490                        match tag {
17491                            __FieldTag::__name => {
17492                                if !fields.insert(__FieldTag::__name) {
17493                                    return std::result::Result::Err(A::Error::duplicate_field(
17494                                        "multiple values for name",
17495                                    ));
17496                                }
17497                                result.name = map
17498                                    .next_value::<std::option::Option<std::string::String>>()?
17499                                    .unwrap_or_default();
17500                            }
17501                            __FieldTag::__available => {
17502                                if !fields.insert(__FieldTag::__available) {
17503                                    return std::result::Result::Err(A::Error::duplicate_field(
17504                                        "multiple values for available",
17505                                    ));
17506                                }
17507                                result.available =
17508                                    map.next_value::<std::option::Option<wkt::BoolValue>>()?;
17509                            }
17510                            __FieldTag::Unknown(key) => {
17511                                let value = map.next_value::<serde_json::Value>()?;
17512                                result._unknown_fields.insert(key, value);
17513                            }
17514                        }
17515                    }
17516                    std::result::Result::Ok(result)
17517                }
17518            }
17519            deserializer.deserialize_any(Visitor)
17520        }
17521    }
17522
17523    #[doc(hidden)]
17524    impl serde::ser::Serialize for SqlFailoverReplica {
17525        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17526        where
17527            S: serde::ser::Serializer,
17528        {
17529            use serde::ser::SerializeMap;
17530            #[allow(unused_imports)]
17531            use std::option::Option::Some;
17532            let mut state = serializer.serialize_map(std::option::Option::None)?;
17533            if !self.name.is_empty() {
17534                state.serialize_entry("name", &self.name)?;
17535            }
17536            if self.available.is_some() {
17537                state.serialize_entry("available", &self.available)?;
17538            }
17539            if !self._unknown_fields.is_empty() {
17540                for (key, value) in self._unknown_fields.iter() {
17541                    state.serialize_entry(key, &value)?;
17542                }
17543            }
17544            state.end()
17545        }
17546    }
17547
17548    impl std::fmt::Debug for SqlFailoverReplica {
17549        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17550            let mut debug_struct = f.debug_struct("SqlFailoverReplica");
17551            debug_struct.field("name", &self.name);
17552            debug_struct.field("available", &self.available);
17553            if !self._unknown_fields.is_empty() {
17554                debug_struct.field("_unknown_fields", &self._unknown_fields);
17555            }
17556            debug_struct.finish()
17557        }
17558    }
17559
17560    /// Any scheduled maintenance for this instance.
17561    #[derive(Clone, Default, PartialEq)]
17562    #[non_exhaustive]
17563    pub struct SqlScheduledMaintenance {
17564        /// The start time of any upcoming scheduled maintenance for this instance.
17565        pub start_time: std::option::Option<wkt::Timestamp>,
17566
17567        #[deprecated]
17568        pub can_defer: bool,
17569
17570        /// If the scheduled maintenance can be rescheduled.
17571        pub can_reschedule: bool,
17572
17573        /// Maintenance cannot be rescheduled to start beyond this deadline.
17574        pub schedule_deadline_time: std::option::Option<wkt::Timestamp>,
17575
17576        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17577    }
17578
17579    impl SqlScheduledMaintenance {
17580        pub fn new() -> Self {
17581            std::default::Default::default()
17582        }
17583
17584        /// Sets the value of [start_time][crate::model::database_instance::SqlScheduledMaintenance::start_time].
17585        pub fn set_start_time<T>(mut self, v: T) -> Self
17586        where
17587            T: std::convert::Into<wkt::Timestamp>,
17588        {
17589            self.start_time = std::option::Option::Some(v.into());
17590            self
17591        }
17592
17593        /// Sets or clears the value of [start_time][crate::model::database_instance::SqlScheduledMaintenance::start_time].
17594        pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
17595        where
17596            T: std::convert::Into<wkt::Timestamp>,
17597        {
17598            self.start_time = v.map(|x| x.into());
17599            self
17600        }
17601
17602        /// Sets the value of [can_defer][crate::model::database_instance::SqlScheduledMaintenance::can_defer].
17603        #[deprecated]
17604        pub fn set_can_defer<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17605            self.can_defer = v.into();
17606            self
17607        }
17608
17609        /// Sets the value of [can_reschedule][crate::model::database_instance::SqlScheduledMaintenance::can_reschedule].
17610        pub fn set_can_reschedule<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17611            self.can_reschedule = v.into();
17612            self
17613        }
17614
17615        /// Sets the value of [schedule_deadline_time][crate::model::database_instance::SqlScheduledMaintenance::schedule_deadline_time].
17616        pub fn set_schedule_deadline_time<T>(mut self, v: T) -> Self
17617        where
17618            T: std::convert::Into<wkt::Timestamp>,
17619        {
17620            self.schedule_deadline_time = std::option::Option::Some(v.into());
17621            self
17622        }
17623
17624        /// Sets or clears the value of [schedule_deadline_time][crate::model::database_instance::SqlScheduledMaintenance::schedule_deadline_time].
17625        pub fn set_or_clear_schedule_deadline_time<T>(mut self, v: std::option::Option<T>) -> Self
17626        where
17627            T: std::convert::Into<wkt::Timestamp>,
17628        {
17629            self.schedule_deadline_time = v.map(|x| x.into());
17630            self
17631        }
17632    }
17633
17634    impl wkt::message::Message for SqlScheduledMaintenance {
17635        fn typename() -> &'static str {
17636            "type.googleapis.com/google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance"
17637        }
17638    }
17639
17640    #[doc(hidden)]
17641    impl<'de> serde::de::Deserialize<'de> for SqlScheduledMaintenance {
17642        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17643        where
17644            D: serde::Deserializer<'de>,
17645        {
17646            #[allow(non_camel_case_types)]
17647            #[doc(hidden)]
17648            #[derive(PartialEq, Eq, Hash)]
17649            enum __FieldTag {
17650                __start_time,
17651                __can_defer,
17652                __can_reschedule,
17653                __schedule_deadline_time,
17654                Unknown(std::string::String),
17655            }
17656            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17657                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17658                where
17659                    D: serde::Deserializer<'de>,
17660                {
17661                    struct Visitor;
17662                    impl<'de> serde::de::Visitor<'de> for Visitor {
17663                        type Value = __FieldTag;
17664                        fn expecting(
17665                            &self,
17666                            formatter: &mut std::fmt::Formatter,
17667                        ) -> std::fmt::Result {
17668                            formatter.write_str("a field name for SqlScheduledMaintenance")
17669                        }
17670                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17671                        where
17672                            E: serde::de::Error,
17673                        {
17674                            use std::result::Result::Ok;
17675                            use std::string::ToString;
17676                            match value {
17677                                "startTime" => Ok(__FieldTag::__start_time),
17678                                "start_time" => Ok(__FieldTag::__start_time),
17679                                "canDefer" => Ok(__FieldTag::__can_defer),
17680                                "can_defer" => Ok(__FieldTag::__can_defer),
17681                                "canReschedule" => Ok(__FieldTag::__can_reschedule),
17682                                "can_reschedule" => Ok(__FieldTag::__can_reschedule),
17683                                "scheduleDeadlineTime" => Ok(__FieldTag::__schedule_deadline_time),
17684                                "schedule_deadline_time" => {
17685                                    Ok(__FieldTag::__schedule_deadline_time)
17686                                }
17687                                _ => Ok(__FieldTag::Unknown(value.to_string())),
17688                            }
17689                        }
17690                    }
17691                    deserializer.deserialize_identifier(Visitor)
17692                }
17693            }
17694            struct Visitor;
17695            impl<'de> serde::de::Visitor<'de> for Visitor {
17696                type Value = SqlScheduledMaintenance;
17697                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17698                    formatter.write_str("struct SqlScheduledMaintenance")
17699                }
17700                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17701                where
17702                    A: serde::de::MapAccess<'de>,
17703                {
17704                    #[allow(unused_imports)]
17705                    use serde::de::Error;
17706                    use std::option::Option::Some;
17707                    let mut fields = std::collections::HashSet::new();
17708                    let mut result = Self::Value::new();
17709                    while let Some(tag) = map.next_key::<__FieldTag>()? {
17710                        #[allow(clippy::match_single_binding)]
17711                        match tag {
17712                            __FieldTag::__start_time => {
17713                                if !fields.insert(__FieldTag::__start_time) {
17714                                    return std::result::Result::Err(A::Error::duplicate_field(
17715                                        "multiple values for start_time",
17716                                    ));
17717                                }
17718                                result.start_time =
17719                                    map.next_value::<std::option::Option<wkt::Timestamp>>()?;
17720                            }
17721                            __FieldTag::__can_defer => {
17722                                if !fields.insert(__FieldTag::__can_defer) {
17723                                    return std::result::Result::Err(A::Error::duplicate_field(
17724                                        "multiple values for can_defer",
17725                                    ));
17726                                }
17727                                result.can_defer = map
17728                                    .next_value::<std::option::Option<bool>>()?
17729                                    .unwrap_or_default();
17730                            }
17731                            __FieldTag::__can_reschedule => {
17732                                if !fields.insert(__FieldTag::__can_reschedule) {
17733                                    return std::result::Result::Err(A::Error::duplicate_field(
17734                                        "multiple values for can_reschedule",
17735                                    ));
17736                                }
17737                                result.can_reschedule = map
17738                                    .next_value::<std::option::Option<bool>>()?
17739                                    .unwrap_or_default();
17740                            }
17741                            __FieldTag::__schedule_deadline_time => {
17742                                if !fields.insert(__FieldTag::__schedule_deadline_time) {
17743                                    return std::result::Result::Err(A::Error::duplicate_field(
17744                                        "multiple values for schedule_deadline_time",
17745                                    ));
17746                                }
17747                                result.schedule_deadline_time =
17748                                    map.next_value::<std::option::Option<wkt::Timestamp>>()?;
17749                            }
17750                            __FieldTag::Unknown(key) => {
17751                                let value = map.next_value::<serde_json::Value>()?;
17752                                result._unknown_fields.insert(key, value);
17753                            }
17754                        }
17755                    }
17756                    std::result::Result::Ok(result)
17757                }
17758            }
17759            deserializer.deserialize_any(Visitor)
17760        }
17761    }
17762
17763    #[doc(hidden)]
17764    impl serde::ser::Serialize for SqlScheduledMaintenance {
17765        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17766        where
17767            S: serde::ser::Serializer,
17768        {
17769            use serde::ser::SerializeMap;
17770            #[allow(unused_imports)]
17771            use std::option::Option::Some;
17772            let mut state = serializer.serialize_map(std::option::Option::None)?;
17773            if self.start_time.is_some() {
17774                state.serialize_entry("startTime", &self.start_time)?;
17775            }
17776            if !wkt::internal::is_default(&self.can_defer) {
17777                state.serialize_entry("canDefer", &self.can_defer)?;
17778            }
17779            if !wkt::internal::is_default(&self.can_reschedule) {
17780                state.serialize_entry("canReschedule", &self.can_reschedule)?;
17781            }
17782            if self.schedule_deadline_time.is_some() {
17783                state.serialize_entry("scheduleDeadlineTime", &self.schedule_deadline_time)?;
17784            }
17785            if !self._unknown_fields.is_empty() {
17786                for (key, value) in self._unknown_fields.iter() {
17787                    state.serialize_entry(key, &value)?;
17788                }
17789            }
17790            state.end()
17791        }
17792    }
17793
17794    impl std::fmt::Debug for SqlScheduledMaintenance {
17795        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17796            let mut debug_struct = f.debug_struct("SqlScheduledMaintenance");
17797            debug_struct.field("start_time", &self.start_time);
17798            debug_struct.field("can_defer", &self.can_defer);
17799            debug_struct.field("can_reschedule", &self.can_reschedule);
17800            debug_struct.field("schedule_deadline_time", &self.schedule_deadline_time);
17801            if !self._unknown_fields.is_empty() {
17802                debug_struct.field("_unknown_fields", &self._unknown_fields);
17803            }
17804            debug_struct.finish()
17805        }
17806    }
17807
17808    /// This message wraps up the information written by out-of-disk detection job.
17809    #[derive(Clone, Default, PartialEq)]
17810    #[non_exhaustive]
17811    pub struct SqlOutOfDiskReport {
17812        /// This field represents the state generated by the proactive database
17813        /// wellness job for OutOfDisk issues.
17814        ///
17815        /// * Writers:
17816        /// * the proactive database wellness job for OOD.
17817        /// * Readers:
17818        /// * the proactive database wellness job
17819        pub sql_out_of_disk_state: std::option::Option<
17820            crate::model::database_instance::sql_out_of_disk_report::SqlOutOfDiskState,
17821        >,
17822
17823        /// The minimum recommended increase size in GigaBytes
17824        /// This field is consumed by the frontend
17825        ///
17826        /// * Writers:
17827        /// * the proactive database wellness job for OOD.
17828        /// * Readers:
17829        pub sql_min_recommended_increase_size_gb: std::option::Option<i32>,
17830
17831        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17832    }
17833
17834    impl SqlOutOfDiskReport {
17835        pub fn new() -> Self {
17836            std::default::Default::default()
17837        }
17838
17839        /// Sets the value of [sql_out_of_disk_state][crate::model::database_instance::SqlOutOfDiskReport::sql_out_of_disk_state].
17840        pub fn set_sql_out_of_disk_state<T>(mut self, v: T) -> Self
17841        where
17842            T: std::convert::Into<
17843                    crate::model::database_instance::sql_out_of_disk_report::SqlOutOfDiskState,
17844                >,
17845        {
17846            self.sql_out_of_disk_state = std::option::Option::Some(v.into());
17847            self
17848        }
17849
17850        /// Sets or clears the value of [sql_out_of_disk_state][crate::model::database_instance::SqlOutOfDiskReport::sql_out_of_disk_state].
17851        pub fn set_or_clear_sql_out_of_disk_state<T>(mut self, v: std::option::Option<T>) -> Self
17852        where
17853            T: std::convert::Into<
17854                    crate::model::database_instance::sql_out_of_disk_report::SqlOutOfDiskState,
17855                >,
17856        {
17857            self.sql_out_of_disk_state = v.map(|x| x.into());
17858            self
17859        }
17860
17861        /// Sets the value of [sql_min_recommended_increase_size_gb][crate::model::database_instance::SqlOutOfDiskReport::sql_min_recommended_increase_size_gb].
17862        pub fn set_sql_min_recommended_increase_size_gb<T>(mut self, v: T) -> Self
17863        where
17864            T: std::convert::Into<i32>,
17865        {
17866            self.sql_min_recommended_increase_size_gb = std::option::Option::Some(v.into());
17867            self
17868        }
17869
17870        /// Sets or clears the value of [sql_min_recommended_increase_size_gb][crate::model::database_instance::SqlOutOfDiskReport::sql_min_recommended_increase_size_gb].
17871        pub fn set_or_clear_sql_min_recommended_increase_size_gb<T>(
17872            mut self,
17873            v: std::option::Option<T>,
17874        ) -> Self
17875        where
17876            T: std::convert::Into<i32>,
17877        {
17878            self.sql_min_recommended_increase_size_gb = v.map(|x| x.into());
17879            self
17880        }
17881    }
17882
17883    impl wkt::message::Message for SqlOutOfDiskReport {
17884        fn typename() -> &'static str {
17885            "type.googleapis.com/google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport"
17886        }
17887    }
17888
17889    #[doc(hidden)]
17890    impl<'de> serde::de::Deserialize<'de> for SqlOutOfDiskReport {
17891        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17892        where
17893            D: serde::Deserializer<'de>,
17894        {
17895            #[allow(non_camel_case_types)]
17896            #[doc(hidden)]
17897            #[derive(PartialEq, Eq, Hash)]
17898            enum __FieldTag {
17899                __sql_out_of_disk_state,
17900                __sql_min_recommended_increase_size_gb,
17901                Unknown(std::string::String),
17902            }
17903            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17904                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17905                where
17906                    D: serde::Deserializer<'de>,
17907                {
17908                    struct Visitor;
17909                    impl<'de> serde::de::Visitor<'de> for Visitor {
17910                        type Value = __FieldTag;
17911                        fn expecting(
17912                            &self,
17913                            formatter: &mut std::fmt::Formatter,
17914                        ) -> std::fmt::Result {
17915                            formatter.write_str("a field name for SqlOutOfDiskReport")
17916                        }
17917                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17918                        where
17919                            E: serde::de::Error,
17920                        {
17921                            use std::result::Result::Ok;
17922                            use std::string::ToString;
17923                            match value {
17924                                "sqlOutOfDiskState" => Ok(__FieldTag::__sql_out_of_disk_state),
17925                                "sql_out_of_disk_state" => Ok(__FieldTag::__sql_out_of_disk_state),
17926                                "sqlMinRecommendedIncreaseSizeGb" => {
17927                                    Ok(__FieldTag::__sql_min_recommended_increase_size_gb)
17928                                }
17929                                "sql_min_recommended_increase_size_gb" => {
17930                                    Ok(__FieldTag::__sql_min_recommended_increase_size_gb)
17931                                }
17932                                _ => Ok(__FieldTag::Unknown(value.to_string())),
17933                            }
17934                        }
17935                    }
17936                    deserializer.deserialize_identifier(Visitor)
17937                }
17938            }
17939            struct Visitor;
17940            impl<'de> serde::de::Visitor<'de> for Visitor {
17941                type Value = SqlOutOfDiskReport;
17942                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17943                    formatter.write_str("struct SqlOutOfDiskReport")
17944                }
17945                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17946                where
17947                    A: serde::de::MapAccess<'de>,
17948                {
17949                    #[allow(unused_imports)]
17950                    use serde::de::Error;
17951                    use std::option::Option::Some;
17952                    let mut fields = std::collections::HashSet::new();
17953                    let mut result = Self::Value::new();
17954                    while let Some(tag) = map.next_key::<__FieldTag>()? {
17955                        #[allow(clippy::match_single_binding)]
17956                        match tag {
17957                            __FieldTag::__sql_out_of_disk_state => {
17958                                if !fields.insert(__FieldTag::__sql_out_of_disk_state) {
17959                                    return std::result::Result::Err(A::Error::duplicate_field(
17960                                        "multiple values for sql_out_of_disk_state",
17961                                    ));
17962                                }
17963                                result.sql_out_of_disk_state = map.next_value::<std::option::Option<crate::model::database_instance::sql_out_of_disk_report::SqlOutOfDiskState>>()?
17964                                    ;
17965                            }
17966                            __FieldTag::__sql_min_recommended_increase_size_gb => {
17967                                if !fields
17968                                    .insert(__FieldTag::__sql_min_recommended_increase_size_gb)
17969                                {
17970                                    return std::result::Result::Err(A::Error::duplicate_field(
17971                                        "multiple values for sql_min_recommended_increase_size_gb",
17972                                    ));
17973                                }
17974                                struct __With(std::option::Option<i32>);
17975                                impl<'de> serde::de::Deserialize<'de> for __With {
17976                                    fn deserialize<D>(
17977                                        deserializer: D,
17978                                    ) -> std::result::Result<Self, D::Error>
17979                                    where
17980                                        D: serde::de::Deserializer<'de>,
17981                                    {
17982                                        serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
17983                                    }
17984                                }
17985                                result.sql_min_recommended_increase_size_gb =
17986                                    map.next_value::<__With>()?.0;
17987                            }
17988                            __FieldTag::Unknown(key) => {
17989                                let value = map.next_value::<serde_json::Value>()?;
17990                                result._unknown_fields.insert(key, value);
17991                            }
17992                        }
17993                    }
17994                    std::result::Result::Ok(result)
17995                }
17996            }
17997            deserializer.deserialize_any(Visitor)
17998        }
17999    }
18000
18001    #[doc(hidden)]
18002    impl serde::ser::Serialize for SqlOutOfDiskReport {
18003        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18004        where
18005            S: serde::ser::Serializer,
18006        {
18007            use serde::ser::SerializeMap;
18008            #[allow(unused_imports)]
18009            use std::option::Option::Some;
18010            let mut state = serializer.serialize_map(std::option::Option::None)?;
18011            if self.sql_out_of_disk_state.is_some() {
18012                state.serialize_entry("sqlOutOfDiskState", &self.sql_out_of_disk_state)?;
18013            }
18014            if self.sql_min_recommended_increase_size_gb.is_some() {
18015                struct __With<'a>(&'a std::option::Option<i32>);
18016                impl<'a> serde::ser::Serialize for __With<'a> {
18017                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18018                    where
18019                        S: serde::ser::Serializer,
18020                    {
18021                        serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
18022                            self.0, serializer,
18023                        )
18024                    }
18025                }
18026                state.serialize_entry(
18027                    "sqlMinRecommendedIncreaseSizeGb",
18028                    &__With(&self.sql_min_recommended_increase_size_gb),
18029                )?;
18030            }
18031            if !self._unknown_fields.is_empty() {
18032                for (key, value) in self._unknown_fields.iter() {
18033                    state.serialize_entry(key, &value)?;
18034                }
18035            }
18036            state.end()
18037        }
18038    }
18039
18040    impl std::fmt::Debug for SqlOutOfDiskReport {
18041        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18042            let mut debug_struct = f.debug_struct("SqlOutOfDiskReport");
18043            debug_struct.field("sql_out_of_disk_state", &self.sql_out_of_disk_state);
18044            debug_struct.field(
18045                "sql_min_recommended_increase_size_gb",
18046                &self.sql_min_recommended_increase_size_gb,
18047            );
18048            if !self._unknown_fields.is_empty() {
18049                debug_struct.field("_unknown_fields", &self._unknown_fields);
18050            }
18051            debug_struct.finish()
18052        }
18053    }
18054
18055    /// Defines additional types related to [SqlOutOfDiskReport].
18056    pub mod sql_out_of_disk_report {
18057        #[allow(unused_imports)]
18058        use super::*;
18059
18060        /// This enum lists all possible states regarding out-of-disk issues.
18061        ///
18062        /// # Working with unknown values
18063        ///
18064        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18065        /// additional enum variants at any time. Adding new variants is not considered
18066        /// a breaking change. Applications should write their code in anticipation of:
18067        ///
18068        /// - New values appearing in future releases of the client library, **and**
18069        /// - New values received dynamically, without application changes.
18070        ///
18071        /// Please consult the [Working with enums] section in the user guide for some
18072        /// guidelines.
18073        ///
18074        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
18075        #[derive(Clone, Debug, PartialEq)]
18076        #[non_exhaustive]
18077        pub enum SqlOutOfDiskState {
18078            /// Unspecified state
18079            Unspecified,
18080            /// The instance has plenty space on data disk
18081            Normal,
18082            /// Data disk is almost used up. It is shutdown to prevent data
18083            /// corruption.
18084            SoftShutdown,
18085            /// If set, the enum was initialized with an unknown value.
18086            ///
18087            /// Applications can examine the value using [SqlOutOfDiskState::value] or
18088            /// [SqlOutOfDiskState::name].
18089            UnknownValue(sql_out_of_disk_state::UnknownValue),
18090        }
18091
18092        #[doc(hidden)]
18093        pub mod sql_out_of_disk_state {
18094            #[allow(unused_imports)]
18095            use super::*;
18096            #[derive(Clone, Debug, PartialEq)]
18097            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18098        }
18099
18100        impl SqlOutOfDiskState {
18101            /// Gets the enum value.
18102            ///
18103            /// Returns `None` if the enum contains an unknown value deserialized from
18104            /// the string representation of enums.
18105            pub fn value(&self) -> std::option::Option<i32> {
18106                match self {
18107                    Self::Unspecified => std::option::Option::Some(0),
18108                    Self::Normal => std::option::Option::Some(1),
18109                    Self::SoftShutdown => std::option::Option::Some(2),
18110                    Self::UnknownValue(u) => u.0.value(),
18111                }
18112            }
18113
18114            /// Gets the enum value as a string.
18115            ///
18116            /// Returns `None` if the enum contains an unknown value deserialized from
18117            /// the integer representation of enums.
18118            pub fn name(&self) -> std::option::Option<&str> {
18119                match self {
18120                    Self::Unspecified => {
18121                        std::option::Option::Some("SQL_OUT_OF_DISK_STATE_UNSPECIFIED")
18122                    }
18123                    Self::Normal => std::option::Option::Some("NORMAL"),
18124                    Self::SoftShutdown => std::option::Option::Some("SOFT_SHUTDOWN"),
18125                    Self::UnknownValue(u) => u.0.name(),
18126                }
18127            }
18128        }
18129
18130        impl std::default::Default for SqlOutOfDiskState {
18131            fn default() -> Self {
18132                use std::convert::From;
18133                Self::from(0)
18134            }
18135        }
18136
18137        impl std::fmt::Display for SqlOutOfDiskState {
18138            fn fmt(
18139                &self,
18140                f: &mut std::fmt::Formatter<'_>,
18141            ) -> std::result::Result<(), std::fmt::Error> {
18142                wkt::internal::display_enum(f, self.name(), self.value())
18143            }
18144        }
18145
18146        impl std::convert::From<i32> for SqlOutOfDiskState {
18147            fn from(value: i32) -> Self {
18148                match value {
18149                    0 => Self::Unspecified,
18150                    1 => Self::Normal,
18151                    2 => Self::SoftShutdown,
18152                    _ => Self::UnknownValue(sql_out_of_disk_state::UnknownValue(
18153                        wkt::internal::UnknownEnumValue::Integer(value),
18154                    )),
18155                }
18156            }
18157        }
18158
18159        impl std::convert::From<&str> for SqlOutOfDiskState {
18160            fn from(value: &str) -> Self {
18161                use std::string::ToString;
18162                match value {
18163                    "SQL_OUT_OF_DISK_STATE_UNSPECIFIED" => Self::Unspecified,
18164                    "NORMAL" => Self::Normal,
18165                    "SOFT_SHUTDOWN" => Self::SoftShutdown,
18166                    _ => Self::UnknownValue(sql_out_of_disk_state::UnknownValue(
18167                        wkt::internal::UnknownEnumValue::String(value.to_string()),
18168                    )),
18169                }
18170            }
18171        }
18172
18173        impl serde::ser::Serialize for SqlOutOfDiskState {
18174            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18175            where
18176                S: serde::Serializer,
18177            {
18178                match self {
18179                    Self::Unspecified => serializer.serialize_i32(0),
18180                    Self::Normal => serializer.serialize_i32(1),
18181                    Self::SoftShutdown => serializer.serialize_i32(2),
18182                    Self::UnknownValue(u) => u.0.serialize(serializer),
18183                }
18184            }
18185        }
18186
18187        impl<'de> serde::de::Deserialize<'de> for SqlOutOfDiskState {
18188            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18189            where
18190                D: serde::Deserializer<'de>,
18191            {
18192                deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlOutOfDiskState>::new(
18193                    ".google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState",
18194                ))
18195            }
18196        }
18197    }
18198
18199    /// The current serving state of the database instance.
18200    ///
18201    /// # Working with unknown values
18202    ///
18203    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18204    /// additional enum variants at any time. Adding new variants is not considered
18205    /// a breaking change. Applications should write their code in anticipation of:
18206    ///
18207    /// - New values appearing in future releases of the client library, **and**
18208    /// - New values received dynamically, without application changes.
18209    ///
18210    /// Please consult the [Working with enums] section in the user guide for some
18211    /// guidelines.
18212    ///
18213    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
18214    #[derive(Clone, Debug, PartialEq)]
18215    #[non_exhaustive]
18216    pub enum SqlInstanceState {
18217        /// The state of the instance is unknown.
18218        Unspecified,
18219        /// The instance is running, or has been stopped by owner.
18220        Runnable,
18221        /// The instance is not available, for example due to problems with billing.
18222        Suspended,
18223        /// The instance is being deleted.
18224        PendingDelete,
18225        /// The instance is being created.
18226        PendingCreate,
18227        /// The instance is down for maintenance.
18228        Maintenance,
18229        /// The creation of the instance failed or a fatal error occurred during
18230        /// maintenance.
18231        Failed,
18232        /// Deprecated
18233        #[deprecated]
18234        OnlineMaintenance,
18235        /// If set, the enum was initialized with an unknown value.
18236        ///
18237        /// Applications can examine the value using [SqlInstanceState::value] or
18238        /// [SqlInstanceState::name].
18239        UnknownValue(sql_instance_state::UnknownValue),
18240    }
18241
18242    #[doc(hidden)]
18243    pub mod sql_instance_state {
18244        #[allow(unused_imports)]
18245        use super::*;
18246        #[derive(Clone, Debug, PartialEq)]
18247        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18248    }
18249
18250    impl SqlInstanceState {
18251        /// Gets the enum value.
18252        ///
18253        /// Returns `None` if the enum contains an unknown value deserialized from
18254        /// the string representation of enums.
18255        pub fn value(&self) -> std::option::Option<i32> {
18256            match self {
18257                Self::Unspecified => std::option::Option::Some(0),
18258                Self::Runnable => std::option::Option::Some(1),
18259                Self::Suspended => std::option::Option::Some(2),
18260                Self::PendingDelete => std::option::Option::Some(3),
18261                Self::PendingCreate => std::option::Option::Some(4),
18262                Self::Maintenance => std::option::Option::Some(5),
18263                Self::Failed => std::option::Option::Some(6),
18264                Self::OnlineMaintenance => std::option::Option::Some(7),
18265                Self::UnknownValue(u) => u.0.value(),
18266            }
18267        }
18268
18269        /// Gets the enum value as a string.
18270        ///
18271        /// Returns `None` if the enum contains an unknown value deserialized from
18272        /// the integer representation of enums.
18273        pub fn name(&self) -> std::option::Option<&str> {
18274            match self {
18275                Self::Unspecified => std::option::Option::Some("SQL_INSTANCE_STATE_UNSPECIFIED"),
18276                Self::Runnable => std::option::Option::Some("RUNNABLE"),
18277                Self::Suspended => std::option::Option::Some("SUSPENDED"),
18278                Self::PendingDelete => std::option::Option::Some("PENDING_DELETE"),
18279                Self::PendingCreate => std::option::Option::Some("PENDING_CREATE"),
18280                Self::Maintenance => std::option::Option::Some("MAINTENANCE"),
18281                Self::Failed => std::option::Option::Some("FAILED"),
18282                Self::OnlineMaintenance => std::option::Option::Some("ONLINE_MAINTENANCE"),
18283                Self::UnknownValue(u) => u.0.name(),
18284            }
18285        }
18286    }
18287
18288    impl std::default::Default for SqlInstanceState {
18289        fn default() -> Self {
18290            use std::convert::From;
18291            Self::from(0)
18292        }
18293    }
18294
18295    impl std::fmt::Display for SqlInstanceState {
18296        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
18297            wkt::internal::display_enum(f, self.name(), self.value())
18298        }
18299    }
18300
18301    impl std::convert::From<i32> for SqlInstanceState {
18302        fn from(value: i32) -> Self {
18303            match value {
18304                0 => Self::Unspecified,
18305                1 => Self::Runnable,
18306                2 => Self::Suspended,
18307                3 => Self::PendingDelete,
18308                4 => Self::PendingCreate,
18309                5 => Self::Maintenance,
18310                6 => Self::Failed,
18311                7 => Self::OnlineMaintenance,
18312                _ => Self::UnknownValue(sql_instance_state::UnknownValue(
18313                    wkt::internal::UnknownEnumValue::Integer(value),
18314                )),
18315            }
18316        }
18317    }
18318
18319    impl std::convert::From<&str> for SqlInstanceState {
18320        fn from(value: &str) -> Self {
18321            use std::string::ToString;
18322            match value {
18323                "SQL_INSTANCE_STATE_UNSPECIFIED" => Self::Unspecified,
18324                "RUNNABLE" => Self::Runnable,
18325                "SUSPENDED" => Self::Suspended,
18326                "PENDING_DELETE" => Self::PendingDelete,
18327                "PENDING_CREATE" => Self::PendingCreate,
18328                "MAINTENANCE" => Self::Maintenance,
18329                "FAILED" => Self::Failed,
18330                "ONLINE_MAINTENANCE" => Self::OnlineMaintenance,
18331                _ => Self::UnknownValue(sql_instance_state::UnknownValue(
18332                    wkt::internal::UnknownEnumValue::String(value.to_string()),
18333                )),
18334            }
18335        }
18336    }
18337
18338    impl serde::ser::Serialize for SqlInstanceState {
18339        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18340        where
18341            S: serde::Serializer,
18342        {
18343            match self {
18344                Self::Unspecified => serializer.serialize_i32(0),
18345                Self::Runnable => serializer.serialize_i32(1),
18346                Self::Suspended => serializer.serialize_i32(2),
18347                Self::PendingDelete => serializer.serialize_i32(3),
18348                Self::PendingCreate => serializer.serialize_i32(4),
18349                Self::Maintenance => serializer.serialize_i32(5),
18350                Self::Failed => serializer.serialize_i32(6),
18351                Self::OnlineMaintenance => serializer.serialize_i32(7),
18352                Self::UnknownValue(u) => u.0.serialize(serializer),
18353            }
18354        }
18355    }
18356
18357    impl<'de> serde::de::Deserialize<'de> for SqlInstanceState {
18358        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18359        where
18360            D: serde::Deserializer<'de>,
18361        {
18362            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlInstanceState>::new(
18363                ".google.cloud.sql.v1.DatabaseInstance.SqlInstanceState",
18364            ))
18365        }
18366    }
18367
18368    /// The SQL network architecture for the instance.
18369    ///
18370    /// # Working with unknown values
18371    ///
18372    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18373    /// additional enum variants at any time. Adding new variants is not considered
18374    /// a breaking change. Applications should write their code in anticipation of:
18375    ///
18376    /// - New values appearing in future releases of the client library, **and**
18377    /// - New values received dynamically, without application changes.
18378    ///
18379    /// Please consult the [Working with enums] section in the user guide for some
18380    /// guidelines.
18381    ///
18382    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
18383    #[derive(Clone, Debug, PartialEq)]
18384    #[non_exhaustive]
18385    pub enum SqlNetworkArchitecture {
18386        Unspecified,
18387        /// The instance uses the new network architecture.
18388        NewNetworkArchitecture,
18389        /// The instance uses the old network architecture.
18390        OldNetworkArchitecture,
18391        /// If set, the enum was initialized with an unknown value.
18392        ///
18393        /// Applications can examine the value using [SqlNetworkArchitecture::value] or
18394        /// [SqlNetworkArchitecture::name].
18395        UnknownValue(sql_network_architecture::UnknownValue),
18396    }
18397
18398    #[doc(hidden)]
18399    pub mod sql_network_architecture {
18400        #[allow(unused_imports)]
18401        use super::*;
18402        #[derive(Clone, Debug, PartialEq)]
18403        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18404    }
18405
18406    impl SqlNetworkArchitecture {
18407        /// Gets the enum value.
18408        ///
18409        /// Returns `None` if the enum contains an unknown value deserialized from
18410        /// the string representation of enums.
18411        pub fn value(&self) -> std::option::Option<i32> {
18412            match self {
18413                Self::Unspecified => std::option::Option::Some(0),
18414                Self::NewNetworkArchitecture => std::option::Option::Some(1),
18415                Self::OldNetworkArchitecture => std::option::Option::Some(2),
18416                Self::UnknownValue(u) => u.0.value(),
18417            }
18418        }
18419
18420        /// Gets the enum value as a string.
18421        ///
18422        /// Returns `None` if the enum contains an unknown value deserialized from
18423        /// the integer representation of enums.
18424        pub fn name(&self) -> std::option::Option<&str> {
18425            match self {
18426                Self::Unspecified => {
18427                    std::option::Option::Some("SQL_NETWORK_ARCHITECTURE_UNSPECIFIED")
18428                }
18429                Self::NewNetworkArchitecture => {
18430                    std::option::Option::Some("NEW_NETWORK_ARCHITECTURE")
18431                }
18432                Self::OldNetworkArchitecture => {
18433                    std::option::Option::Some("OLD_NETWORK_ARCHITECTURE")
18434                }
18435                Self::UnknownValue(u) => u.0.name(),
18436            }
18437        }
18438    }
18439
18440    impl std::default::Default for SqlNetworkArchitecture {
18441        fn default() -> Self {
18442            use std::convert::From;
18443            Self::from(0)
18444        }
18445    }
18446
18447    impl std::fmt::Display for SqlNetworkArchitecture {
18448        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
18449            wkt::internal::display_enum(f, self.name(), self.value())
18450        }
18451    }
18452
18453    impl std::convert::From<i32> for SqlNetworkArchitecture {
18454        fn from(value: i32) -> Self {
18455            match value {
18456                0 => Self::Unspecified,
18457                1 => Self::NewNetworkArchitecture,
18458                2 => Self::OldNetworkArchitecture,
18459                _ => Self::UnknownValue(sql_network_architecture::UnknownValue(
18460                    wkt::internal::UnknownEnumValue::Integer(value),
18461                )),
18462            }
18463        }
18464    }
18465
18466    impl std::convert::From<&str> for SqlNetworkArchitecture {
18467        fn from(value: &str) -> Self {
18468            use std::string::ToString;
18469            match value {
18470                "SQL_NETWORK_ARCHITECTURE_UNSPECIFIED" => Self::Unspecified,
18471                "NEW_NETWORK_ARCHITECTURE" => Self::NewNetworkArchitecture,
18472                "OLD_NETWORK_ARCHITECTURE" => Self::OldNetworkArchitecture,
18473                _ => Self::UnknownValue(sql_network_architecture::UnknownValue(
18474                    wkt::internal::UnknownEnumValue::String(value.to_string()),
18475                )),
18476            }
18477        }
18478    }
18479
18480    impl serde::ser::Serialize for SqlNetworkArchitecture {
18481        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18482        where
18483            S: serde::Serializer,
18484        {
18485            match self {
18486                Self::Unspecified => serializer.serialize_i32(0),
18487                Self::NewNetworkArchitecture => serializer.serialize_i32(1),
18488                Self::OldNetworkArchitecture => serializer.serialize_i32(2),
18489                Self::UnknownValue(u) => u.0.serialize(serializer),
18490            }
18491        }
18492    }
18493
18494    impl<'de> serde::de::Deserialize<'de> for SqlNetworkArchitecture {
18495        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18496        where
18497            D: serde::Deserializer<'de>,
18498        {
18499            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlNetworkArchitecture>::new(
18500                ".google.cloud.sql.v1.DatabaseInstance.SqlNetworkArchitecture",
18501            ))
18502        }
18503    }
18504}
18505
18506/// Gemini instance configuration.
18507#[derive(Clone, Default, PartialEq)]
18508#[non_exhaustive]
18509pub struct GeminiInstanceConfig {
18510    /// Output only. Whether Gemini is enabled.
18511    pub entitled: std::option::Option<bool>,
18512
18513    /// Output only. Whether the vacuum management is enabled.
18514    pub google_vacuum_mgmt_enabled: std::option::Option<bool>,
18515
18516    /// Output only. Whether canceling the out-of-memory (OOM) session is enabled.
18517    pub oom_session_cancel_enabled: std::option::Option<bool>,
18518
18519    /// Output only. Whether the active query is enabled.
18520    pub active_query_enabled: std::option::Option<bool>,
18521
18522    /// Output only. Whether the index advisor is enabled.
18523    pub index_advisor_enabled: std::option::Option<bool>,
18524
18525    /// Output only. Whether the flag recommender is enabled.
18526    pub flag_recommender_enabled: std::option::Option<bool>,
18527
18528    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18529}
18530
18531impl GeminiInstanceConfig {
18532    pub fn new() -> Self {
18533        std::default::Default::default()
18534    }
18535
18536    /// Sets the value of [entitled][crate::model::GeminiInstanceConfig::entitled].
18537    pub fn set_entitled<T>(mut self, v: T) -> Self
18538    where
18539        T: std::convert::Into<bool>,
18540    {
18541        self.entitled = std::option::Option::Some(v.into());
18542        self
18543    }
18544
18545    /// Sets or clears the value of [entitled][crate::model::GeminiInstanceConfig::entitled].
18546    pub fn set_or_clear_entitled<T>(mut self, v: std::option::Option<T>) -> Self
18547    where
18548        T: std::convert::Into<bool>,
18549    {
18550        self.entitled = v.map(|x| x.into());
18551        self
18552    }
18553
18554    /// Sets the value of [google_vacuum_mgmt_enabled][crate::model::GeminiInstanceConfig::google_vacuum_mgmt_enabled].
18555    pub fn set_google_vacuum_mgmt_enabled<T>(mut self, v: T) -> Self
18556    where
18557        T: std::convert::Into<bool>,
18558    {
18559        self.google_vacuum_mgmt_enabled = std::option::Option::Some(v.into());
18560        self
18561    }
18562
18563    /// Sets or clears the value of [google_vacuum_mgmt_enabled][crate::model::GeminiInstanceConfig::google_vacuum_mgmt_enabled].
18564    pub fn set_or_clear_google_vacuum_mgmt_enabled<T>(mut self, v: std::option::Option<T>) -> Self
18565    where
18566        T: std::convert::Into<bool>,
18567    {
18568        self.google_vacuum_mgmt_enabled = v.map(|x| x.into());
18569        self
18570    }
18571
18572    /// Sets the value of [oom_session_cancel_enabled][crate::model::GeminiInstanceConfig::oom_session_cancel_enabled].
18573    pub fn set_oom_session_cancel_enabled<T>(mut self, v: T) -> Self
18574    where
18575        T: std::convert::Into<bool>,
18576    {
18577        self.oom_session_cancel_enabled = std::option::Option::Some(v.into());
18578        self
18579    }
18580
18581    /// Sets or clears the value of [oom_session_cancel_enabled][crate::model::GeminiInstanceConfig::oom_session_cancel_enabled].
18582    pub fn set_or_clear_oom_session_cancel_enabled<T>(mut self, v: std::option::Option<T>) -> Self
18583    where
18584        T: std::convert::Into<bool>,
18585    {
18586        self.oom_session_cancel_enabled = v.map(|x| x.into());
18587        self
18588    }
18589
18590    /// Sets the value of [active_query_enabled][crate::model::GeminiInstanceConfig::active_query_enabled].
18591    pub fn set_active_query_enabled<T>(mut self, v: T) -> Self
18592    where
18593        T: std::convert::Into<bool>,
18594    {
18595        self.active_query_enabled = std::option::Option::Some(v.into());
18596        self
18597    }
18598
18599    /// Sets or clears the value of [active_query_enabled][crate::model::GeminiInstanceConfig::active_query_enabled].
18600    pub fn set_or_clear_active_query_enabled<T>(mut self, v: std::option::Option<T>) -> Self
18601    where
18602        T: std::convert::Into<bool>,
18603    {
18604        self.active_query_enabled = v.map(|x| x.into());
18605        self
18606    }
18607
18608    /// Sets the value of [index_advisor_enabled][crate::model::GeminiInstanceConfig::index_advisor_enabled].
18609    pub fn set_index_advisor_enabled<T>(mut self, v: T) -> Self
18610    where
18611        T: std::convert::Into<bool>,
18612    {
18613        self.index_advisor_enabled = std::option::Option::Some(v.into());
18614        self
18615    }
18616
18617    /// Sets or clears the value of [index_advisor_enabled][crate::model::GeminiInstanceConfig::index_advisor_enabled].
18618    pub fn set_or_clear_index_advisor_enabled<T>(mut self, v: std::option::Option<T>) -> Self
18619    where
18620        T: std::convert::Into<bool>,
18621    {
18622        self.index_advisor_enabled = v.map(|x| x.into());
18623        self
18624    }
18625
18626    /// Sets the value of [flag_recommender_enabled][crate::model::GeminiInstanceConfig::flag_recommender_enabled].
18627    pub fn set_flag_recommender_enabled<T>(mut self, v: T) -> Self
18628    where
18629        T: std::convert::Into<bool>,
18630    {
18631        self.flag_recommender_enabled = std::option::Option::Some(v.into());
18632        self
18633    }
18634
18635    /// Sets or clears the value of [flag_recommender_enabled][crate::model::GeminiInstanceConfig::flag_recommender_enabled].
18636    pub fn set_or_clear_flag_recommender_enabled<T>(mut self, v: std::option::Option<T>) -> Self
18637    where
18638        T: std::convert::Into<bool>,
18639    {
18640        self.flag_recommender_enabled = v.map(|x| x.into());
18641        self
18642    }
18643}
18644
18645impl wkt::message::Message for GeminiInstanceConfig {
18646    fn typename() -> &'static str {
18647        "type.googleapis.com/google.cloud.sql.v1.GeminiInstanceConfig"
18648    }
18649}
18650
18651#[doc(hidden)]
18652impl<'de> serde::de::Deserialize<'de> for GeminiInstanceConfig {
18653    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18654    where
18655        D: serde::Deserializer<'de>,
18656    {
18657        #[allow(non_camel_case_types)]
18658        #[doc(hidden)]
18659        #[derive(PartialEq, Eq, Hash)]
18660        enum __FieldTag {
18661            __entitled,
18662            __google_vacuum_mgmt_enabled,
18663            __oom_session_cancel_enabled,
18664            __active_query_enabled,
18665            __index_advisor_enabled,
18666            __flag_recommender_enabled,
18667            Unknown(std::string::String),
18668        }
18669        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18670            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18671            where
18672                D: serde::Deserializer<'de>,
18673            {
18674                struct Visitor;
18675                impl<'de> serde::de::Visitor<'de> for Visitor {
18676                    type Value = __FieldTag;
18677                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18678                        formatter.write_str("a field name for GeminiInstanceConfig")
18679                    }
18680                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18681                    where
18682                        E: serde::de::Error,
18683                    {
18684                        use std::result::Result::Ok;
18685                        use std::string::ToString;
18686                        match value {
18687                            "entitled" => Ok(__FieldTag::__entitled),
18688                            "googleVacuumMgmtEnabled" => {
18689                                Ok(__FieldTag::__google_vacuum_mgmt_enabled)
18690                            }
18691                            "google_vacuum_mgmt_enabled" => {
18692                                Ok(__FieldTag::__google_vacuum_mgmt_enabled)
18693                            }
18694                            "oomSessionCancelEnabled" => {
18695                                Ok(__FieldTag::__oom_session_cancel_enabled)
18696                            }
18697                            "oom_session_cancel_enabled" => {
18698                                Ok(__FieldTag::__oom_session_cancel_enabled)
18699                            }
18700                            "activeQueryEnabled" => Ok(__FieldTag::__active_query_enabled),
18701                            "active_query_enabled" => Ok(__FieldTag::__active_query_enabled),
18702                            "indexAdvisorEnabled" => Ok(__FieldTag::__index_advisor_enabled),
18703                            "index_advisor_enabled" => Ok(__FieldTag::__index_advisor_enabled),
18704                            "flagRecommenderEnabled" => Ok(__FieldTag::__flag_recommender_enabled),
18705                            "flag_recommender_enabled" => {
18706                                Ok(__FieldTag::__flag_recommender_enabled)
18707                            }
18708                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18709                        }
18710                    }
18711                }
18712                deserializer.deserialize_identifier(Visitor)
18713            }
18714        }
18715        struct Visitor;
18716        impl<'de> serde::de::Visitor<'de> for Visitor {
18717            type Value = GeminiInstanceConfig;
18718            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18719                formatter.write_str("struct GeminiInstanceConfig")
18720            }
18721            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18722            where
18723                A: serde::de::MapAccess<'de>,
18724            {
18725                #[allow(unused_imports)]
18726                use serde::de::Error;
18727                use std::option::Option::Some;
18728                let mut fields = std::collections::HashSet::new();
18729                let mut result = Self::Value::new();
18730                while let Some(tag) = map.next_key::<__FieldTag>()? {
18731                    #[allow(clippy::match_single_binding)]
18732                    match tag {
18733                        __FieldTag::__entitled => {
18734                            if !fields.insert(__FieldTag::__entitled) {
18735                                return std::result::Result::Err(A::Error::duplicate_field(
18736                                    "multiple values for entitled",
18737                                ));
18738                            }
18739                            result.entitled = map.next_value::<std::option::Option<bool>>()?;
18740                        }
18741                        __FieldTag::__google_vacuum_mgmt_enabled => {
18742                            if !fields.insert(__FieldTag::__google_vacuum_mgmt_enabled) {
18743                                return std::result::Result::Err(A::Error::duplicate_field(
18744                                    "multiple values for google_vacuum_mgmt_enabled",
18745                                ));
18746                            }
18747                            result.google_vacuum_mgmt_enabled =
18748                                map.next_value::<std::option::Option<bool>>()?;
18749                        }
18750                        __FieldTag::__oom_session_cancel_enabled => {
18751                            if !fields.insert(__FieldTag::__oom_session_cancel_enabled) {
18752                                return std::result::Result::Err(A::Error::duplicate_field(
18753                                    "multiple values for oom_session_cancel_enabled",
18754                                ));
18755                            }
18756                            result.oom_session_cancel_enabled =
18757                                map.next_value::<std::option::Option<bool>>()?;
18758                        }
18759                        __FieldTag::__active_query_enabled => {
18760                            if !fields.insert(__FieldTag::__active_query_enabled) {
18761                                return std::result::Result::Err(A::Error::duplicate_field(
18762                                    "multiple values for active_query_enabled",
18763                                ));
18764                            }
18765                            result.active_query_enabled =
18766                                map.next_value::<std::option::Option<bool>>()?;
18767                        }
18768                        __FieldTag::__index_advisor_enabled => {
18769                            if !fields.insert(__FieldTag::__index_advisor_enabled) {
18770                                return std::result::Result::Err(A::Error::duplicate_field(
18771                                    "multiple values for index_advisor_enabled",
18772                                ));
18773                            }
18774                            result.index_advisor_enabled =
18775                                map.next_value::<std::option::Option<bool>>()?;
18776                        }
18777                        __FieldTag::__flag_recommender_enabled => {
18778                            if !fields.insert(__FieldTag::__flag_recommender_enabled) {
18779                                return std::result::Result::Err(A::Error::duplicate_field(
18780                                    "multiple values for flag_recommender_enabled",
18781                                ));
18782                            }
18783                            result.flag_recommender_enabled =
18784                                map.next_value::<std::option::Option<bool>>()?;
18785                        }
18786                        __FieldTag::Unknown(key) => {
18787                            let value = map.next_value::<serde_json::Value>()?;
18788                            result._unknown_fields.insert(key, value);
18789                        }
18790                    }
18791                }
18792                std::result::Result::Ok(result)
18793            }
18794        }
18795        deserializer.deserialize_any(Visitor)
18796    }
18797}
18798
18799#[doc(hidden)]
18800impl serde::ser::Serialize for GeminiInstanceConfig {
18801    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18802    where
18803        S: serde::ser::Serializer,
18804    {
18805        use serde::ser::SerializeMap;
18806        #[allow(unused_imports)]
18807        use std::option::Option::Some;
18808        let mut state = serializer.serialize_map(std::option::Option::None)?;
18809        if self.entitled.is_some() {
18810            state.serialize_entry("entitled", &self.entitled)?;
18811        }
18812        if self.google_vacuum_mgmt_enabled.is_some() {
18813            state.serialize_entry("googleVacuumMgmtEnabled", &self.google_vacuum_mgmt_enabled)?;
18814        }
18815        if self.oom_session_cancel_enabled.is_some() {
18816            state.serialize_entry("oomSessionCancelEnabled", &self.oom_session_cancel_enabled)?;
18817        }
18818        if self.active_query_enabled.is_some() {
18819            state.serialize_entry("activeQueryEnabled", &self.active_query_enabled)?;
18820        }
18821        if self.index_advisor_enabled.is_some() {
18822            state.serialize_entry("indexAdvisorEnabled", &self.index_advisor_enabled)?;
18823        }
18824        if self.flag_recommender_enabled.is_some() {
18825            state.serialize_entry("flagRecommenderEnabled", &self.flag_recommender_enabled)?;
18826        }
18827        if !self._unknown_fields.is_empty() {
18828            for (key, value) in self._unknown_fields.iter() {
18829                state.serialize_entry(key, &value)?;
18830            }
18831        }
18832        state.end()
18833    }
18834}
18835
18836impl std::fmt::Debug for GeminiInstanceConfig {
18837    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18838        let mut debug_struct = f.debug_struct("GeminiInstanceConfig");
18839        debug_struct.field("entitled", &self.entitled);
18840        debug_struct.field(
18841            "google_vacuum_mgmt_enabled",
18842            &self.google_vacuum_mgmt_enabled,
18843        );
18844        debug_struct.field(
18845            "oom_session_cancel_enabled",
18846            &self.oom_session_cancel_enabled,
18847        );
18848        debug_struct.field("active_query_enabled", &self.active_query_enabled);
18849        debug_struct.field("index_advisor_enabled", &self.index_advisor_enabled);
18850        debug_struct.field("flag_recommender_enabled", &self.flag_recommender_enabled);
18851        if !self._unknown_fields.is_empty() {
18852            debug_struct.field("_unknown_fields", &self._unknown_fields);
18853        }
18854        debug_struct.finish()
18855    }
18856}
18857
18858/// A primary instance and disaster recovery (DR) replica pair.
18859/// A DR replica is a cross-region replica that you designate for failover in
18860/// the event that the primary instance experiences regional failure.
18861/// Only applicable to MySQL.
18862#[derive(Clone, Default, PartialEq)]
18863#[non_exhaustive]
18864pub struct ReplicationCluster {
18865    /// Output only. If set, it indicates this instance has a private service
18866    /// access (PSA) dns endpoint that is pointing to the primary instance of the
18867    /// cluster. If this instance is the primary, the dns should be pointing to
18868    /// this instance. After Switchover or Replica failover, this DNS endpoint
18869    /// points to the promoted instance. This is a read-only field, returned to the
18870    /// user as information. This field can exist even if a standalone instance
18871    /// does not yet have a replica, or had a DR replica that was deleted.
18872    pub psa_write_endpoint: std::string::String,
18873
18874    /// Optional. If the instance is a primary instance, then this field identifies
18875    /// the disaster recovery (DR) replica. A DR replica is an optional
18876    /// configuration for Enterprise Plus edition instances. If the instance is a
18877    /// read replica, then the field is not set. Set this field to a replica name
18878    /// to designate a DR replica for a primary instance. Remove the replica name
18879    /// to remove the DR replica designation.
18880    pub failover_dr_replica_name: std::string::String,
18881
18882    /// Output only. Read-only field that indicates whether the replica is a DR
18883    /// replica. This field is not set if the instance is a primary instance.
18884    pub dr_replica: bool,
18885
18886    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18887}
18888
18889impl ReplicationCluster {
18890    pub fn new() -> Self {
18891        std::default::Default::default()
18892    }
18893
18894    /// Sets the value of [psa_write_endpoint][crate::model::ReplicationCluster::psa_write_endpoint].
18895    pub fn set_psa_write_endpoint<T: std::convert::Into<std::string::String>>(
18896        mut self,
18897        v: T,
18898    ) -> Self {
18899        self.psa_write_endpoint = v.into();
18900        self
18901    }
18902
18903    /// Sets the value of [failover_dr_replica_name][crate::model::ReplicationCluster::failover_dr_replica_name].
18904    pub fn set_failover_dr_replica_name<T: std::convert::Into<std::string::String>>(
18905        mut self,
18906        v: T,
18907    ) -> Self {
18908        self.failover_dr_replica_name = v.into();
18909        self
18910    }
18911
18912    /// Sets the value of [dr_replica][crate::model::ReplicationCluster::dr_replica].
18913    pub fn set_dr_replica<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18914        self.dr_replica = v.into();
18915        self
18916    }
18917}
18918
18919impl wkt::message::Message for ReplicationCluster {
18920    fn typename() -> &'static str {
18921        "type.googleapis.com/google.cloud.sql.v1.ReplicationCluster"
18922    }
18923}
18924
18925#[doc(hidden)]
18926impl<'de> serde::de::Deserialize<'de> for ReplicationCluster {
18927    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18928    where
18929        D: serde::Deserializer<'de>,
18930    {
18931        #[allow(non_camel_case_types)]
18932        #[doc(hidden)]
18933        #[derive(PartialEq, Eq, Hash)]
18934        enum __FieldTag {
18935            __psa_write_endpoint,
18936            __failover_dr_replica_name,
18937            __dr_replica,
18938            Unknown(std::string::String),
18939        }
18940        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18941            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18942            where
18943                D: serde::Deserializer<'de>,
18944            {
18945                struct Visitor;
18946                impl<'de> serde::de::Visitor<'de> for Visitor {
18947                    type Value = __FieldTag;
18948                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18949                        formatter.write_str("a field name for ReplicationCluster")
18950                    }
18951                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18952                    where
18953                        E: serde::de::Error,
18954                    {
18955                        use std::result::Result::Ok;
18956                        use std::string::ToString;
18957                        match value {
18958                            "psaWriteEndpoint" => Ok(__FieldTag::__psa_write_endpoint),
18959                            "psa_write_endpoint" => Ok(__FieldTag::__psa_write_endpoint),
18960                            "failoverDrReplicaName" => Ok(__FieldTag::__failover_dr_replica_name),
18961                            "failover_dr_replica_name" => {
18962                                Ok(__FieldTag::__failover_dr_replica_name)
18963                            }
18964                            "drReplica" => Ok(__FieldTag::__dr_replica),
18965                            "dr_replica" => Ok(__FieldTag::__dr_replica),
18966                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18967                        }
18968                    }
18969                }
18970                deserializer.deserialize_identifier(Visitor)
18971            }
18972        }
18973        struct Visitor;
18974        impl<'de> serde::de::Visitor<'de> for Visitor {
18975            type Value = ReplicationCluster;
18976            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18977                formatter.write_str("struct ReplicationCluster")
18978            }
18979            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18980            where
18981                A: serde::de::MapAccess<'de>,
18982            {
18983                #[allow(unused_imports)]
18984                use serde::de::Error;
18985                use std::option::Option::Some;
18986                let mut fields = std::collections::HashSet::new();
18987                let mut result = Self::Value::new();
18988                while let Some(tag) = map.next_key::<__FieldTag>()? {
18989                    #[allow(clippy::match_single_binding)]
18990                    match tag {
18991                        __FieldTag::__psa_write_endpoint => {
18992                            if !fields.insert(__FieldTag::__psa_write_endpoint) {
18993                                return std::result::Result::Err(A::Error::duplicate_field(
18994                                    "multiple values for psa_write_endpoint",
18995                                ));
18996                            }
18997                            result.psa_write_endpoint = map
18998                                .next_value::<std::option::Option<std::string::String>>()?
18999                                .unwrap_or_default();
19000                        }
19001                        __FieldTag::__failover_dr_replica_name => {
19002                            if !fields.insert(__FieldTag::__failover_dr_replica_name) {
19003                                return std::result::Result::Err(A::Error::duplicate_field(
19004                                    "multiple values for failover_dr_replica_name",
19005                                ));
19006                            }
19007                            result.failover_dr_replica_name = map
19008                                .next_value::<std::option::Option<std::string::String>>()?
19009                                .unwrap_or_default();
19010                        }
19011                        __FieldTag::__dr_replica => {
19012                            if !fields.insert(__FieldTag::__dr_replica) {
19013                                return std::result::Result::Err(A::Error::duplicate_field(
19014                                    "multiple values for dr_replica",
19015                                ));
19016                            }
19017                            result.dr_replica = map
19018                                .next_value::<std::option::Option<bool>>()?
19019                                .unwrap_or_default();
19020                        }
19021                        __FieldTag::Unknown(key) => {
19022                            let value = map.next_value::<serde_json::Value>()?;
19023                            result._unknown_fields.insert(key, value);
19024                        }
19025                    }
19026                }
19027                std::result::Result::Ok(result)
19028            }
19029        }
19030        deserializer.deserialize_any(Visitor)
19031    }
19032}
19033
19034#[doc(hidden)]
19035impl serde::ser::Serialize for ReplicationCluster {
19036    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19037    where
19038        S: serde::ser::Serializer,
19039    {
19040        use serde::ser::SerializeMap;
19041        #[allow(unused_imports)]
19042        use std::option::Option::Some;
19043        let mut state = serializer.serialize_map(std::option::Option::None)?;
19044        if !self.psa_write_endpoint.is_empty() {
19045            state.serialize_entry("psaWriteEndpoint", &self.psa_write_endpoint)?;
19046        }
19047        if !self.failover_dr_replica_name.is_empty() {
19048            state.serialize_entry("failoverDrReplicaName", &self.failover_dr_replica_name)?;
19049        }
19050        if !wkt::internal::is_default(&self.dr_replica) {
19051            state.serialize_entry("drReplica", &self.dr_replica)?;
19052        }
19053        if !self._unknown_fields.is_empty() {
19054            for (key, value) in self._unknown_fields.iter() {
19055                state.serialize_entry(key, &value)?;
19056            }
19057        }
19058        state.end()
19059    }
19060}
19061
19062impl std::fmt::Debug for ReplicationCluster {
19063    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19064        let mut debug_struct = f.debug_struct("ReplicationCluster");
19065        debug_struct.field("psa_write_endpoint", &self.psa_write_endpoint);
19066        debug_struct.field("failover_dr_replica_name", &self.failover_dr_replica_name);
19067        debug_struct.field("dr_replica", &self.dr_replica);
19068        if !self._unknown_fields.is_empty() {
19069            debug_struct.field("_unknown_fields", &self._unknown_fields);
19070        }
19071        debug_struct.finish()
19072    }
19073}
19074
19075/// An available database version. It can be a major or a minor version.
19076#[derive(Clone, Default, PartialEq)]
19077#[non_exhaustive]
19078pub struct AvailableDatabaseVersion {
19079    /// The version's major version name.
19080    pub major_version: std::option::Option<std::string::String>,
19081
19082    /// The database version name. For MySQL 8.0, this string provides the database
19083    /// major and minor version.
19084    pub name: std::option::Option<std::string::String>,
19085
19086    /// The database version's display name.
19087    pub display_name: std::option::Option<std::string::String>,
19088
19089    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19090}
19091
19092impl AvailableDatabaseVersion {
19093    pub fn new() -> Self {
19094        std::default::Default::default()
19095    }
19096
19097    /// Sets the value of [major_version][crate::model::AvailableDatabaseVersion::major_version].
19098    pub fn set_major_version<T>(mut self, v: T) -> Self
19099    where
19100        T: std::convert::Into<std::string::String>,
19101    {
19102        self.major_version = std::option::Option::Some(v.into());
19103        self
19104    }
19105
19106    /// Sets or clears the value of [major_version][crate::model::AvailableDatabaseVersion::major_version].
19107    pub fn set_or_clear_major_version<T>(mut self, v: std::option::Option<T>) -> Self
19108    where
19109        T: std::convert::Into<std::string::String>,
19110    {
19111        self.major_version = v.map(|x| x.into());
19112        self
19113    }
19114
19115    /// Sets the value of [name][crate::model::AvailableDatabaseVersion::name].
19116    pub fn set_name<T>(mut self, v: T) -> Self
19117    where
19118        T: std::convert::Into<std::string::String>,
19119    {
19120        self.name = std::option::Option::Some(v.into());
19121        self
19122    }
19123
19124    /// Sets or clears the value of [name][crate::model::AvailableDatabaseVersion::name].
19125    pub fn set_or_clear_name<T>(mut self, v: std::option::Option<T>) -> Self
19126    where
19127        T: std::convert::Into<std::string::String>,
19128    {
19129        self.name = v.map(|x| x.into());
19130        self
19131    }
19132
19133    /// Sets the value of [display_name][crate::model::AvailableDatabaseVersion::display_name].
19134    pub fn set_display_name<T>(mut self, v: T) -> Self
19135    where
19136        T: std::convert::Into<std::string::String>,
19137    {
19138        self.display_name = std::option::Option::Some(v.into());
19139        self
19140    }
19141
19142    /// Sets or clears the value of [display_name][crate::model::AvailableDatabaseVersion::display_name].
19143    pub fn set_or_clear_display_name<T>(mut self, v: std::option::Option<T>) -> Self
19144    where
19145        T: std::convert::Into<std::string::String>,
19146    {
19147        self.display_name = v.map(|x| x.into());
19148        self
19149    }
19150}
19151
19152impl wkt::message::Message for AvailableDatabaseVersion {
19153    fn typename() -> &'static str {
19154        "type.googleapis.com/google.cloud.sql.v1.AvailableDatabaseVersion"
19155    }
19156}
19157
19158#[doc(hidden)]
19159impl<'de> serde::de::Deserialize<'de> for AvailableDatabaseVersion {
19160    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19161    where
19162        D: serde::Deserializer<'de>,
19163    {
19164        #[allow(non_camel_case_types)]
19165        #[doc(hidden)]
19166        #[derive(PartialEq, Eq, Hash)]
19167        enum __FieldTag {
19168            __major_version,
19169            __name,
19170            __display_name,
19171            Unknown(std::string::String),
19172        }
19173        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
19174            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19175            where
19176                D: serde::Deserializer<'de>,
19177            {
19178                struct Visitor;
19179                impl<'de> serde::de::Visitor<'de> for Visitor {
19180                    type Value = __FieldTag;
19181                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19182                        formatter.write_str("a field name for AvailableDatabaseVersion")
19183                    }
19184                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19185                    where
19186                        E: serde::de::Error,
19187                    {
19188                        use std::result::Result::Ok;
19189                        use std::string::ToString;
19190                        match value {
19191                            "majorVersion" => Ok(__FieldTag::__major_version),
19192                            "major_version" => Ok(__FieldTag::__major_version),
19193                            "name" => Ok(__FieldTag::__name),
19194                            "displayName" => Ok(__FieldTag::__display_name),
19195                            "display_name" => Ok(__FieldTag::__display_name),
19196                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19197                        }
19198                    }
19199                }
19200                deserializer.deserialize_identifier(Visitor)
19201            }
19202        }
19203        struct Visitor;
19204        impl<'de> serde::de::Visitor<'de> for Visitor {
19205            type Value = AvailableDatabaseVersion;
19206            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19207                formatter.write_str("struct AvailableDatabaseVersion")
19208            }
19209            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19210            where
19211                A: serde::de::MapAccess<'de>,
19212            {
19213                #[allow(unused_imports)]
19214                use serde::de::Error;
19215                use std::option::Option::Some;
19216                let mut fields = std::collections::HashSet::new();
19217                let mut result = Self::Value::new();
19218                while let Some(tag) = map.next_key::<__FieldTag>()? {
19219                    #[allow(clippy::match_single_binding)]
19220                    match tag {
19221                        __FieldTag::__major_version => {
19222                            if !fields.insert(__FieldTag::__major_version) {
19223                                return std::result::Result::Err(A::Error::duplicate_field(
19224                                    "multiple values for major_version",
19225                                ));
19226                            }
19227                            result.major_version =
19228                                map.next_value::<std::option::Option<std::string::String>>()?;
19229                        }
19230                        __FieldTag::__name => {
19231                            if !fields.insert(__FieldTag::__name) {
19232                                return std::result::Result::Err(A::Error::duplicate_field(
19233                                    "multiple values for name",
19234                                ));
19235                            }
19236                            result.name =
19237                                map.next_value::<std::option::Option<std::string::String>>()?;
19238                        }
19239                        __FieldTag::__display_name => {
19240                            if !fields.insert(__FieldTag::__display_name) {
19241                                return std::result::Result::Err(A::Error::duplicate_field(
19242                                    "multiple values for display_name",
19243                                ));
19244                            }
19245                            result.display_name =
19246                                map.next_value::<std::option::Option<std::string::String>>()?;
19247                        }
19248                        __FieldTag::Unknown(key) => {
19249                            let value = map.next_value::<serde_json::Value>()?;
19250                            result._unknown_fields.insert(key, value);
19251                        }
19252                    }
19253                }
19254                std::result::Result::Ok(result)
19255            }
19256        }
19257        deserializer.deserialize_any(Visitor)
19258    }
19259}
19260
19261#[doc(hidden)]
19262impl serde::ser::Serialize for AvailableDatabaseVersion {
19263    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19264    where
19265        S: serde::ser::Serializer,
19266    {
19267        use serde::ser::SerializeMap;
19268        #[allow(unused_imports)]
19269        use std::option::Option::Some;
19270        let mut state = serializer.serialize_map(std::option::Option::None)?;
19271        if self.major_version.is_some() {
19272            state.serialize_entry("majorVersion", &self.major_version)?;
19273        }
19274        if self.name.is_some() {
19275            state.serialize_entry("name", &self.name)?;
19276        }
19277        if self.display_name.is_some() {
19278            state.serialize_entry("displayName", &self.display_name)?;
19279        }
19280        if !self._unknown_fields.is_empty() {
19281            for (key, value) in self._unknown_fields.iter() {
19282                state.serialize_entry(key, &value)?;
19283            }
19284        }
19285        state.end()
19286    }
19287}
19288
19289impl std::fmt::Debug for AvailableDatabaseVersion {
19290    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19291        let mut debug_struct = f.debug_struct("AvailableDatabaseVersion");
19292        debug_struct.field("major_version", &self.major_version);
19293        debug_struct.field("name", &self.name);
19294        debug_struct.field("display_name", &self.display_name);
19295        if !self._unknown_fields.is_empty() {
19296            debug_struct.field("_unknown_fields", &self._unknown_fields);
19297        }
19298        debug_struct.finish()
19299    }
19300}
19301
19302/// Reschedule options for maintenance windows.
19303#[derive(Clone, Default, PartialEq)]
19304#[non_exhaustive]
19305pub struct SqlInstancesRescheduleMaintenanceRequestBody {
19306    /// Required. The type of the reschedule the user wants.
19307    pub reschedule: std::option::Option<
19308        crate::model::sql_instances_reschedule_maintenance_request_body::Reschedule,
19309    >,
19310
19311    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19312}
19313
19314impl SqlInstancesRescheduleMaintenanceRequestBody {
19315    pub fn new() -> Self {
19316        std::default::Default::default()
19317    }
19318
19319    /// Sets the value of [reschedule][crate::model::SqlInstancesRescheduleMaintenanceRequestBody::reschedule].
19320    pub fn set_reschedule<T>(mut self, v: T) -> Self
19321    where
19322        T: std::convert::Into<
19323                crate::model::sql_instances_reschedule_maintenance_request_body::Reschedule,
19324            >,
19325    {
19326        self.reschedule = std::option::Option::Some(v.into());
19327        self
19328    }
19329
19330    /// Sets or clears the value of [reschedule][crate::model::SqlInstancesRescheduleMaintenanceRequestBody::reschedule].
19331    pub fn set_or_clear_reschedule<T>(mut self, v: std::option::Option<T>) -> Self
19332    where
19333        T: std::convert::Into<
19334                crate::model::sql_instances_reschedule_maintenance_request_body::Reschedule,
19335            >,
19336    {
19337        self.reschedule = v.map(|x| x.into());
19338        self
19339    }
19340}
19341
19342impl wkt::message::Message for SqlInstancesRescheduleMaintenanceRequestBody {
19343    fn typename() -> &'static str {
19344        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody"
19345    }
19346}
19347
19348#[doc(hidden)]
19349impl<'de> serde::de::Deserialize<'de> for SqlInstancesRescheduleMaintenanceRequestBody {
19350    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19351    where
19352        D: serde::Deserializer<'de>,
19353    {
19354        #[allow(non_camel_case_types)]
19355        #[doc(hidden)]
19356        #[derive(PartialEq, Eq, Hash)]
19357        enum __FieldTag {
19358            __reschedule,
19359            Unknown(std::string::String),
19360        }
19361        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
19362            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19363            where
19364                D: serde::Deserializer<'de>,
19365            {
19366                struct Visitor;
19367                impl<'de> serde::de::Visitor<'de> for Visitor {
19368                    type Value = __FieldTag;
19369                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19370                        formatter.write_str(
19371                            "a field name for SqlInstancesRescheduleMaintenanceRequestBody",
19372                        )
19373                    }
19374                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19375                    where
19376                        E: serde::de::Error,
19377                    {
19378                        use std::result::Result::Ok;
19379                        use std::string::ToString;
19380                        match value {
19381                            "reschedule" => Ok(__FieldTag::__reschedule),
19382                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19383                        }
19384                    }
19385                }
19386                deserializer.deserialize_identifier(Visitor)
19387            }
19388        }
19389        struct Visitor;
19390        impl<'de> serde::de::Visitor<'de> for Visitor {
19391            type Value = SqlInstancesRescheduleMaintenanceRequestBody;
19392            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19393                formatter.write_str("struct SqlInstancesRescheduleMaintenanceRequestBody")
19394            }
19395            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19396            where
19397                A: serde::de::MapAccess<'de>,
19398            {
19399                #[allow(unused_imports)]
19400                use serde::de::Error;
19401                use std::option::Option::Some;
19402                let mut fields = std::collections::HashSet::new();
19403                let mut result = Self::Value::new();
19404                while let Some(tag) = map.next_key::<__FieldTag>()? {
19405                    #[allow(clippy::match_single_binding)]
19406                    match tag {
19407                        __FieldTag::__reschedule => {
19408                            if !fields.insert(__FieldTag::__reschedule) {
19409                                return std::result::Result::Err(A::Error::duplicate_field(
19410                                    "multiple values for reschedule",
19411                                ));
19412                            }
19413                            result.reschedule = map.next_value::<std::option::Option<crate::model::sql_instances_reschedule_maintenance_request_body::Reschedule>>()?
19414                                ;
19415                        }
19416                        __FieldTag::Unknown(key) => {
19417                            let value = map.next_value::<serde_json::Value>()?;
19418                            result._unknown_fields.insert(key, value);
19419                        }
19420                    }
19421                }
19422                std::result::Result::Ok(result)
19423            }
19424        }
19425        deserializer.deserialize_any(Visitor)
19426    }
19427}
19428
19429#[doc(hidden)]
19430impl serde::ser::Serialize for SqlInstancesRescheduleMaintenanceRequestBody {
19431    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19432    where
19433        S: serde::ser::Serializer,
19434    {
19435        use serde::ser::SerializeMap;
19436        #[allow(unused_imports)]
19437        use std::option::Option::Some;
19438        let mut state = serializer.serialize_map(std::option::Option::None)?;
19439        if self.reschedule.is_some() {
19440            state.serialize_entry("reschedule", &self.reschedule)?;
19441        }
19442        if !self._unknown_fields.is_empty() {
19443            for (key, value) in self._unknown_fields.iter() {
19444                state.serialize_entry(key, &value)?;
19445            }
19446        }
19447        state.end()
19448    }
19449}
19450
19451impl std::fmt::Debug for SqlInstancesRescheduleMaintenanceRequestBody {
19452    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19453        let mut debug_struct = f.debug_struct("SqlInstancesRescheduleMaintenanceRequestBody");
19454        debug_struct.field("reschedule", &self.reschedule);
19455        if !self._unknown_fields.is_empty() {
19456            debug_struct.field("_unknown_fields", &self._unknown_fields);
19457        }
19458        debug_struct.finish()
19459    }
19460}
19461
19462/// Defines additional types related to [SqlInstancesRescheduleMaintenanceRequestBody].
19463pub mod sql_instances_reschedule_maintenance_request_body {
19464    #[allow(unused_imports)]
19465    use super::*;
19466
19467    #[derive(Clone, Default, PartialEq)]
19468    #[non_exhaustive]
19469    pub struct Reschedule {
19470        /// Required. The type of the reschedule.
19471        pub reschedule_type:
19472            crate::model::sql_instances_reschedule_maintenance_request_body::RescheduleType,
19473
19474        /// Optional. Timestamp when the maintenance shall be rescheduled to if
19475        /// reschedule_type=SPECIFIC_TIME, in
19476        /// [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example
19477        /// `2012-11-15T16:19:00.094Z`.
19478        pub schedule_time: std::option::Option<wkt::Timestamp>,
19479
19480        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19481    }
19482
19483    impl Reschedule {
19484        pub fn new() -> Self {
19485            std::default::Default::default()
19486        }
19487
19488        /// Sets the value of [reschedule_type][crate::model::sql_instances_reschedule_maintenance_request_body::Reschedule::reschedule_type].
19489        pub fn set_reschedule_type<
19490            T: std::convert::Into<
19491                    crate::model::sql_instances_reschedule_maintenance_request_body::RescheduleType,
19492                >,
19493        >(
19494            mut self,
19495            v: T,
19496        ) -> Self {
19497            self.reschedule_type = v.into();
19498            self
19499        }
19500
19501        /// Sets the value of [schedule_time][crate::model::sql_instances_reschedule_maintenance_request_body::Reschedule::schedule_time].
19502        pub fn set_schedule_time<T>(mut self, v: T) -> Self
19503        where
19504            T: std::convert::Into<wkt::Timestamp>,
19505        {
19506            self.schedule_time = std::option::Option::Some(v.into());
19507            self
19508        }
19509
19510        /// Sets or clears the value of [schedule_time][crate::model::sql_instances_reschedule_maintenance_request_body::Reschedule::schedule_time].
19511        pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
19512        where
19513            T: std::convert::Into<wkt::Timestamp>,
19514        {
19515            self.schedule_time = v.map(|x| x.into());
19516            self
19517        }
19518    }
19519
19520    impl wkt::message::Message for Reschedule {
19521        fn typename() -> &'static str {
19522            "type.googleapis.com/google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule"
19523        }
19524    }
19525
19526    #[doc(hidden)]
19527    impl<'de> serde::de::Deserialize<'de> for Reschedule {
19528        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19529        where
19530            D: serde::Deserializer<'de>,
19531        {
19532            #[allow(non_camel_case_types)]
19533            #[doc(hidden)]
19534            #[derive(PartialEq, Eq, Hash)]
19535            enum __FieldTag {
19536                __reschedule_type,
19537                __schedule_time,
19538                Unknown(std::string::String),
19539            }
19540            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
19541                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19542                where
19543                    D: serde::Deserializer<'de>,
19544                {
19545                    struct Visitor;
19546                    impl<'de> serde::de::Visitor<'de> for Visitor {
19547                        type Value = __FieldTag;
19548                        fn expecting(
19549                            &self,
19550                            formatter: &mut std::fmt::Formatter,
19551                        ) -> std::fmt::Result {
19552                            formatter.write_str("a field name for Reschedule")
19553                        }
19554                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19555                        where
19556                            E: serde::de::Error,
19557                        {
19558                            use std::result::Result::Ok;
19559                            use std::string::ToString;
19560                            match value {
19561                                "rescheduleType" => Ok(__FieldTag::__reschedule_type),
19562                                "reschedule_type" => Ok(__FieldTag::__reschedule_type),
19563                                "scheduleTime" => Ok(__FieldTag::__schedule_time),
19564                                "schedule_time" => Ok(__FieldTag::__schedule_time),
19565                                _ => Ok(__FieldTag::Unknown(value.to_string())),
19566                            }
19567                        }
19568                    }
19569                    deserializer.deserialize_identifier(Visitor)
19570                }
19571            }
19572            struct Visitor;
19573            impl<'de> serde::de::Visitor<'de> for Visitor {
19574                type Value = Reschedule;
19575                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19576                    formatter.write_str("struct Reschedule")
19577                }
19578                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19579                where
19580                    A: serde::de::MapAccess<'de>,
19581                {
19582                    #[allow(unused_imports)]
19583                    use serde::de::Error;
19584                    use std::option::Option::Some;
19585                    let mut fields = std::collections::HashSet::new();
19586                    let mut result = Self::Value::new();
19587                    while let Some(tag) = map.next_key::<__FieldTag>()? {
19588                        #[allow(clippy::match_single_binding)]
19589                        match tag {
19590                            __FieldTag::__reschedule_type => {
19591                                if !fields.insert(__FieldTag::__reschedule_type) {
19592                                    return std::result::Result::Err(A::Error::duplicate_field(
19593                                        "multiple values for reschedule_type",
19594                                    ));
19595                                }
19596                                result.reschedule_type = map.next_value::<std::option::Option<crate::model::sql_instances_reschedule_maintenance_request_body::RescheduleType>>()?.unwrap_or_default();
19597                            }
19598                            __FieldTag::__schedule_time => {
19599                                if !fields.insert(__FieldTag::__schedule_time) {
19600                                    return std::result::Result::Err(A::Error::duplicate_field(
19601                                        "multiple values for schedule_time",
19602                                    ));
19603                                }
19604                                result.schedule_time =
19605                                    map.next_value::<std::option::Option<wkt::Timestamp>>()?;
19606                            }
19607                            __FieldTag::Unknown(key) => {
19608                                let value = map.next_value::<serde_json::Value>()?;
19609                                result._unknown_fields.insert(key, value);
19610                            }
19611                        }
19612                    }
19613                    std::result::Result::Ok(result)
19614                }
19615            }
19616            deserializer.deserialize_any(Visitor)
19617        }
19618    }
19619
19620    #[doc(hidden)]
19621    impl serde::ser::Serialize for Reschedule {
19622        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19623        where
19624            S: serde::ser::Serializer,
19625        {
19626            use serde::ser::SerializeMap;
19627            #[allow(unused_imports)]
19628            use std::option::Option::Some;
19629            let mut state = serializer.serialize_map(std::option::Option::None)?;
19630            if !wkt::internal::is_default(&self.reschedule_type) {
19631                state.serialize_entry("rescheduleType", &self.reschedule_type)?;
19632            }
19633            if self.schedule_time.is_some() {
19634                state.serialize_entry("scheduleTime", &self.schedule_time)?;
19635            }
19636            if !self._unknown_fields.is_empty() {
19637                for (key, value) in self._unknown_fields.iter() {
19638                    state.serialize_entry(key, &value)?;
19639                }
19640            }
19641            state.end()
19642        }
19643    }
19644
19645    impl std::fmt::Debug for Reschedule {
19646        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19647            let mut debug_struct = f.debug_struct("Reschedule");
19648            debug_struct.field("reschedule_type", &self.reschedule_type);
19649            debug_struct.field("schedule_time", &self.schedule_time);
19650            if !self._unknown_fields.is_empty() {
19651                debug_struct.field("_unknown_fields", &self._unknown_fields);
19652            }
19653            debug_struct.finish()
19654        }
19655    }
19656
19657    ///
19658    /// # Working with unknown values
19659    ///
19660    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19661    /// additional enum variants at any time. Adding new variants is not considered
19662    /// a breaking change. Applications should write their code in anticipation of:
19663    ///
19664    /// - New values appearing in future releases of the client library, **and**
19665    /// - New values received dynamically, without application changes.
19666    ///
19667    /// Please consult the [Working with enums] section in the user guide for some
19668    /// guidelines.
19669    ///
19670    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
19671    #[derive(Clone, Debug, PartialEq)]
19672    #[non_exhaustive]
19673    pub enum RescheduleType {
19674        Unspecified,
19675        /// Reschedules maintenance to happen now (within 5 minutes).
19676        Immediate,
19677        /// Reschedules maintenance to occur within one week from the originally
19678        /// scheduled day and time.
19679        NextAvailableWindow,
19680        /// Reschedules maintenance to a specific time and day.
19681        SpecificTime,
19682        /// If set, the enum was initialized with an unknown value.
19683        ///
19684        /// Applications can examine the value using [RescheduleType::value] or
19685        /// [RescheduleType::name].
19686        UnknownValue(reschedule_type::UnknownValue),
19687    }
19688
19689    #[doc(hidden)]
19690    pub mod reschedule_type {
19691        #[allow(unused_imports)]
19692        use super::*;
19693        #[derive(Clone, Debug, PartialEq)]
19694        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19695    }
19696
19697    impl RescheduleType {
19698        /// Gets the enum value.
19699        ///
19700        /// Returns `None` if the enum contains an unknown value deserialized from
19701        /// the string representation of enums.
19702        pub fn value(&self) -> std::option::Option<i32> {
19703            match self {
19704                Self::Unspecified => std::option::Option::Some(0),
19705                Self::Immediate => std::option::Option::Some(1),
19706                Self::NextAvailableWindow => std::option::Option::Some(2),
19707                Self::SpecificTime => std::option::Option::Some(3),
19708                Self::UnknownValue(u) => u.0.value(),
19709            }
19710        }
19711
19712        /// Gets the enum value as a string.
19713        ///
19714        /// Returns `None` if the enum contains an unknown value deserialized from
19715        /// the integer representation of enums.
19716        pub fn name(&self) -> std::option::Option<&str> {
19717            match self {
19718                Self::Unspecified => std::option::Option::Some("RESCHEDULE_TYPE_UNSPECIFIED"),
19719                Self::Immediate => std::option::Option::Some("IMMEDIATE"),
19720                Self::NextAvailableWindow => std::option::Option::Some("NEXT_AVAILABLE_WINDOW"),
19721                Self::SpecificTime => std::option::Option::Some("SPECIFIC_TIME"),
19722                Self::UnknownValue(u) => u.0.name(),
19723            }
19724        }
19725    }
19726
19727    impl std::default::Default for RescheduleType {
19728        fn default() -> Self {
19729            use std::convert::From;
19730            Self::from(0)
19731        }
19732    }
19733
19734    impl std::fmt::Display for RescheduleType {
19735        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19736            wkt::internal::display_enum(f, self.name(), self.value())
19737        }
19738    }
19739
19740    impl std::convert::From<i32> for RescheduleType {
19741        fn from(value: i32) -> Self {
19742            match value {
19743                0 => Self::Unspecified,
19744                1 => Self::Immediate,
19745                2 => Self::NextAvailableWindow,
19746                3 => Self::SpecificTime,
19747                _ => Self::UnknownValue(reschedule_type::UnknownValue(
19748                    wkt::internal::UnknownEnumValue::Integer(value),
19749                )),
19750            }
19751        }
19752    }
19753
19754    impl std::convert::From<&str> for RescheduleType {
19755        fn from(value: &str) -> Self {
19756            use std::string::ToString;
19757            match value {
19758                "RESCHEDULE_TYPE_UNSPECIFIED" => Self::Unspecified,
19759                "IMMEDIATE" => Self::Immediate,
19760                "NEXT_AVAILABLE_WINDOW" => Self::NextAvailableWindow,
19761                "SPECIFIC_TIME" => Self::SpecificTime,
19762                _ => Self::UnknownValue(reschedule_type::UnknownValue(
19763                    wkt::internal::UnknownEnumValue::String(value.to_string()),
19764                )),
19765            }
19766        }
19767    }
19768
19769    impl serde::ser::Serialize for RescheduleType {
19770        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19771        where
19772            S: serde::Serializer,
19773        {
19774            match self {
19775                Self::Unspecified => serializer.serialize_i32(0),
19776                Self::Immediate => serializer.serialize_i32(1),
19777                Self::NextAvailableWindow => serializer.serialize_i32(2),
19778                Self::SpecificTime => serializer.serialize_i32(3),
19779                Self::UnknownValue(u) => u.0.serialize(serializer),
19780            }
19781        }
19782    }
19783
19784    impl<'de> serde::de::Deserialize<'de> for RescheduleType {
19785        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19786        where
19787            D: serde::Deserializer<'de>,
19788        {
19789            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RescheduleType>::new(
19790                ".google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType",
19791            ))
19792        }
19793    }
19794}
19795
19796/// Database instance demote primary instance context.
19797#[derive(Clone, Default, PartialEq)]
19798#[non_exhaustive]
19799pub struct DemoteMasterContext {
19800    /// This is always `sql#demoteMasterContext`.
19801    pub kind: std::string::String,
19802
19803    /// Verify the GTID consistency for demote operation. Default value:
19804    /// `True`. Setting this flag to `false` enables you to bypass the GTID
19805    /// consistency check between on-premises primary instance and Cloud SQL
19806    /// instance during the demotion operation but also exposes you to the risk of
19807    /// future replication failures. Change the value only if you know the reason
19808    /// for the GTID divergence and are confident that doing so will not cause any
19809    /// replication issues.
19810    pub verify_gtid_consistency: std::option::Option<wkt::BoolValue>,
19811
19812    /// The name of the instance which will act as on-premises primary instance
19813    /// in the replication setup.
19814    pub master_instance_name: std::string::String,
19815
19816    /// Configuration specific to read-replicas replicating from the on-premises
19817    /// primary instance.
19818    pub replica_configuration: std::option::Option<crate::model::DemoteMasterConfiguration>,
19819
19820    /// Flag to skip replication setup on the instance.
19821    pub skip_replication_setup: bool,
19822
19823    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19824}
19825
19826impl DemoteMasterContext {
19827    pub fn new() -> Self {
19828        std::default::Default::default()
19829    }
19830
19831    /// Sets the value of [kind][crate::model::DemoteMasterContext::kind].
19832    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19833        self.kind = v.into();
19834        self
19835    }
19836
19837    /// Sets the value of [verify_gtid_consistency][crate::model::DemoteMasterContext::verify_gtid_consistency].
19838    pub fn set_verify_gtid_consistency<T>(mut self, v: T) -> Self
19839    where
19840        T: std::convert::Into<wkt::BoolValue>,
19841    {
19842        self.verify_gtid_consistency = std::option::Option::Some(v.into());
19843        self
19844    }
19845
19846    /// Sets or clears the value of [verify_gtid_consistency][crate::model::DemoteMasterContext::verify_gtid_consistency].
19847    pub fn set_or_clear_verify_gtid_consistency<T>(mut self, v: std::option::Option<T>) -> Self
19848    where
19849        T: std::convert::Into<wkt::BoolValue>,
19850    {
19851        self.verify_gtid_consistency = v.map(|x| x.into());
19852        self
19853    }
19854
19855    /// Sets the value of [master_instance_name][crate::model::DemoteMasterContext::master_instance_name].
19856    pub fn set_master_instance_name<T: std::convert::Into<std::string::String>>(
19857        mut self,
19858        v: T,
19859    ) -> Self {
19860        self.master_instance_name = v.into();
19861        self
19862    }
19863
19864    /// Sets the value of [replica_configuration][crate::model::DemoteMasterContext::replica_configuration].
19865    pub fn set_replica_configuration<T>(mut self, v: T) -> Self
19866    where
19867        T: std::convert::Into<crate::model::DemoteMasterConfiguration>,
19868    {
19869        self.replica_configuration = std::option::Option::Some(v.into());
19870        self
19871    }
19872
19873    /// Sets or clears the value of [replica_configuration][crate::model::DemoteMasterContext::replica_configuration].
19874    pub fn set_or_clear_replica_configuration<T>(mut self, v: std::option::Option<T>) -> Self
19875    where
19876        T: std::convert::Into<crate::model::DemoteMasterConfiguration>,
19877    {
19878        self.replica_configuration = v.map(|x| x.into());
19879        self
19880    }
19881
19882    /// Sets the value of [skip_replication_setup][crate::model::DemoteMasterContext::skip_replication_setup].
19883    pub fn set_skip_replication_setup<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19884        self.skip_replication_setup = v.into();
19885        self
19886    }
19887}
19888
19889impl wkt::message::Message for DemoteMasterContext {
19890    fn typename() -> &'static str {
19891        "type.googleapis.com/google.cloud.sql.v1.DemoteMasterContext"
19892    }
19893}
19894
19895#[doc(hidden)]
19896impl<'de> serde::de::Deserialize<'de> for DemoteMasterContext {
19897    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19898    where
19899        D: serde::Deserializer<'de>,
19900    {
19901        #[allow(non_camel_case_types)]
19902        #[doc(hidden)]
19903        #[derive(PartialEq, Eq, Hash)]
19904        enum __FieldTag {
19905            __kind,
19906            __verify_gtid_consistency,
19907            __master_instance_name,
19908            __replica_configuration,
19909            __skip_replication_setup,
19910            Unknown(std::string::String),
19911        }
19912        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
19913            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19914            where
19915                D: serde::Deserializer<'de>,
19916            {
19917                struct Visitor;
19918                impl<'de> serde::de::Visitor<'de> for Visitor {
19919                    type Value = __FieldTag;
19920                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19921                        formatter.write_str("a field name for DemoteMasterContext")
19922                    }
19923                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19924                    where
19925                        E: serde::de::Error,
19926                    {
19927                        use std::result::Result::Ok;
19928                        use std::string::ToString;
19929                        match value {
19930                            "kind" => Ok(__FieldTag::__kind),
19931                            "verifyGtidConsistency" => Ok(__FieldTag::__verify_gtid_consistency),
19932                            "verify_gtid_consistency" => Ok(__FieldTag::__verify_gtid_consistency),
19933                            "masterInstanceName" => Ok(__FieldTag::__master_instance_name),
19934                            "master_instance_name" => Ok(__FieldTag::__master_instance_name),
19935                            "replicaConfiguration" => Ok(__FieldTag::__replica_configuration),
19936                            "replica_configuration" => Ok(__FieldTag::__replica_configuration),
19937                            "skipReplicationSetup" => Ok(__FieldTag::__skip_replication_setup),
19938                            "skip_replication_setup" => Ok(__FieldTag::__skip_replication_setup),
19939                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19940                        }
19941                    }
19942                }
19943                deserializer.deserialize_identifier(Visitor)
19944            }
19945        }
19946        struct Visitor;
19947        impl<'de> serde::de::Visitor<'de> for Visitor {
19948            type Value = DemoteMasterContext;
19949            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19950                formatter.write_str("struct DemoteMasterContext")
19951            }
19952            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19953            where
19954                A: serde::de::MapAccess<'de>,
19955            {
19956                #[allow(unused_imports)]
19957                use serde::de::Error;
19958                use std::option::Option::Some;
19959                let mut fields = std::collections::HashSet::new();
19960                let mut result = Self::Value::new();
19961                while let Some(tag) = map.next_key::<__FieldTag>()? {
19962                    #[allow(clippy::match_single_binding)]
19963                    match tag {
19964                        __FieldTag::__kind => {
19965                            if !fields.insert(__FieldTag::__kind) {
19966                                return std::result::Result::Err(A::Error::duplicate_field(
19967                                    "multiple values for kind",
19968                                ));
19969                            }
19970                            result.kind = map
19971                                .next_value::<std::option::Option<std::string::String>>()?
19972                                .unwrap_or_default();
19973                        }
19974                        __FieldTag::__verify_gtid_consistency => {
19975                            if !fields.insert(__FieldTag::__verify_gtid_consistency) {
19976                                return std::result::Result::Err(A::Error::duplicate_field(
19977                                    "multiple values for verify_gtid_consistency",
19978                                ));
19979                            }
19980                            result.verify_gtid_consistency =
19981                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
19982                        }
19983                        __FieldTag::__master_instance_name => {
19984                            if !fields.insert(__FieldTag::__master_instance_name) {
19985                                return std::result::Result::Err(A::Error::duplicate_field(
19986                                    "multiple values for master_instance_name",
19987                                ));
19988                            }
19989                            result.master_instance_name = map
19990                                .next_value::<std::option::Option<std::string::String>>()?
19991                                .unwrap_or_default();
19992                        }
19993                        __FieldTag::__replica_configuration => {
19994                            if !fields.insert(__FieldTag::__replica_configuration) {
19995                                return std::result::Result::Err(A::Error::duplicate_field(
19996                                    "multiple values for replica_configuration",
19997                                ));
19998                            }
19999                            result.replica_configuration = map.next_value::<std::option::Option<crate::model::DemoteMasterConfiguration>>()?
20000                                ;
20001                        }
20002                        __FieldTag::__skip_replication_setup => {
20003                            if !fields.insert(__FieldTag::__skip_replication_setup) {
20004                                return std::result::Result::Err(A::Error::duplicate_field(
20005                                    "multiple values for skip_replication_setup",
20006                                ));
20007                            }
20008                            result.skip_replication_setup = map
20009                                .next_value::<std::option::Option<bool>>()?
20010                                .unwrap_or_default();
20011                        }
20012                        __FieldTag::Unknown(key) => {
20013                            let value = map.next_value::<serde_json::Value>()?;
20014                            result._unknown_fields.insert(key, value);
20015                        }
20016                    }
20017                }
20018                std::result::Result::Ok(result)
20019            }
20020        }
20021        deserializer.deserialize_any(Visitor)
20022    }
20023}
20024
20025#[doc(hidden)]
20026impl serde::ser::Serialize for DemoteMasterContext {
20027    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20028    where
20029        S: serde::ser::Serializer,
20030    {
20031        use serde::ser::SerializeMap;
20032        #[allow(unused_imports)]
20033        use std::option::Option::Some;
20034        let mut state = serializer.serialize_map(std::option::Option::None)?;
20035        if !self.kind.is_empty() {
20036            state.serialize_entry("kind", &self.kind)?;
20037        }
20038        if self.verify_gtid_consistency.is_some() {
20039            state.serialize_entry("verifyGtidConsistency", &self.verify_gtid_consistency)?;
20040        }
20041        if !self.master_instance_name.is_empty() {
20042            state.serialize_entry("masterInstanceName", &self.master_instance_name)?;
20043        }
20044        if self.replica_configuration.is_some() {
20045            state.serialize_entry("replicaConfiguration", &self.replica_configuration)?;
20046        }
20047        if !wkt::internal::is_default(&self.skip_replication_setup) {
20048            state.serialize_entry("skipReplicationSetup", &self.skip_replication_setup)?;
20049        }
20050        if !self._unknown_fields.is_empty() {
20051            for (key, value) in self._unknown_fields.iter() {
20052                state.serialize_entry(key, &value)?;
20053            }
20054        }
20055        state.end()
20056    }
20057}
20058
20059impl std::fmt::Debug for DemoteMasterContext {
20060    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20061        let mut debug_struct = f.debug_struct("DemoteMasterContext");
20062        debug_struct.field("kind", &self.kind);
20063        debug_struct.field("verify_gtid_consistency", &self.verify_gtid_consistency);
20064        debug_struct.field("master_instance_name", &self.master_instance_name);
20065        debug_struct.field("replica_configuration", &self.replica_configuration);
20066        debug_struct.field("skip_replication_setup", &self.skip_replication_setup);
20067        if !self._unknown_fields.is_empty() {
20068            debug_struct.field("_unknown_fields", &self._unknown_fields);
20069        }
20070        debug_struct.finish()
20071    }
20072}
20073
20074/// This context is used to demote an existing standalone instance to be
20075/// a Cloud SQL read replica for an external database server.
20076#[derive(Clone, Default, PartialEq)]
20077#[non_exhaustive]
20078pub struct DemoteContext {
20079    /// This is always `sql#demoteContext`.
20080    pub kind: std::string::String,
20081
20082    /// Required. The name of the instance which acts as the on-premises primary
20083    /// instance in the replication setup.
20084    pub source_representative_instance_name: std::string::String,
20085
20086    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20087}
20088
20089impl DemoteContext {
20090    pub fn new() -> Self {
20091        std::default::Default::default()
20092    }
20093
20094    /// Sets the value of [kind][crate::model::DemoteContext::kind].
20095    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20096        self.kind = v.into();
20097        self
20098    }
20099
20100    /// Sets the value of [source_representative_instance_name][crate::model::DemoteContext::source_representative_instance_name].
20101    pub fn set_source_representative_instance_name<T: std::convert::Into<std::string::String>>(
20102        mut self,
20103        v: T,
20104    ) -> Self {
20105        self.source_representative_instance_name = v.into();
20106        self
20107    }
20108}
20109
20110impl wkt::message::Message for DemoteContext {
20111    fn typename() -> &'static str {
20112        "type.googleapis.com/google.cloud.sql.v1.DemoteContext"
20113    }
20114}
20115
20116#[doc(hidden)]
20117impl<'de> serde::de::Deserialize<'de> for DemoteContext {
20118    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20119    where
20120        D: serde::Deserializer<'de>,
20121    {
20122        #[allow(non_camel_case_types)]
20123        #[doc(hidden)]
20124        #[derive(PartialEq, Eq, Hash)]
20125        enum __FieldTag {
20126            __kind,
20127            __source_representative_instance_name,
20128            Unknown(std::string::String),
20129        }
20130        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
20131            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20132            where
20133                D: serde::Deserializer<'de>,
20134            {
20135                struct Visitor;
20136                impl<'de> serde::de::Visitor<'de> for Visitor {
20137                    type Value = __FieldTag;
20138                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20139                        formatter.write_str("a field name for DemoteContext")
20140                    }
20141                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
20142                    where
20143                        E: serde::de::Error,
20144                    {
20145                        use std::result::Result::Ok;
20146                        use std::string::ToString;
20147                        match value {
20148                            "kind" => Ok(__FieldTag::__kind),
20149                            "sourceRepresentativeInstanceName" => {
20150                                Ok(__FieldTag::__source_representative_instance_name)
20151                            }
20152                            "source_representative_instance_name" => {
20153                                Ok(__FieldTag::__source_representative_instance_name)
20154                            }
20155                            _ => Ok(__FieldTag::Unknown(value.to_string())),
20156                        }
20157                    }
20158                }
20159                deserializer.deserialize_identifier(Visitor)
20160            }
20161        }
20162        struct Visitor;
20163        impl<'de> serde::de::Visitor<'de> for Visitor {
20164            type Value = DemoteContext;
20165            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20166                formatter.write_str("struct DemoteContext")
20167            }
20168            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
20169            where
20170                A: serde::de::MapAccess<'de>,
20171            {
20172                #[allow(unused_imports)]
20173                use serde::de::Error;
20174                use std::option::Option::Some;
20175                let mut fields = std::collections::HashSet::new();
20176                let mut result = Self::Value::new();
20177                while let Some(tag) = map.next_key::<__FieldTag>()? {
20178                    #[allow(clippy::match_single_binding)]
20179                    match tag {
20180                        __FieldTag::__kind => {
20181                            if !fields.insert(__FieldTag::__kind) {
20182                                return std::result::Result::Err(A::Error::duplicate_field(
20183                                    "multiple values for kind",
20184                                ));
20185                            }
20186                            result.kind = map
20187                                .next_value::<std::option::Option<std::string::String>>()?
20188                                .unwrap_or_default();
20189                        }
20190                        __FieldTag::__source_representative_instance_name => {
20191                            if !fields.insert(__FieldTag::__source_representative_instance_name) {
20192                                return std::result::Result::Err(A::Error::duplicate_field(
20193                                    "multiple values for source_representative_instance_name",
20194                                ));
20195                            }
20196                            result.source_representative_instance_name = map
20197                                .next_value::<std::option::Option<std::string::String>>()?
20198                                .unwrap_or_default();
20199                        }
20200                        __FieldTag::Unknown(key) => {
20201                            let value = map.next_value::<serde_json::Value>()?;
20202                            result._unknown_fields.insert(key, value);
20203                        }
20204                    }
20205                }
20206                std::result::Result::Ok(result)
20207            }
20208        }
20209        deserializer.deserialize_any(Visitor)
20210    }
20211}
20212
20213#[doc(hidden)]
20214impl serde::ser::Serialize for DemoteContext {
20215    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20216    where
20217        S: serde::ser::Serializer,
20218    {
20219        use serde::ser::SerializeMap;
20220        #[allow(unused_imports)]
20221        use std::option::Option::Some;
20222        let mut state = serializer.serialize_map(std::option::Option::None)?;
20223        if !self.kind.is_empty() {
20224            state.serialize_entry("kind", &self.kind)?;
20225        }
20226        if !self.source_representative_instance_name.is_empty() {
20227            state.serialize_entry(
20228                "sourceRepresentativeInstanceName",
20229                &self.source_representative_instance_name,
20230            )?;
20231        }
20232        if !self._unknown_fields.is_empty() {
20233            for (key, value) in self._unknown_fields.iter() {
20234                state.serialize_entry(key, &value)?;
20235            }
20236        }
20237        state.end()
20238    }
20239}
20240
20241impl std::fmt::Debug for DemoteContext {
20242    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20243        let mut debug_struct = f.debug_struct("DemoteContext");
20244        debug_struct.field("kind", &self.kind);
20245        debug_struct.field(
20246            "source_representative_instance_name",
20247            &self.source_representative_instance_name,
20248        );
20249        if !self._unknown_fields.is_empty() {
20250            debug_struct.field("_unknown_fields", &self._unknown_fields);
20251        }
20252        debug_struct.finish()
20253    }
20254}
20255
20256/// Database instance failover context.
20257#[derive(Clone, Default, PartialEq)]
20258#[non_exhaustive]
20259pub struct FailoverContext {
20260    /// The current settings version of this instance. Request will be rejected if
20261    /// this version doesn't match the current settings version.
20262    pub settings_version: i64,
20263
20264    /// This is always `sql#failoverContext`.
20265    pub kind: std::string::String,
20266
20267    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20268}
20269
20270impl FailoverContext {
20271    pub fn new() -> Self {
20272        std::default::Default::default()
20273    }
20274
20275    /// Sets the value of [settings_version][crate::model::FailoverContext::settings_version].
20276    pub fn set_settings_version<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20277        self.settings_version = v.into();
20278        self
20279    }
20280
20281    /// Sets the value of [kind][crate::model::FailoverContext::kind].
20282    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20283        self.kind = v.into();
20284        self
20285    }
20286}
20287
20288impl wkt::message::Message for FailoverContext {
20289    fn typename() -> &'static str {
20290        "type.googleapis.com/google.cloud.sql.v1.FailoverContext"
20291    }
20292}
20293
20294#[doc(hidden)]
20295impl<'de> serde::de::Deserialize<'de> for FailoverContext {
20296    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20297    where
20298        D: serde::Deserializer<'de>,
20299    {
20300        #[allow(non_camel_case_types)]
20301        #[doc(hidden)]
20302        #[derive(PartialEq, Eq, Hash)]
20303        enum __FieldTag {
20304            __settings_version,
20305            __kind,
20306            Unknown(std::string::String),
20307        }
20308        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
20309            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20310            where
20311                D: serde::Deserializer<'de>,
20312            {
20313                struct Visitor;
20314                impl<'de> serde::de::Visitor<'de> for Visitor {
20315                    type Value = __FieldTag;
20316                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20317                        formatter.write_str("a field name for FailoverContext")
20318                    }
20319                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
20320                    where
20321                        E: serde::de::Error,
20322                    {
20323                        use std::result::Result::Ok;
20324                        use std::string::ToString;
20325                        match value {
20326                            "settingsVersion" => Ok(__FieldTag::__settings_version),
20327                            "settings_version" => Ok(__FieldTag::__settings_version),
20328                            "kind" => Ok(__FieldTag::__kind),
20329                            _ => Ok(__FieldTag::Unknown(value.to_string())),
20330                        }
20331                    }
20332                }
20333                deserializer.deserialize_identifier(Visitor)
20334            }
20335        }
20336        struct Visitor;
20337        impl<'de> serde::de::Visitor<'de> for Visitor {
20338            type Value = FailoverContext;
20339            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20340                formatter.write_str("struct FailoverContext")
20341            }
20342            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
20343            where
20344                A: serde::de::MapAccess<'de>,
20345            {
20346                #[allow(unused_imports)]
20347                use serde::de::Error;
20348                use std::option::Option::Some;
20349                let mut fields = std::collections::HashSet::new();
20350                let mut result = Self::Value::new();
20351                while let Some(tag) = map.next_key::<__FieldTag>()? {
20352                    #[allow(clippy::match_single_binding)]
20353                    match tag {
20354                        __FieldTag::__settings_version => {
20355                            if !fields.insert(__FieldTag::__settings_version) {
20356                                return std::result::Result::Err(A::Error::duplicate_field(
20357                                    "multiple values for settings_version",
20358                                ));
20359                            }
20360                            struct __With(std::option::Option<i64>);
20361                            impl<'de> serde::de::Deserialize<'de> for __With {
20362                                fn deserialize<D>(
20363                                    deserializer: D,
20364                                ) -> std::result::Result<Self, D::Error>
20365                                where
20366                                    D: serde::de::Deserializer<'de>,
20367                                {
20368                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
20369                                }
20370                            }
20371                            result.settings_version =
20372                                map.next_value::<__With>()?.0.unwrap_or_default();
20373                        }
20374                        __FieldTag::__kind => {
20375                            if !fields.insert(__FieldTag::__kind) {
20376                                return std::result::Result::Err(A::Error::duplicate_field(
20377                                    "multiple values for kind",
20378                                ));
20379                            }
20380                            result.kind = map
20381                                .next_value::<std::option::Option<std::string::String>>()?
20382                                .unwrap_or_default();
20383                        }
20384                        __FieldTag::Unknown(key) => {
20385                            let value = map.next_value::<serde_json::Value>()?;
20386                            result._unknown_fields.insert(key, value);
20387                        }
20388                    }
20389                }
20390                std::result::Result::Ok(result)
20391            }
20392        }
20393        deserializer.deserialize_any(Visitor)
20394    }
20395}
20396
20397#[doc(hidden)]
20398impl serde::ser::Serialize for FailoverContext {
20399    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20400    where
20401        S: serde::ser::Serializer,
20402    {
20403        use serde::ser::SerializeMap;
20404        #[allow(unused_imports)]
20405        use std::option::Option::Some;
20406        let mut state = serializer.serialize_map(std::option::Option::None)?;
20407        if !wkt::internal::is_default(&self.settings_version) {
20408            struct __With<'a>(&'a i64);
20409            impl<'a> serde::ser::Serialize for __With<'a> {
20410                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20411                where
20412                    S: serde::ser::Serializer,
20413                {
20414                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
20415                }
20416            }
20417            state.serialize_entry("settingsVersion", &__With(&self.settings_version))?;
20418        }
20419        if !self.kind.is_empty() {
20420            state.serialize_entry("kind", &self.kind)?;
20421        }
20422        if !self._unknown_fields.is_empty() {
20423            for (key, value) in self._unknown_fields.iter() {
20424                state.serialize_entry(key, &value)?;
20425            }
20426        }
20427        state.end()
20428    }
20429}
20430
20431impl std::fmt::Debug for FailoverContext {
20432    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20433        let mut debug_struct = f.debug_struct("FailoverContext");
20434        debug_struct.field("settings_version", &self.settings_version);
20435        debug_struct.field("kind", &self.kind);
20436        if !self._unknown_fields.is_empty() {
20437            debug_struct.field("_unknown_fields", &self._unknown_fields);
20438        }
20439        debug_struct.finish()
20440    }
20441}
20442
20443/// Database instance restore from backup context.
20444/// Backup context contains source instance id and project id.
20445#[derive(Clone, Default, PartialEq)]
20446#[non_exhaustive]
20447pub struct RestoreBackupContext {
20448    /// This is always `sql#restoreBackupContext`.
20449    pub kind: std::string::String,
20450
20451    /// The ID of the backup run to restore from.
20452    pub backup_run_id: i64,
20453
20454    /// The ID of the instance that the backup was taken from.
20455    pub instance_id: std::string::String,
20456
20457    /// The full project ID of the source instance.
20458    pub project: std::string::String,
20459
20460    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20461}
20462
20463impl RestoreBackupContext {
20464    pub fn new() -> Self {
20465        std::default::Default::default()
20466    }
20467
20468    /// Sets the value of [kind][crate::model::RestoreBackupContext::kind].
20469    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20470        self.kind = v.into();
20471        self
20472    }
20473
20474    /// Sets the value of [backup_run_id][crate::model::RestoreBackupContext::backup_run_id].
20475    pub fn set_backup_run_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20476        self.backup_run_id = v.into();
20477        self
20478    }
20479
20480    /// Sets the value of [instance_id][crate::model::RestoreBackupContext::instance_id].
20481    pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20482        self.instance_id = v.into();
20483        self
20484    }
20485
20486    /// Sets the value of [project][crate::model::RestoreBackupContext::project].
20487    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20488        self.project = v.into();
20489        self
20490    }
20491}
20492
20493impl wkt::message::Message for RestoreBackupContext {
20494    fn typename() -> &'static str {
20495        "type.googleapis.com/google.cloud.sql.v1.RestoreBackupContext"
20496    }
20497}
20498
20499#[doc(hidden)]
20500impl<'de> serde::de::Deserialize<'de> for RestoreBackupContext {
20501    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20502    where
20503        D: serde::Deserializer<'de>,
20504    {
20505        #[allow(non_camel_case_types)]
20506        #[doc(hidden)]
20507        #[derive(PartialEq, Eq, Hash)]
20508        enum __FieldTag {
20509            __kind,
20510            __backup_run_id,
20511            __instance_id,
20512            __project,
20513            Unknown(std::string::String),
20514        }
20515        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
20516            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20517            where
20518                D: serde::Deserializer<'de>,
20519            {
20520                struct Visitor;
20521                impl<'de> serde::de::Visitor<'de> for Visitor {
20522                    type Value = __FieldTag;
20523                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20524                        formatter.write_str("a field name for RestoreBackupContext")
20525                    }
20526                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
20527                    where
20528                        E: serde::de::Error,
20529                    {
20530                        use std::result::Result::Ok;
20531                        use std::string::ToString;
20532                        match value {
20533                            "kind" => Ok(__FieldTag::__kind),
20534                            "backupRunId" => Ok(__FieldTag::__backup_run_id),
20535                            "backup_run_id" => Ok(__FieldTag::__backup_run_id),
20536                            "instanceId" => Ok(__FieldTag::__instance_id),
20537                            "instance_id" => Ok(__FieldTag::__instance_id),
20538                            "project" => Ok(__FieldTag::__project),
20539                            _ => Ok(__FieldTag::Unknown(value.to_string())),
20540                        }
20541                    }
20542                }
20543                deserializer.deserialize_identifier(Visitor)
20544            }
20545        }
20546        struct Visitor;
20547        impl<'de> serde::de::Visitor<'de> for Visitor {
20548            type Value = RestoreBackupContext;
20549            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20550                formatter.write_str("struct RestoreBackupContext")
20551            }
20552            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
20553            where
20554                A: serde::de::MapAccess<'de>,
20555            {
20556                #[allow(unused_imports)]
20557                use serde::de::Error;
20558                use std::option::Option::Some;
20559                let mut fields = std::collections::HashSet::new();
20560                let mut result = Self::Value::new();
20561                while let Some(tag) = map.next_key::<__FieldTag>()? {
20562                    #[allow(clippy::match_single_binding)]
20563                    match tag {
20564                        __FieldTag::__kind => {
20565                            if !fields.insert(__FieldTag::__kind) {
20566                                return std::result::Result::Err(A::Error::duplicate_field(
20567                                    "multiple values for kind",
20568                                ));
20569                            }
20570                            result.kind = map
20571                                .next_value::<std::option::Option<std::string::String>>()?
20572                                .unwrap_or_default();
20573                        }
20574                        __FieldTag::__backup_run_id => {
20575                            if !fields.insert(__FieldTag::__backup_run_id) {
20576                                return std::result::Result::Err(A::Error::duplicate_field(
20577                                    "multiple values for backup_run_id",
20578                                ));
20579                            }
20580                            struct __With(std::option::Option<i64>);
20581                            impl<'de> serde::de::Deserialize<'de> for __With {
20582                                fn deserialize<D>(
20583                                    deserializer: D,
20584                                ) -> std::result::Result<Self, D::Error>
20585                                where
20586                                    D: serde::de::Deserializer<'de>,
20587                                {
20588                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
20589                                }
20590                            }
20591                            result.backup_run_id =
20592                                map.next_value::<__With>()?.0.unwrap_or_default();
20593                        }
20594                        __FieldTag::__instance_id => {
20595                            if !fields.insert(__FieldTag::__instance_id) {
20596                                return std::result::Result::Err(A::Error::duplicate_field(
20597                                    "multiple values for instance_id",
20598                                ));
20599                            }
20600                            result.instance_id = map
20601                                .next_value::<std::option::Option<std::string::String>>()?
20602                                .unwrap_or_default();
20603                        }
20604                        __FieldTag::__project => {
20605                            if !fields.insert(__FieldTag::__project) {
20606                                return std::result::Result::Err(A::Error::duplicate_field(
20607                                    "multiple values for project",
20608                                ));
20609                            }
20610                            result.project = map
20611                                .next_value::<std::option::Option<std::string::String>>()?
20612                                .unwrap_or_default();
20613                        }
20614                        __FieldTag::Unknown(key) => {
20615                            let value = map.next_value::<serde_json::Value>()?;
20616                            result._unknown_fields.insert(key, value);
20617                        }
20618                    }
20619                }
20620                std::result::Result::Ok(result)
20621            }
20622        }
20623        deserializer.deserialize_any(Visitor)
20624    }
20625}
20626
20627#[doc(hidden)]
20628impl serde::ser::Serialize for RestoreBackupContext {
20629    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20630    where
20631        S: serde::ser::Serializer,
20632    {
20633        use serde::ser::SerializeMap;
20634        #[allow(unused_imports)]
20635        use std::option::Option::Some;
20636        let mut state = serializer.serialize_map(std::option::Option::None)?;
20637        if !self.kind.is_empty() {
20638            state.serialize_entry("kind", &self.kind)?;
20639        }
20640        if !wkt::internal::is_default(&self.backup_run_id) {
20641            struct __With<'a>(&'a i64);
20642            impl<'a> serde::ser::Serialize for __With<'a> {
20643                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20644                where
20645                    S: serde::ser::Serializer,
20646                {
20647                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
20648                }
20649            }
20650            state.serialize_entry("backupRunId", &__With(&self.backup_run_id))?;
20651        }
20652        if !self.instance_id.is_empty() {
20653            state.serialize_entry("instanceId", &self.instance_id)?;
20654        }
20655        if !self.project.is_empty() {
20656            state.serialize_entry("project", &self.project)?;
20657        }
20658        if !self._unknown_fields.is_empty() {
20659            for (key, value) in self._unknown_fields.iter() {
20660                state.serialize_entry(key, &value)?;
20661            }
20662        }
20663        state.end()
20664    }
20665}
20666
20667impl std::fmt::Debug for RestoreBackupContext {
20668    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20669        let mut debug_struct = f.debug_struct("RestoreBackupContext");
20670        debug_struct.field("kind", &self.kind);
20671        debug_struct.field("backup_run_id", &self.backup_run_id);
20672        debug_struct.field("instance_id", &self.instance_id);
20673        debug_struct.field("project", &self.project);
20674        if !self._unknown_fields.is_empty() {
20675            debug_struct.field("_unknown_fields", &self._unknown_fields);
20676        }
20677        debug_struct.finish()
20678    }
20679}
20680
20681/// Instance rotate server CA context.
20682#[derive(Clone, Default, PartialEq)]
20683#[non_exhaustive]
20684pub struct RotateServerCaContext {
20685    /// This is always `sql#rotateServerCaContext`.
20686    pub kind: std::string::String,
20687
20688    /// The fingerprint of the next version to be rotated to. If left unspecified,
20689    /// will be rotated to the most recently added server CA version.
20690    pub next_version: std::string::String,
20691
20692    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20693}
20694
20695impl RotateServerCaContext {
20696    pub fn new() -> Self {
20697        std::default::Default::default()
20698    }
20699
20700    /// Sets the value of [kind][crate::model::RotateServerCaContext::kind].
20701    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20702        self.kind = v.into();
20703        self
20704    }
20705
20706    /// Sets the value of [next_version][crate::model::RotateServerCaContext::next_version].
20707    pub fn set_next_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20708        self.next_version = v.into();
20709        self
20710    }
20711}
20712
20713impl wkt::message::Message for RotateServerCaContext {
20714    fn typename() -> &'static str {
20715        "type.googleapis.com/google.cloud.sql.v1.RotateServerCaContext"
20716    }
20717}
20718
20719#[doc(hidden)]
20720impl<'de> serde::de::Deserialize<'de> for RotateServerCaContext {
20721    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20722    where
20723        D: serde::Deserializer<'de>,
20724    {
20725        #[allow(non_camel_case_types)]
20726        #[doc(hidden)]
20727        #[derive(PartialEq, Eq, Hash)]
20728        enum __FieldTag {
20729            __kind,
20730            __next_version,
20731            Unknown(std::string::String),
20732        }
20733        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
20734            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20735            where
20736                D: serde::Deserializer<'de>,
20737            {
20738                struct Visitor;
20739                impl<'de> serde::de::Visitor<'de> for Visitor {
20740                    type Value = __FieldTag;
20741                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20742                        formatter.write_str("a field name for RotateServerCaContext")
20743                    }
20744                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
20745                    where
20746                        E: serde::de::Error,
20747                    {
20748                        use std::result::Result::Ok;
20749                        use std::string::ToString;
20750                        match value {
20751                            "kind" => Ok(__FieldTag::__kind),
20752                            "nextVersion" => Ok(__FieldTag::__next_version),
20753                            "next_version" => Ok(__FieldTag::__next_version),
20754                            _ => Ok(__FieldTag::Unknown(value.to_string())),
20755                        }
20756                    }
20757                }
20758                deserializer.deserialize_identifier(Visitor)
20759            }
20760        }
20761        struct Visitor;
20762        impl<'de> serde::de::Visitor<'de> for Visitor {
20763            type Value = RotateServerCaContext;
20764            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20765                formatter.write_str("struct RotateServerCaContext")
20766            }
20767            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
20768            where
20769                A: serde::de::MapAccess<'de>,
20770            {
20771                #[allow(unused_imports)]
20772                use serde::de::Error;
20773                use std::option::Option::Some;
20774                let mut fields = std::collections::HashSet::new();
20775                let mut result = Self::Value::new();
20776                while let Some(tag) = map.next_key::<__FieldTag>()? {
20777                    #[allow(clippy::match_single_binding)]
20778                    match tag {
20779                        __FieldTag::__kind => {
20780                            if !fields.insert(__FieldTag::__kind) {
20781                                return std::result::Result::Err(A::Error::duplicate_field(
20782                                    "multiple values for kind",
20783                                ));
20784                            }
20785                            result.kind = map
20786                                .next_value::<std::option::Option<std::string::String>>()?
20787                                .unwrap_or_default();
20788                        }
20789                        __FieldTag::__next_version => {
20790                            if !fields.insert(__FieldTag::__next_version) {
20791                                return std::result::Result::Err(A::Error::duplicate_field(
20792                                    "multiple values for next_version",
20793                                ));
20794                            }
20795                            result.next_version = map
20796                                .next_value::<std::option::Option<std::string::String>>()?
20797                                .unwrap_or_default();
20798                        }
20799                        __FieldTag::Unknown(key) => {
20800                            let value = map.next_value::<serde_json::Value>()?;
20801                            result._unknown_fields.insert(key, value);
20802                        }
20803                    }
20804                }
20805                std::result::Result::Ok(result)
20806            }
20807        }
20808        deserializer.deserialize_any(Visitor)
20809    }
20810}
20811
20812#[doc(hidden)]
20813impl serde::ser::Serialize for RotateServerCaContext {
20814    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20815    where
20816        S: serde::ser::Serializer,
20817    {
20818        use serde::ser::SerializeMap;
20819        #[allow(unused_imports)]
20820        use std::option::Option::Some;
20821        let mut state = serializer.serialize_map(std::option::Option::None)?;
20822        if !self.kind.is_empty() {
20823            state.serialize_entry("kind", &self.kind)?;
20824        }
20825        if !self.next_version.is_empty() {
20826            state.serialize_entry("nextVersion", &self.next_version)?;
20827        }
20828        if !self._unknown_fields.is_empty() {
20829            for (key, value) in self._unknown_fields.iter() {
20830                state.serialize_entry(key, &value)?;
20831            }
20832        }
20833        state.end()
20834    }
20835}
20836
20837impl std::fmt::Debug for RotateServerCaContext {
20838    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20839        let mut debug_struct = f.debug_struct("RotateServerCaContext");
20840        debug_struct.field("kind", &self.kind);
20841        debug_struct.field("next_version", &self.next_version);
20842        if !self._unknown_fields.is_empty() {
20843            debug_struct.field("_unknown_fields", &self._unknown_fields);
20844        }
20845        debug_struct.finish()
20846    }
20847}
20848
20849/// Database Instance truncate log context.
20850#[derive(Clone, Default, PartialEq)]
20851#[non_exhaustive]
20852pub struct TruncateLogContext {
20853    /// This is always `sql#truncateLogContext`.
20854    pub kind: std::string::String,
20855
20856    /// The type of log to truncate. Valid values are `MYSQL_GENERAL_TABLE` and
20857    /// `MYSQL_SLOW_TABLE`.
20858    pub log_type: std::string::String,
20859
20860    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20861}
20862
20863impl TruncateLogContext {
20864    pub fn new() -> Self {
20865        std::default::Default::default()
20866    }
20867
20868    /// Sets the value of [kind][crate::model::TruncateLogContext::kind].
20869    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20870        self.kind = v.into();
20871        self
20872    }
20873
20874    /// Sets the value of [log_type][crate::model::TruncateLogContext::log_type].
20875    pub fn set_log_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20876        self.log_type = v.into();
20877        self
20878    }
20879}
20880
20881impl wkt::message::Message for TruncateLogContext {
20882    fn typename() -> &'static str {
20883        "type.googleapis.com/google.cloud.sql.v1.TruncateLogContext"
20884    }
20885}
20886
20887#[doc(hidden)]
20888impl<'de> serde::de::Deserialize<'de> for TruncateLogContext {
20889    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20890    where
20891        D: serde::Deserializer<'de>,
20892    {
20893        #[allow(non_camel_case_types)]
20894        #[doc(hidden)]
20895        #[derive(PartialEq, Eq, Hash)]
20896        enum __FieldTag {
20897            __kind,
20898            __log_type,
20899            Unknown(std::string::String),
20900        }
20901        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
20902            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20903            where
20904                D: serde::Deserializer<'de>,
20905            {
20906                struct Visitor;
20907                impl<'de> serde::de::Visitor<'de> for Visitor {
20908                    type Value = __FieldTag;
20909                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20910                        formatter.write_str("a field name for TruncateLogContext")
20911                    }
20912                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
20913                    where
20914                        E: serde::de::Error,
20915                    {
20916                        use std::result::Result::Ok;
20917                        use std::string::ToString;
20918                        match value {
20919                            "kind" => Ok(__FieldTag::__kind),
20920                            "logType" => Ok(__FieldTag::__log_type),
20921                            "log_type" => Ok(__FieldTag::__log_type),
20922                            _ => Ok(__FieldTag::Unknown(value.to_string())),
20923                        }
20924                    }
20925                }
20926                deserializer.deserialize_identifier(Visitor)
20927            }
20928        }
20929        struct Visitor;
20930        impl<'de> serde::de::Visitor<'de> for Visitor {
20931            type Value = TruncateLogContext;
20932            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20933                formatter.write_str("struct TruncateLogContext")
20934            }
20935            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
20936            where
20937                A: serde::de::MapAccess<'de>,
20938            {
20939                #[allow(unused_imports)]
20940                use serde::de::Error;
20941                use std::option::Option::Some;
20942                let mut fields = std::collections::HashSet::new();
20943                let mut result = Self::Value::new();
20944                while let Some(tag) = map.next_key::<__FieldTag>()? {
20945                    #[allow(clippy::match_single_binding)]
20946                    match tag {
20947                        __FieldTag::__kind => {
20948                            if !fields.insert(__FieldTag::__kind) {
20949                                return std::result::Result::Err(A::Error::duplicate_field(
20950                                    "multiple values for kind",
20951                                ));
20952                            }
20953                            result.kind = map
20954                                .next_value::<std::option::Option<std::string::String>>()?
20955                                .unwrap_or_default();
20956                        }
20957                        __FieldTag::__log_type => {
20958                            if !fields.insert(__FieldTag::__log_type) {
20959                                return std::result::Result::Err(A::Error::duplicate_field(
20960                                    "multiple values for log_type",
20961                                ));
20962                            }
20963                            result.log_type = map
20964                                .next_value::<std::option::Option<std::string::String>>()?
20965                                .unwrap_or_default();
20966                        }
20967                        __FieldTag::Unknown(key) => {
20968                            let value = map.next_value::<serde_json::Value>()?;
20969                            result._unknown_fields.insert(key, value);
20970                        }
20971                    }
20972                }
20973                std::result::Result::Ok(result)
20974            }
20975        }
20976        deserializer.deserialize_any(Visitor)
20977    }
20978}
20979
20980#[doc(hidden)]
20981impl serde::ser::Serialize for TruncateLogContext {
20982    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20983    where
20984        S: serde::ser::Serializer,
20985    {
20986        use serde::ser::SerializeMap;
20987        #[allow(unused_imports)]
20988        use std::option::Option::Some;
20989        let mut state = serializer.serialize_map(std::option::Option::None)?;
20990        if !self.kind.is_empty() {
20991            state.serialize_entry("kind", &self.kind)?;
20992        }
20993        if !self.log_type.is_empty() {
20994            state.serialize_entry("logType", &self.log_type)?;
20995        }
20996        if !self._unknown_fields.is_empty() {
20997            for (key, value) in self._unknown_fields.iter() {
20998                state.serialize_entry(key, &value)?;
20999            }
21000        }
21001        state.end()
21002    }
21003}
21004
21005impl std::fmt::Debug for TruncateLogContext {
21006    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
21007        let mut debug_struct = f.debug_struct("TruncateLogContext");
21008        debug_struct.field("kind", &self.kind);
21009        debug_struct.field("log_type", &self.log_type);
21010        if !self._unknown_fields.is_empty() {
21011            debug_struct.field("_unknown_fields", &self._unknown_fields);
21012        }
21013        debug_struct.finish()
21014    }
21015}
21016
21017/// External primary instance migration setting error/warning.
21018#[derive(Clone, Default, PartialEq)]
21019#[non_exhaustive]
21020pub struct SqlExternalSyncSettingError {
21021    /// Can be `sql#externalSyncSettingError` or
21022    /// `sql#externalSyncSettingWarning`.
21023    pub kind: std::string::String,
21024
21025    /// Identifies the specific error that occurred.
21026    pub r#type: crate::model::sql_external_sync_setting_error::SqlExternalSyncSettingErrorType,
21027
21028    /// Additional information about the error encountered.
21029    pub detail: std::string::String,
21030
21031    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21032}
21033
21034impl SqlExternalSyncSettingError {
21035    pub fn new() -> Self {
21036        std::default::Default::default()
21037    }
21038
21039    /// Sets the value of [kind][crate::model::SqlExternalSyncSettingError::kind].
21040    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21041        self.kind = v.into();
21042        self
21043    }
21044
21045    /// Sets the value of [r#type][crate::model::SqlExternalSyncSettingError::type].
21046    pub fn set_type<
21047        T: std::convert::Into<
21048                crate::model::sql_external_sync_setting_error::SqlExternalSyncSettingErrorType,
21049            >,
21050    >(
21051        mut self,
21052        v: T,
21053    ) -> Self {
21054        self.r#type = v.into();
21055        self
21056    }
21057
21058    /// Sets the value of [detail][crate::model::SqlExternalSyncSettingError::detail].
21059    pub fn set_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21060        self.detail = v.into();
21061        self
21062    }
21063}
21064
21065impl wkt::message::Message for SqlExternalSyncSettingError {
21066    fn typename() -> &'static str {
21067        "type.googleapis.com/google.cloud.sql.v1.SqlExternalSyncSettingError"
21068    }
21069}
21070
21071#[doc(hidden)]
21072impl<'de> serde::de::Deserialize<'de> for SqlExternalSyncSettingError {
21073    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21074    where
21075        D: serde::Deserializer<'de>,
21076    {
21077        #[allow(non_camel_case_types)]
21078        #[doc(hidden)]
21079        #[derive(PartialEq, Eq, Hash)]
21080        enum __FieldTag {
21081            __kind,
21082            __type,
21083            __detail,
21084            Unknown(std::string::String),
21085        }
21086        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
21087            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21088            where
21089                D: serde::Deserializer<'de>,
21090            {
21091                struct Visitor;
21092                impl<'de> serde::de::Visitor<'de> for Visitor {
21093                    type Value = __FieldTag;
21094                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21095                        formatter.write_str("a field name for SqlExternalSyncSettingError")
21096                    }
21097                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
21098                    where
21099                        E: serde::de::Error,
21100                    {
21101                        use std::result::Result::Ok;
21102                        use std::string::ToString;
21103                        match value {
21104                            "kind" => Ok(__FieldTag::__kind),
21105                            "type" => Ok(__FieldTag::__type),
21106                            "detail" => Ok(__FieldTag::__detail),
21107                            _ => Ok(__FieldTag::Unknown(value.to_string())),
21108                        }
21109                    }
21110                }
21111                deserializer.deserialize_identifier(Visitor)
21112            }
21113        }
21114        struct Visitor;
21115        impl<'de> serde::de::Visitor<'de> for Visitor {
21116            type Value = SqlExternalSyncSettingError;
21117            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21118                formatter.write_str("struct SqlExternalSyncSettingError")
21119            }
21120            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
21121            where
21122                A: serde::de::MapAccess<'de>,
21123            {
21124                #[allow(unused_imports)]
21125                use serde::de::Error;
21126                use std::option::Option::Some;
21127                let mut fields = std::collections::HashSet::new();
21128                let mut result = Self::Value::new();
21129                while let Some(tag) = map.next_key::<__FieldTag>()? {
21130                    #[allow(clippy::match_single_binding)]
21131                    match tag {
21132                        __FieldTag::__kind => {
21133                            if !fields.insert(__FieldTag::__kind) {
21134                                return std::result::Result::Err(A::Error::duplicate_field(
21135                                    "multiple values for kind",
21136                                ));
21137                            }
21138                            result.kind = map
21139                                .next_value::<std::option::Option<std::string::String>>()?
21140                                .unwrap_or_default();
21141                        }
21142                        __FieldTag::__type => {
21143                            if !fields.insert(__FieldTag::__type) {
21144                                return std::result::Result::Err(A::Error::duplicate_field(
21145                                    "multiple values for type",
21146                                ));
21147                            }
21148                            result.r#type = map.next_value::<std::option::Option<crate::model::sql_external_sync_setting_error::SqlExternalSyncSettingErrorType>>()?.unwrap_or_default();
21149                        }
21150                        __FieldTag::__detail => {
21151                            if !fields.insert(__FieldTag::__detail) {
21152                                return std::result::Result::Err(A::Error::duplicate_field(
21153                                    "multiple values for detail",
21154                                ));
21155                            }
21156                            result.detail = map
21157                                .next_value::<std::option::Option<std::string::String>>()?
21158                                .unwrap_or_default();
21159                        }
21160                        __FieldTag::Unknown(key) => {
21161                            let value = map.next_value::<serde_json::Value>()?;
21162                            result._unknown_fields.insert(key, value);
21163                        }
21164                    }
21165                }
21166                std::result::Result::Ok(result)
21167            }
21168        }
21169        deserializer.deserialize_any(Visitor)
21170    }
21171}
21172
21173#[doc(hidden)]
21174impl serde::ser::Serialize for SqlExternalSyncSettingError {
21175    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21176    where
21177        S: serde::ser::Serializer,
21178    {
21179        use serde::ser::SerializeMap;
21180        #[allow(unused_imports)]
21181        use std::option::Option::Some;
21182        let mut state = serializer.serialize_map(std::option::Option::None)?;
21183        if !self.kind.is_empty() {
21184            state.serialize_entry("kind", &self.kind)?;
21185        }
21186        if !wkt::internal::is_default(&self.r#type) {
21187            state.serialize_entry("type", &self.r#type)?;
21188        }
21189        if !self.detail.is_empty() {
21190            state.serialize_entry("detail", &self.detail)?;
21191        }
21192        if !self._unknown_fields.is_empty() {
21193            for (key, value) in self._unknown_fields.iter() {
21194                state.serialize_entry(key, &value)?;
21195            }
21196        }
21197        state.end()
21198    }
21199}
21200
21201impl std::fmt::Debug for SqlExternalSyncSettingError {
21202    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
21203        let mut debug_struct = f.debug_struct("SqlExternalSyncSettingError");
21204        debug_struct.field("kind", &self.kind);
21205        debug_struct.field("r#type", &self.r#type);
21206        debug_struct.field("detail", &self.detail);
21207        if !self._unknown_fields.is_empty() {
21208            debug_struct.field("_unknown_fields", &self._unknown_fields);
21209        }
21210        debug_struct.finish()
21211    }
21212}
21213
21214/// Defines additional types related to [SqlExternalSyncSettingError].
21215pub mod sql_external_sync_setting_error {
21216    #[allow(unused_imports)]
21217    use super::*;
21218
21219    ///
21220    /// # Working with unknown values
21221    ///
21222    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21223    /// additional enum variants at any time. Adding new variants is not considered
21224    /// a breaking change. Applications should write their code in anticipation of:
21225    ///
21226    /// - New values appearing in future releases of the client library, **and**
21227    /// - New values received dynamically, without application changes.
21228    ///
21229    /// Please consult the [Working with enums] section in the user guide for some
21230    /// guidelines.
21231    ///
21232    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
21233    #[derive(Clone, Debug, PartialEq)]
21234    #[non_exhaustive]
21235    pub enum SqlExternalSyncSettingErrorType {
21236        Unspecified,
21237        ConnectionFailure,
21238        BinlogNotEnabled,
21239        IncompatibleDatabaseVersion,
21240        ReplicaAlreadySetup,
21241        /// The replication user is missing privileges that are required.
21242        InsufficientPrivilege,
21243        /// Unsupported migration type.
21244        UnsupportedMigrationType,
21245        /// No pglogical extension installed on databases, applicable for postgres.
21246        NoPglogicalInstalled,
21247        /// pglogical node already exists on databases, applicable for postgres.
21248        PglogicalNodeAlreadyExists,
21249        /// The value of parameter wal_level is not set to logical.
21250        InvalidWalLevel,
21251        /// The value of parameter shared_preload_libraries does not include
21252        /// pglogical.
21253        InvalidSharedPreloadLibrary,
21254        /// The value of parameter max_replication_slots is not sufficient.
21255        InsufficientMaxReplicationSlots,
21256        /// The value of parameter max_wal_senders is not sufficient.
21257        InsufficientMaxWalSenders,
21258        /// The value of parameter max_worker_processes is not sufficient.
21259        InsufficientMaxWorkerProcesses,
21260        /// Extensions installed are either not supported or having unsupported
21261        /// versions.
21262        UnsupportedExtensions,
21263        /// The value of parameter rds.logical_replication is not set to 1.
21264        InvalidRdsLogicalReplication,
21265        /// The primary instance logging setup doesn't allow EM sync.
21266        InvalidLoggingSetup,
21267        /// The primary instance database parameter setup doesn't allow EM sync.
21268        InvalidDbParam,
21269        /// The gtid_mode is not supported, applicable for MySQL.
21270        UnsupportedGtidMode,
21271        /// SQL Server Agent is not running.
21272        SqlserverAgentNotRunning,
21273        /// The table definition is not support due to missing primary key or replica
21274        /// identity, applicable for postgres.
21275        UnsupportedTableDefinition,
21276        /// The customer has a definer that will break EM setup.
21277        UnsupportedDefiner,
21278        /// SQL Server @@SERVERNAME does not match actual host name.
21279        SqlserverServernameMismatch,
21280        /// The primary instance has been setup and will fail the setup.
21281        PrimaryAlreadySetup,
21282        /// The primary instance has unsupported binary log format.
21283        UnsupportedBinlogFormat,
21284        /// The primary instance's binary log retention setting.
21285        BinlogRetentionSetting,
21286        /// The primary instance has tables with unsupported storage engine.
21287        UnsupportedStorageEngine,
21288        /// Source has tables with limited support
21289        /// eg: PostgreSQL tables without primary keys.
21290        LimitedSupportTables,
21291        /// The replica instance contains existing data.
21292        ExistingDataInReplica,
21293        /// The replication user is missing privileges that are optional.
21294        MissingOptionalPrivileges,
21295        /// Additional BACKUP_ADMIN privilege is granted to the replication user
21296        /// which may lock source MySQL 8 instance for DDLs during initial sync.
21297        RiskyBackupAdminPrivilege,
21298        /// The Cloud Storage bucket is missing necessary permissions.
21299        InsufficientGcsPermissions,
21300        /// The Cloud Storage bucket has an error in the file or contains invalid
21301        /// file information.
21302        InvalidFileInfo,
21303        /// The source instance has unsupported database settings for migration.
21304        UnsupportedDatabaseSettings,
21305        /// The replication user is missing parallel import specific privileges.
21306        /// (e.g. LOCK TABLES) for MySQL.
21307        MysqlParallelImportInsufficientPrivilege,
21308        /// The global variable local_infile is off on external server replica.
21309        LocalInfileOff,
21310        /// This code instructs customers to turn on point-in-time recovery manually
21311        /// for the instance after promoting the Cloud SQL for PostgreSQL instance.
21312        TurnOnPitrAfterPromote,
21313        /// The minor version of replica database is incompatible with the source.
21314        IncompatibleDatabaseMinorVersion,
21315        /// This warning message indicates that Cloud SQL uses the maximum number of
21316        /// subscriptions to migrate data from the source to the destination.
21317        SourceMaxSubscriptions,
21318        /// Unable to verify definers on the source for MySQL.
21319        UnableToVerifyDefiners,
21320        /// If a time out occurs while the subscription counts are calculated, then
21321        /// this value is set to 1. Otherwise, this value is set to 2.
21322        SubscriptionCalculationStatus,
21323        /// Count of subscriptions needed to sync source data for PostgreSQL
21324        /// database.
21325        PgSubscriptionCount,
21326        /// Final parallel level that is used to do migration.
21327        PgSyncParallelLevel,
21328        /// The disk size of the replica instance is smaller than the data size of
21329        /// the source instance.
21330        InsufficientDiskSize,
21331        /// The data size of the source instance is greater than 1 TB, the number of
21332        /// cores of the replica instance is less than 8, and the memory of the
21333        /// replica is less than 32 GB.
21334        InsufficientMachineTier,
21335        /// The warning message indicates the unsupported extensions will not be
21336        /// migrated to the destination.
21337        UnsupportedExtensionsNotMigrated,
21338        /// The warning message indicates the pg_cron extension and settings will not
21339        /// be migrated to the destination.
21340        ExtensionsNotMigrated,
21341        /// The error message indicates that pg_cron flags are enabled on the
21342        /// destination which is not supported during the migration.
21343        PgCronFlagEnabledInReplica,
21344        /// This error message indicates that the specified extensions are not
21345        /// enabled on destination instance. For example, before you can migrate
21346        /// data to the destination instance, you must enable the PGAudit extension
21347        /// on the instance.
21348        ExtensionsNotEnabledInReplica,
21349        /// The source database has generated columns that can't be migrated. Please
21350        /// change them to regular columns before migration.
21351        UnsupportedColumns,
21352        /// If set, the enum was initialized with an unknown value.
21353        ///
21354        /// Applications can examine the value using [SqlExternalSyncSettingErrorType::value] or
21355        /// [SqlExternalSyncSettingErrorType::name].
21356        UnknownValue(sql_external_sync_setting_error_type::UnknownValue),
21357    }
21358
21359    #[doc(hidden)]
21360    pub mod sql_external_sync_setting_error_type {
21361        #[allow(unused_imports)]
21362        use super::*;
21363        #[derive(Clone, Debug, PartialEq)]
21364        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
21365    }
21366
21367    impl SqlExternalSyncSettingErrorType {
21368        /// Gets the enum value.
21369        ///
21370        /// Returns `None` if the enum contains an unknown value deserialized from
21371        /// the string representation of enums.
21372        pub fn value(&self) -> std::option::Option<i32> {
21373            match self {
21374                Self::Unspecified => std::option::Option::Some(0),
21375                Self::ConnectionFailure => std::option::Option::Some(1),
21376                Self::BinlogNotEnabled => std::option::Option::Some(2),
21377                Self::IncompatibleDatabaseVersion => std::option::Option::Some(3),
21378                Self::ReplicaAlreadySetup => std::option::Option::Some(4),
21379                Self::InsufficientPrivilege => std::option::Option::Some(5),
21380                Self::UnsupportedMigrationType => std::option::Option::Some(6),
21381                Self::NoPglogicalInstalled => std::option::Option::Some(7),
21382                Self::PglogicalNodeAlreadyExists => std::option::Option::Some(8),
21383                Self::InvalidWalLevel => std::option::Option::Some(9),
21384                Self::InvalidSharedPreloadLibrary => std::option::Option::Some(10),
21385                Self::InsufficientMaxReplicationSlots => std::option::Option::Some(11),
21386                Self::InsufficientMaxWalSenders => std::option::Option::Some(12),
21387                Self::InsufficientMaxWorkerProcesses => std::option::Option::Some(13),
21388                Self::UnsupportedExtensions => std::option::Option::Some(14),
21389                Self::InvalidRdsLogicalReplication => std::option::Option::Some(15),
21390                Self::InvalidLoggingSetup => std::option::Option::Some(16),
21391                Self::InvalidDbParam => std::option::Option::Some(17),
21392                Self::UnsupportedGtidMode => std::option::Option::Some(18),
21393                Self::SqlserverAgentNotRunning => std::option::Option::Some(19),
21394                Self::UnsupportedTableDefinition => std::option::Option::Some(20),
21395                Self::UnsupportedDefiner => std::option::Option::Some(21),
21396                Self::SqlserverServernameMismatch => std::option::Option::Some(22),
21397                Self::PrimaryAlreadySetup => std::option::Option::Some(23),
21398                Self::UnsupportedBinlogFormat => std::option::Option::Some(24),
21399                Self::BinlogRetentionSetting => std::option::Option::Some(25),
21400                Self::UnsupportedStorageEngine => std::option::Option::Some(26),
21401                Self::LimitedSupportTables => std::option::Option::Some(27),
21402                Self::ExistingDataInReplica => std::option::Option::Some(28),
21403                Self::MissingOptionalPrivileges => std::option::Option::Some(29),
21404                Self::RiskyBackupAdminPrivilege => std::option::Option::Some(30),
21405                Self::InsufficientGcsPermissions => std::option::Option::Some(31),
21406                Self::InvalidFileInfo => std::option::Option::Some(32),
21407                Self::UnsupportedDatabaseSettings => std::option::Option::Some(33),
21408                Self::MysqlParallelImportInsufficientPrivilege => std::option::Option::Some(34),
21409                Self::LocalInfileOff => std::option::Option::Some(35),
21410                Self::TurnOnPitrAfterPromote => std::option::Option::Some(36),
21411                Self::IncompatibleDatabaseMinorVersion => std::option::Option::Some(37),
21412                Self::SourceMaxSubscriptions => std::option::Option::Some(38),
21413                Self::UnableToVerifyDefiners => std::option::Option::Some(39),
21414                Self::SubscriptionCalculationStatus => std::option::Option::Some(40),
21415                Self::PgSubscriptionCount => std::option::Option::Some(41),
21416                Self::PgSyncParallelLevel => std::option::Option::Some(42),
21417                Self::InsufficientDiskSize => std::option::Option::Some(43),
21418                Self::InsufficientMachineTier => std::option::Option::Some(44),
21419                Self::UnsupportedExtensionsNotMigrated => std::option::Option::Some(45),
21420                Self::ExtensionsNotMigrated => std::option::Option::Some(46),
21421                Self::PgCronFlagEnabledInReplica => std::option::Option::Some(47),
21422                Self::ExtensionsNotEnabledInReplica => std::option::Option::Some(48),
21423                Self::UnsupportedColumns => std::option::Option::Some(49),
21424                Self::UnknownValue(u) => u.0.value(),
21425            }
21426        }
21427
21428        /// Gets the enum value as a string.
21429        ///
21430        /// Returns `None` if the enum contains an unknown value deserialized from
21431        /// the integer representation of enums.
21432        pub fn name(&self) -> std::option::Option<&str> {
21433            match self {
21434                Self::Unspecified => {
21435                    std::option::Option::Some("SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED")
21436                }
21437                Self::ConnectionFailure => std::option::Option::Some("CONNECTION_FAILURE"),
21438                Self::BinlogNotEnabled => std::option::Option::Some("BINLOG_NOT_ENABLED"),
21439                Self::IncompatibleDatabaseVersion => {
21440                    std::option::Option::Some("INCOMPATIBLE_DATABASE_VERSION")
21441                }
21442                Self::ReplicaAlreadySetup => std::option::Option::Some("REPLICA_ALREADY_SETUP"),
21443                Self::InsufficientPrivilege => std::option::Option::Some("INSUFFICIENT_PRIVILEGE"),
21444                Self::UnsupportedMigrationType => {
21445                    std::option::Option::Some("UNSUPPORTED_MIGRATION_TYPE")
21446                }
21447                Self::NoPglogicalInstalled => std::option::Option::Some("NO_PGLOGICAL_INSTALLED"),
21448                Self::PglogicalNodeAlreadyExists => {
21449                    std::option::Option::Some("PGLOGICAL_NODE_ALREADY_EXISTS")
21450                }
21451                Self::InvalidWalLevel => std::option::Option::Some("INVALID_WAL_LEVEL"),
21452                Self::InvalidSharedPreloadLibrary => {
21453                    std::option::Option::Some("INVALID_SHARED_PRELOAD_LIBRARY")
21454                }
21455                Self::InsufficientMaxReplicationSlots => {
21456                    std::option::Option::Some("INSUFFICIENT_MAX_REPLICATION_SLOTS")
21457                }
21458                Self::InsufficientMaxWalSenders => {
21459                    std::option::Option::Some("INSUFFICIENT_MAX_WAL_SENDERS")
21460                }
21461                Self::InsufficientMaxWorkerProcesses => {
21462                    std::option::Option::Some("INSUFFICIENT_MAX_WORKER_PROCESSES")
21463                }
21464                Self::UnsupportedExtensions => std::option::Option::Some("UNSUPPORTED_EXTENSIONS"),
21465                Self::InvalidRdsLogicalReplication => {
21466                    std::option::Option::Some("INVALID_RDS_LOGICAL_REPLICATION")
21467                }
21468                Self::InvalidLoggingSetup => std::option::Option::Some("INVALID_LOGGING_SETUP"),
21469                Self::InvalidDbParam => std::option::Option::Some("INVALID_DB_PARAM"),
21470                Self::UnsupportedGtidMode => std::option::Option::Some("UNSUPPORTED_GTID_MODE"),
21471                Self::SqlserverAgentNotRunning => {
21472                    std::option::Option::Some("SQLSERVER_AGENT_NOT_RUNNING")
21473                }
21474                Self::UnsupportedTableDefinition => {
21475                    std::option::Option::Some("UNSUPPORTED_TABLE_DEFINITION")
21476                }
21477                Self::UnsupportedDefiner => std::option::Option::Some("UNSUPPORTED_DEFINER"),
21478                Self::SqlserverServernameMismatch => {
21479                    std::option::Option::Some("SQLSERVER_SERVERNAME_MISMATCH")
21480                }
21481                Self::PrimaryAlreadySetup => std::option::Option::Some("PRIMARY_ALREADY_SETUP"),
21482                Self::UnsupportedBinlogFormat => {
21483                    std::option::Option::Some("UNSUPPORTED_BINLOG_FORMAT")
21484                }
21485                Self::BinlogRetentionSetting => {
21486                    std::option::Option::Some("BINLOG_RETENTION_SETTING")
21487                }
21488                Self::UnsupportedStorageEngine => {
21489                    std::option::Option::Some("UNSUPPORTED_STORAGE_ENGINE")
21490                }
21491                Self::LimitedSupportTables => std::option::Option::Some("LIMITED_SUPPORT_TABLES"),
21492                Self::ExistingDataInReplica => {
21493                    std::option::Option::Some("EXISTING_DATA_IN_REPLICA")
21494                }
21495                Self::MissingOptionalPrivileges => {
21496                    std::option::Option::Some("MISSING_OPTIONAL_PRIVILEGES")
21497                }
21498                Self::RiskyBackupAdminPrivilege => {
21499                    std::option::Option::Some("RISKY_BACKUP_ADMIN_PRIVILEGE")
21500                }
21501                Self::InsufficientGcsPermissions => {
21502                    std::option::Option::Some("INSUFFICIENT_GCS_PERMISSIONS")
21503                }
21504                Self::InvalidFileInfo => std::option::Option::Some("INVALID_FILE_INFO"),
21505                Self::UnsupportedDatabaseSettings => {
21506                    std::option::Option::Some("UNSUPPORTED_DATABASE_SETTINGS")
21507                }
21508                Self::MysqlParallelImportInsufficientPrivilege => {
21509                    std::option::Option::Some("MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE")
21510                }
21511                Self::LocalInfileOff => std::option::Option::Some("LOCAL_INFILE_OFF"),
21512                Self::TurnOnPitrAfterPromote => {
21513                    std::option::Option::Some("TURN_ON_PITR_AFTER_PROMOTE")
21514                }
21515                Self::IncompatibleDatabaseMinorVersion => {
21516                    std::option::Option::Some("INCOMPATIBLE_DATABASE_MINOR_VERSION")
21517                }
21518                Self::SourceMaxSubscriptions => {
21519                    std::option::Option::Some("SOURCE_MAX_SUBSCRIPTIONS")
21520                }
21521                Self::UnableToVerifyDefiners => {
21522                    std::option::Option::Some("UNABLE_TO_VERIFY_DEFINERS")
21523                }
21524                Self::SubscriptionCalculationStatus => {
21525                    std::option::Option::Some("SUBSCRIPTION_CALCULATION_STATUS")
21526                }
21527                Self::PgSubscriptionCount => std::option::Option::Some("PG_SUBSCRIPTION_COUNT"),
21528                Self::PgSyncParallelLevel => std::option::Option::Some("PG_SYNC_PARALLEL_LEVEL"),
21529                Self::InsufficientDiskSize => std::option::Option::Some("INSUFFICIENT_DISK_SIZE"),
21530                Self::InsufficientMachineTier => {
21531                    std::option::Option::Some("INSUFFICIENT_MACHINE_TIER")
21532                }
21533                Self::UnsupportedExtensionsNotMigrated => {
21534                    std::option::Option::Some("UNSUPPORTED_EXTENSIONS_NOT_MIGRATED")
21535                }
21536                Self::ExtensionsNotMigrated => std::option::Option::Some("EXTENSIONS_NOT_MIGRATED"),
21537                Self::PgCronFlagEnabledInReplica => {
21538                    std::option::Option::Some("PG_CRON_FLAG_ENABLED_IN_REPLICA")
21539                }
21540                Self::ExtensionsNotEnabledInReplica => {
21541                    std::option::Option::Some("EXTENSIONS_NOT_ENABLED_IN_REPLICA")
21542                }
21543                Self::UnsupportedColumns => std::option::Option::Some("UNSUPPORTED_COLUMNS"),
21544                Self::UnknownValue(u) => u.0.name(),
21545            }
21546        }
21547    }
21548
21549    impl std::default::Default for SqlExternalSyncSettingErrorType {
21550        fn default() -> Self {
21551            use std::convert::From;
21552            Self::from(0)
21553        }
21554    }
21555
21556    impl std::fmt::Display for SqlExternalSyncSettingErrorType {
21557        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
21558            wkt::internal::display_enum(f, self.name(), self.value())
21559        }
21560    }
21561
21562    impl std::convert::From<i32> for SqlExternalSyncSettingErrorType {
21563        fn from(value: i32) -> Self {
21564            match value {
21565                0 => Self::Unspecified,
21566                1 => Self::ConnectionFailure,
21567                2 => Self::BinlogNotEnabled,
21568                3 => Self::IncompatibleDatabaseVersion,
21569                4 => Self::ReplicaAlreadySetup,
21570                5 => Self::InsufficientPrivilege,
21571                6 => Self::UnsupportedMigrationType,
21572                7 => Self::NoPglogicalInstalled,
21573                8 => Self::PglogicalNodeAlreadyExists,
21574                9 => Self::InvalidWalLevel,
21575                10 => Self::InvalidSharedPreloadLibrary,
21576                11 => Self::InsufficientMaxReplicationSlots,
21577                12 => Self::InsufficientMaxWalSenders,
21578                13 => Self::InsufficientMaxWorkerProcesses,
21579                14 => Self::UnsupportedExtensions,
21580                15 => Self::InvalidRdsLogicalReplication,
21581                16 => Self::InvalidLoggingSetup,
21582                17 => Self::InvalidDbParam,
21583                18 => Self::UnsupportedGtidMode,
21584                19 => Self::SqlserverAgentNotRunning,
21585                20 => Self::UnsupportedTableDefinition,
21586                21 => Self::UnsupportedDefiner,
21587                22 => Self::SqlserverServernameMismatch,
21588                23 => Self::PrimaryAlreadySetup,
21589                24 => Self::UnsupportedBinlogFormat,
21590                25 => Self::BinlogRetentionSetting,
21591                26 => Self::UnsupportedStorageEngine,
21592                27 => Self::LimitedSupportTables,
21593                28 => Self::ExistingDataInReplica,
21594                29 => Self::MissingOptionalPrivileges,
21595                30 => Self::RiskyBackupAdminPrivilege,
21596                31 => Self::InsufficientGcsPermissions,
21597                32 => Self::InvalidFileInfo,
21598                33 => Self::UnsupportedDatabaseSettings,
21599                34 => Self::MysqlParallelImportInsufficientPrivilege,
21600                35 => Self::LocalInfileOff,
21601                36 => Self::TurnOnPitrAfterPromote,
21602                37 => Self::IncompatibleDatabaseMinorVersion,
21603                38 => Self::SourceMaxSubscriptions,
21604                39 => Self::UnableToVerifyDefiners,
21605                40 => Self::SubscriptionCalculationStatus,
21606                41 => Self::PgSubscriptionCount,
21607                42 => Self::PgSyncParallelLevel,
21608                43 => Self::InsufficientDiskSize,
21609                44 => Self::InsufficientMachineTier,
21610                45 => Self::UnsupportedExtensionsNotMigrated,
21611                46 => Self::ExtensionsNotMigrated,
21612                47 => Self::PgCronFlagEnabledInReplica,
21613                48 => Self::ExtensionsNotEnabledInReplica,
21614                49 => Self::UnsupportedColumns,
21615                _ => Self::UnknownValue(sql_external_sync_setting_error_type::UnknownValue(
21616                    wkt::internal::UnknownEnumValue::Integer(value),
21617                )),
21618            }
21619        }
21620    }
21621
21622    impl std::convert::From<&str> for SqlExternalSyncSettingErrorType {
21623        fn from(value: &str) -> Self {
21624            use std::string::ToString;
21625            match value {
21626                "SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED" => Self::Unspecified,
21627                "CONNECTION_FAILURE" => Self::ConnectionFailure,
21628                "BINLOG_NOT_ENABLED" => Self::BinlogNotEnabled,
21629                "INCOMPATIBLE_DATABASE_VERSION" => Self::IncompatibleDatabaseVersion,
21630                "REPLICA_ALREADY_SETUP" => Self::ReplicaAlreadySetup,
21631                "INSUFFICIENT_PRIVILEGE" => Self::InsufficientPrivilege,
21632                "UNSUPPORTED_MIGRATION_TYPE" => Self::UnsupportedMigrationType,
21633                "NO_PGLOGICAL_INSTALLED" => Self::NoPglogicalInstalled,
21634                "PGLOGICAL_NODE_ALREADY_EXISTS" => Self::PglogicalNodeAlreadyExists,
21635                "INVALID_WAL_LEVEL" => Self::InvalidWalLevel,
21636                "INVALID_SHARED_PRELOAD_LIBRARY" => Self::InvalidSharedPreloadLibrary,
21637                "INSUFFICIENT_MAX_REPLICATION_SLOTS" => Self::InsufficientMaxReplicationSlots,
21638                "INSUFFICIENT_MAX_WAL_SENDERS" => Self::InsufficientMaxWalSenders,
21639                "INSUFFICIENT_MAX_WORKER_PROCESSES" => Self::InsufficientMaxWorkerProcesses,
21640                "UNSUPPORTED_EXTENSIONS" => Self::UnsupportedExtensions,
21641                "INVALID_RDS_LOGICAL_REPLICATION" => Self::InvalidRdsLogicalReplication,
21642                "INVALID_LOGGING_SETUP" => Self::InvalidLoggingSetup,
21643                "INVALID_DB_PARAM" => Self::InvalidDbParam,
21644                "UNSUPPORTED_GTID_MODE" => Self::UnsupportedGtidMode,
21645                "SQLSERVER_AGENT_NOT_RUNNING" => Self::SqlserverAgentNotRunning,
21646                "UNSUPPORTED_TABLE_DEFINITION" => Self::UnsupportedTableDefinition,
21647                "UNSUPPORTED_DEFINER" => Self::UnsupportedDefiner,
21648                "SQLSERVER_SERVERNAME_MISMATCH" => Self::SqlserverServernameMismatch,
21649                "PRIMARY_ALREADY_SETUP" => Self::PrimaryAlreadySetup,
21650                "UNSUPPORTED_BINLOG_FORMAT" => Self::UnsupportedBinlogFormat,
21651                "BINLOG_RETENTION_SETTING" => Self::BinlogRetentionSetting,
21652                "UNSUPPORTED_STORAGE_ENGINE" => Self::UnsupportedStorageEngine,
21653                "LIMITED_SUPPORT_TABLES" => Self::LimitedSupportTables,
21654                "EXISTING_DATA_IN_REPLICA" => Self::ExistingDataInReplica,
21655                "MISSING_OPTIONAL_PRIVILEGES" => Self::MissingOptionalPrivileges,
21656                "RISKY_BACKUP_ADMIN_PRIVILEGE" => Self::RiskyBackupAdminPrivilege,
21657                "INSUFFICIENT_GCS_PERMISSIONS" => Self::InsufficientGcsPermissions,
21658                "INVALID_FILE_INFO" => Self::InvalidFileInfo,
21659                "UNSUPPORTED_DATABASE_SETTINGS" => Self::UnsupportedDatabaseSettings,
21660                "MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE" => {
21661                    Self::MysqlParallelImportInsufficientPrivilege
21662                }
21663                "LOCAL_INFILE_OFF" => Self::LocalInfileOff,
21664                "TURN_ON_PITR_AFTER_PROMOTE" => Self::TurnOnPitrAfterPromote,
21665                "INCOMPATIBLE_DATABASE_MINOR_VERSION" => Self::IncompatibleDatabaseMinorVersion,
21666                "SOURCE_MAX_SUBSCRIPTIONS" => Self::SourceMaxSubscriptions,
21667                "UNABLE_TO_VERIFY_DEFINERS" => Self::UnableToVerifyDefiners,
21668                "SUBSCRIPTION_CALCULATION_STATUS" => Self::SubscriptionCalculationStatus,
21669                "PG_SUBSCRIPTION_COUNT" => Self::PgSubscriptionCount,
21670                "PG_SYNC_PARALLEL_LEVEL" => Self::PgSyncParallelLevel,
21671                "INSUFFICIENT_DISK_SIZE" => Self::InsufficientDiskSize,
21672                "INSUFFICIENT_MACHINE_TIER" => Self::InsufficientMachineTier,
21673                "UNSUPPORTED_EXTENSIONS_NOT_MIGRATED" => Self::UnsupportedExtensionsNotMigrated,
21674                "EXTENSIONS_NOT_MIGRATED" => Self::ExtensionsNotMigrated,
21675                "PG_CRON_FLAG_ENABLED_IN_REPLICA" => Self::PgCronFlagEnabledInReplica,
21676                "EXTENSIONS_NOT_ENABLED_IN_REPLICA" => Self::ExtensionsNotEnabledInReplica,
21677                "UNSUPPORTED_COLUMNS" => Self::UnsupportedColumns,
21678                _ => Self::UnknownValue(sql_external_sync_setting_error_type::UnknownValue(
21679                    wkt::internal::UnknownEnumValue::String(value.to_string()),
21680                )),
21681            }
21682        }
21683    }
21684
21685    impl serde::ser::Serialize for SqlExternalSyncSettingErrorType {
21686        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21687        where
21688            S: serde::Serializer,
21689        {
21690            match self {
21691                Self::Unspecified => serializer.serialize_i32(0),
21692                Self::ConnectionFailure => serializer.serialize_i32(1),
21693                Self::BinlogNotEnabled => serializer.serialize_i32(2),
21694                Self::IncompatibleDatabaseVersion => serializer.serialize_i32(3),
21695                Self::ReplicaAlreadySetup => serializer.serialize_i32(4),
21696                Self::InsufficientPrivilege => serializer.serialize_i32(5),
21697                Self::UnsupportedMigrationType => serializer.serialize_i32(6),
21698                Self::NoPglogicalInstalled => serializer.serialize_i32(7),
21699                Self::PglogicalNodeAlreadyExists => serializer.serialize_i32(8),
21700                Self::InvalidWalLevel => serializer.serialize_i32(9),
21701                Self::InvalidSharedPreloadLibrary => serializer.serialize_i32(10),
21702                Self::InsufficientMaxReplicationSlots => serializer.serialize_i32(11),
21703                Self::InsufficientMaxWalSenders => serializer.serialize_i32(12),
21704                Self::InsufficientMaxWorkerProcesses => serializer.serialize_i32(13),
21705                Self::UnsupportedExtensions => serializer.serialize_i32(14),
21706                Self::InvalidRdsLogicalReplication => serializer.serialize_i32(15),
21707                Self::InvalidLoggingSetup => serializer.serialize_i32(16),
21708                Self::InvalidDbParam => serializer.serialize_i32(17),
21709                Self::UnsupportedGtidMode => serializer.serialize_i32(18),
21710                Self::SqlserverAgentNotRunning => serializer.serialize_i32(19),
21711                Self::UnsupportedTableDefinition => serializer.serialize_i32(20),
21712                Self::UnsupportedDefiner => serializer.serialize_i32(21),
21713                Self::SqlserverServernameMismatch => serializer.serialize_i32(22),
21714                Self::PrimaryAlreadySetup => serializer.serialize_i32(23),
21715                Self::UnsupportedBinlogFormat => serializer.serialize_i32(24),
21716                Self::BinlogRetentionSetting => serializer.serialize_i32(25),
21717                Self::UnsupportedStorageEngine => serializer.serialize_i32(26),
21718                Self::LimitedSupportTables => serializer.serialize_i32(27),
21719                Self::ExistingDataInReplica => serializer.serialize_i32(28),
21720                Self::MissingOptionalPrivileges => serializer.serialize_i32(29),
21721                Self::RiskyBackupAdminPrivilege => serializer.serialize_i32(30),
21722                Self::InsufficientGcsPermissions => serializer.serialize_i32(31),
21723                Self::InvalidFileInfo => serializer.serialize_i32(32),
21724                Self::UnsupportedDatabaseSettings => serializer.serialize_i32(33),
21725                Self::MysqlParallelImportInsufficientPrivilege => serializer.serialize_i32(34),
21726                Self::LocalInfileOff => serializer.serialize_i32(35),
21727                Self::TurnOnPitrAfterPromote => serializer.serialize_i32(36),
21728                Self::IncompatibleDatabaseMinorVersion => serializer.serialize_i32(37),
21729                Self::SourceMaxSubscriptions => serializer.serialize_i32(38),
21730                Self::UnableToVerifyDefiners => serializer.serialize_i32(39),
21731                Self::SubscriptionCalculationStatus => serializer.serialize_i32(40),
21732                Self::PgSubscriptionCount => serializer.serialize_i32(41),
21733                Self::PgSyncParallelLevel => serializer.serialize_i32(42),
21734                Self::InsufficientDiskSize => serializer.serialize_i32(43),
21735                Self::InsufficientMachineTier => serializer.serialize_i32(44),
21736                Self::UnsupportedExtensionsNotMigrated => serializer.serialize_i32(45),
21737                Self::ExtensionsNotMigrated => serializer.serialize_i32(46),
21738                Self::PgCronFlagEnabledInReplica => serializer.serialize_i32(47),
21739                Self::ExtensionsNotEnabledInReplica => serializer.serialize_i32(48),
21740                Self::UnsupportedColumns => serializer.serialize_i32(49),
21741                Self::UnknownValue(u) => u.0.serialize(serializer),
21742            }
21743        }
21744    }
21745
21746    impl<'de> serde::de::Deserialize<'de> for SqlExternalSyncSettingErrorType {
21747        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21748        where
21749            D: serde::Deserializer<'de>,
21750        {
21751            deserializer.deserialize_any(wkt::internal::EnumVisitor::<
21752                SqlExternalSyncSettingErrorType,
21753            >::new(
21754                ".google.cloud.sql.v1.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType",
21755            ))
21756        }
21757    }
21758}
21759
21760/// On-premises instance configuration.
21761#[derive(Clone, Default, PartialEq)]
21762#[non_exhaustive]
21763pub struct OnPremisesConfiguration {
21764    /// The host and port of the on-premises instance in host:port format
21765    pub host_port: std::string::String,
21766
21767    /// This is always `sql#onPremisesConfiguration`.
21768    pub kind: std::string::String,
21769
21770    /// The username for connecting to on-premises instance.
21771    pub username: std::string::String,
21772
21773    /// The password for connecting to on-premises instance.
21774    pub password: std::string::String,
21775
21776    /// PEM representation of the trusted CA's x509 certificate.
21777    pub ca_certificate: std::string::String,
21778
21779    /// PEM representation of the replica's x509 certificate.
21780    pub client_certificate: std::string::String,
21781
21782    /// PEM representation of the replica's private key. The corresponsing public
21783    /// key is encoded in the client's certificate.
21784    pub client_key: std::string::String,
21785
21786    /// The dump file to create the Cloud SQL replica.
21787    pub dump_file_path: std::string::String,
21788
21789    /// The reference to Cloud SQL instance if the source is Cloud SQL.
21790    pub source_instance: std::option::Option<crate::model::InstanceReference>,
21791
21792    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21793}
21794
21795impl OnPremisesConfiguration {
21796    pub fn new() -> Self {
21797        std::default::Default::default()
21798    }
21799
21800    /// Sets the value of [host_port][crate::model::OnPremisesConfiguration::host_port].
21801    pub fn set_host_port<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21802        self.host_port = v.into();
21803        self
21804    }
21805
21806    /// Sets the value of [kind][crate::model::OnPremisesConfiguration::kind].
21807    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21808        self.kind = v.into();
21809        self
21810    }
21811
21812    /// Sets the value of [username][crate::model::OnPremisesConfiguration::username].
21813    pub fn set_username<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21814        self.username = v.into();
21815        self
21816    }
21817
21818    /// Sets the value of [password][crate::model::OnPremisesConfiguration::password].
21819    pub fn set_password<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21820        self.password = v.into();
21821        self
21822    }
21823
21824    /// Sets the value of [ca_certificate][crate::model::OnPremisesConfiguration::ca_certificate].
21825    pub fn set_ca_certificate<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21826        self.ca_certificate = v.into();
21827        self
21828    }
21829
21830    /// Sets the value of [client_certificate][crate::model::OnPremisesConfiguration::client_certificate].
21831    pub fn set_client_certificate<T: std::convert::Into<std::string::String>>(
21832        mut self,
21833        v: T,
21834    ) -> Self {
21835        self.client_certificate = v.into();
21836        self
21837    }
21838
21839    /// Sets the value of [client_key][crate::model::OnPremisesConfiguration::client_key].
21840    pub fn set_client_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21841        self.client_key = v.into();
21842        self
21843    }
21844
21845    /// Sets the value of [dump_file_path][crate::model::OnPremisesConfiguration::dump_file_path].
21846    pub fn set_dump_file_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21847        self.dump_file_path = v.into();
21848        self
21849    }
21850
21851    /// Sets the value of [source_instance][crate::model::OnPremisesConfiguration::source_instance].
21852    pub fn set_source_instance<T>(mut self, v: T) -> Self
21853    where
21854        T: std::convert::Into<crate::model::InstanceReference>,
21855    {
21856        self.source_instance = std::option::Option::Some(v.into());
21857        self
21858    }
21859
21860    /// Sets or clears the value of [source_instance][crate::model::OnPremisesConfiguration::source_instance].
21861    pub fn set_or_clear_source_instance<T>(mut self, v: std::option::Option<T>) -> Self
21862    where
21863        T: std::convert::Into<crate::model::InstanceReference>,
21864    {
21865        self.source_instance = v.map(|x| x.into());
21866        self
21867    }
21868}
21869
21870impl wkt::message::Message for OnPremisesConfiguration {
21871    fn typename() -> &'static str {
21872        "type.googleapis.com/google.cloud.sql.v1.OnPremisesConfiguration"
21873    }
21874}
21875
21876#[doc(hidden)]
21877impl<'de> serde::de::Deserialize<'de> for OnPremisesConfiguration {
21878    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21879    where
21880        D: serde::Deserializer<'de>,
21881    {
21882        #[allow(non_camel_case_types)]
21883        #[doc(hidden)]
21884        #[derive(PartialEq, Eq, Hash)]
21885        enum __FieldTag {
21886            __host_port,
21887            __kind,
21888            __username,
21889            __password,
21890            __ca_certificate,
21891            __client_certificate,
21892            __client_key,
21893            __dump_file_path,
21894            __source_instance,
21895            Unknown(std::string::String),
21896        }
21897        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
21898            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21899            where
21900                D: serde::Deserializer<'de>,
21901            {
21902                struct Visitor;
21903                impl<'de> serde::de::Visitor<'de> for Visitor {
21904                    type Value = __FieldTag;
21905                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21906                        formatter.write_str("a field name for OnPremisesConfiguration")
21907                    }
21908                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
21909                    where
21910                        E: serde::de::Error,
21911                    {
21912                        use std::result::Result::Ok;
21913                        use std::string::ToString;
21914                        match value {
21915                            "hostPort" => Ok(__FieldTag::__host_port),
21916                            "host_port" => Ok(__FieldTag::__host_port),
21917                            "kind" => Ok(__FieldTag::__kind),
21918                            "username" => Ok(__FieldTag::__username),
21919                            "password" => Ok(__FieldTag::__password),
21920                            "caCertificate" => Ok(__FieldTag::__ca_certificate),
21921                            "ca_certificate" => Ok(__FieldTag::__ca_certificate),
21922                            "clientCertificate" => Ok(__FieldTag::__client_certificate),
21923                            "client_certificate" => Ok(__FieldTag::__client_certificate),
21924                            "clientKey" => Ok(__FieldTag::__client_key),
21925                            "client_key" => Ok(__FieldTag::__client_key),
21926                            "dumpFilePath" => Ok(__FieldTag::__dump_file_path),
21927                            "dump_file_path" => Ok(__FieldTag::__dump_file_path),
21928                            "sourceInstance" => Ok(__FieldTag::__source_instance),
21929                            "source_instance" => Ok(__FieldTag::__source_instance),
21930                            _ => Ok(__FieldTag::Unknown(value.to_string())),
21931                        }
21932                    }
21933                }
21934                deserializer.deserialize_identifier(Visitor)
21935            }
21936        }
21937        struct Visitor;
21938        impl<'de> serde::de::Visitor<'de> for Visitor {
21939            type Value = OnPremisesConfiguration;
21940            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21941                formatter.write_str("struct OnPremisesConfiguration")
21942            }
21943            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
21944            where
21945                A: serde::de::MapAccess<'de>,
21946            {
21947                #[allow(unused_imports)]
21948                use serde::de::Error;
21949                use std::option::Option::Some;
21950                let mut fields = std::collections::HashSet::new();
21951                let mut result = Self::Value::new();
21952                while let Some(tag) = map.next_key::<__FieldTag>()? {
21953                    #[allow(clippy::match_single_binding)]
21954                    match tag {
21955                        __FieldTag::__host_port => {
21956                            if !fields.insert(__FieldTag::__host_port) {
21957                                return std::result::Result::Err(A::Error::duplicate_field(
21958                                    "multiple values for host_port",
21959                                ));
21960                            }
21961                            result.host_port = map
21962                                .next_value::<std::option::Option<std::string::String>>()?
21963                                .unwrap_or_default();
21964                        }
21965                        __FieldTag::__kind => {
21966                            if !fields.insert(__FieldTag::__kind) {
21967                                return std::result::Result::Err(A::Error::duplicate_field(
21968                                    "multiple values for kind",
21969                                ));
21970                            }
21971                            result.kind = map
21972                                .next_value::<std::option::Option<std::string::String>>()?
21973                                .unwrap_or_default();
21974                        }
21975                        __FieldTag::__username => {
21976                            if !fields.insert(__FieldTag::__username) {
21977                                return std::result::Result::Err(A::Error::duplicate_field(
21978                                    "multiple values for username",
21979                                ));
21980                            }
21981                            result.username = map
21982                                .next_value::<std::option::Option<std::string::String>>()?
21983                                .unwrap_or_default();
21984                        }
21985                        __FieldTag::__password => {
21986                            if !fields.insert(__FieldTag::__password) {
21987                                return std::result::Result::Err(A::Error::duplicate_field(
21988                                    "multiple values for password",
21989                                ));
21990                            }
21991                            result.password = map
21992                                .next_value::<std::option::Option<std::string::String>>()?
21993                                .unwrap_or_default();
21994                        }
21995                        __FieldTag::__ca_certificate => {
21996                            if !fields.insert(__FieldTag::__ca_certificate) {
21997                                return std::result::Result::Err(A::Error::duplicate_field(
21998                                    "multiple values for ca_certificate",
21999                                ));
22000                            }
22001                            result.ca_certificate = map
22002                                .next_value::<std::option::Option<std::string::String>>()?
22003                                .unwrap_or_default();
22004                        }
22005                        __FieldTag::__client_certificate => {
22006                            if !fields.insert(__FieldTag::__client_certificate) {
22007                                return std::result::Result::Err(A::Error::duplicate_field(
22008                                    "multiple values for client_certificate",
22009                                ));
22010                            }
22011                            result.client_certificate = map
22012                                .next_value::<std::option::Option<std::string::String>>()?
22013                                .unwrap_or_default();
22014                        }
22015                        __FieldTag::__client_key => {
22016                            if !fields.insert(__FieldTag::__client_key) {
22017                                return std::result::Result::Err(A::Error::duplicate_field(
22018                                    "multiple values for client_key",
22019                                ));
22020                            }
22021                            result.client_key = map
22022                                .next_value::<std::option::Option<std::string::String>>()?
22023                                .unwrap_or_default();
22024                        }
22025                        __FieldTag::__dump_file_path => {
22026                            if !fields.insert(__FieldTag::__dump_file_path) {
22027                                return std::result::Result::Err(A::Error::duplicate_field(
22028                                    "multiple values for dump_file_path",
22029                                ));
22030                            }
22031                            result.dump_file_path = map
22032                                .next_value::<std::option::Option<std::string::String>>()?
22033                                .unwrap_or_default();
22034                        }
22035                        __FieldTag::__source_instance => {
22036                            if !fields.insert(__FieldTag::__source_instance) {
22037                                return std::result::Result::Err(A::Error::duplicate_field(
22038                                    "multiple values for source_instance",
22039                                ));
22040                            }
22041                            result.source_instance = map
22042                                .next_value::<std::option::Option<crate::model::InstanceReference>>(
22043                                )?;
22044                        }
22045                        __FieldTag::Unknown(key) => {
22046                            let value = map.next_value::<serde_json::Value>()?;
22047                            result._unknown_fields.insert(key, value);
22048                        }
22049                    }
22050                }
22051                std::result::Result::Ok(result)
22052            }
22053        }
22054        deserializer.deserialize_any(Visitor)
22055    }
22056}
22057
22058#[doc(hidden)]
22059impl serde::ser::Serialize for OnPremisesConfiguration {
22060    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22061    where
22062        S: serde::ser::Serializer,
22063    {
22064        use serde::ser::SerializeMap;
22065        #[allow(unused_imports)]
22066        use std::option::Option::Some;
22067        let mut state = serializer.serialize_map(std::option::Option::None)?;
22068        if !self.host_port.is_empty() {
22069            state.serialize_entry("hostPort", &self.host_port)?;
22070        }
22071        if !self.kind.is_empty() {
22072            state.serialize_entry("kind", &self.kind)?;
22073        }
22074        if !self.username.is_empty() {
22075            state.serialize_entry("username", &self.username)?;
22076        }
22077        if !self.password.is_empty() {
22078            state.serialize_entry("password", &self.password)?;
22079        }
22080        if !self.ca_certificate.is_empty() {
22081            state.serialize_entry("caCertificate", &self.ca_certificate)?;
22082        }
22083        if !self.client_certificate.is_empty() {
22084            state.serialize_entry("clientCertificate", &self.client_certificate)?;
22085        }
22086        if !self.client_key.is_empty() {
22087            state.serialize_entry("clientKey", &self.client_key)?;
22088        }
22089        if !self.dump_file_path.is_empty() {
22090            state.serialize_entry("dumpFilePath", &self.dump_file_path)?;
22091        }
22092        if self.source_instance.is_some() {
22093            state.serialize_entry("sourceInstance", &self.source_instance)?;
22094        }
22095        if !self._unknown_fields.is_empty() {
22096            for (key, value) in self._unknown_fields.iter() {
22097                state.serialize_entry(key, &value)?;
22098            }
22099        }
22100        state.end()
22101    }
22102}
22103
22104impl std::fmt::Debug for OnPremisesConfiguration {
22105    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22106        let mut debug_struct = f.debug_struct("OnPremisesConfiguration");
22107        debug_struct.field("host_port", &self.host_port);
22108        debug_struct.field("kind", &self.kind);
22109        debug_struct.field("username", &self.username);
22110        debug_struct.field("password", &self.password);
22111        debug_struct.field("ca_certificate", &self.ca_certificate);
22112        debug_struct.field("client_certificate", &self.client_certificate);
22113        debug_struct.field("client_key", &self.client_key);
22114        debug_struct.field("dump_file_path", &self.dump_file_path);
22115        debug_struct.field("source_instance", &self.source_instance);
22116        if !self._unknown_fields.is_empty() {
22117            debug_struct.field("_unknown_fields", &self._unknown_fields);
22118        }
22119        debug_struct.finish()
22120    }
22121}
22122
22123/// Read-replica configuration for connecting to the primary instance.
22124#[derive(Clone, Default, PartialEq)]
22125#[non_exhaustive]
22126pub struct ReplicaConfiguration {
22127    /// This is always `sql#replicaConfiguration`.
22128    pub kind: std::string::String,
22129
22130    /// MySQL specific configuration when replicating from a MySQL on-premises
22131    /// primary instance. Replication configuration information such as the
22132    /// username, password, certificates, and keys are not stored in the instance
22133    /// metadata. The configuration information is used only to set up the
22134    /// replication connection and is stored by MySQL in a file named
22135    /// `master.info` in the data directory.
22136    pub mysql_replica_configuration: std::option::Option<crate::model::MySqlReplicaConfiguration>,
22137
22138    /// Specifies if the replica is the failover target. If the field is set to
22139    /// `true`, the replica will be designated as a failover replica. In case the
22140    /// primary instance fails, the replica instance will be promoted as the new
22141    /// primary instance. Only one replica can be specified as failover target, and
22142    /// the replica has to be in different zone with the primary instance.
22143    pub failover_target: std::option::Option<wkt::BoolValue>,
22144
22145    /// Optional. Specifies if a SQL Server replica is a cascadable replica. A
22146    /// cascadable replica is a SQL Server cross region replica that supports
22147    /// replica(s) under it.
22148    pub cascadable_replica: std::option::Option<wkt::BoolValue>,
22149
22150    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22151}
22152
22153impl ReplicaConfiguration {
22154    pub fn new() -> Self {
22155        std::default::Default::default()
22156    }
22157
22158    /// Sets the value of [kind][crate::model::ReplicaConfiguration::kind].
22159    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22160        self.kind = v.into();
22161        self
22162    }
22163
22164    /// Sets the value of [mysql_replica_configuration][crate::model::ReplicaConfiguration::mysql_replica_configuration].
22165    pub fn set_mysql_replica_configuration<T>(mut self, v: T) -> Self
22166    where
22167        T: std::convert::Into<crate::model::MySqlReplicaConfiguration>,
22168    {
22169        self.mysql_replica_configuration = std::option::Option::Some(v.into());
22170        self
22171    }
22172
22173    /// Sets or clears the value of [mysql_replica_configuration][crate::model::ReplicaConfiguration::mysql_replica_configuration].
22174    pub fn set_or_clear_mysql_replica_configuration<T>(mut self, v: std::option::Option<T>) -> Self
22175    where
22176        T: std::convert::Into<crate::model::MySqlReplicaConfiguration>,
22177    {
22178        self.mysql_replica_configuration = v.map(|x| x.into());
22179        self
22180    }
22181
22182    /// Sets the value of [failover_target][crate::model::ReplicaConfiguration::failover_target].
22183    pub fn set_failover_target<T>(mut self, v: T) -> Self
22184    where
22185        T: std::convert::Into<wkt::BoolValue>,
22186    {
22187        self.failover_target = std::option::Option::Some(v.into());
22188        self
22189    }
22190
22191    /// Sets or clears the value of [failover_target][crate::model::ReplicaConfiguration::failover_target].
22192    pub fn set_or_clear_failover_target<T>(mut self, v: std::option::Option<T>) -> Self
22193    where
22194        T: std::convert::Into<wkt::BoolValue>,
22195    {
22196        self.failover_target = v.map(|x| x.into());
22197        self
22198    }
22199
22200    /// Sets the value of [cascadable_replica][crate::model::ReplicaConfiguration::cascadable_replica].
22201    pub fn set_cascadable_replica<T>(mut self, v: T) -> Self
22202    where
22203        T: std::convert::Into<wkt::BoolValue>,
22204    {
22205        self.cascadable_replica = std::option::Option::Some(v.into());
22206        self
22207    }
22208
22209    /// Sets or clears the value of [cascadable_replica][crate::model::ReplicaConfiguration::cascadable_replica].
22210    pub fn set_or_clear_cascadable_replica<T>(mut self, v: std::option::Option<T>) -> Self
22211    where
22212        T: std::convert::Into<wkt::BoolValue>,
22213    {
22214        self.cascadable_replica = v.map(|x| x.into());
22215        self
22216    }
22217}
22218
22219impl wkt::message::Message for ReplicaConfiguration {
22220    fn typename() -> &'static str {
22221        "type.googleapis.com/google.cloud.sql.v1.ReplicaConfiguration"
22222    }
22223}
22224
22225#[doc(hidden)]
22226impl<'de> serde::de::Deserialize<'de> for ReplicaConfiguration {
22227    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22228    where
22229        D: serde::Deserializer<'de>,
22230    {
22231        #[allow(non_camel_case_types)]
22232        #[doc(hidden)]
22233        #[derive(PartialEq, Eq, Hash)]
22234        enum __FieldTag {
22235            __kind,
22236            __mysql_replica_configuration,
22237            __failover_target,
22238            __cascadable_replica,
22239            Unknown(std::string::String),
22240        }
22241        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
22242            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22243            where
22244                D: serde::Deserializer<'de>,
22245            {
22246                struct Visitor;
22247                impl<'de> serde::de::Visitor<'de> for Visitor {
22248                    type Value = __FieldTag;
22249                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22250                        formatter.write_str("a field name for ReplicaConfiguration")
22251                    }
22252                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22253                    where
22254                        E: serde::de::Error,
22255                    {
22256                        use std::result::Result::Ok;
22257                        use std::string::ToString;
22258                        match value {
22259                            "kind" => Ok(__FieldTag::__kind),
22260                            "mysqlReplicaConfiguration" => {
22261                                Ok(__FieldTag::__mysql_replica_configuration)
22262                            }
22263                            "mysql_replica_configuration" => {
22264                                Ok(__FieldTag::__mysql_replica_configuration)
22265                            }
22266                            "failoverTarget" => Ok(__FieldTag::__failover_target),
22267                            "failover_target" => Ok(__FieldTag::__failover_target),
22268                            "cascadableReplica" => Ok(__FieldTag::__cascadable_replica),
22269                            "cascadable_replica" => Ok(__FieldTag::__cascadable_replica),
22270                            _ => Ok(__FieldTag::Unknown(value.to_string())),
22271                        }
22272                    }
22273                }
22274                deserializer.deserialize_identifier(Visitor)
22275            }
22276        }
22277        struct Visitor;
22278        impl<'de> serde::de::Visitor<'de> for Visitor {
22279            type Value = ReplicaConfiguration;
22280            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22281                formatter.write_str("struct ReplicaConfiguration")
22282            }
22283            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22284            where
22285                A: serde::de::MapAccess<'de>,
22286            {
22287                #[allow(unused_imports)]
22288                use serde::de::Error;
22289                use std::option::Option::Some;
22290                let mut fields = std::collections::HashSet::new();
22291                let mut result = Self::Value::new();
22292                while let Some(tag) = map.next_key::<__FieldTag>()? {
22293                    #[allow(clippy::match_single_binding)]
22294                    match tag {
22295                        __FieldTag::__kind => {
22296                            if !fields.insert(__FieldTag::__kind) {
22297                                return std::result::Result::Err(A::Error::duplicate_field(
22298                                    "multiple values for kind",
22299                                ));
22300                            }
22301                            result.kind = map
22302                                .next_value::<std::option::Option<std::string::String>>()?
22303                                .unwrap_or_default();
22304                        }
22305                        __FieldTag::__mysql_replica_configuration => {
22306                            if !fields.insert(__FieldTag::__mysql_replica_configuration) {
22307                                return std::result::Result::Err(A::Error::duplicate_field(
22308                                    "multiple values for mysql_replica_configuration",
22309                                ));
22310                            }
22311                            result.mysql_replica_configuration = map.next_value::<std::option::Option<crate::model::MySqlReplicaConfiguration>>()?
22312                                ;
22313                        }
22314                        __FieldTag::__failover_target => {
22315                            if !fields.insert(__FieldTag::__failover_target) {
22316                                return std::result::Result::Err(A::Error::duplicate_field(
22317                                    "multiple values for failover_target",
22318                                ));
22319                            }
22320                            result.failover_target =
22321                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
22322                        }
22323                        __FieldTag::__cascadable_replica => {
22324                            if !fields.insert(__FieldTag::__cascadable_replica) {
22325                                return std::result::Result::Err(A::Error::duplicate_field(
22326                                    "multiple values for cascadable_replica",
22327                                ));
22328                            }
22329                            result.cascadable_replica =
22330                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
22331                        }
22332                        __FieldTag::Unknown(key) => {
22333                            let value = map.next_value::<serde_json::Value>()?;
22334                            result._unknown_fields.insert(key, value);
22335                        }
22336                    }
22337                }
22338                std::result::Result::Ok(result)
22339            }
22340        }
22341        deserializer.deserialize_any(Visitor)
22342    }
22343}
22344
22345#[doc(hidden)]
22346impl serde::ser::Serialize for ReplicaConfiguration {
22347    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22348    where
22349        S: serde::ser::Serializer,
22350    {
22351        use serde::ser::SerializeMap;
22352        #[allow(unused_imports)]
22353        use std::option::Option::Some;
22354        let mut state = serializer.serialize_map(std::option::Option::None)?;
22355        if !self.kind.is_empty() {
22356            state.serialize_entry("kind", &self.kind)?;
22357        }
22358        if self.mysql_replica_configuration.is_some() {
22359            state.serialize_entry(
22360                "mysqlReplicaConfiguration",
22361                &self.mysql_replica_configuration,
22362            )?;
22363        }
22364        if self.failover_target.is_some() {
22365            state.serialize_entry("failoverTarget", &self.failover_target)?;
22366        }
22367        if self.cascadable_replica.is_some() {
22368            state.serialize_entry("cascadableReplica", &self.cascadable_replica)?;
22369        }
22370        if !self._unknown_fields.is_empty() {
22371            for (key, value) in self._unknown_fields.iter() {
22372                state.serialize_entry(key, &value)?;
22373            }
22374        }
22375        state.end()
22376    }
22377}
22378
22379impl std::fmt::Debug for ReplicaConfiguration {
22380    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22381        let mut debug_struct = f.debug_struct("ReplicaConfiguration");
22382        debug_struct.field("kind", &self.kind);
22383        debug_struct.field(
22384            "mysql_replica_configuration",
22385            &self.mysql_replica_configuration,
22386        );
22387        debug_struct.field("failover_target", &self.failover_target);
22388        debug_struct.field("cascadable_replica", &self.cascadable_replica);
22389        if !self._unknown_fields.is_empty() {
22390            debug_struct.field("_unknown_fields", &self._unknown_fields);
22391        }
22392        debug_struct.finish()
22393    }
22394}
22395
22396/// Request to acquire a lease for SSRS.
22397#[derive(Clone, Default, PartialEq)]
22398#[non_exhaustive]
22399pub struct SqlInstancesAcquireSsrsLeaseRequest {
22400    /// Required. Cloud SQL instance ID. This doesn't include the project ID. It's
22401    /// composed of lowercase letters, numbers, and hyphens, and it must start with
22402    /// a letter. The total length must be 98 characters or less (Example:
22403    /// instance-id).
22404    pub instance: std::string::String,
22405
22406    /// Required. Project ID of the project that contains the instance (Example:
22407    /// project-id).
22408    pub project: std::string::String,
22409
22410    /// Required. The request body.
22411    pub body: std::option::Option<crate::model::InstancesAcquireSsrsLeaseRequest>,
22412
22413    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22414}
22415
22416impl SqlInstancesAcquireSsrsLeaseRequest {
22417    pub fn new() -> Self {
22418        std::default::Default::default()
22419    }
22420
22421    /// Sets the value of [instance][crate::model::SqlInstancesAcquireSsrsLeaseRequest::instance].
22422    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22423        self.instance = v.into();
22424        self
22425    }
22426
22427    /// Sets the value of [project][crate::model::SqlInstancesAcquireSsrsLeaseRequest::project].
22428    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22429        self.project = v.into();
22430        self
22431    }
22432
22433    /// Sets the value of [body][crate::model::SqlInstancesAcquireSsrsLeaseRequest::body].
22434    pub fn set_body<T>(mut self, v: T) -> Self
22435    where
22436        T: std::convert::Into<crate::model::InstancesAcquireSsrsLeaseRequest>,
22437    {
22438        self.body = std::option::Option::Some(v.into());
22439        self
22440    }
22441
22442    /// Sets or clears the value of [body][crate::model::SqlInstancesAcquireSsrsLeaseRequest::body].
22443    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
22444    where
22445        T: std::convert::Into<crate::model::InstancesAcquireSsrsLeaseRequest>,
22446    {
22447        self.body = v.map(|x| x.into());
22448        self
22449    }
22450}
22451
22452impl wkt::message::Message for SqlInstancesAcquireSsrsLeaseRequest {
22453    fn typename() -> &'static str {
22454        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest"
22455    }
22456}
22457
22458#[doc(hidden)]
22459impl<'de> serde::de::Deserialize<'de> for SqlInstancesAcquireSsrsLeaseRequest {
22460    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22461    where
22462        D: serde::Deserializer<'de>,
22463    {
22464        #[allow(non_camel_case_types)]
22465        #[doc(hidden)]
22466        #[derive(PartialEq, Eq, Hash)]
22467        enum __FieldTag {
22468            __instance,
22469            __project,
22470            __body,
22471            Unknown(std::string::String),
22472        }
22473        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
22474            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22475            where
22476                D: serde::Deserializer<'de>,
22477            {
22478                struct Visitor;
22479                impl<'de> serde::de::Visitor<'de> for Visitor {
22480                    type Value = __FieldTag;
22481                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22482                        formatter.write_str("a field name for SqlInstancesAcquireSsrsLeaseRequest")
22483                    }
22484                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22485                    where
22486                        E: serde::de::Error,
22487                    {
22488                        use std::result::Result::Ok;
22489                        use std::string::ToString;
22490                        match value {
22491                            "instance" => Ok(__FieldTag::__instance),
22492                            "project" => Ok(__FieldTag::__project),
22493                            "body" => Ok(__FieldTag::__body),
22494                            _ => Ok(__FieldTag::Unknown(value.to_string())),
22495                        }
22496                    }
22497                }
22498                deserializer.deserialize_identifier(Visitor)
22499            }
22500        }
22501        struct Visitor;
22502        impl<'de> serde::de::Visitor<'de> for Visitor {
22503            type Value = SqlInstancesAcquireSsrsLeaseRequest;
22504            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22505                formatter.write_str("struct SqlInstancesAcquireSsrsLeaseRequest")
22506            }
22507            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22508            where
22509                A: serde::de::MapAccess<'de>,
22510            {
22511                #[allow(unused_imports)]
22512                use serde::de::Error;
22513                use std::option::Option::Some;
22514                let mut fields = std::collections::HashSet::new();
22515                let mut result = Self::Value::new();
22516                while let Some(tag) = map.next_key::<__FieldTag>()? {
22517                    #[allow(clippy::match_single_binding)]
22518                    match tag {
22519                        __FieldTag::__instance => {
22520                            if !fields.insert(__FieldTag::__instance) {
22521                                return std::result::Result::Err(A::Error::duplicate_field(
22522                                    "multiple values for instance",
22523                                ));
22524                            }
22525                            result.instance = map
22526                                .next_value::<std::option::Option<std::string::String>>()?
22527                                .unwrap_or_default();
22528                        }
22529                        __FieldTag::__project => {
22530                            if !fields.insert(__FieldTag::__project) {
22531                                return std::result::Result::Err(A::Error::duplicate_field(
22532                                    "multiple values for project",
22533                                ));
22534                            }
22535                            result.project = map
22536                                .next_value::<std::option::Option<std::string::String>>()?
22537                                .unwrap_or_default();
22538                        }
22539                        __FieldTag::__body => {
22540                            if !fields.insert(__FieldTag::__body) {
22541                                return std::result::Result::Err(A::Error::duplicate_field(
22542                                    "multiple values for body",
22543                                ));
22544                            }
22545                            result.body = map.next_value::<std::option::Option<
22546                                crate::model::InstancesAcquireSsrsLeaseRequest,
22547                            >>()?;
22548                        }
22549                        __FieldTag::Unknown(key) => {
22550                            let value = map.next_value::<serde_json::Value>()?;
22551                            result._unknown_fields.insert(key, value);
22552                        }
22553                    }
22554                }
22555                std::result::Result::Ok(result)
22556            }
22557        }
22558        deserializer.deserialize_any(Visitor)
22559    }
22560}
22561
22562#[doc(hidden)]
22563impl serde::ser::Serialize for SqlInstancesAcquireSsrsLeaseRequest {
22564    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22565    where
22566        S: serde::ser::Serializer,
22567    {
22568        use serde::ser::SerializeMap;
22569        #[allow(unused_imports)]
22570        use std::option::Option::Some;
22571        let mut state = serializer.serialize_map(std::option::Option::None)?;
22572        if !self.instance.is_empty() {
22573            state.serialize_entry("instance", &self.instance)?;
22574        }
22575        if !self.project.is_empty() {
22576            state.serialize_entry("project", &self.project)?;
22577        }
22578        if self.body.is_some() {
22579            state.serialize_entry("body", &self.body)?;
22580        }
22581        if !self._unknown_fields.is_empty() {
22582            for (key, value) in self._unknown_fields.iter() {
22583                state.serialize_entry(key, &value)?;
22584            }
22585        }
22586        state.end()
22587    }
22588}
22589
22590impl std::fmt::Debug for SqlInstancesAcquireSsrsLeaseRequest {
22591    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22592        let mut debug_struct = f.debug_struct("SqlInstancesAcquireSsrsLeaseRequest");
22593        debug_struct.field("instance", &self.instance);
22594        debug_struct.field("project", &self.project);
22595        debug_struct.field("body", &self.body);
22596        if !self._unknown_fields.is_empty() {
22597            debug_struct.field("_unknown_fields", &self._unknown_fields);
22598        }
22599        debug_struct.finish()
22600    }
22601}
22602
22603/// Response for the acquire SSRS lease request.
22604#[derive(Clone, Default, PartialEq)]
22605#[non_exhaustive]
22606pub struct SqlInstancesAcquireSsrsLeaseResponse {
22607    /// The unique identifier for this operation.
22608    pub operation_id: std::string::String,
22609
22610    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22611}
22612
22613impl SqlInstancesAcquireSsrsLeaseResponse {
22614    pub fn new() -> Self {
22615        std::default::Default::default()
22616    }
22617
22618    /// Sets the value of [operation_id][crate::model::SqlInstancesAcquireSsrsLeaseResponse::operation_id].
22619    pub fn set_operation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22620        self.operation_id = v.into();
22621        self
22622    }
22623}
22624
22625impl wkt::message::Message for SqlInstancesAcquireSsrsLeaseResponse {
22626    fn typename() -> &'static str {
22627        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse"
22628    }
22629}
22630
22631#[doc(hidden)]
22632impl<'de> serde::de::Deserialize<'de> for SqlInstancesAcquireSsrsLeaseResponse {
22633    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22634    where
22635        D: serde::Deserializer<'de>,
22636    {
22637        #[allow(non_camel_case_types)]
22638        #[doc(hidden)]
22639        #[derive(PartialEq, Eq, Hash)]
22640        enum __FieldTag {
22641            __operation_id,
22642            Unknown(std::string::String),
22643        }
22644        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
22645            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22646            where
22647                D: serde::Deserializer<'de>,
22648            {
22649                struct Visitor;
22650                impl<'de> serde::de::Visitor<'de> for Visitor {
22651                    type Value = __FieldTag;
22652                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22653                        formatter.write_str("a field name for SqlInstancesAcquireSsrsLeaseResponse")
22654                    }
22655                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22656                    where
22657                        E: serde::de::Error,
22658                    {
22659                        use std::result::Result::Ok;
22660                        use std::string::ToString;
22661                        match value {
22662                            "operationId" => Ok(__FieldTag::__operation_id),
22663                            "operation_id" => Ok(__FieldTag::__operation_id),
22664                            _ => Ok(__FieldTag::Unknown(value.to_string())),
22665                        }
22666                    }
22667                }
22668                deserializer.deserialize_identifier(Visitor)
22669            }
22670        }
22671        struct Visitor;
22672        impl<'de> serde::de::Visitor<'de> for Visitor {
22673            type Value = SqlInstancesAcquireSsrsLeaseResponse;
22674            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22675                formatter.write_str("struct SqlInstancesAcquireSsrsLeaseResponse")
22676            }
22677            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22678            where
22679                A: serde::de::MapAccess<'de>,
22680            {
22681                #[allow(unused_imports)]
22682                use serde::de::Error;
22683                use std::option::Option::Some;
22684                let mut fields = std::collections::HashSet::new();
22685                let mut result = Self::Value::new();
22686                while let Some(tag) = map.next_key::<__FieldTag>()? {
22687                    #[allow(clippy::match_single_binding)]
22688                    match tag {
22689                        __FieldTag::__operation_id => {
22690                            if !fields.insert(__FieldTag::__operation_id) {
22691                                return std::result::Result::Err(A::Error::duplicate_field(
22692                                    "multiple values for operation_id",
22693                                ));
22694                            }
22695                            result.operation_id = map
22696                                .next_value::<std::option::Option<std::string::String>>()?
22697                                .unwrap_or_default();
22698                        }
22699                        __FieldTag::Unknown(key) => {
22700                            let value = map.next_value::<serde_json::Value>()?;
22701                            result._unknown_fields.insert(key, value);
22702                        }
22703                    }
22704                }
22705                std::result::Result::Ok(result)
22706            }
22707        }
22708        deserializer.deserialize_any(Visitor)
22709    }
22710}
22711
22712#[doc(hidden)]
22713impl serde::ser::Serialize for SqlInstancesAcquireSsrsLeaseResponse {
22714    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22715    where
22716        S: serde::ser::Serializer,
22717    {
22718        use serde::ser::SerializeMap;
22719        #[allow(unused_imports)]
22720        use std::option::Option::Some;
22721        let mut state = serializer.serialize_map(std::option::Option::None)?;
22722        if !self.operation_id.is_empty() {
22723            state.serialize_entry("operationId", &self.operation_id)?;
22724        }
22725        if !self._unknown_fields.is_empty() {
22726            for (key, value) in self._unknown_fields.iter() {
22727                state.serialize_entry(key, &value)?;
22728            }
22729        }
22730        state.end()
22731    }
22732}
22733
22734impl std::fmt::Debug for SqlInstancesAcquireSsrsLeaseResponse {
22735    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22736        let mut debug_struct = f.debug_struct("SqlInstancesAcquireSsrsLeaseResponse");
22737        debug_struct.field("operation_id", &self.operation_id);
22738        if !self._unknown_fields.is_empty() {
22739            debug_struct.field("_unknown_fields", &self._unknown_fields);
22740        }
22741        debug_struct.finish()
22742    }
22743}
22744
22745/// Request to release a lease for SSRS.
22746#[derive(Clone, Default, PartialEq)]
22747#[non_exhaustive]
22748pub struct SqlInstancesReleaseSsrsLeaseRequest {
22749    /// Required. The Cloud SQL instance ID. This doesn't include the project ID.
22750    /// The instance ID contains lowercase letters, numbers, and hyphens, and it
22751    /// must start with a letter. This ID can have a maximum length of 98
22752    /// characters.
22753    pub instance: std::string::String,
22754
22755    /// Required. The project ID that contains the instance.
22756    pub project: std::string::String,
22757
22758    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22759}
22760
22761impl SqlInstancesReleaseSsrsLeaseRequest {
22762    pub fn new() -> Self {
22763        std::default::Default::default()
22764    }
22765
22766    /// Sets the value of [instance][crate::model::SqlInstancesReleaseSsrsLeaseRequest::instance].
22767    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22768        self.instance = v.into();
22769        self
22770    }
22771
22772    /// Sets the value of [project][crate::model::SqlInstancesReleaseSsrsLeaseRequest::project].
22773    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22774        self.project = v.into();
22775        self
22776    }
22777}
22778
22779impl wkt::message::Message for SqlInstancesReleaseSsrsLeaseRequest {
22780    fn typename() -> &'static str {
22781        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest"
22782    }
22783}
22784
22785#[doc(hidden)]
22786impl<'de> serde::de::Deserialize<'de> for SqlInstancesReleaseSsrsLeaseRequest {
22787    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22788    where
22789        D: serde::Deserializer<'de>,
22790    {
22791        #[allow(non_camel_case_types)]
22792        #[doc(hidden)]
22793        #[derive(PartialEq, Eq, Hash)]
22794        enum __FieldTag {
22795            __instance,
22796            __project,
22797            Unknown(std::string::String),
22798        }
22799        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
22800            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22801            where
22802                D: serde::Deserializer<'de>,
22803            {
22804                struct Visitor;
22805                impl<'de> serde::de::Visitor<'de> for Visitor {
22806                    type Value = __FieldTag;
22807                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22808                        formatter.write_str("a field name for SqlInstancesReleaseSsrsLeaseRequest")
22809                    }
22810                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22811                    where
22812                        E: serde::de::Error,
22813                    {
22814                        use std::result::Result::Ok;
22815                        use std::string::ToString;
22816                        match value {
22817                            "instance" => Ok(__FieldTag::__instance),
22818                            "project" => Ok(__FieldTag::__project),
22819                            _ => Ok(__FieldTag::Unknown(value.to_string())),
22820                        }
22821                    }
22822                }
22823                deserializer.deserialize_identifier(Visitor)
22824            }
22825        }
22826        struct Visitor;
22827        impl<'de> serde::de::Visitor<'de> for Visitor {
22828            type Value = SqlInstancesReleaseSsrsLeaseRequest;
22829            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22830                formatter.write_str("struct SqlInstancesReleaseSsrsLeaseRequest")
22831            }
22832            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22833            where
22834                A: serde::de::MapAccess<'de>,
22835            {
22836                #[allow(unused_imports)]
22837                use serde::de::Error;
22838                use std::option::Option::Some;
22839                let mut fields = std::collections::HashSet::new();
22840                let mut result = Self::Value::new();
22841                while let Some(tag) = map.next_key::<__FieldTag>()? {
22842                    #[allow(clippy::match_single_binding)]
22843                    match tag {
22844                        __FieldTag::__instance => {
22845                            if !fields.insert(__FieldTag::__instance) {
22846                                return std::result::Result::Err(A::Error::duplicate_field(
22847                                    "multiple values for instance",
22848                                ));
22849                            }
22850                            result.instance = map
22851                                .next_value::<std::option::Option<std::string::String>>()?
22852                                .unwrap_or_default();
22853                        }
22854                        __FieldTag::__project => {
22855                            if !fields.insert(__FieldTag::__project) {
22856                                return std::result::Result::Err(A::Error::duplicate_field(
22857                                    "multiple values for project",
22858                                ));
22859                            }
22860                            result.project = map
22861                                .next_value::<std::option::Option<std::string::String>>()?
22862                                .unwrap_or_default();
22863                        }
22864                        __FieldTag::Unknown(key) => {
22865                            let value = map.next_value::<serde_json::Value>()?;
22866                            result._unknown_fields.insert(key, value);
22867                        }
22868                    }
22869                }
22870                std::result::Result::Ok(result)
22871            }
22872        }
22873        deserializer.deserialize_any(Visitor)
22874    }
22875}
22876
22877#[doc(hidden)]
22878impl serde::ser::Serialize for SqlInstancesReleaseSsrsLeaseRequest {
22879    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22880    where
22881        S: serde::ser::Serializer,
22882    {
22883        use serde::ser::SerializeMap;
22884        #[allow(unused_imports)]
22885        use std::option::Option::Some;
22886        let mut state = serializer.serialize_map(std::option::Option::None)?;
22887        if !self.instance.is_empty() {
22888            state.serialize_entry("instance", &self.instance)?;
22889        }
22890        if !self.project.is_empty() {
22891            state.serialize_entry("project", &self.project)?;
22892        }
22893        if !self._unknown_fields.is_empty() {
22894            for (key, value) in self._unknown_fields.iter() {
22895                state.serialize_entry(key, &value)?;
22896            }
22897        }
22898        state.end()
22899    }
22900}
22901
22902impl std::fmt::Debug for SqlInstancesReleaseSsrsLeaseRequest {
22903    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22904        let mut debug_struct = f.debug_struct("SqlInstancesReleaseSsrsLeaseRequest");
22905        debug_struct.field("instance", &self.instance);
22906        debug_struct.field("project", &self.project);
22907        if !self._unknown_fields.is_empty() {
22908            debug_struct.field("_unknown_fields", &self._unknown_fields);
22909        }
22910        debug_struct.finish()
22911    }
22912}
22913
22914/// Response for the release SSRS lease request.
22915#[derive(Clone, Default, PartialEq)]
22916#[non_exhaustive]
22917pub struct SqlInstancesReleaseSsrsLeaseResponse {
22918    /// The unique identifier for this operation.
22919    pub operation_id: std::string::String,
22920
22921    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22922}
22923
22924impl SqlInstancesReleaseSsrsLeaseResponse {
22925    pub fn new() -> Self {
22926        std::default::Default::default()
22927    }
22928
22929    /// Sets the value of [operation_id][crate::model::SqlInstancesReleaseSsrsLeaseResponse::operation_id].
22930    pub fn set_operation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22931        self.operation_id = v.into();
22932        self
22933    }
22934}
22935
22936impl wkt::message::Message for SqlInstancesReleaseSsrsLeaseResponse {
22937    fn typename() -> &'static str {
22938        "type.googleapis.com/google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse"
22939    }
22940}
22941
22942#[doc(hidden)]
22943impl<'de> serde::de::Deserialize<'de> for SqlInstancesReleaseSsrsLeaseResponse {
22944    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22945    where
22946        D: serde::Deserializer<'de>,
22947    {
22948        #[allow(non_camel_case_types)]
22949        #[doc(hidden)]
22950        #[derive(PartialEq, Eq, Hash)]
22951        enum __FieldTag {
22952            __operation_id,
22953            Unknown(std::string::String),
22954        }
22955        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
22956            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22957            where
22958                D: serde::Deserializer<'de>,
22959            {
22960                struct Visitor;
22961                impl<'de> serde::de::Visitor<'de> for Visitor {
22962                    type Value = __FieldTag;
22963                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22964                        formatter.write_str("a field name for SqlInstancesReleaseSsrsLeaseResponse")
22965                    }
22966                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22967                    where
22968                        E: serde::de::Error,
22969                    {
22970                        use std::result::Result::Ok;
22971                        use std::string::ToString;
22972                        match value {
22973                            "operationId" => Ok(__FieldTag::__operation_id),
22974                            "operation_id" => Ok(__FieldTag::__operation_id),
22975                            _ => Ok(__FieldTag::Unknown(value.to_string())),
22976                        }
22977                    }
22978                }
22979                deserializer.deserialize_identifier(Visitor)
22980            }
22981        }
22982        struct Visitor;
22983        impl<'de> serde::de::Visitor<'de> for Visitor {
22984            type Value = SqlInstancesReleaseSsrsLeaseResponse;
22985            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22986                formatter.write_str("struct SqlInstancesReleaseSsrsLeaseResponse")
22987            }
22988            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22989            where
22990                A: serde::de::MapAccess<'de>,
22991            {
22992                #[allow(unused_imports)]
22993                use serde::de::Error;
22994                use std::option::Option::Some;
22995                let mut fields = std::collections::HashSet::new();
22996                let mut result = Self::Value::new();
22997                while let Some(tag) = map.next_key::<__FieldTag>()? {
22998                    #[allow(clippy::match_single_binding)]
22999                    match tag {
23000                        __FieldTag::__operation_id => {
23001                            if !fields.insert(__FieldTag::__operation_id) {
23002                                return std::result::Result::Err(A::Error::duplicate_field(
23003                                    "multiple values for operation_id",
23004                                ));
23005                            }
23006                            result.operation_id = map
23007                                .next_value::<std::option::Option<std::string::String>>()?
23008                                .unwrap_or_default();
23009                        }
23010                        __FieldTag::Unknown(key) => {
23011                            let value = map.next_value::<serde_json::Value>()?;
23012                            result._unknown_fields.insert(key, value);
23013                        }
23014                    }
23015                }
23016                std::result::Result::Ok(result)
23017            }
23018        }
23019        deserializer.deserialize_any(Visitor)
23020    }
23021}
23022
23023#[doc(hidden)]
23024impl serde::ser::Serialize for SqlInstancesReleaseSsrsLeaseResponse {
23025    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23026    where
23027        S: serde::ser::Serializer,
23028    {
23029        use serde::ser::SerializeMap;
23030        #[allow(unused_imports)]
23031        use std::option::Option::Some;
23032        let mut state = serializer.serialize_map(std::option::Option::None)?;
23033        if !self.operation_id.is_empty() {
23034            state.serialize_entry("operationId", &self.operation_id)?;
23035        }
23036        if !self._unknown_fields.is_empty() {
23037            for (key, value) in self._unknown_fields.iter() {
23038                state.serialize_entry(key, &value)?;
23039            }
23040        }
23041        state.end()
23042    }
23043}
23044
23045impl std::fmt::Debug for SqlInstancesReleaseSsrsLeaseResponse {
23046    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23047        let mut debug_struct = f.debug_struct("SqlInstancesReleaseSsrsLeaseResponse");
23048        debug_struct.field("operation_id", &self.operation_id);
23049        if !self._unknown_fields.is_empty() {
23050            debug_struct.field("_unknown_fields", &self._unknown_fields);
23051        }
23052        debug_struct.finish()
23053    }
23054}
23055
23056/// Operations get request.
23057#[derive(Clone, Default, PartialEq)]
23058#[non_exhaustive]
23059pub struct SqlOperationsGetRequest {
23060    /// Instance operation ID.
23061    pub operation: std::string::String,
23062
23063    /// Project ID of the project that contains the instance.
23064    pub project: std::string::String,
23065
23066    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23067}
23068
23069impl SqlOperationsGetRequest {
23070    pub fn new() -> Self {
23071        std::default::Default::default()
23072    }
23073
23074    /// Sets the value of [operation][crate::model::SqlOperationsGetRequest::operation].
23075    pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23076        self.operation = v.into();
23077        self
23078    }
23079
23080    /// Sets the value of [project][crate::model::SqlOperationsGetRequest::project].
23081    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23082        self.project = v.into();
23083        self
23084    }
23085}
23086
23087impl wkt::message::Message for SqlOperationsGetRequest {
23088    fn typename() -> &'static str {
23089        "type.googleapis.com/google.cloud.sql.v1.SqlOperationsGetRequest"
23090    }
23091}
23092
23093#[doc(hidden)]
23094impl<'de> serde::de::Deserialize<'de> for SqlOperationsGetRequest {
23095    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23096    where
23097        D: serde::Deserializer<'de>,
23098    {
23099        #[allow(non_camel_case_types)]
23100        #[doc(hidden)]
23101        #[derive(PartialEq, Eq, Hash)]
23102        enum __FieldTag {
23103            __operation,
23104            __project,
23105            Unknown(std::string::String),
23106        }
23107        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
23108            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23109            where
23110                D: serde::Deserializer<'de>,
23111            {
23112                struct Visitor;
23113                impl<'de> serde::de::Visitor<'de> for Visitor {
23114                    type Value = __FieldTag;
23115                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23116                        formatter.write_str("a field name for SqlOperationsGetRequest")
23117                    }
23118                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
23119                    where
23120                        E: serde::de::Error,
23121                    {
23122                        use std::result::Result::Ok;
23123                        use std::string::ToString;
23124                        match value {
23125                            "operation" => Ok(__FieldTag::__operation),
23126                            "project" => Ok(__FieldTag::__project),
23127                            _ => Ok(__FieldTag::Unknown(value.to_string())),
23128                        }
23129                    }
23130                }
23131                deserializer.deserialize_identifier(Visitor)
23132            }
23133        }
23134        struct Visitor;
23135        impl<'de> serde::de::Visitor<'de> for Visitor {
23136            type Value = SqlOperationsGetRequest;
23137            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23138                formatter.write_str("struct SqlOperationsGetRequest")
23139            }
23140            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
23141            where
23142                A: serde::de::MapAccess<'de>,
23143            {
23144                #[allow(unused_imports)]
23145                use serde::de::Error;
23146                use std::option::Option::Some;
23147                let mut fields = std::collections::HashSet::new();
23148                let mut result = Self::Value::new();
23149                while let Some(tag) = map.next_key::<__FieldTag>()? {
23150                    #[allow(clippy::match_single_binding)]
23151                    match tag {
23152                        __FieldTag::__operation => {
23153                            if !fields.insert(__FieldTag::__operation) {
23154                                return std::result::Result::Err(A::Error::duplicate_field(
23155                                    "multiple values for operation",
23156                                ));
23157                            }
23158                            result.operation = map
23159                                .next_value::<std::option::Option<std::string::String>>()?
23160                                .unwrap_or_default();
23161                        }
23162                        __FieldTag::__project => {
23163                            if !fields.insert(__FieldTag::__project) {
23164                                return std::result::Result::Err(A::Error::duplicate_field(
23165                                    "multiple values for project",
23166                                ));
23167                            }
23168                            result.project = map
23169                                .next_value::<std::option::Option<std::string::String>>()?
23170                                .unwrap_or_default();
23171                        }
23172                        __FieldTag::Unknown(key) => {
23173                            let value = map.next_value::<serde_json::Value>()?;
23174                            result._unknown_fields.insert(key, value);
23175                        }
23176                    }
23177                }
23178                std::result::Result::Ok(result)
23179            }
23180        }
23181        deserializer.deserialize_any(Visitor)
23182    }
23183}
23184
23185#[doc(hidden)]
23186impl serde::ser::Serialize for SqlOperationsGetRequest {
23187    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23188    where
23189        S: serde::ser::Serializer,
23190    {
23191        use serde::ser::SerializeMap;
23192        #[allow(unused_imports)]
23193        use std::option::Option::Some;
23194        let mut state = serializer.serialize_map(std::option::Option::None)?;
23195        if !self.operation.is_empty() {
23196            state.serialize_entry("operation", &self.operation)?;
23197        }
23198        if !self.project.is_empty() {
23199            state.serialize_entry("project", &self.project)?;
23200        }
23201        if !self._unknown_fields.is_empty() {
23202            for (key, value) in self._unknown_fields.iter() {
23203                state.serialize_entry(key, &value)?;
23204            }
23205        }
23206        state.end()
23207    }
23208}
23209
23210impl std::fmt::Debug for SqlOperationsGetRequest {
23211    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23212        let mut debug_struct = f.debug_struct("SqlOperationsGetRequest");
23213        debug_struct.field("operation", &self.operation);
23214        debug_struct.field("project", &self.project);
23215        if !self._unknown_fields.is_empty() {
23216            debug_struct.field("_unknown_fields", &self._unknown_fields);
23217        }
23218        debug_struct.finish()
23219    }
23220}
23221
23222/// Operations list request.
23223#[derive(Clone, Default, PartialEq)]
23224#[non_exhaustive]
23225pub struct SqlOperationsListRequest {
23226    /// Cloud SQL instance ID. This does not include the project ID.
23227    pub instance: std::string::String,
23228
23229    /// Maximum number of operations per response.
23230    pub max_results: u32,
23231
23232    /// A previously-returned page token representing part of the larger set of
23233    /// results to view.
23234    pub page_token: std::string::String,
23235
23236    /// Project ID of the project that contains the instance.
23237    pub project: std::string::String,
23238
23239    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23240}
23241
23242impl SqlOperationsListRequest {
23243    pub fn new() -> Self {
23244        std::default::Default::default()
23245    }
23246
23247    /// Sets the value of [instance][crate::model::SqlOperationsListRequest::instance].
23248    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23249        self.instance = v.into();
23250        self
23251    }
23252
23253    /// Sets the value of [max_results][crate::model::SqlOperationsListRequest::max_results].
23254    pub fn set_max_results<T: std::convert::Into<u32>>(mut self, v: T) -> Self {
23255        self.max_results = v.into();
23256        self
23257    }
23258
23259    /// Sets the value of [page_token][crate::model::SqlOperationsListRequest::page_token].
23260    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23261        self.page_token = v.into();
23262        self
23263    }
23264
23265    /// Sets the value of [project][crate::model::SqlOperationsListRequest::project].
23266    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23267        self.project = v.into();
23268        self
23269    }
23270}
23271
23272impl wkt::message::Message for SqlOperationsListRequest {
23273    fn typename() -> &'static str {
23274        "type.googleapis.com/google.cloud.sql.v1.SqlOperationsListRequest"
23275    }
23276}
23277
23278#[doc(hidden)]
23279impl<'de> serde::de::Deserialize<'de> for SqlOperationsListRequest {
23280    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23281    where
23282        D: serde::Deserializer<'de>,
23283    {
23284        #[allow(non_camel_case_types)]
23285        #[doc(hidden)]
23286        #[derive(PartialEq, Eq, Hash)]
23287        enum __FieldTag {
23288            __instance,
23289            __max_results,
23290            __page_token,
23291            __project,
23292            Unknown(std::string::String),
23293        }
23294        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
23295            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23296            where
23297                D: serde::Deserializer<'de>,
23298            {
23299                struct Visitor;
23300                impl<'de> serde::de::Visitor<'de> for Visitor {
23301                    type Value = __FieldTag;
23302                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23303                        formatter.write_str("a field name for SqlOperationsListRequest")
23304                    }
23305                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
23306                    where
23307                        E: serde::de::Error,
23308                    {
23309                        use std::result::Result::Ok;
23310                        use std::string::ToString;
23311                        match value {
23312                            "instance" => Ok(__FieldTag::__instance),
23313                            "maxResults" => Ok(__FieldTag::__max_results),
23314                            "max_results" => Ok(__FieldTag::__max_results),
23315                            "pageToken" => Ok(__FieldTag::__page_token),
23316                            "page_token" => Ok(__FieldTag::__page_token),
23317                            "project" => Ok(__FieldTag::__project),
23318                            _ => Ok(__FieldTag::Unknown(value.to_string())),
23319                        }
23320                    }
23321                }
23322                deserializer.deserialize_identifier(Visitor)
23323            }
23324        }
23325        struct Visitor;
23326        impl<'de> serde::de::Visitor<'de> for Visitor {
23327            type Value = SqlOperationsListRequest;
23328            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23329                formatter.write_str("struct SqlOperationsListRequest")
23330            }
23331            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
23332            where
23333                A: serde::de::MapAccess<'de>,
23334            {
23335                #[allow(unused_imports)]
23336                use serde::de::Error;
23337                use std::option::Option::Some;
23338                let mut fields = std::collections::HashSet::new();
23339                let mut result = Self::Value::new();
23340                while let Some(tag) = map.next_key::<__FieldTag>()? {
23341                    #[allow(clippy::match_single_binding)]
23342                    match tag {
23343                        __FieldTag::__instance => {
23344                            if !fields.insert(__FieldTag::__instance) {
23345                                return std::result::Result::Err(A::Error::duplicate_field(
23346                                    "multiple values for instance",
23347                                ));
23348                            }
23349                            result.instance = map
23350                                .next_value::<std::option::Option<std::string::String>>()?
23351                                .unwrap_or_default();
23352                        }
23353                        __FieldTag::__max_results => {
23354                            if !fields.insert(__FieldTag::__max_results) {
23355                                return std::result::Result::Err(A::Error::duplicate_field(
23356                                    "multiple values for max_results",
23357                                ));
23358                            }
23359                            struct __With(std::option::Option<u32>);
23360                            impl<'de> serde::de::Deserialize<'de> for __With {
23361                                fn deserialize<D>(
23362                                    deserializer: D,
23363                                ) -> std::result::Result<Self, D::Error>
23364                                where
23365                                    D: serde::de::Deserializer<'de>,
23366                                {
23367                                    serde_with::As::< std::option::Option<wkt::internal::U32> >::deserialize(deserializer).map(__With)
23368                                }
23369                            }
23370                            result.max_results = map.next_value::<__With>()?.0.unwrap_or_default();
23371                        }
23372                        __FieldTag::__page_token => {
23373                            if !fields.insert(__FieldTag::__page_token) {
23374                                return std::result::Result::Err(A::Error::duplicate_field(
23375                                    "multiple values for page_token",
23376                                ));
23377                            }
23378                            result.page_token = map
23379                                .next_value::<std::option::Option<std::string::String>>()?
23380                                .unwrap_or_default();
23381                        }
23382                        __FieldTag::__project => {
23383                            if !fields.insert(__FieldTag::__project) {
23384                                return std::result::Result::Err(A::Error::duplicate_field(
23385                                    "multiple values for project",
23386                                ));
23387                            }
23388                            result.project = map
23389                                .next_value::<std::option::Option<std::string::String>>()?
23390                                .unwrap_or_default();
23391                        }
23392                        __FieldTag::Unknown(key) => {
23393                            let value = map.next_value::<serde_json::Value>()?;
23394                            result._unknown_fields.insert(key, value);
23395                        }
23396                    }
23397                }
23398                std::result::Result::Ok(result)
23399            }
23400        }
23401        deserializer.deserialize_any(Visitor)
23402    }
23403}
23404
23405#[doc(hidden)]
23406impl serde::ser::Serialize for SqlOperationsListRequest {
23407    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23408    where
23409        S: serde::ser::Serializer,
23410    {
23411        use serde::ser::SerializeMap;
23412        #[allow(unused_imports)]
23413        use std::option::Option::Some;
23414        let mut state = serializer.serialize_map(std::option::Option::None)?;
23415        if !self.instance.is_empty() {
23416            state.serialize_entry("instance", &self.instance)?;
23417        }
23418        if !wkt::internal::is_default(&self.max_results) {
23419            struct __With<'a>(&'a u32);
23420            impl<'a> serde::ser::Serialize for __With<'a> {
23421                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23422                where
23423                    S: serde::ser::Serializer,
23424                {
23425                    serde_with::As::<wkt::internal::U32>::serialize(self.0, serializer)
23426                }
23427            }
23428            state.serialize_entry("maxResults", &__With(&self.max_results))?;
23429        }
23430        if !self.page_token.is_empty() {
23431            state.serialize_entry("pageToken", &self.page_token)?;
23432        }
23433        if !self.project.is_empty() {
23434            state.serialize_entry("project", &self.project)?;
23435        }
23436        if !self._unknown_fields.is_empty() {
23437            for (key, value) in self._unknown_fields.iter() {
23438                state.serialize_entry(key, &value)?;
23439            }
23440        }
23441        state.end()
23442    }
23443}
23444
23445impl std::fmt::Debug for SqlOperationsListRequest {
23446    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23447        let mut debug_struct = f.debug_struct("SqlOperationsListRequest");
23448        debug_struct.field("instance", &self.instance);
23449        debug_struct.field("max_results", &self.max_results);
23450        debug_struct.field("page_token", &self.page_token);
23451        debug_struct.field("project", &self.project);
23452        if !self._unknown_fields.is_empty() {
23453            debug_struct.field("_unknown_fields", &self._unknown_fields);
23454        }
23455        debug_struct.finish()
23456    }
23457}
23458
23459/// Operations list response.
23460#[derive(Clone, Default, PartialEq)]
23461#[non_exhaustive]
23462pub struct OperationsListResponse {
23463    /// This is always `sql#operationsList`.
23464    pub kind: std::string::String,
23465
23466    /// List of operation resources.
23467    pub items: std::vec::Vec<crate::model::Operation>,
23468
23469    /// The continuation token, used to page through large result sets. Provide
23470    /// this value in a subsequent request to return the next page of results.
23471    pub next_page_token: std::string::String,
23472
23473    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23474}
23475
23476impl OperationsListResponse {
23477    pub fn new() -> Self {
23478        std::default::Default::default()
23479    }
23480
23481    /// Sets the value of [kind][crate::model::OperationsListResponse::kind].
23482    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23483        self.kind = v.into();
23484        self
23485    }
23486
23487    /// Sets the value of [items][crate::model::OperationsListResponse::items].
23488    pub fn set_items<T, V>(mut self, v: T) -> Self
23489    where
23490        T: std::iter::IntoIterator<Item = V>,
23491        V: std::convert::Into<crate::model::Operation>,
23492    {
23493        use std::iter::Iterator;
23494        self.items = v.into_iter().map(|i| i.into()).collect();
23495        self
23496    }
23497
23498    /// Sets the value of [next_page_token][crate::model::OperationsListResponse::next_page_token].
23499    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23500        self.next_page_token = v.into();
23501        self
23502    }
23503}
23504
23505impl wkt::message::Message for OperationsListResponse {
23506    fn typename() -> &'static str {
23507        "type.googleapis.com/google.cloud.sql.v1.OperationsListResponse"
23508    }
23509}
23510
23511#[doc(hidden)]
23512impl gax::paginator::internal::PageableResponse for OperationsListResponse {
23513    type PageItem = crate::model::Operation;
23514
23515    fn items(self) -> std::vec::Vec<Self::PageItem> {
23516        self.items
23517    }
23518
23519    fn next_page_token(&self) -> std::string::String {
23520        use std::clone::Clone;
23521        self.next_page_token.clone()
23522    }
23523}
23524
23525#[doc(hidden)]
23526impl<'de> serde::de::Deserialize<'de> for OperationsListResponse {
23527    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23528    where
23529        D: serde::Deserializer<'de>,
23530    {
23531        #[allow(non_camel_case_types)]
23532        #[doc(hidden)]
23533        #[derive(PartialEq, Eq, Hash)]
23534        enum __FieldTag {
23535            __kind,
23536            __items,
23537            __next_page_token,
23538            Unknown(std::string::String),
23539        }
23540        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
23541            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23542            where
23543                D: serde::Deserializer<'de>,
23544            {
23545                struct Visitor;
23546                impl<'de> serde::de::Visitor<'de> for Visitor {
23547                    type Value = __FieldTag;
23548                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23549                        formatter.write_str("a field name for OperationsListResponse")
23550                    }
23551                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
23552                    where
23553                        E: serde::de::Error,
23554                    {
23555                        use std::result::Result::Ok;
23556                        use std::string::ToString;
23557                        match value {
23558                            "kind" => Ok(__FieldTag::__kind),
23559                            "items" => Ok(__FieldTag::__items),
23560                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
23561                            "next_page_token" => Ok(__FieldTag::__next_page_token),
23562                            _ => Ok(__FieldTag::Unknown(value.to_string())),
23563                        }
23564                    }
23565                }
23566                deserializer.deserialize_identifier(Visitor)
23567            }
23568        }
23569        struct Visitor;
23570        impl<'de> serde::de::Visitor<'de> for Visitor {
23571            type Value = OperationsListResponse;
23572            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23573                formatter.write_str("struct OperationsListResponse")
23574            }
23575            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
23576            where
23577                A: serde::de::MapAccess<'de>,
23578            {
23579                #[allow(unused_imports)]
23580                use serde::de::Error;
23581                use std::option::Option::Some;
23582                let mut fields = std::collections::HashSet::new();
23583                let mut result = Self::Value::new();
23584                while let Some(tag) = map.next_key::<__FieldTag>()? {
23585                    #[allow(clippy::match_single_binding)]
23586                    match tag {
23587                        __FieldTag::__kind => {
23588                            if !fields.insert(__FieldTag::__kind) {
23589                                return std::result::Result::Err(A::Error::duplicate_field(
23590                                    "multiple values for kind",
23591                                ));
23592                            }
23593                            result.kind = map
23594                                .next_value::<std::option::Option<std::string::String>>()?
23595                                .unwrap_or_default();
23596                        }
23597                        __FieldTag::__items => {
23598                            if !fields.insert(__FieldTag::__items) {
23599                                return std::result::Result::Err(A::Error::duplicate_field(
23600                                    "multiple values for items",
23601                                ));
23602                            }
23603                            result.items = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Operation>>>()?.unwrap_or_default();
23604                        }
23605                        __FieldTag::__next_page_token => {
23606                            if !fields.insert(__FieldTag::__next_page_token) {
23607                                return std::result::Result::Err(A::Error::duplicate_field(
23608                                    "multiple values for next_page_token",
23609                                ));
23610                            }
23611                            result.next_page_token = map
23612                                .next_value::<std::option::Option<std::string::String>>()?
23613                                .unwrap_or_default();
23614                        }
23615                        __FieldTag::Unknown(key) => {
23616                            let value = map.next_value::<serde_json::Value>()?;
23617                            result._unknown_fields.insert(key, value);
23618                        }
23619                    }
23620                }
23621                std::result::Result::Ok(result)
23622            }
23623        }
23624        deserializer.deserialize_any(Visitor)
23625    }
23626}
23627
23628#[doc(hidden)]
23629impl serde::ser::Serialize for OperationsListResponse {
23630    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23631    where
23632        S: serde::ser::Serializer,
23633    {
23634        use serde::ser::SerializeMap;
23635        #[allow(unused_imports)]
23636        use std::option::Option::Some;
23637        let mut state = serializer.serialize_map(std::option::Option::None)?;
23638        if !self.kind.is_empty() {
23639            state.serialize_entry("kind", &self.kind)?;
23640        }
23641        if !self.items.is_empty() {
23642            state.serialize_entry("items", &self.items)?;
23643        }
23644        if !self.next_page_token.is_empty() {
23645            state.serialize_entry("nextPageToken", &self.next_page_token)?;
23646        }
23647        if !self._unknown_fields.is_empty() {
23648            for (key, value) in self._unknown_fields.iter() {
23649                state.serialize_entry(key, &value)?;
23650            }
23651        }
23652        state.end()
23653    }
23654}
23655
23656impl std::fmt::Debug for OperationsListResponse {
23657    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23658        let mut debug_struct = f.debug_struct("OperationsListResponse");
23659        debug_struct.field("kind", &self.kind);
23660        debug_struct.field("items", &self.items);
23661        debug_struct.field("next_page_token", &self.next_page_token);
23662        if !self._unknown_fields.is_empty() {
23663            debug_struct.field("_unknown_fields", &self._unknown_fields);
23664        }
23665        debug_struct.finish()
23666    }
23667}
23668
23669/// Operations cancel request.
23670#[derive(Clone, Default, PartialEq)]
23671#[non_exhaustive]
23672pub struct SqlOperationsCancelRequest {
23673    /// Instance operation ID.
23674    pub operation: std::string::String,
23675
23676    /// Project ID of the project that contains the instance.
23677    pub project: std::string::String,
23678
23679    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23680}
23681
23682impl SqlOperationsCancelRequest {
23683    pub fn new() -> Self {
23684        std::default::Default::default()
23685    }
23686
23687    /// Sets the value of [operation][crate::model::SqlOperationsCancelRequest::operation].
23688    pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23689        self.operation = v.into();
23690        self
23691    }
23692
23693    /// Sets the value of [project][crate::model::SqlOperationsCancelRequest::project].
23694    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23695        self.project = v.into();
23696        self
23697    }
23698}
23699
23700impl wkt::message::Message for SqlOperationsCancelRequest {
23701    fn typename() -> &'static str {
23702        "type.googleapis.com/google.cloud.sql.v1.SqlOperationsCancelRequest"
23703    }
23704}
23705
23706#[doc(hidden)]
23707impl<'de> serde::de::Deserialize<'de> for SqlOperationsCancelRequest {
23708    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23709    where
23710        D: serde::Deserializer<'de>,
23711    {
23712        #[allow(non_camel_case_types)]
23713        #[doc(hidden)]
23714        #[derive(PartialEq, Eq, Hash)]
23715        enum __FieldTag {
23716            __operation,
23717            __project,
23718            Unknown(std::string::String),
23719        }
23720        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
23721            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23722            where
23723                D: serde::Deserializer<'de>,
23724            {
23725                struct Visitor;
23726                impl<'de> serde::de::Visitor<'de> for Visitor {
23727                    type Value = __FieldTag;
23728                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23729                        formatter.write_str("a field name for SqlOperationsCancelRequest")
23730                    }
23731                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
23732                    where
23733                        E: serde::de::Error,
23734                    {
23735                        use std::result::Result::Ok;
23736                        use std::string::ToString;
23737                        match value {
23738                            "operation" => Ok(__FieldTag::__operation),
23739                            "project" => Ok(__FieldTag::__project),
23740                            _ => Ok(__FieldTag::Unknown(value.to_string())),
23741                        }
23742                    }
23743                }
23744                deserializer.deserialize_identifier(Visitor)
23745            }
23746        }
23747        struct Visitor;
23748        impl<'de> serde::de::Visitor<'de> for Visitor {
23749            type Value = SqlOperationsCancelRequest;
23750            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23751                formatter.write_str("struct SqlOperationsCancelRequest")
23752            }
23753            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
23754            where
23755                A: serde::de::MapAccess<'de>,
23756            {
23757                #[allow(unused_imports)]
23758                use serde::de::Error;
23759                use std::option::Option::Some;
23760                let mut fields = std::collections::HashSet::new();
23761                let mut result = Self::Value::new();
23762                while let Some(tag) = map.next_key::<__FieldTag>()? {
23763                    #[allow(clippy::match_single_binding)]
23764                    match tag {
23765                        __FieldTag::__operation => {
23766                            if !fields.insert(__FieldTag::__operation) {
23767                                return std::result::Result::Err(A::Error::duplicate_field(
23768                                    "multiple values for operation",
23769                                ));
23770                            }
23771                            result.operation = map
23772                                .next_value::<std::option::Option<std::string::String>>()?
23773                                .unwrap_or_default();
23774                        }
23775                        __FieldTag::__project => {
23776                            if !fields.insert(__FieldTag::__project) {
23777                                return std::result::Result::Err(A::Error::duplicate_field(
23778                                    "multiple values for project",
23779                                ));
23780                            }
23781                            result.project = map
23782                                .next_value::<std::option::Option<std::string::String>>()?
23783                                .unwrap_or_default();
23784                        }
23785                        __FieldTag::Unknown(key) => {
23786                            let value = map.next_value::<serde_json::Value>()?;
23787                            result._unknown_fields.insert(key, value);
23788                        }
23789                    }
23790                }
23791                std::result::Result::Ok(result)
23792            }
23793        }
23794        deserializer.deserialize_any(Visitor)
23795    }
23796}
23797
23798#[doc(hidden)]
23799impl serde::ser::Serialize for SqlOperationsCancelRequest {
23800    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23801    where
23802        S: serde::ser::Serializer,
23803    {
23804        use serde::ser::SerializeMap;
23805        #[allow(unused_imports)]
23806        use std::option::Option::Some;
23807        let mut state = serializer.serialize_map(std::option::Option::None)?;
23808        if !self.operation.is_empty() {
23809            state.serialize_entry("operation", &self.operation)?;
23810        }
23811        if !self.project.is_empty() {
23812            state.serialize_entry("project", &self.project)?;
23813        }
23814        if !self._unknown_fields.is_empty() {
23815            for (key, value) in self._unknown_fields.iter() {
23816                state.serialize_entry(key, &value)?;
23817            }
23818        }
23819        state.end()
23820    }
23821}
23822
23823impl std::fmt::Debug for SqlOperationsCancelRequest {
23824    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23825        let mut debug_struct = f.debug_struct("SqlOperationsCancelRequest");
23826        debug_struct.field("operation", &self.operation);
23827        debug_struct.field("project", &self.project);
23828        if !self._unknown_fields.is_empty() {
23829            debug_struct.field("_unknown_fields", &self._unknown_fields);
23830        }
23831        debug_struct.finish()
23832    }
23833}
23834
23835/// An entry for an Access Control list.
23836#[derive(Clone, Default, PartialEq)]
23837#[non_exhaustive]
23838pub struct AclEntry {
23839    /// The allowlisted value for the access control list.
23840    pub value: std::string::String,
23841
23842    /// The time when this access control entry expires in
23843    /// [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example
23844    /// `2012-11-15T16:19:00.094Z`.
23845    pub expiration_time: std::option::Option<wkt::Timestamp>,
23846
23847    /// Optional. A label to identify this entry.
23848    pub name: std::string::String,
23849
23850    /// This is always `sql#aclEntry`.
23851    pub kind: std::string::String,
23852
23853    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23854}
23855
23856impl AclEntry {
23857    pub fn new() -> Self {
23858        std::default::Default::default()
23859    }
23860
23861    /// Sets the value of [value][crate::model::AclEntry::value].
23862    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23863        self.value = v.into();
23864        self
23865    }
23866
23867    /// Sets the value of [expiration_time][crate::model::AclEntry::expiration_time].
23868    pub fn set_expiration_time<T>(mut self, v: T) -> Self
23869    where
23870        T: std::convert::Into<wkt::Timestamp>,
23871    {
23872        self.expiration_time = std::option::Option::Some(v.into());
23873        self
23874    }
23875
23876    /// Sets or clears the value of [expiration_time][crate::model::AclEntry::expiration_time].
23877    pub fn set_or_clear_expiration_time<T>(mut self, v: std::option::Option<T>) -> Self
23878    where
23879        T: std::convert::Into<wkt::Timestamp>,
23880    {
23881        self.expiration_time = v.map(|x| x.into());
23882        self
23883    }
23884
23885    /// Sets the value of [name][crate::model::AclEntry::name].
23886    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23887        self.name = v.into();
23888        self
23889    }
23890
23891    /// Sets the value of [kind][crate::model::AclEntry::kind].
23892    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23893        self.kind = v.into();
23894        self
23895    }
23896}
23897
23898impl wkt::message::Message for AclEntry {
23899    fn typename() -> &'static str {
23900        "type.googleapis.com/google.cloud.sql.v1.AclEntry"
23901    }
23902}
23903
23904#[doc(hidden)]
23905impl<'de> serde::de::Deserialize<'de> for AclEntry {
23906    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23907    where
23908        D: serde::Deserializer<'de>,
23909    {
23910        #[allow(non_camel_case_types)]
23911        #[doc(hidden)]
23912        #[derive(PartialEq, Eq, Hash)]
23913        enum __FieldTag {
23914            __value,
23915            __expiration_time,
23916            __name,
23917            __kind,
23918            Unknown(std::string::String),
23919        }
23920        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
23921            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23922            where
23923                D: serde::Deserializer<'de>,
23924            {
23925                struct Visitor;
23926                impl<'de> serde::de::Visitor<'de> for Visitor {
23927                    type Value = __FieldTag;
23928                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23929                        formatter.write_str("a field name for AclEntry")
23930                    }
23931                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
23932                    where
23933                        E: serde::de::Error,
23934                    {
23935                        use std::result::Result::Ok;
23936                        use std::string::ToString;
23937                        match value {
23938                            "value" => Ok(__FieldTag::__value),
23939                            "expirationTime" => Ok(__FieldTag::__expiration_time),
23940                            "expiration_time" => Ok(__FieldTag::__expiration_time),
23941                            "name" => Ok(__FieldTag::__name),
23942                            "kind" => Ok(__FieldTag::__kind),
23943                            _ => Ok(__FieldTag::Unknown(value.to_string())),
23944                        }
23945                    }
23946                }
23947                deserializer.deserialize_identifier(Visitor)
23948            }
23949        }
23950        struct Visitor;
23951        impl<'de> serde::de::Visitor<'de> for Visitor {
23952            type Value = AclEntry;
23953            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23954                formatter.write_str("struct AclEntry")
23955            }
23956            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
23957            where
23958                A: serde::de::MapAccess<'de>,
23959            {
23960                #[allow(unused_imports)]
23961                use serde::de::Error;
23962                use std::option::Option::Some;
23963                let mut fields = std::collections::HashSet::new();
23964                let mut result = Self::Value::new();
23965                while let Some(tag) = map.next_key::<__FieldTag>()? {
23966                    #[allow(clippy::match_single_binding)]
23967                    match tag {
23968                        __FieldTag::__value => {
23969                            if !fields.insert(__FieldTag::__value) {
23970                                return std::result::Result::Err(A::Error::duplicate_field(
23971                                    "multiple values for value",
23972                                ));
23973                            }
23974                            result.value = map
23975                                .next_value::<std::option::Option<std::string::String>>()?
23976                                .unwrap_or_default();
23977                        }
23978                        __FieldTag::__expiration_time => {
23979                            if !fields.insert(__FieldTag::__expiration_time) {
23980                                return std::result::Result::Err(A::Error::duplicate_field(
23981                                    "multiple values for expiration_time",
23982                                ));
23983                            }
23984                            result.expiration_time =
23985                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
23986                        }
23987                        __FieldTag::__name => {
23988                            if !fields.insert(__FieldTag::__name) {
23989                                return std::result::Result::Err(A::Error::duplicate_field(
23990                                    "multiple values for name",
23991                                ));
23992                            }
23993                            result.name = map
23994                                .next_value::<std::option::Option<std::string::String>>()?
23995                                .unwrap_or_default();
23996                        }
23997                        __FieldTag::__kind => {
23998                            if !fields.insert(__FieldTag::__kind) {
23999                                return std::result::Result::Err(A::Error::duplicate_field(
24000                                    "multiple values for kind",
24001                                ));
24002                            }
24003                            result.kind = map
24004                                .next_value::<std::option::Option<std::string::String>>()?
24005                                .unwrap_or_default();
24006                        }
24007                        __FieldTag::Unknown(key) => {
24008                            let value = map.next_value::<serde_json::Value>()?;
24009                            result._unknown_fields.insert(key, value);
24010                        }
24011                    }
24012                }
24013                std::result::Result::Ok(result)
24014            }
24015        }
24016        deserializer.deserialize_any(Visitor)
24017    }
24018}
24019
24020#[doc(hidden)]
24021impl serde::ser::Serialize for AclEntry {
24022    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24023    where
24024        S: serde::ser::Serializer,
24025    {
24026        use serde::ser::SerializeMap;
24027        #[allow(unused_imports)]
24028        use std::option::Option::Some;
24029        let mut state = serializer.serialize_map(std::option::Option::None)?;
24030        if !self.value.is_empty() {
24031            state.serialize_entry("value", &self.value)?;
24032        }
24033        if self.expiration_time.is_some() {
24034            state.serialize_entry("expirationTime", &self.expiration_time)?;
24035        }
24036        if !self.name.is_empty() {
24037            state.serialize_entry("name", &self.name)?;
24038        }
24039        if !self.kind.is_empty() {
24040            state.serialize_entry("kind", &self.kind)?;
24041        }
24042        if !self._unknown_fields.is_empty() {
24043            for (key, value) in self._unknown_fields.iter() {
24044                state.serialize_entry(key, &value)?;
24045            }
24046        }
24047        state.end()
24048    }
24049}
24050
24051impl std::fmt::Debug for AclEntry {
24052    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
24053        let mut debug_struct = f.debug_struct("AclEntry");
24054        debug_struct.field("value", &self.value);
24055        debug_struct.field("expiration_time", &self.expiration_time);
24056        debug_struct.field("name", &self.name);
24057        debug_struct.field("kind", &self.kind);
24058        if !self._unknown_fields.is_empty() {
24059            debug_struct.field("_unknown_fields", &self._unknown_fields);
24060        }
24061        debug_struct.finish()
24062    }
24063}
24064
24065/// An Admin API warning message.
24066#[derive(Clone, Default, PartialEq)]
24067#[non_exhaustive]
24068pub struct ApiWarning {
24069    /// Code to uniquely identify the warning type.
24070    pub code: crate::model::api_warning::SqlApiWarningCode,
24071
24072    /// The warning message.
24073    pub message: std::string::String,
24074
24075    /// The region name for REGION_UNREACHABLE warning.
24076    pub region: std::string::String,
24077
24078    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24079}
24080
24081impl ApiWarning {
24082    pub fn new() -> Self {
24083        std::default::Default::default()
24084    }
24085
24086    /// Sets the value of [code][crate::model::ApiWarning::code].
24087    pub fn set_code<T: std::convert::Into<crate::model::api_warning::SqlApiWarningCode>>(
24088        mut self,
24089        v: T,
24090    ) -> Self {
24091        self.code = v.into();
24092        self
24093    }
24094
24095    /// Sets the value of [message][crate::model::ApiWarning::message].
24096    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24097        self.message = v.into();
24098        self
24099    }
24100
24101    /// Sets the value of [region][crate::model::ApiWarning::region].
24102    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24103        self.region = v.into();
24104        self
24105    }
24106}
24107
24108impl wkt::message::Message for ApiWarning {
24109    fn typename() -> &'static str {
24110        "type.googleapis.com/google.cloud.sql.v1.ApiWarning"
24111    }
24112}
24113
24114#[doc(hidden)]
24115impl<'de> serde::de::Deserialize<'de> for ApiWarning {
24116    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24117    where
24118        D: serde::Deserializer<'de>,
24119    {
24120        #[allow(non_camel_case_types)]
24121        #[doc(hidden)]
24122        #[derive(PartialEq, Eq, Hash)]
24123        enum __FieldTag {
24124            __code,
24125            __message,
24126            __region,
24127            Unknown(std::string::String),
24128        }
24129        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
24130            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24131            where
24132                D: serde::Deserializer<'de>,
24133            {
24134                struct Visitor;
24135                impl<'de> serde::de::Visitor<'de> for Visitor {
24136                    type Value = __FieldTag;
24137                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24138                        formatter.write_str("a field name for ApiWarning")
24139                    }
24140                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
24141                    where
24142                        E: serde::de::Error,
24143                    {
24144                        use std::result::Result::Ok;
24145                        use std::string::ToString;
24146                        match value {
24147                            "code" => Ok(__FieldTag::__code),
24148                            "message" => Ok(__FieldTag::__message),
24149                            "region" => Ok(__FieldTag::__region),
24150                            _ => Ok(__FieldTag::Unknown(value.to_string())),
24151                        }
24152                    }
24153                }
24154                deserializer.deserialize_identifier(Visitor)
24155            }
24156        }
24157        struct Visitor;
24158        impl<'de> serde::de::Visitor<'de> for Visitor {
24159            type Value = ApiWarning;
24160            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24161                formatter.write_str("struct ApiWarning")
24162            }
24163            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
24164            where
24165                A: serde::de::MapAccess<'de>,
24166            {
24167                #[allow(unused_imports)]
24168                use serde::de::Error;
24169                use std::option::Option::Some;
24170                let mut fields = std::collections::HashSet::new();
24171                let mut result = Self::Value::new();
24172                while let Some(tag) = map.next_key::<__FieldTag>()? {
24173                    #[allow(clippy::match_single_binding)]
24174                    match tag {
24175                        __FieldTag::__code => {
24176                            if !fields.insert(__FieldTag::__code) {
24177                                return std::result::Result::Err(A::Error::duplicate_field(
24178                                    "multiple values for code",
24179                                ));
24180                            }
24181                            result.code =
24182                                map.next_value::<std::option::Option<
24183                                    crate::model::api_warning::SqlApiWarningCode,
24184                                >>()?
24185                                .unwrap_or_default();
24186                        }
24187                        __FieldTag::__message => {
24188                            if !fields.insert(__FieldTag::__message) {
24189                                return std::result::Result::Err(A::Error::duplicate_field(
24190                                    "multiple values for message",
24191                                ));
24192                            }
24193                            result.message = map
24194                                .next_value::<std::option::Option<std::string::String>>()?
24195                                .unwrap_or_default();
24196                        }
24197                        __FieldTag::__region => {
24198                            if !fields.insert(__FieldTag::__region) {
24199                                return std::result::Result::Err(A::Error::duplicate_field(
24200                                    "multiple values for region",
24201                                ));
24202                            }
24203                            result.region = map
24204                                .next_value::<std::option::Option<std::string::String>>()?
24205                                .unwrap_or_default();
24206                        }
24207                        __FieldTag::Unknown(key) => {
24208                            let value = map.next_value::<serde_json::Value>()?;
24209                            result._unknown_fields.insert(key, value);
24210                        }
24211                    }
24212                }
24213                std::result::Result::Ok(result)
24214            }
24215        }
24216        deserializer.deserialize_any(Visitor)
24217    }
24218}
24219
24220#[doc(hidden)]
24221impl serde::ser::Serialize for ApiWarning {
24222    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24223    where
24224        S: serde::ser::Serializer,
24225    {
24226        use serde::ser::SerializeMap;
24227        #[allow(unused_imports)]
24228        use std::option::Option::Some;
24229        let mut state = serializer.serialize_map(std::option::Option::None)?;
24230        if !wkt::internal::is_default(&self.code) {
24231            state.serialize_entry("code", &self.code)?;
24232        }
24233        if !self.message.is_empty() {
24234            state.serialize_entry("message", &self.message)?;
24235        }
24236        if !self.region.is_empty() {
24237            state.serialize_entry("region", &self.region)?;
24238        }
24239        if !self._unknown_fields.is_empty() {
24240            for (key, value) in self._unknown_fields.iter() {
24241                state.serialize_entry(key, &value)?;
24242            }
24243        }
24244        state.end()
24245    }
24246}
24247
24248impl std::fmt::Debug for ApiWarning {
24249    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
24250        let mut debug_struct = f.debug_struct("ApiWarning");
24251        debug_struct.field("code", &self.code);
24252        debug_struct.field("message", &self.message);
24253        debug_struct.field("region", &self.region);
24254        if !self._unknown_fields.is_empty() {
24255            debug_struct.field("_unknown_fields", &self._unknown_fields);
24256        }
24257        debug_struct.finish()
24258    }
24259}
24260
24261/// Defines additional types related to [ApiWarning].
24262pub mod api_warning {
24263    #[allow(unused_imports)]
24264    use super::*;
24265
24266    ///
24267    /// # Working with unknown values
24268    ///
24269    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
24270    /// additional enum variants at any time. Adding new variants is not considered
24271    /// a breaking change. Applications should write their code in anticipation of:
24272    ///
24273    /// - New values appearing in future releases of the client library, **and**
24274    /// - New values received dynamically, without application changes.
24275    ///
24276    /// Please consult the [Working with enums] section in the user guide for some
24277    /// guidelines.
24278    ///
24279    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
24280    #[derive(Clone, Debug, PartialEq)]
24281    #[non_exhaustive]
24282    pub enum SqlApiWarningCode {
24283        /// An unknown or unset warning type from Cloud SQL API.
24284        Unspecified,
24285        /// Warning when one or more regions are not reachable.  The returned result
24286        /// set may be incomplete.
24287        RegionUnreachable,
24288        /// Warning when user provided maxResults parameter exceeds the limit.  The
24289        /// returned result set may be incomplete.
24290        MaxResultsExceedsLimit,
24291        /// Warning when user tries to create/update a user with credentials that
24292        /// have previously been compromised by a public data breach.
24293        CompromisedCredentials,
24294        /// Warning when the operation succeeds but some non-critical workflow state
24295        /// failed.
24296        InternalStateFailure,
24297        /// If set, the enum was initialized with an unknown value.
24298        ///
24299        /// Applications can examine the value using [SqlApiWarningCode::value] or
24300        /// [SqlApiWarningCode::name].
24301        UnknownValue(sql_api_warning_code::UnknownValue),
24302    }
24303
24304    #[doc(hidden)]
24305    pub mod sql_api_warning_code {
24306        #[allow(unused_imports)]
24307        use super::*;
24308        #[derive(Clone, Debug, PartialEq)]
24309        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
24310    }
24311
24312    impl SqlApiWarningCode {
24313        /// Gets the enum value.
24314        ///
24315        /// Returns `None` if the enum contains an unknown value deserialized from
24316        /// the string representation of enums.
24317        pub fn value(&self) -> std::option::Option<i32> {
24318            match self {
24319                Self::Unspecified => std::option::Option::Some(0),
24320                Self::RegionUnreachable => std::option::Option::Some(1),
24321                Self::MaxResultsExceedsLimit => std::option::Option::Some(2),
24322                Self::CompromisedCredentials => std::option::Option::Some(3),
24323                Self::InternalStateFailure => std::option::Option::Some(4),
24324                Self::UnknownValue(u) => u.0.value(),
24325            }
24326        }
24327
24328        /// Gets the enum value as a string.
24329        ///
24330        /// Returns `None` if the enum contains an unknown value deserialized from
24331        /// the integer representation of enums.
24332        pub fn name(&self) -> std::option::Option<&str> {
24333            match self {
24334                Self::Unspecified => std::option::Option::Some("SQL_API_WARNING_CODE_UNSPECIFIED"),
24335                Self::RegionUnreachable => std::option::Option::Some("REGION_UNREACHABLE"),
24336                Self::MaxResultsExceedsLimit => {
24337                    std::option::Option::Some("MAX_RESULTS_EXCEEDS_LIMIT")
24338                }
24339                Self::CompromisedCredentials => {
24340                    std::option::Option::Some("COMPROMISED_CREDENTIALS")
24341                }
24342                Self::InternalStateFailure => std::option::Option::Some("INTERNAL_STATE_FAILURE"),
24343                Self::UnknownValue(u) => u.0.name(),
24344            }
24345        }
24346    }
24347
24348    impl std::default::Default for SqlApiWarningCode {
24349        fn default() -> Self {
24350            use std::convert::From;
24351            Self::from(0)
24352        }
24353    }
24354
24355    impl std::fmt::Display for SqlApiWarningCode {
24356        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
24357            wkt::internal::display_enum(f, self.name(), self.value())
24358        }
24359    }
24360
24361    impl std::convert::From<i32> for SqlApiWarningCode {
24362        fn from(value: i32) -> Self {
24363            match value {
24364                0 => Self::Unspecified,
24365                1 => Self::RegionUnreachable,
24366                2 => Self::MaxResultsExceedsLimit,
24367                3 => Self::CompromisedCredentials,
24368                4 => Self::InternalStateFailure,
24369                _ => Self::UnknownValue(sql_api_warning_code::UnknownValue(
24370                    wkt::internal::UnknownEnumValue::Integer(value),
24371                )),
24372            }
24373        }
24374    }
24375
24376    impl std::convert::From<&str> for SqlApiWarningCode {
24377        fn from(value: &str) -> Self {
24378            use std::string::ToString;
24379            match value {
24380                "SQL_API_WARNING_CODE_UNSPECIFIED" => Self::Unspecified,
24381                "REGION_UNREACHABLE" => Self::RegionUnreachable,
24382                "MAX_RESULTS_EXCEEDS_LIMIT" => Self::MaxResultsExceedsLimit,
24383                "COMPROMISED_CREDENTIALS" => Self::CompromisedCredentials,
24384                "INTERNAL_STATE_FAILURE" => Self::InternalStateFailure,
24385                _ => Self::UnknownValue(sql_api_warning_code::UnknownValue(
24386                    wkt::internal::UnknownEnumValue::String(value.to_string()),
24387                )),
24388            }
24389        }
24390    }
24391
24392    impl serde::ser::Serialize for SqlApiWarningCode {
24393        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24394        where
24395            S: serde::Serializer,
24396        {
24397            match self {
24398                Self::Unspecified => serializer.serialize_i32(0),
24399                Self::RegionUnreachable => serializer.serialize_i32(1),
24400                Self::MaxResultsExceedsLimit => serializer.serialize_i32(2),
24401                Self::CompromisedCredentials => serializer.serialize_i32(3),
24402                Self::InternalStateFailure => serializer.serialize_i32(4),
24403                Self::UnknownValue(u) => u.0.serialize(serializer),
24404            }
24405        }
24406    }
24407
24408    impl<'de> serde::de::Deserialize<'de> for SqlApiWarningCode {
24409        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24410        where
24411            D: serde::Deserializer<'de>,
24412        {
24413            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlApiWarningCode>::new(
24414                ".google.cloud.sql.v1.ApiWarning.SqlApiWarningCode",
24415            ))
24416        }
24417    }
24418}
24419
24420/// We currently only support backup retention by specifying the number
24421/// of backups we will retain.
24422#[derive(Clone, Default, PartialEq)]
24423#[non_exhaustive]
24424pub struct BackupRetentionSettings {
24425    /// The unit that 'retained_backups' represents.
24426    pub retention_unit: crate::model::backup_retention_settings::RetentionUnit,
24427
24428    /// Depending on the value of retention_unit, this is used to determine
24429    /// if a backup needs to be deleted.  If retention_unit is 'COUNT', we will
24430    /// retain this many backups.
24431    pub retained_backups: std::option::Option<wkt::Int32Value>,
24432
24433    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24434}
24435
24436impl BackupRetentionSettings {
24437    pub fn new() -> Self {
24438        std::default::Default::default()
24439    }
24440
24441    /// Sets the value of [retention_unit][crate::model::BackupRetentionSettings::retention_unit].
24442    pub fn set_retention_unit<
24443        T: std::convert::Into<crate::model::backup_retention_settings::RetentionUnit>,
24444    >(
24445        mut self,
24446        v: T,
24447    ) -> Self {
24448        self.retention_unit = v.into();
24449        self
24450    }
24451
24452    /// Sets the value of [retained_backups][crate::model::BackupRetentionSettings::retained_backups].
24453    pub fn set_retained_backups<T>(mut self, v: T) -> Self
24454    where
24455        T: std::convert::Into<wkt::Int32Value>,
24456    {
24457        self.retained_backups = std::option::Option::Some(v.into());
24458        self
24459    }
24460
24461    /// Sets or clears the value of [retained_backups][crate::model::BackupRetentionSettings::retained_backups].
24462    pub fn set_or_clear_retained_backups<T>(mut self, v: std::option::Option<T>) -> Self
24463    where
24464        T: std::convert::Into<wkt::Int32Value>,
24465    {
24466        self.retained_backups = v.map(|x| x.into());
24467        self
24468    }
24469}
24470
24471impl wkt::message::Message for BackupRetentionSettings {
24472    fn typename() -> &'static str {
24473        "type.googleapis.com/google.cloud.sql.v1.BackupRetentionSettings"
24474    }
24475}
24476
24477#[doc(hidden)]
24478impl<'de> serde::de::Deserialize<'de> for BackupRetentionSettings {
24479    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24480    where
24481        D: serde::Deserializer<'de>,
24482    {
24483        #[allow(non_camel_case_types)]
24484        #[doc(hidden)]
24485        #[derive(PartialEq, Eq, Hash)]
24486        enum __FieldTag {
24487            __retention_unit,
24488            __retained_backups,
24489            Unknown(std::string::String),
24490        }
24491        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
24492            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24493            where
24494                D: serde::Deserializer<'de>,
24495            {
24496                struct Visitor;
24497                impl<'de> serde::de::Visitor<'de> for Visitor {
24498                    type Value = __FieldTag;
24499                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24500                        formatter.write_str("a field name for BackupRetentionSettings")
24501                    }
24502                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
24503                    where
24504                        E: serde::de::Error,
24505                    {
24506                        use std::result::Result::Ok;
24507                        use std::string::ToString;
24508                        match value {
24509                            "retentionUnit" => Ok(__FieldTag::__retention_unit),
24510                            "retention_unit" => Ok(__FieldTag::__retention_unit),
24511                            "retainedBackups" => Ok(__FieldTag::__retained_backups),
24512                            "retained_backups" => Ok(__FieldTag::__retained_backups),
24513                            _ => Ok(__FieldTag::Unknown(value.to_string())),
24514                        }
24515                    }
24516                }
24517                deserializer.deserialize_identifier(Visitor)
24518            }
24519        }
24520        struct Visitor;
24521        impl<'de> serde::de::Visitor<'de> for Visitor {
24522            type Value = BackupRetentionSettings;
24523            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24524                formatter.write_str("struct BackupRetentionSettings")
24525            }
24526            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
24527            where
24528                A: serde::de::MapAccess<'de>,
24529            {
24530                #[allow(unused_imports)]
24531                use serde::de::Error;
24532                use std::option::Option::Some;
24533                let mut fields = std::collections::HashSet::new();
24534                let mut result = Self::Value::new();
24535                while let Some(tag) = map.next_key::<__FieldTag>()? {
24536                    #[allow(clippy::match_single_binding)]
24537                    match tag {
24538                        __FieldTag::__retention_unit => {
24539                            if !fields.insert(__FieldTag::__retention_unit) {
24540                                return std::result::Result::Err(A::Error::duplicate_field(
24541                                    "multiple values for retention_unit",
24542                                ));
24543                            }
24544                            result.retention_unit = map
24545                                .next_value::<std::option::Option<
24546                                    crate::model::backup_retention_settings::RetentionUnit,
24547                                >>()?
24548                                .unwrap_or_default();
24549                        }
24550                        __FieldTag::__retained_backups => {
24551                            if !fields.insert(__FieldTag::__retained_backups) {
24552                                return std::result::Result::Err(A::Error::duplicate_field(
24553                                    "multiple values for retained_backups",
24554                                ));
24555                            }
24556                            struct __With(std::option::Option<wkt::Int32Value>);
24557                            impl<'de> serde::de::Deserialize<'de> for __With {
24558                                fn deserialize<D>(
24559                                    deserializer: D,
24560                                ) -> std::result::Result<Self, D::Error>
24561                                where
24562                                    D: serde::de::Deserializer<'de>,
24563                                {
24564                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
24565                                }
24566                            }
24567                            result.retained_backups = map.next_value::<__With>()?.0;
24568                        }
24569                        __FieldTag::Unknown(key) => {
24570                            let value = map.next_value::<serde_json::Value>()?;
24571                            result._unknown_fields.insert(key, value);
24572                        }
24573                    }
24574                }
24575                std::result::Result::Ok(result)
24576            }
24577        }
24578        deserializer.deserialize_any(Visitor)
24579    }
24580}
24581
24582#[doc(hidden)]
24583impl serde::ser::Serialize for BackupRetentionSettings {
24584    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24585    where
24586        S: serde::ser::Serializer,
24587    {
24588        use serde::ser::SerializeMap;
24589        #[allow(unused_imports)]
24590        use std::option::Option::Some;
24591        let mut state = serializer.serialize_map(std::option::Option::None)?;
24592        if !wkt::internal::is_default(&self.retention_unit) {
24593            state.serialize_entry("retentionUnit", &self.retention_unit)?;
24594        }
24595        if self.retained_backups.is_some() {
24596            struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
24597            impl<'a> serde::ser::Serialize for __With<'a> {
24598                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24599                where
24600                    S: serde::ser::Serializer,
24601                {
24602                    serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
24603                        self.0, serializer,
24604                    )
24605                }
24606            }
24607            state.serialize_entry("retainedBackups", &__With(&self.retained_backups))?;
24608        }
24609        if !self._unknown_fields.is_empty() {
24610            for (key, value) in self._unknown_fields.iter() {
24611                state.serialize_entry(key, &value)?;
24612            }
24613        }
24614        state.end()
24615    }
24616}
24617
24618impl std::fmt::Debug for BackupRetentionSettings {
24619    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
24620        let mut debug_struct = f.debug_struct("BackupRetentionSettings");
24621        debug_struct.field("retention_unit", &self.retention_unit);
24622        debug_struct.field("retained_backups", &self.retained_backups);
24623        if !self._unknown_fields.is_empty() {
24624            debug_struct.field("_unknown_fields", &self._unknown_fields);
24625        }
24626        debug_struct.finish()
24627    }
24628}
24629
24630/// Defines additional types related to [BackupRetentionSettings].
24631pub mod backup_retention_settings {
24632    #[allow(unused_imports)]
24633    use super::*;
24634
24635    /// The units that retained_backups specifies, we only support COUNT.
24636    ///
24637    /// # Working with unknown values
24638    ///
24639    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
24640    /// additional enum variants at any time. Adding new variants is not considered
24641    /// a breaking change. Applications should write their code in anticipation of:
24642    ///
24643    /// - New values appearing in future releases of the client library, **and**
24644    /// - New values received dynamically, without application changes.
24645    ///
24646    /// Please consult the [Working with enums] section in the user guide for some
24647    /// guidelines.
24648    ///
24649    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
24650    #[derive(Clone, Debug, PartialEq)]
24651    #[non_exhaustive]
24652    pub enum RetentionUnit {
24653        /// Backup retention unit is unspecified, will be treated as COUNT.
24654        Unspecified,
24655        /// Retention will be by count, eg. "retain the most recent 7 backups".
24656        Count,
24657        /// If set, the enum was initialized with an unknown value.
24658        ///
24659        /// Applications can examine the value using [RetentionUnit::value] or
24660        /// [RetentionUnit::name].
24661        UnknownValue(retention_unit::UnknownValue),
24662    }
24663
24664    #[doc(hidden)]
24665    pub mod retention_unit {
24666        #[allow(unused_imports)]
24667        use super::*;
24668        #[derive(Clone, Debug, PartialEq)]
24669        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
24670    }
24671
24672    impl RetentionUnit {
24673        /// Gets the enum value.
24674        ///
24675        /// Returns `None` if the enum contains an unknown value deserialized from
24676        /// the string representation of enums.
24677        pub fn value(&self) -> std::option::Option<i32> {
24678            match self {
24679                Self::Unspecified => std::option::Option::Some(0),
24680                Self::Count => std::option::Option::Some(1),
24681                Self::UnknownValue(u) => u.0.value(),
24682            }
24683        }
24684
24685        /// Gets the enum value as a string.
24686        ///
24687        /// Returns `None` if the enum contains an unknown value deserialized from
24688        /// the integer representation of enums.
24689        pub fn name(&self) -> std::option::Option<&str> {
24690            match self {
24691                Self::Unspecified => std::option::Option::Some("RETENTION_UNIT_UNSPECIFIED"),
24692                Self::Count => std::option::Option::Some("COUNT"),
24693                Self::UnknownValue(u) => u.0.name(),
24694            }
24695        }
24696    }
24697
24698    impl std::default::Default for RetentionUnit {
24699        fn default() -> Self {
24700            use std::convert::From;
24701            Self::from(0)
24702        }
24703    }
24704
24705    impl std::fmt::Display for RetentionUnit {
24706        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
24707            wkt::internal::display_enum(f, self.name(), self.value())
24708        }
24709    }
24710
24711    impl std::convert::From<i32> for RetentionUnit {
24712        fn from(value: i32) -> Self {
24713            match value {
24714                0 => Self::Unspecified,
24715                1 => Self::Count,
24716                _ => Self::UnknownValue(retention_unit::UnknownValue(
24717                    wkt::internal::UnknownEnumValue::Integer(value),
24718                )),
24719            }
24720        }
24721    }
24722
24723    impl std::convert::From<&str> for RetentionUnit {
24724        fn from(value: &str) -> Self {
24725            use std::string::ToString;
24726            match value {
24727                "RETENTION_UNIT_UNSPECIFIED" => Self::Unspecified,
24728                "COUNT" => Self::Count,
24729                _ => Self::UnknownValue(retention_unit::UnknownValue(
24730                    wkt::internal::UnknownEnumValue::String(value.to_string()),
24731                )),
24732            }
24733        }
24734    }
24735
24736    impl serde::ser::Serialize for RetentionUnit {
24737        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24738        where
24739            S: serde::Serializer,
24740        {
24741            match self {
24742                Self::Unspecified => serializer.serialize_i32(0),
24743                Self::Count => serializer.serialize_i32(1),
24744                Self::UnknownValue(u) => u.0.serialize(serializer),
24745            }
24746        }
24747    }
24748
24749    impl<'de> serde::de::Deserialize<'de> for RetentionUnit {
24750        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24751        where
24752            D: serde::Deserializer<'de>,
24753        {
24754            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RetentionUnit>::new(
24755                ".google.cloud.sql.v1.BackupRetentionSettings.RetentionUnit",
24756            ))
24757        }
24758    }
24759}
24760
24761/// Database instance backup configuration.
24762#[derive(Clone, Default, PartialEq)]
24763#[non_exhaustive]
24764pub struct BackupConfiguration {
24765    /// Start time for the daily backup configuration in UTC timezone in the 24
24766    /// hour format - `HH:MM`.
24767    pub start_time: std::string::String,
24768
24769    /// Whether this configuration is enabled.
24770    pub enabled: std::option::Option<wkt::BoolValue>,
24771
24772    /// This is always `sql#backupConfiguration`.
24773    pub kind: std::string::String,
24774
24775    /// (MySQL only) Whether binary log is enabled. If backup configuration is
24776    /// disabled, binarylog must be disabled as well.
24777    pub binary_log_enabled: std::option::Option<wkt::BoolValue>,
24778
24779    /// Reserved for future use.
24780    pub replication_log_archiving_enabled: std::option::Option<wkt::BoolValue>,
24781
24782    /// Location of the backup
24783    pub location: std::string::String,
24784
24785    /// Whether point in time recovery is enabled.
24786    pub point_in_time_recovery_enabled: std::option::Option<wkt::BoolValue>,
24787
24788    /// Backup retention settings.
24789    pub backup_retention_settings: std::option::Option<crate::model::BackupRetentionSettings>,
24790
24791    /// The number of days of transaction logs we retain for point in time
24792    /// restore, from 1-7.
24793    pub transaction_log_retention_days: std::option::Option<wkt::Int32Value>,
24794
24795    /// Output only. This value contains the storage location of transactional logs
24796    /// used to perform point-in-time recovery (PITR) for the database.
24797    pub transactional_log_storage_state:
24798        std::option::Option<crate::model::backup_configuration::TransactionalLogStorageState>,
24799
24800    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24801}
24802
24803impl BackupConfiguration {
24804    pub fn new() -> Self {
24805        std::default::Default::default()
24806    }
24807
24808    /// Sets the value of [start_time][crate::model::BackupConfiguration::start_time].
24809    pub fn set_start_time<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24810        self.start_time = v.into();
24811        self
24812    }
24813
24814    /// Sets the value of [enabled][crate::model::BackupConfiguration::enabled].
24815    pub fn set_enabled<T>(mut self, v: T) -> Self
24816    where
24817        T: std::convert::Into<wkt::BoolValue>,
24818    {
24819        self.enabled = std::option::Option::Some(v.into());
24820        self
24821    }
24822
24823    /// Sets or clears the value of [enabled][crate::model::BackupConfiguration::enabled].
24824    pub fn set_or_clear_enabled<T>(mut self, v: std::option::Option<T>) -> Self
24825    where
24826        T: std::convert::Into<wkt::BoolValue>,
24827    {
24828        self.enabled = v.map(|x| x.into());
24829        self
24830    }
24831
24832    /// Sets the value of [kind][crate::model::BackupConfiguration::kind].
24833    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24834        self.kind = v.into();
24835        self
24836    }
24837
24838    /// Sets the value of [binary_log_enabled][crate::model::BackupConfiguration::binary_log_enabled].
24839    pub fn set_binary_log_enabled<T>(mut self, v: T) -> Self
24840    where
24841        T: std::convert::Into<wkt::BoolValue>,
24842    {
24843        self.binary_log_enabled = std::option::Option::Some(v.into());
24844        self
24845    }
24846
24847    /// Sets or clears the value of [binary_log_enabled][crate::model::BackupConfiguration::binary_log_enabled].
24848    pub fn set_or_clear_binary_log_enabled<T>(mut self, v: std::option::Option<T>) -> Self
24849    where
24850        T: std::convert::Into<wkt::BoolValue>,
24851    {
24852        self.binary_log_enabled = v.map(|x| x.into());
24853        self
24854    }
24855
24856    /// Sets the value of [replication_log_archiving_enabled][crate::model::BackupConfiguration::replication_log_archiving_enabled].
24857    pub fn set_replication_log_archiving_enabled<T>(mut self, v: T) -> Self
24858    where
24859        T: std::convert::Into<wkt::BoolValue>,
24860    {
24861        self.replication_log_archiving_enabled = std::option::Option::Some(v.into());
24862        self
24863    }
24864
24865    /// Sets or clears the value of [replication_log_archiving_enabled][crate::model::BackupConfiguration::replication_log_archiving_enabled].
24866    pub fn set_or_clear_replication_log_archiving_enabled<T>(
24867        mut self,
24868        v: std::option::Option<T>,
24869    ) -> Self
24870    where
24871        T: std::convert::Into<wkt::BoolValue>,
24872    {
24873        self.replication_log_archiving_enabled = v.map(|x| x.into());
24874        self
24875    }
24876
24877    /// Sets the value of [location][crate::model::BackupConfiguration::location].
24878    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24879        self.location = v.into();
24880        self
24881    }
24882
24883    /// Sets the value of [point_in_time_recovery_enabled][crate::model::BackupConfiguration::point_in_time_recovery_enabled].
24884    pub fn set_point_in_time_recovery_enabled<T>(mut self, v: T) -> Self
24885    where
24886        T: std::convert::Into<wkt::BoolValue>,
24887    {
24888        self.point_in_time_recovery_enabled = std::option::Option::Some(v.into());
24889        self
24890    }
24891
24892    /// Sets or clears the value of [point_in_time_recovery_enabled][crate::model::BackupConfiguration::point_in_time_recovery_enabled].
24893    pub fn set_or_clear_point_in_time_recovery_enabled<T>(
24894        mut self,
24895        v: std::option::Option<T>,
24896    ) -> Self
24897    where
24898        T: std::convert::Into<wkt::BoolValue>,
24899    {
24900        self.point_in_time_recovery_enabled = v.map(|x| x.into());
24901        self
24902    }
24903
24904    /// Sets the value of [backup_retention_settings][crate::model::BackupConfiguration::backup_retention_settings].
24905    pub fn set_backup_retention_settings<T>(mut self, v: T) -> Self
24906    where
24907        T: std::convert::Into<crate::model::BackupRetentionSettings>,
24908    {
24909        self.backup_retention_settings = std::option::Option::Some(v.into());
24910        self
24911    }
24912
24913    /// Sets or clears the value of [backup_retention_settings][crate::model::BackupConfiguration::backup_retention_settings].
24914    pub fn set_or_clear_backup_retention_settings<T>(mut self, v: std::option::Option<T>) -> Self
24915    where
24916        T: std::convert::Into<crate::model::BackupRetentionSettings>,
24917    {
24918        self.backup_retention_settings = v.map(|x| x.into());
24919        self
24920    }
24921
24922    /// Sets the value of [transaction_log_retention_days][crate::model::BackupConfiguration::transaction_log_retention_days].
24923    pub fn set_transaction_log_retention_days<T>(mut self, v: T) -> Self
24924    where
24925        T: std::convert::Into<wkt::Int32Value>,
24926    {
24927        self.transaction_log_retention_days = std::option::Option::Some(v.into());
24928        self
24929    }
24930
24931    /// Sets or clears the value of [transaction_log_retention_days][crate::model::BackupConfiguration::transaction_log_retention_days].
24932    pub fn set_or_clear_transaction_log_retention_days<T>(
24933        mut self,
24934        v: std::option::Option<T>,
24935    ) -> Self
24936    where
24937        T: std::convert::Into<wkt::Int32Value>,
24938    {
24939        self.transaction_log_retention_days = v.map(|x| x.into());
24940        self
24941    }
24942
24943    /// Sets the value of [transactional_log_storage_state][crate::model::BackupConfiguration::transactional_log_storage_state].
24944    pub fn set_transactional_log_storage_state<T>(mut self, v: T) -> Self
24945    where
24946        T: std::convert::Into<crate::model::backup_configuration::TransactionalLogStorageState>,
24947    {
24948        self.transactional_log_storage_state = std::option::Option::Some(v.into());
24949        self
24950    }
24951
24952    /// Sets or clears the value of [transactional_log_storage_state][crate::model::BackupConfiguration::transactional_log_storage_state].
24953    pub fn set_or_clear_transactional_log_storage_state<T>(
24954        mut self,
24955        v: std::option::Option<T>,
24956    ) -> Self
24957    where
24958        T: std::convert::Into<crate::model::backup_configuration::TransactionalLogStorageState>,
24959    {
24960        self.transactional_log_storage_state = v.map(|x| x.into());
24961        self
24962    }
24963}
24964
24965impl wkt::message::Message for BackupConfiguration {
24966    fn typename() -> &'static str {
24967        "type.googleapis.com/google.cloud.sql.v1.BackupConfiguration"
24968    }
24969}
24970
24971#[doc(hidden)]
24972impl<'de> serde::de::Deserialize<'de> for BackupConfiguration {
24973    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24974    where
24975        D: serde::Deserializer<'de>,
24976    {
24977        #[allow(non_camel_case_types)]
24978        #[doc(hidden)]
24979        #[derive(PartialEq, Eq, Hash)]
24980        enum __FieldTag {
24981            __start_time,
24982            __enabled,
24983            __kind,
24984            __binary_log_enabled,
24985            __replication_log_archiving_enabled,
24986            __location,
24987            __point_in_time_recovery_enabled,
24988            __backup_retention_settings,
24989            __transaction_log_retention_days,
24990            __transactional_log_storage_state,
24991            Unknown(std::string::String),
24992        }
24993        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
24994            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24995            where
24996                D: serde::Deserializer<'de>,
24997            {
24998                struct Visitor;
24999                impl<'de> serde::de::Visitor<'de> for Visitor {
25000                    type Value = __FieldTag;
25001                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25002                        formatter.write_str("a field name for BackupConfiguration")
25003                    }
25004                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
25005                    where
25006                        E: serde::de::Error,
25007                    {
25008                        use std::result::Result::Ok;
25009                        use std::string::ToString;
25010                        match value {
25011                            "startTime" => Ok(__FieldTag::__start_time),
25012                            "start_time" => Ok(__FieldTag::__start_time),
25013                            "enabled" => Ok(__FieldTag::__enabled),
25014                            "kind" => Ok(__FieldTag::__kind),
25015                            "binaryLogEnabled" => Ok(__FieldTag::__binary_log_enabled),
25016                            "binary_log_enabled" => Ok(__FieldTag::__binary_log_enabled),
25017                            "replicationLogArchivingEnabled" => {
25018                                Ok(__FieldTag::__replication_log_archiving_enabled)
25019                            }
25020                            "replication_log_archiving_enabled" => {
25021                                Ok(__FieldTag::__replication_log_archiving_enabled)
25022                            }
25023                            "location" => Ok(__FieldTag::__location),
25024                            "pointInTimeRecoveryEnabled" => {
25025                                Ok(__FieldTag::__point_in_time_recovery_enabled)
25026                            }
25027                            "point_in_time_recovery_enabled" => {
25028                                Ok(__FieldTag::__point_in_time_recovery_enabled)
25029                            }
25030                            "backupRetentionSettings" => {
25031                                Ok(__FieldTag::__backup_retention_settings)
25032                            }
25033                            "backup_retention_settings" => {
25034                                Ok(__FieldTag::__backup_retention_settings)
25035                            }
25036                            "transactionLogRetentionDays" => {
25037                                Ok(__FieldTag::__transaction_log_retention_days)
25038                            }
25039                            "transaction_log_retention_days" => {
25040                                Ok(__FieldTag::__transaction_log_retention_days)
25041                            }
25042                            "transactionalLogStorageState" => {
25043                                Ok(__FieldTag::__transactional_log_storage_state)
25044                            }
25045                            "transactional_log_storage_state" => {
25046                                Ok(__FieldTag::__transactional_log_storage_state)
25047                            }
25048                            _ => Ok(__FieldTag::Unknown(value.to_string())),
25049                        }
25050                    }
25051                }
25052                deserializer.deserialize_identifier(Visitor)
25053            }
25054        }
25055        struct Visitor;
25056        impl<'de> serde::de::Visitor<'de> for Visitor {
25057            type Value = BackupConfiguration;
25058            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25059                formatter.write_str("struct BackupConfiguration")
25060            }
25061            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
25062            where
25063                A: serde::de::MapAccess<'de>,
25064            {
25065                #[allow(unused_imports)]
25066                use serde::de::Error;
25067                use std::option::Option::Some;
25068                let mut fields = std::collections::HashSet::new();
25069                let mut result = Self::Value::new();
25070                while let Some(tag) = map.next_key::<__FieldTag>()? {
25071                    #[allow(clippy::match_single_binding)]
25072                    match tag {
25073                        __FieldTag::__start_time => {
25074                            if !fields.insert(__FieldTag::__start_time) {
25075                                return std::result::Result::Err(A::Error::duplicate_field(
25076                                    "multiple values for start_time",
25077                                ));
25078                            }
25079                            result.start_time = map
25080                                .next_value::<std::option::Option<std::string::String>>()?
25081                                .unwrap_or_default();
25082                        }
25083                        __FieldTag::__enabled => {
25084                            if !fields.insert(__FieldTag::__enabled) {
25085                                return std::result::Result::Err(A::Error::duplicate_field(
25086                                    "multiple values for enabled",
25087                                ));
25088                            }
25089                            result.enabled =
25090                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
25091                        }
25092                        __FieldTag::__kind => {
25093                            if !fields.insert(__FieldTag::__kind) {
25094                                return std::result::Result::Err(A::Error::duplicate_field(
25095                                    "multiple values for kind",
25096                                ));
25097                            }
25098                            result.kind = map
25099                                .next_value::<std::option::Option<std::string::String>>()?
25100                                .unwrap_or_default();
25101                        }
25102                        __FieldTag::__binary_log_enabled => {
25103                            if !fields.insert(__FieldTag::__binary_log_enabled) {
25104                                return std::result::Result::Err(A::Error::duplicate_field(
25105                                    "multiple values for binary_log_enabled",
25106                                ));
25107                            }
25108                            result.binary_log_enabled =
25109                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
25110                        }
25111                        __FieldTag::__replication_log_archiving_enabled => {
25112                            if !fields.insert(__FieldTag::__replication_log_archiving_enabled) {
25113                                return std::result::Result::Err(A::Error::duplicate_field(
25114                                    "multiple values for replication_log_archiving_enabled",
25115                                ));
25116                            }
25117                            result.replication_log_archiving_enabled =
25118                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
25119                        }
25120                        __FieldTag::__location => {
25121                            if !fields.insert(__FieldTag::__location) {
25122                                return std::result::Result::Err(A::Error::duplicate_field(
25123                                    "multiple values for location",
25124                                ));
25125                            }
25126                            result.location = map
25127                                .next_value::<std::option::Option<std::string::String>>()?
25128                                .unwrap_or_default();
25129                        }
25130                        __FieldTag::__point_in_time_recovery_enabled => {
25131                            if !fields.insert(__FieldTag::__point_in_time_recovery_enabled) {
25132                                return std::result::Result::Err(A::Error::duplicate_field(
25133                                    "multiple values for point_in_time_recovery_enabled",
25134                                ));
25135                            }
25136                            result.point_in_time_recovery_enabled =
25137                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
25138                        }
25139                        __FieldTag::__backup_retention_settings => {
25140                            if !fields.insert(__FieldTag::__backup_retention_settings) {
25141                                return std::result::Result::Err(A::Error::duplicate_field(
25142                                    "multiple values for backup_retention_settings",
25143                                ));
25144                            }
25145                            result.backup_retention_settings = map.next_value::<std::option::Option<crate::model::BackupRetentionSettings>>()?
25146                                ;
25147                        }
25148                        __FieldTag::__transaction_log_retention_days => {
25149                            if !fields.insert(__FieldTag::__transaction_log_retention_days) {
25150                                return std::result::Result::Err(A::Error::duplicate_field(
25151                                    "multiple values for transaction_log_retention_days",
25152                                ));
25153                            }
25154                            struct __With(std::option::Option<wkt::Int32Value>);
25155                            impl<'de> serde::de::Deserialize<'de> for __With {
25156                                fn deserialize<D>(
25157                                    deserializer: D,
25158                                ) -> std::result::Result<Self, D::Error>
25159                                where
25160                                    D: serde::de::Deserializer<'de>,
25161                                {
25162                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
25163                                }
25164                            }
25165                            result.transaction_log_retention_days = map.next_value::<__With>()?.0;
25166                        }
25167                        __FieldTag::__transactional_log_storage_state => {
25168                            if !fields.insert(__FieldTag::__transactional_log_storage_state) {
25169                                return std::result::Result::Err(A::Error::duplicate_field(
25170                                    "multiple values for transactional_log_storage_state",
25171                                ));
25172                            }
25173                            result.transactional_log_storage_state = map
25174                                .next_value::<std::option::Option<
25175                                crate::model::backup_configuration::TransactionalLogStorageState,
25176                            >>(
25177                            )?;
25178                        }
25179                        __FieldTag::Unknown(key) => {
25180                            let value = map.next_value::<serde_json::Value>()?;
25181                            result._unknown_fields.insert(key, value);
25182                        }
25183                    }
25184                }
25185                std::result::Result::Ok(result)
25186            }
25187        }
25188        deserializer.deserialize_any(Visitor)
25189    }
25190}
25191
25192#[doc(hidden)]
25193impl serde::ser::Serialize for BackupConfiguration {
25194    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25195    where
25196        S: serde::ser::Serializer,
25197    {
25198        use serde::ser::SerializeMap;
25199        #[allow(unused_imports)]
25200        use std::option::Option::Some;
25201        let mut state = serializer.serialize_map(std::option::Option::None)?;
25202        if !self.start_time.is_empty() {
25203            state.serialize_entry("startTime", &self.start_time)?;
25204        }
25205        if self.enabled.is_some() {
25206            state.serialize_entry("enabled", &self.enabled)?;
25207        }
25208        if !self.kind.is_empty() {
25209            state.serialize_entry("kind", &self.kind)?;
25210        }
25211        if self.binary_log_enabled.is_some() {
25212            state.serialize_entry("binaryLogEnabled", &self.binary_log_enabled)?;
25213        }
25214        if self.replication_log_archiving_enabled.is_some() {
25215            state.serialize_entry(
25216                "replicationLogArchivingEnabled",
25217                &self.replication_log_archiving_enabled,
25218            )?;
25219        }
25220        if !self.location.is_empty() {
25221            state.serialize_entry("location", &self.location)?;
25222        }
25223        if self.point_in_time_recovery_enabled.is_some() {
25224            state.serialize_entry(
25225                "pointInTimeRecoveryEnabled",
25226                &self.point_in_time_recovery_enabled,
25227            )?;
25228        }
25229        if self.backup_retention_settings.is_some() {
25230            state.serialize_entry("backupRetentionSettings", &self.backup_retention_settings)?;
25231        }
25232        if self.transaction_log_retention_days.is_some() {
25233            struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
25234            impl<'a> serde::ser::Serialize for __With<'a> {
25235                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25236                where
25237                    S: serde::ser::Serializer,
25238                {
25239                    serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
25240                        self.0, serializer,
25241                    )
25242                }
25243            }
25244            state.serialize_entry(
25245                "transactionLogRetentionDays",
25246                &__With(&self.transaction_log_retention_days),
25247            )?;
25248        }
25249        if self.transactional_log_storage_state.is_some() {
25250            state.serialize_entry(
25251                "transactionalLogStorageState",
25252                &self.transactional_log_storage_state,
25253            )?;
25254        }
25255        if !self._unknown_fields.is_empty() {
25256            for (key, value) in self._unknown_fields.iter() {
25257                state.serialize_entry(key, &value)?;
25258            }
25259        }
25260        state.end()
25261    }
25262}
25263
25264impl std::fmt::Debug for BackupConfiguration {
25265    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25266        let mut debug_struct = f.debug_struct("BackupConfiguration");
25267        debug_struct.field("start_time", &self.start_time);
25268        debug_struct.field("enabled", &self.enabled);
25269        debug_struct.field("kind", &self.kind);
25270        debug_struct.field("binary_log_enabled", &self.binary_log_enabled);
25271        debug_struct.field(
25272            "replication_log_archiving_enabled",
25273            &self.replication_log_archiving_enabled,
25274        );
25275        debug_struct.field("location", &self.location);
25276        debug_struct.field(
25277            "point_in_time_recovery_enabled",
25278            &self.point_in_time_recovery_enabled,
25279        );
25280        debug_struct.field("backup_retention_settings", &self.backup_retention_settings);
25281        debug_struct.field(
25282            "transaction_log_retention_days",
25283            &self.transaction_log_retention_days,
25284        );
25285        debug_struct.field(
25286            "transactional_log_storage_state",
25287            &self.transactional_log_storage_state,
25288        );
25289        if !self._unknown_fields.is_empty() {
25290            debug_struct.field("_unknown_fields", &self._unknown_fields);
25291        }
25292        debug_struct.finish()
25293    }
25294}
25295
25296/// Defines additional types related to [BackupConfiguration].
25297pub mod backup_configuration {
25298    #[allow(unused_imports)]
25299    use super::*;
25300
25301    /// This value contains the storage location of the transactional logs
25302    /// used to perform point-in-time recovery (PITR) for the database.
25303    ///
25304    /// # Working with unknown values
25305    ///
25306    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25307    /// additional enum variants at any time. Adding new variants is not considered
25308    /// a breaking change. Applications should write their code in anticipation of:
25309    ///
25310    /// - New values appearing in future releases of the client library, **and**
25311    /// - New values received dynamically, without application changes.
25312    ///
25313    /// Please consult the [Working with enums] section in the user guide for some
25314    /// guidelines.
25315    ///
25316    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
25317    #[derive(Clone, Debug, PartialEq)]
25318    #[non_exhaustive]
25319    pub enum TransactionalLogStorageState {
25320        /// Unspecified.
25321        Unspecified,
25322        /// The transaction logs used for PITR for the instance are stored
25323        /// on a data disk.
25324        Disk,
25325        /// The transaction logs used for PITR for the instance are switching from
25326        /// being stored on a data disk to being stored in Cloud Storage.
25327        /// Only applicable to MySQL.
25328        SwitchingToCloudStorage,
25329        /// The transaction logs used for PITR for the instance are now stored
25330        /// in Cloud Storage. Previously, they were stored on a data disk.
25331        /// Only applicable to MySQL.
25332        SwitchedToCloudStorage,
25333        /// The transaction logs used for PITR for the instance are stored in
25334        /// Cloud Storage. Only applicable to MySQL and PostgreSQL.
25335        CloudStorage,
25336        /// If set, the enum was initialized with an unknown value.
25337        ///
25338        /// Applications can examine the value using [TransactionalLogStorageState::value] or
25339        /// [TransactionalLogStorageState::name].
25340        UnknownValue(transactional_log_storage_state::UnknownValue),
25341    }
25342
25343    #[doc(hidden)]
25344    pub mod transactional_log_storage_state {
25345        #[allow(unused_imports)]
25346        use super::*;
25347        #[derive(Clone, Debug, PartialEq)]
25348        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25349    }
25350
25351    impl TransactionalLogStorageState {
25352        /// Gets the enum value.
25353        ///
25354        /// Returns `None` if the enum contains an unknown value deserialized from
25355        /// the string representation of enums.
25356        pub fn value(&self) -> std::option::Option<i32> {
25357            match self {
25358                Self::Unspecified => std::option::Option::Some(0),
25359                Self::Disk => std::option::Option::Some(1),
25360                Self::SwitchingToCloudStorage => std::option::Option::Some(2),
25361                Self::SwitchedToCloudStorage => std::option::Option::Some(3),
25362                Self::CloudStorage => std::option::Option::Some(4),
25363                Self::UnknownValue(u) => u.0.value(),
25364            }
25365        }
25366
25367        /// Gets the enum value as a string.
25368        ///
25369        /// Returns `None` if the enum contains an unknown value deserialized from
25370        /// the integer representation of enums.
25371        pub fn name(&self) -> std::option::Option<&str> {
25372            match self {
25373                Self::Unspecified => {
25374                    std::option::Option::Some("TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED")
25375                }
25376                Self::Disk => std::option::Option::Some("DISK"),
25377                Self::SwitchingToCloudStorage => {
25378                    std::option::Option::Some("SWITCHING_TO_CLOUD_STORAGE")
25379                }
25380                Self::SwitchedToCloudStorage => {
25381                    std::option::Option::Some("SWITCHED_TO_CLOUD_STORAGE")
25382                }
25383                Self::CloudStorage => std::option::Option::Some("CLOUD_STORAGE"),
25384                Self::UnknownValue(u) => u.0.name(),
25385            }
25386        }
25387    }
25388
25389    impl std::default::Default for TransactionalLogStorageState {
25390        fn default() -> Self {
25391            use std::convert::From;
25392            Self::from(0)
25393        }
25394    }
25395
25396    impl std::fmt::Display for TransactionalLogStorageState {
25397        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25398            wkt::internal::display_enum(f, self.name(), self.value())
25399        }
25400    }
25401
25402    impl std::convert::From<i32> for TransactionalLogStorageState {
25403        fn from(value: i32) -> Self {
25404            match value {
25405                0 => Self::Unspecified,
25406                1 => Self::Disk,
25407                2 => Self::SwitchingToCloudStorage,
25408                3 => Self::SwitchedToCloudStorage,
25409                4 => Self::CloudStorage,
25410                _ => Self::UnknownValue(transactional_log_storage_state::UnknownValue(
25411                    wkt::internal::UnknownEnumValue::Integer(value),
25412                )),
25413            }
25414        }
25415    }
25416
25417    impl std::convert::From<&str> for TransactionalLogStorageState {
25418        fn from(value: &str) -> Self {
25419            use std::string::ToString;
25420            match value {
25421                "TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED" => Self::Unspecified,
25422                "DISK" => Self::Disk,
25423                "SWITCHING_TO_CLOUD_STORAGE" => Self::SwitchingToCloudStorage,
25424                "SWITCHED_TO_CLOUD_STORAGE" => Self::SwitchedToCloudStorage,
25425                "CLOUD_STORAGE" => Self::CloudStorage,
25426                _ => Self::UnknownValue(transactional_log_storage_state::UnknownValue(
25427                    wkt::internal::UnknownEnumValue::String(value.to_string()),
25428                )),
25429            }
25430        }
25431    }
25432
25433    impl serde::ser::Serialize for TransactionalLogStorageState {
25434        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25435        where
25436            S: serde::Serializer,
25437        {
25438            match self {
25439                Self::Unspecified => serializer.serialize_i32(0),
25440                Self::Disk => serializer.serialize_i32(1),
25441                Self::SwitchingToCloudStorage => serializer.serialize_i32(2),
25442                Self::SwitchedToCloudStorage => serializer.serialize_i32(3),
25443                Self::CloudStorage => serializer.serialize_i32(4),
25444                Self::UnknownValue(u) => u.0.serialize(serializer),
25445            }
25446        }
25447    }
25448
25449    impl<'de> serde::de::Deserialize<'de> for TransactionalLogStorageState {
25450        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25451        where
25452            D: serde::Deserializer<'de>,
25453        {
25454            deserializer.deserialize_any(
25455                wkt::internal::EnumVisitor::<TransactionalLogStorageState>::new(
25456                    ".google.cloud.sql.v1.BackupConfiguration.TransactionalLogStorageState",
25457                ),
25458            )
25459        }
25460    }
25461}
25462
25463/// Perform disk shrink context.
25464#[derive(Clone, Default, PartialEq)]
25465#[non_exhaustive]
25466pub struct PerformDiskShrinkContext {
25467    /// The target disk shrink size in GigaBytes.
25468    pub target_size_gb: i64,
25469
25470    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25471}
25472
25473impl PerformDiskShrinkContext {
25474    pub fn new() -> Self {
25475        std::default::Default::default()
25476    }
25477
25478    /// Sets the value of [target_size_gb][crate::model::PerformDiskShrinkContext::target_size_gb].
25479    pub fn set_target_size_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
25480        self.target_size_gb = v.into();
25481        self
25482    }
25483}
25484
25485impl wkt::message::Message for PerformDiskShrinkContext {
25486    fn typename() -> &'static str {
25487        "type.googleapis.com/google.cloud.sql.v1.PerformDiskShrinkContext"
25488    }
25489}
25490
25491#[doc(hidden)]
25492impl<'de> serde::de::Deserialize<'de> for PerformDiskShrinkContext {
25493    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25494    where
25495        D: serde::Deserializer<'de>,
25496    {
25497        #[allow(non_camel_case_types)]
25498        #[doc(hidden)]
25499        #[derive(PartialEq, Eq, Hash)]
25500        enum __FieldTag {
25501            __target_size_gb,
25502            Unknown(std::string::String),
25503        }
25504        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
25505            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25506            where
25507                D: serde::Deserializer<'de>,
25508            {
25509                struct Visitor;
25510                impl<'de> serde::de::Visitor<'de> for Visitor {
25511                    type Value = __FieldTag;
25512                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25513                        formatter.write_str("a field name for PerformDiskShrinkContext")
25514                    }
25515                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
25516                    where
25517                        E: serde::de::Error,
25518                    {
25519                        use std::result::Result::Ok;
25520                        use std::string::ToString;
25521                        match value {
25522                            "targetSizeGb" => Ok(__FieldTag::__target_size_gb),
25523                            "target_size_gb" => Ok(__FieldTag::__target_size_gb),
25524                            _ => Ok(__FieldTag::Unknown(value.to_string())),
25525                        }
25526                    }
25527                }
25528                deserializer.deserialize_identifier(Visitor)
25529            }
25530        }
25531        struct Visitor;
25532        impl<'de> serde::de::Visitor<'de> for Visitor {
25533            type Value = PerformDiskShrinkContext;
25534            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25535                formatter.write_str("struct PerformDiskShrinkContext")
25536            }
25537            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
25538            where
25539                A: serde::de::MapAccess<'de>,
25540            {
25541                #[allow(unused_imports)]
25542                use serde::de::Error;
25543                use std::option::Option::Some;
25544                let mut fields = std::collections::HashSet::new();
25545                let mut result = Self::Value::new();
25546                while let Some(tag) = map.next_key::<__FieldTag>()? {
25547                    #[allow(clippy::match_single_binding)]
25548                    match tag {
25549                        __FieldTag::__target_size_gb => {
25550                            if !fields.insert(__FieldTag::__target_size_gb) {
25551                                return std::result::Result::Err(A::Error::duplicate_field(
25552                                    "multiple values for target_size_gb",
25553                                ));
25554                            }
25555                            struct __With(std::option::Option<i64>);
25556                            impl<'de> serde::de::Deserialize<'de> for __With {
25557                                fn deserialize<D>(
25558                                    deserializer: D,
25559                                ) -> std::result::Result<Self, D::Error>
25560                                where
25561                                    D: serde::de::Deserializer<'de>,
25562                                {
25563                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
25564                                }
25565                            }
25566                            result.target_size_gb =
25567                                map.next_value::<__With>()?.0.unwrap_or_default();
25568                        }
25569                        __FieldTag::Unknown(key) => {
25570                            let value = map.next_value::<serde_json::Value>()?;
25571                            result._unknown_fields.insert(key, value);
25572                        }
25573                    }
25574                }
25575                std::result::Result::Ok(result)
25576            }
25577        }
25578        deserializer.deserialize_any(Visitor)
25579    }
25580}
25581
25582#[doc(hidden)]
25583impl serde::ser::Serialize for PerformDiskShrinkContext {
25584    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25585    where
25586        S: serde::ser::Serializer,
25587    {
25588        use serde::ser::SerializeMap;
25589        #[allow(unused_imports)]
25590        use std::option::Option::Some;
25591        let mut state = serializer.serialize_map(std::option::Option::None)?;
25592        if !wkt::internal::is_default(&self.target_size_gb) {
25593            struct __With<'a>(&'a i64);
25594            impl<'a> serde::ser::Serialize for __With<'a> {
25595                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25596                where
25597                    S: serde::ser::Serializer,
25598                {
25599                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
25600                }
25601            }
25602            state.serialize_entry("targetSizeGb", &__With(&self.target_size_gb))?;
25603        }
25604        if !self._unknown_fields.is_empty() {
25605            for (key, value) in self._unknown_fields.iter() {
25606                state.serialize_entry(key, &value)?;
25607            }
25608        }
25609        state.end()
25610    }
25611}
25612
25613impl std::fmt::Debug for PerformDiskShrinkContext {
25614    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25615        let mut debug_struct = f.debug_struct("PerformDiskShrinkContext");
25616        debug_struct.field("target_size_gb", &self.target_size_gb);
25617        if !self._unknown_fields.is_empty() {
25618            debug_struct.field("_unknown_fields", &self._unknown_fields);
25619        }
25620        debug_struct.finish()
25621    }
25622}
25623
25624/// Backup context.
25625#[derive(Clone, Default, PartialEq)]
25626#[non_exhaustive]
25627pub struct BackupContext {
25628    /// The identifier of the backup.
25629    pub backup_id: i64,
25630
25631    /// This is always `sql#backupContext`.
25632    pub kind: std::string::String,
25633
25634    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25635}
25636
25637impl BackupContext {
25638    pub fn new() -> Self {
25639        std::default::Default::default()
25640    }
25641
25642    /// Sets the value of [backup_id][crate::model::BackupContext::backup_id].
25643    pub fn set_backup_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
25644        self.backup_id = v.into();
25645        self
25646    }
25647
25648    /// Sets the value of [kind][crate::model::BackupContext::kind].
25649    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25650        self.kind = v.into();
25651        self
25652    }
25653}
25654
25655impl wkt::message::Message for BackupContext {
25656    fn typename() -> &'static str {
25657        "type.googleapis.com/google.cloud.sql.v1.BackupContext"
25658    }
25659}
25660
25661#[doc(hidden)]
25662impl<'de> serde::de::Deserialize<'de> for BackupContext {
25663    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25664    where
25665        D: serde::Deserializer<'de>,
25666    {
25667        #[allow(non_camel_case_types)]
25668        #[doc(hidden)]
25669        #[derive(PartialEq, Eq, Hash)]
25670        enum __FieldTag {
25671            __backup_id,
25672            __kind,
25673            Unknown(std::string::String),
25674        }
25675        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
25676            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25677            where
25678                D: serde::Deserializer<'de>,
25679            {
25680                struct Visitor;
25681                impl<'de> serde::de::Visitor<'de> for Visitor {
25682                    type Value = __FieldTag;
25683                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25684                        formatter.write_str("a field name for BackupContext")
25685                    }
25686                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
25687                    where
25688                        E: serde::de::Error,
25689                    {
25690                        use std::result::Result::Ok;
25691                        use std::string::ToString;
25692                        match value {
25693                            "backupId" => Ok(__FieldTag::__backup_id),
25694                            "backup_id" => Ok(__FieldTag::__backup_id),
25695                            "kind" => Ok(__FieldTag::__kind),
25696                            _ => Ok(__FieldTag::Unknown(value.to_string())),
25697                        }
25698                    }
25699                }
25700                deserializer.deserialize_identifier(Visitor)
25701            }
25702        }
25703        struct Visitor;
25704        impl<'de> serde::de::Visitor<'de> for Visitor {
25705            type Value = BackupContext;
25706            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25707                formatter.write_str("struct BackupContext")
25708            }
25709            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
25710            where
25711                A: serde::de::MapAccess<'de>,
25712            {
25713                #[allow(unused_imports)]
25714                use serde::de::Error;
25715                use std::option::Option::Some;
25716                let mut fields = std::collections::HashSet::new();
25717                let mut result = Self::Value::new();
25718                while let Some(tag) = map.next_key::<__FieldTag>()? {
25719                    #[allow(clippy::match_single_binding)]
25720                    match tag {
25721                        __FieldTag::__backup_id => {
25722                            if !fields.insert(__FieldTag::__backup_id) {
25723                                return std::result::Result::Err(A::Error::duplicate_field(
25724                                    "multiple values for backup_id",
25725                                ));
25726                            }
25727                            struct __With(std::option::Option<i64>);
25728                            impl<'de> serde::de::Deserialize<'de> for __With {
25729                                fn deserialize<D>(
25730                                    deserializer: D,
25731                                ) -> std::result::Result<Self, D::Error>
25732                                where
25733                                    D: serde::de::Deserializer<'de>,
25734                                {
25735                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
25736                                }
25737                            }
25738                            result.backup_id = map.next_value::<__With>()?.0.unwrap_or_default();
25739                        }
25740                        __FieldTag::__kind => {
25741                            if !fields.insert(__FieldTag::__kind) {
25742                                return std::result::Result::Err(A::Error::duplicate_field(
25743                                    "multiple values for kind",
25744                                ));
25745                            }
25746                            result.kind = map
25747                                .next_value::<std::option::Option<std::string::String>>()?
25748                                .unwrap_or_default();
25749                        }
25750                        __FieldTag::Unknown(key) => {
25751                            let value = map.next_value::<serde_json::Value>()?;
25752                            result._unknown_fields.insert(key, value);
25753                        }
25754                    }
25755                }
25756                std::result::Result::Ok(result)
25757            }
25758        }
25759        deserializer.deserialize_any(Visitor)
25760    }
25761}
25762
25763#[doc(hidden)]
25764impl serde::ser::Serialize for BackupContext {
25765    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25766    where
25767        S: serde::ser::Serializer,
25768    {
25769        use serde::ser::SerializeMap;
25770        #[allow(unused_imports)]
25771        use std::option::Option::Some;
25772        let mut state = serializer.serialize_map(std::option::Option::None)?;
25773        if !wkt::internal::is_default(&self.backup_id) {
25774            struct __With<'a>(&'a i64);
25775            impl<'a> serde::ser::Serialize for __With<'a> {
25776                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25777                where
25778                    S: serde::ser::Serializer,
25779                {
25780                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
25781                }
25782            }
25783            state.serialize_entry("backupId", &__With(&self.backup_id))?;
25784        }
25785        if !self.kind.is_empty() {
25786            state.serialize_entry("kind", &self.kind)?;
25787        }
25788        if !self._unknown_fields.is_empty() {
25789            for (key, value) in self._unknown_fields.iter() {
25790                state.serialize_entry(key, &value)?;
25791            }
25792        }
25793        state.end()
25794    }
25795}
25796
25797impl std::fmt::Debug for BackupContext {
25798    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25799        let mut debug_struct = f.debug_struct("BackupContext");
25800        debug_struct.field("backup_id", &self.backup_id);
25801        debug_struct.field("kind", &self.kind);
25802        if !self._unknown_fields.is_empty() {
25803            debug_struct.field("_unknown_fields", &self._unknown_fields);
25804        }
25805        debug_struct.finish()
25806    }
25807}
25808
25809/// Represents a SQL database on the Cloud SQL instance.
25810#[derive(Clone, Default, PartialEq)]
25811#[non_exhaustive]
25812pub struct Database {
25813    /// This is always `sql#database`.
25814    pub kind: std::string::String,
25815
25816    /// The Cloud SQL charset value.
25817    pub charset: std::string::String,
25818
25819    /// The Cloud SQL collation value.
25820    pub collation: std::string::String,
25821
25822    /// This field is deprecated and will be removed from a future version of the
25823    /// API.
25824    pub etag: std::string::String,
25825
25826    /// The name of the database in the Cloud SQL instance. This does not include
25827    /// the project ID or instance name.
25828    pub name: std::string::String,
25829
25830    /// The name of the Cloud SQL instance. This does not include the project ID.
25831    pub instance: std::string::String,
25832
25833    /// The URI of this resource.
25834    pub self_link: std::string::String,
25835
25836    /// The project ID of the project containing the Cloud SQL database. The Google
25837    /// apps domain is prefixed if applicable.
25838    pub project: std::string::String,
25839
25840    pub database_details: std::option::Option<crate::model::database::DatabaseDetails>,
25841
25842    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25843}
25844
25845impl Database {
25846    pub fn new() -> Self {
25847        std::default::Default::default()
25848    }
25849
25850    /// Sets the value of [kind][crate::model::Database::kind].
25851    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25852        self.kind = v.into();
25853        self
25854    }
25855
25856    /// Sets the value of [charset][crate::model::Database::charset].
25857    pub fn set_charset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25858        self.charset = v.into();
25859        self
25860    }
25861
25862    /// Sets the value of [collation][crate::model::Database::collation].
25863    pub fn set_collation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25864        self.collation = v.into();
25865        self
25866    }
25867
25868    /// Sets the value of [etag][crate::model::Database::etag].
25869    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25870        self.etag = v.into();
25871        self
25872    }
25873
25874    /// Sets the value of [name][crate::model::Database::name].
25875    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25876        self.name = v.into();
25877        self
25878    }
25879
25880    /// Sets the value of [instance][crate::model::Database::instance].
25881    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25882        self.instance = v.into();
25883        self
25884    }
25885
25886    /// Sets the value of [self_link][crate::model::Database::self_link].
25887    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25888        self.self_link = v.into();
25889        self
25890    }
25891
25892    /// Sets the value of [project][crate::model::Database::project].
25893    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25894        self.project = v.into();
25895        self
25896    }
25897
25898    /// Sets the value of [database_details][crate::model::Database::database_details].
25899    ///
25900    /// Note that all the setters affecting `database_details` are mutually
25901    /// exclusive.
25902    pub fn set_database_details<
25903        T: std::convert::Into<std::option::Option<crate::model::database::DatabaseDetails>>,
25904    >(
25905        mut self,
25906        v: T,
25907    ) -> Self {
25908        self.database_details = v.into();
25909        self
25910    }
25911
25912    /// The value of [database_details][crate::model::Database::database_details]
25913    /// if it holds a `SqlserverDatabaseDetails`, `None` if the field is not set or
25914    /// holds a different branch.
25915    pub fn sqlserver_database_details(
25916        &self,
25917    ) -> std::option::Option<&std::boxed::Box<crate::model::SqlServerDatabaseDetails>> {
25918        #[allow(unreachable_patterns)]
25919        self.database_details.as_ref().and_then(|v| match v {
25920            crate::model::database::DatabaseDetails::SqlserverDatabaseDetails(v) => {
25921                std::option::Option::Some(v)
25922            }
25923            _ => std::option::Option::None,
25924        })
25925    }
25926
25927    /// Sets the value of [database_details][crate::model::Database::database_details]
25928    /// to hold a `SqlserverDatabaseDetails`.
25929    ///
25930    /// Note that all the setters affecting `database_details` are
25931    /// mutually exclusive.
25932    pub fn set_sqlserver_database_details<
25933        T: std::convert::Into<std::boxed::Box<crate::model::SqlServerDatabaseDetails>>,
25934    >(
25935        mut self,
25936        v: T,
25937    ) -> Self {
25938        self.database_details = std::option::Option::Some(
25939            crate::model::database::DatabaseDetails::SqlserverDatabaseDetails(v.into()),
25940        );
25941        self
25942    }
25943}
25944
25945impl wkt::message::Message for Database {
25946    fn typename() -> &'static str {
25947        "type.googleapis.com/google.cloud.sql.v1.Database"
25948    }
25949}
25950
25951#[doc(hidden)]
25952impl<'de> serde::de::Deserialize<'de> for Database {
25953    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25954    where
25955        D: serde::Deserializer<'de>,
25956    {
25957        #[allow(non_camel_case_types)]
25958        #[doc(hidden)]
25959        #[derive(PartialEq, Eq, Hash)]
25960        enum __FieldTag {
25961            __kind,
25962            __charset,
25963            __collation,
25964            __etag,
25965            __name,
25966            __instance,
25967            __self_link,
25968            __project,
25969            __sqlserver_database_details,
25970            Unknown(std::string::String),
25971        }
25972        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
25973            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25974            where
25975                D: serde::Deserializer<'de>,
25976            {
25977                struct Visitor;
25978                impl<'de> serde::de::Visitor<'de> for Visitor {
25979                    type Value = __FieldTag;
25980                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25981                        formatter.write_str("a field name for Database")
25982                    }
25983                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
25984                    where
25985                        E: serde::de::Error,
25986                    {
25987                        use std::result::Result::Ok;
25988                        use std::string::ToString;
25989                        match value {
25990                            "kind" => Ok(__FieldTag::__kind),
25991                            "charset" => Ok(__FieldTag::__charset),
25992                            "collation" => Ok(__FieldTag::__collation),
25993                            "etag" => Ok(__FieldTag::__etag),
25994                            "name" => Ok(__FieldTag::__name),
25995                            "instance" => Ok(__FieldTag::__instance),
25996                            "selfLink" => Ok(__FieldTag::__self_link),
25997                            "self_link" => Ok(__FieldTag::__self_link),
25998                            "project" => Ok(__FieldTag::__project),
25999                            "sqlserverDatabaseDetails" => {
26000                                Ok(__FieldTag::__sqlserver_database_details)
26001                            }
26002                            "sqlserver_database_details" => {
26003                                Ok(__FieldTag::__sqlserver_database_details)
26004                            }
26005                            _ => Ok(__FieldTag::Unknown(value.to_string())),
26006                        }
26007                    }
26008                }
26009                deserializer.deserialize_identifier(Visitor)
26010            }
26011        }
26012        struct Visitor;
26013        impl<'de> serde::de::Visitor<'de> for Visitor {
26014            type Value = Database;
26015            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
26016                formatter.write_str("struct Database")
26017            }
26018            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
26019            where
26020                A: serde::de::MapAccess<'de>,
26021            {
26022                #[allow(unused_imports)]
26023                use serde::de::Error;
26024                use std::option::Option::Some;
26025                let mut fields = std::collections::HashSet::new();
26026                let mut result = Self::Value::new();
26027                while let Some(tag) = map.next_key::<__FieldTag>()? {
26028                    #[allow(clippy::match_single_binding)]
26029                    match tag {
26030                        __FieldTag::__kind => {
26031                            if !fields.insert(__FieldTag::__kind) {
26032                                return std::result::Result::Err(A::Error::duplicate_field(
26033                                    "multiple values for kind",
26034                                ));
26035                            }
26036                            result.kind = map
26037                                .next_value::<std::option::Option<std::string::String>>()?
26038                                .unwrap_or_default();
26039                        }
26040                        __FieldTag::__charset => {
26041                            if !fields.insert(__FieldTag::__charset) {
26042                                return std::result::Result::Err(A::Error::duplicate_field(
26043                                    "multiple values for charset",
26044                                ));
26045                            }
26046                            result.charset = map
26047                                .next_value::<std::option::Option<std::string::String>>()?
26048                                .unwrap_or_default();
26049                        }
26050                        __FieldTag::__collation => {
26051                            if !fields.insert(__FieldTag::__collation) {
26052                                return std::result::Result::Err(A::Error::duplicate_field(
26053                                    "multiple values for collation",
26054                                ));
26055                            }
26056                            result.collation = map
26057                                .next_value::<std::option::Option<std::string::String>>()?
26058                                .unwrap_or_default();
26059                        }
26060                        __FieldTag::__etag => {
26061                            if !fields.insert(__FieldTag::__etag) {
26062                                return std::result::Result::Err(A::Error::duplicate_field(
26063                                    "multiple values for etag",
26064                                ));
26065                            }
26066                            result.etag = map
26067                                .next_value::<std::option::Option<std::string::String>>()?
26068                                .unwrap_or_default();
26069                        }
26070                        __FieldTag::__name => {
26071                            if !fields.insert(__FieldTag::__name) {
26072                                return std::result::Result::Err(A::Error::duplicate_field(
26073                                    "multiple values for name",
26074                                ));
26075                            }
26076                            result.name = map
26077                                .next_value::<std::option::Option<std::string::String>>()?
26078                                .unwrap_or_default();
26079                        }
26080                        __FieldTag::__instance => {
26081                            if !fields.insert(__FieldTag::__instance) {
26082                                return std::result::Result::Err(A::Error::duplicate_field(
26083                                    "multiple values for instance",
26084                                ));
26085                            }
26086                            result.instance = map
26087                                .next_value::<std::option::Option<std::string::String>>()?
26088                                .unwrap_or_default();
26089                        }
26090                        __FieldTag::__self_link => {
26091                            if !fields.insert(__FieldTag::__self_link) {
26092                                return std::result::Result::Err(A::Error::duplicate_field(
26093                                    "multiple values for self_link",
26094                                ));
26095                            }
26096                            result.self_link = map
26097                                .next_value::<std::option::Option<std::string::String>>()?
26098                                .unwrap_or_default();
26099                        }
26100                        __FieldTag::__project => {
26101                            if !fields.insert(__FieldTag::__project) {
26102                                return std::result::Result::Err(A::Error::duplicate_field(
26103                                    "multiple values for project",
26104                                ));
26105                            }
26106                            result.project = map
26107                                .next_value::<std::option::Option<std::string::String>>()?
26108                                .unwrap_or_default();
26109                        }
26110                        __FieldTag::__sqlserver_database_details => {
26111                            if !fields.insert(__FieldTag::__sqlserver_database_details) {
26112                                return std::result::Result::Err(A::Error::duplicate_field(
26113                                    "multiple values for sqlserver_database_details",
26114                                ));
26115                            }
26116                            if result.database_details.is_some() {
26117                                return std::result::Result::Err(A::Error::duplicate_field(
26118                                    "multiple values for `database_details`, a oneof with full ID .google.cloud.sql.v1.Database.sqlserver_database_details, latest field was sqlserverDatabaseDetails",
26119                                ));
26120                            }
26121                            result.database_details = std::option::Option::Some(
26122                                crate::model::database::DatabaseDetails::SqlserverDatabaseDetails(
26123                                    map.next_value::<std::option::Option<
26124                                        std::boxed::Box<crate::model::SqlServerDatabaseDetails>,
26125                                    >>()?
26126                                    .unwrap_or_default(),
26127                                ),
26128                            );
26129                        }
26130                        __FieldTag::Unknown(key) => {
26131                            let value = map.next_value::<serde_json::Value>()?;
26132                            result._unknown_fields.insert(key, value);
26133                        }
26134                    }
26135                }
26136                std::result::Result::Ok(result)
26137            }
26138        }
26139        deserializer.deserialize_any(Visitor)
26140    }
26141}
26142
26143#[doc(hidden)]
26144impl serde::ser::Serialize for Database {
26145    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26146    where
26147        S: serde::ser::Serializer,
26148    {
26149        use serde::ser::SerializeMap;
26150        #[allow(unused_imports)]
26151        use std::option::Option::Some;
26152        let mut state = serializer.serialize_map(std::option::Option::None)?;
26153        if !self.kind.is_empty() {
26154            state.serialize_entry("kind", &self.kind)?;
26155        }
26156        if !self.charset.is_empty() {
26157            state.serialize_entry("charset", &self.charset)?;
26158        }
26159        if !self.collation.is_empty() {
26160            state.serialize_entry("collation", &self.collation)?;
26161        }
26162        if !self.etag.is_empty() {
26163            state.serialize_entry("etag", &self.etag)?;
26164        }
26165        if !self.name.is_empty() {
26166            state.serialize_entry("name", &self.name)?;
26167        }
26168        if !self.instance.is_empty() {
26169            state.serialize_entry("instance", &self.instance)?;
26170        }
26171        if !self.self_link.is_empty() {
26172            state.serialize_entry("selfLink", &self.self_link)?;
26173        }
26174        if !self.project.is_empty() {
26175            state.serialize_entry("project", &self.project)?;
26176        }
26177        if let Some(value) = self.sqlserver_database_details() {
26178            state.serialize_entry("sqlserverDatabaseDetails", value)?;
26179        }
26180        if !self._unknown_fields.is_empty() {
26181            for (key, value) in self._unknown_fields.iter() {
26182                state.serialize_entry(key, &value)?;
26183            }
26184        }
26185        state.end()
26186    }
26187}
26188
26189impl std::fmt::Debug for Database {
26190    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
26191        let mut debug_struct = f.debug_struct("Database");
26192        debug_struct.field("kind", &self.kind);
26193        debug_struct.field("charset", &self.charset);
26194        debug_struct.field("collation", &self.collation);
26195        debug_struct.field("etag", &self.etag);
26196        debug_struct.field("name", &self.name);
26197        debug_struct.field("instance", &self.instance);
26198        debug_struct.field("self_link", &self.self_link);
26199        debug_struct.field("project", &self.project);
26200        debug_struct.field("database_details", &self.database_details);
26201        if !self._unknown_fields.is_empty() {
26202            debug_struct.field("_unknown_fields", &self._unknown_fields);
26203        }
26204        debug_struct.finish()
26205    }
26206}
26207
26208/// Defines additional types related to [Database].
26209pub mod database {
26210    #[allow(unused_imports)]
26211    use super::*;
26212
26213    #[derive(Clone, Debug, PartialEq)]
26214    #[non_exhaustive]
26215    pub enum DatabaseDetails {
26216        SqlserverDatabaseDetails(std::boxed::Box<crate::model::SqlServerDatabaseDetails>),
26217    }
26218}
26219
26220/// Represents a Sql Server database on the Cloud SQL instance.
26221#[derive(Clone, Default, PartialEq)]
26222#[non_exhaustive]
26223pub struct SqlServerDatabaseDetails {
26224    /// The version of SQL Server with which the database is to be made compatible
26225    pub compatibility_level: i32,
26226
26227    /// The recovery model of a SQL Server database
26228    pub recovery_model: std::string::String,
26229
26230    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26231}
26232
26233impl SqlServerDatabaseDetails {
26234    pub fn new() -> Self {
26235        std::default::Default::default()
26236    }
26237
26238    /// Sets the value of [compatibility_level][crate::model::SqlServerDatabaseDetails::compatibility_level].
26239    pub fn set_compatibility_level<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
26240        self.compatibility_level = v.into();
26241        self
26242    }
26243
26244    /// Sets the value of [recovery_model][crate::model::SqlServerDatabaseDetails::recovery_model].
26245    pub fn set_recovery_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26246        self.recovery_model = v.into();
26247        self
26248    }
26249}
26250
26251impl wkt::message::Message for SqlServerDatabaseDetails {
26252    fn typename() -> &'static str {
26253        "type.googleapis.com/google.cloud.sql.v1.SqlServerDatabaseDetails"
26254    }
26255}
26256
26257#[doc(hidden)]
26258impl<'de> serde::de::Deserialize<'de> for SqlServerDatabaseDetails {
26259    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26260    where
26261        D: serde::Deserializer<'de>,
26262    {
26263        #[allow(non_camel_case_types)]
26264        #[doc(hidden)]
26265        #[derive(PartialEq, Eq, Hash)]
26266        enum __FieldTag {
26267            __compatibility_level,
26268            __recovery_model,
26269            Unknown(std::string::String),
26270        }
26271        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
26272            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26273            where
26274                D: serde::Deserializer<'de>,
26275            {
26276                struct Visitor;
26277                impl<'de> serde::de::Visitor<'de> for Visitor {
26278                    type Value = __FieldTag;
26279                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
26280                        formatter.write_str("a field name for SqlServerDatabaseDetails")
26281                    }
26282                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
26283                    where
26284                        E: serde::de::Error,
26285                    {
26286                        use std::result::Result::Ok;
26287                        use std::string::ToString;
26288                        match value {
26289                            "compatibilityLevel" => Ok(__FieldTag::__compatibility_level),
26290                            "compatibility_level" => Ok(__FieldTag::__compatibility_level),
26291                            "recoveryModel" => Ok(__FieldTag::__recovery_model),
26292                            "recovery_model" => Ok(__FieldTag::__recovery_model),
26293                            _ => Ok(__FieldTag::Unknown(value.to_string())),
26294                        }
26295                    }
26296                }
26297                deserializer.deserialize_identifier(Visitor)
26298            }
26299        }
26300        struct Visitor;
26301        impl<'de> serde::de::Visitor<'de> for Visitor {
26302            type Value = SqlServerDatabaseDetails;
26303            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
26304                formatter.write_str("struct SqlServerDatabaseDetails")
26305            }
26306            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
26307            where
26308                A: serde::de::MapAccess<'de>,
26309            {
26310                #[allow(unused_imports)]
26311                use serde::de::Error;
26312                use std::option::Option::Some;
26313                let mut fields = std::collections::HashSet::new();
26314                let mut result = Self::Value::new();
26315                while let Some(tag) = map.next_key::<__FieldTag>()? {
26316                    #[allow(clippy::match_single_binding)]
26317                    match tag {
26318                        __FieldTag::__compatibility_level => {
26319                            if !fields.insert(__FieldTag::__compatibility_level) {
26320                                return std::result::Result::Err(A::Error::duplicate_field(
26321                                    "multiple values for compatibility_level",
26322                                ));
26323                            }
26324                            struct __With(std::option::Option<i32>);
26325                            impl<'de> serde::de::Deserialize<'de> for __With {
26326                                fn deserialize<D>(
26327                                    deserializer: D,
26328                                ) -> std::result::Result<Self, D::Error>
26329                                where
26330                                    D: serde::de::Deserializer<'de>,
26331                                {
26332                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
26333                                }
26334                            }
26335                            result.compatibility_level =
26336                                map.next_value::<__With>()?.0.unwrap_or_default();
26337                        }
26338                        __FieldTag::__recovery_model => {
26339                            if !fields.insert(__FieldTag::__recovery_model) {
26340                                return std::result::Result::Err(A::Error::duplicate_field(
26341                                    "multiple values for recovery_model",
26342                                ));
26343                            }
26344                            result.recovery_model = map
26345                                .next_value::<std::option::Option<std::string::String>>()?
26346                                .unwrap_or_default();
26347                        }
26348                        __FieldTag::Unknown(key) => {
26349                            let value = map.next_value::<serde_json::Value>()?;
26350                            result._unknown_fields.insert(key, value);
26351                        }
26352                    }
26353                }
26354                std::result::Result::Ok(result)
26355            }
26356        }
26357        deserializer.deserialize_any(Visitor)
26358    }
26359}
26360
26361#[doc(hidden)]
26362impl serde::ser::Serialize for SqlServerDatabaseDetails {
26363    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26364    where
26365        S: serde::ser::Serializer,
26366    {
26367        use serde::ser::SerializeMap;
26368        #[allow(unused_imports)]
26369        use std::option::Option::Some;
26370        let mut state = serializer.serialize_map(std::option::Option::None)?;
26371        if !wkt::internal::is_default(&self.compatibility_level) {
26372            struct __With<'a>(&'a i32);
26373            impl<'a> serde::ser::Serialize for __With<'a> {
26374                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26375                where
26376                    S: serde::ser::Serializer,
26377                {
26378                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
26379                }
26380            }
26381            state.serialize_entry("compatibilityLevel", &__With(&self.compatibility_level))?;
26382        }
26383        if !self.recovery_model.is_empty() {
26384            state.serialize_entry("recoveryModel", &self.recovery_model)?;
26385        }
26386        if !self._unknown_fields.is_empty() {
26387            for (key, value) in self._unknown_fields.iter() {
26388                state.serialize_entry(key, &value)?;
26389            }
26390        }
26391        state.end()
26392    }
26393}
26394
26395impl std::fmt::Debug for SqlServerDatabaseDetails {
26396    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
26397        let mut debug_struct = f.debug_struct("SqlServerDatabaseDetails");
26398        debug_struct.field("compatibility_level", &self.compatibility_level);
26399        debug_struct.field("recovery_model", &self.recovery_model);
26400        if !self._unknown_fields.is_empty() {
26401            debug_struct.field("_unknown_fields", &self._unknown_fields);
26402        }
26403        debug_struct.finish()
26404    }
26405}
26406
26407/// Database flags for Cloud SQL instances.
26408#[derive(Clone, Default, PartialEq)]
26409#[non_exhaustive]
26410pub struct DatabaseFlags {
26411    /// The name of the flag. These flags are passed at instance startup, so
26412    /// include both server options and system variables. Flags are
26413    /// specified with underscores, not hyphens. For more information, see
26414    /// [Configuring Database Flags](https://cloud.google.com/sql/docs/mysql/flags)
26415    /// in the Cloud SQL documentation.
26416    pub name: std::string::String,
26417
26418    /// The value of the flag. Boolean flags are set to `on` for true
26419    /// and `off` for false. This field must be omitted if the flag
26420    /// doesn't take a value.
26421    pub value: std::string::String,
26422
26423    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26424}
26425
26426impl DatabaseFlags {
26427    pub fn new() -> Self {
26428        std::default::Default::default()
26429    }
26430
26431    /// Sets the value of [name][crate::model::DatabaseFlags::name].
26432    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26433        self.name = v.into();
26434        self
26435    }
26436
26437    /// Sets the value of [value][crate::model::DatabaseFlags::value].
26438    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26439        self.value = v.into();
26440        self
26441    }
26442}
26443
26444impl wkt::message::Message for DatabaseFlags {
26445    fn typename() -> &'static str {
26446        "type.googleapis.com/google.cloud.sql.v1.DatabaseFlags"
26447    }
26448}
26449
26450#[doc(hidden)]
26451impl<'de> serde::de::Deserialize<'de> for DatabaseFlags {
26452    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26453    where
26454        D: serde::Deserializer<'de>,
26455    {
26456        #[allow(non_camel_case_types)]
26457        #[doc(hidden)]
26458        #[derive(PartialEq, Eq, Hash)]
26459        enum __FieldTag {
26460            __name,
26461            __value,
26462            Unknown(std::string::String),
26463        }
26464        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
26465            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26466            where
26467                D: serde::Deserializer<'de>,
26468            {
26469                struct Visitor;
26470                impl<'de> serde::de::Visitor<'de> for Visitor {
26471                    type Value = __FieldTag;
26472                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
26473                        formatter.write_str("a field name for DatabaseFlags")
26474                    }
26475                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
26476                    where
26477                        E: serde::de::Error,
26478                    {
26479                        use std::result::Result::Ok;
26480                        use std::string::ToString;
26481                        match value {
26482                            "name" => Ok(__FieldTag::__name),
26483                            "value" => Ok(__FieldTag::__value),
26484                            _ => Ok(__FieldTag::Unknown(value.to_string())),
26485                        }
26486                    }
26487                }
26488                deserializer.deserialize_identifier(Visitor)
26489            }
26490        }
26491        struct Visitor;
26492        impl<'de> serde::de::Visitor<'de> for Visitor {
26493            type Value = DatabaseFlags;
26494            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
26495                formatter.write_str("struct DatabaseFlags")
26496            }
26497            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
26498            where
26499                A: serde::de::MapAccess<'de>,
26500            {
26501                #[allow(unused_imports)]
26502                use serde::de::Error;
26503                use std::option::Option::Some;
26504                let mut fields = std::collections::HashSet::new();
26505                let mut result = Self::Value::new();
26506                while let Some(tag) = map.next_key::<__FieldTag>()? {
26507                    #[allow(clippy::match_single_binding)]
26508                    match tag {
26509                        __FieldTag::__name => {
26510                            if !fields.insert(__FieldTag::__name) {
26511                                return std::result::Result::Err(A::Error::duplicate_field(
26512                                    "multiple values for name",
26513                                ));
26514                            }
26515                            result.name = map
26516                                .next_value::<std::option::Option<std::string::String>>()?
26517                                .unwrap_or_default();
26518                        }
26519                        __FieldTag::__value => {
26520                            if !fields.insert(__FieldTag::__value) {
26521                                return std::result::Result::Err(A::Error::duplicate_field(
26522                                    "multiple values for value",
26523                                ));
26524                            }
26525                            result.value = map
26526                                .next_value::<std::option::Option<std::string::String>>()?
26527                                .unwrap_or_default();
26528                        }
26529                        __FieldTag::Unknown(key) => {
26530                            let value = map.next_value::<serde_json::Value>()?;
26531                            result._unknown_fields.insert(key, value);
26532                        }
26533                    }
26534                }
26535                std::result::Result::Ok(result)
26536            }
26537        }
26538        deserializer.deserialize_any(Visitor)
26539    }
26540}
26541
26542#[doc(hidden)]
26543impl serde::ser::Serialize for DatabaseFlags {
26544    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26545    where
26546        S: serde::ser::Serializer,
26547    {
26548        use serde::ser::SerializeMap;
26549        #[allow(unused_imports)]
26550        use std::option::Option::Some;
26551        let mut state = serializer.serialize_map(std::option::Option::None)?;
26552        if !self.name.is_empty() {
26553            state.serialize_entry("name", &self.name)?;
26554        }
26555        if !self.value.is_empty() {
26556            state.serialize_entry("value", &self.value)?;
26557        }
26558        if !self._unknown_fields.is_empty() {
26559            for (key, value) in self._unknown_fields.iter() {
26560                state.serialize_entry(key, &value)?;
26561            }
26562        }
26563        state.end()
26564    }
26565}
26566
26567impl std::fmt::Debug for DatabaseFlags {
26568    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
26569        let mut debug_struct = f.debug_struct("DatabaseFlags");
26570        debug_struct.field("name", &self.name);
26571        debug_struct.field("value", &self.value);
26572        if !self._unknown_fields.is_empty() {
26573            debug_struct.field("_unknown_fields", &self._unknown_fields);
26574        }
26575        debug_struct.finish()
26576    }
26577}
26578
26579/// MySQL-specific external server sync settings.
26580#[derive(Clone, Default, PartialEq)]
26581#[non_exhaustive]
26582pub struct MySqlSyncConfig {
26583    /// Flags to use for the initial dump.
26584    pub initial_sync_flags: std::vec::Vec<crate::model::SyncFlags>,
26585
26586    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26587}
26588
26589impl MySqlSyncConfig {
26590    pub fn new() -> Self {
26591        std::default::Default::default()
26592    }
26593
26594    /// Sets the value of [initial_sync_flags][crate::model::MySqlSyncConfig::initial_sync_flags].
26595    pub fn set_initial_sync_flags<T, V>(mut self, v: T) -> Self
26596    where
26597        T: std::iter::IntoIterator<Item = V>,
26598        V: std::convert::Into<crate::model::SyncFlags>,
26599    {
26600        use std::iter::Iterator;
26601        self.initial_sync_flags = v.into_iter().map(|i| i.into()).collect();
26602        self
26603    }
26604}
26605
26606impl wkt::message::Message for MySqlSyncConfig {
26607    fn typename() -> &'static str {
26608        "type.googleapis.com/google.cloud.sql.v1.MySqlSyncConfig"
26609    }
26610}
26611
26612#[doc(hidden)]
26613impl<'de> serde::de::Deserialize<'de> for MySqlSyncConfig {
26614    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26615    where
26616        D: serde::Deserializer<'de>,
26617    {
26618        #[allow(non_camel_case_types)]
26619        #[doc(hidden)]
26620        #[derive(PartialEq, Eq, Hash)]
26621        enum __FieldTag {
26622            __initial_sync_flags,
26623            Unknown(std::string::String),
26624        }
26625        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
26626            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26627            where
26628                D: serde::Deserializer<'de>,
26629            {
26630                struct Visitor;
26631                impl<'de> serde::de::Visitor<'de> for Visitor {
26632                    type Value = __FieldTag;
26633                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
26634                        formatter.write_str("a field name for MySqlSyncConfig")
26635                    }
26636                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
26637                    where
26638                        E: serde::de::Error,
26639                    {
26640                        use std::result::Result::Ok;
26641                        use std::string::ToString;
26642                        match value {
26643                            "initialSyncFlags" => Ok(__FieldTag::__initial_sync_flags),
26644                            "initial_sync_flags" => Ok(__FieldTag::__initial_sync_flags),
26645                            _ => Ok(__FieldTag::Unknown(value.to_string())),
26646                        }
26647                    }
26648                }
26649                deserializer.deserialize_identifier(Visitor)
26650            }
26651        }
26652        struct Visitor;
26653        impl<'de> serde::de::Visitor<'de> for Visitor {
26654            type Value = MySqlSyncConfig;
26655            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
26656                formatter.write_str("struct MySqlSyncConfig")
26657            }
26658            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
26659            where
26660                A: serde::de::MapAccess<'de>,
26661            {
26662                #[allow(unused_imports)]
26663                use serde::de::Error;
26664                use std::option::Option::Some;
26665                let mut fields = std::collections::HashSet::new();
26666                let mut result = Self::Value::new();
26667                while let Some(tag) = map.next_key::<__FieldTag>()? {
26668                    #[allow(clippy::match_single_binding)]
26669                    match tag {
26670                        __FieldTag::__initial_sync_flags => {
26671                            if !fields.insert(__FieldTag::__initial_sync_flags) {
26672                                return std::result::Result::Err(A::Error::duplicate_field(
26673                                    "multiple values for initial_sync_flags",
26674                                ));
26675                            }
26676                            result.initial_sync_flags = map.next_value::<std::option::Option<std::vec::Vec<crate::model::SyncFlags>>>()?.unwrap_or_default();
26677                        }
26678                        __FieldTag::Unknown(key) => {
26679                            let value = map.next_value::<serde_json::Value>()?;
26680                            result._unknown_fields.insert(key, value);
26681                        }
26682                    }
26683                }
26684                std::result::Result::Ok(result)
26685            }
26686        }
26687        deserializer.deserialize_any(Visitor)
26688    }
26689}
26690
26691#[doc(hidden)]
26692impl serde::ser::Serialize for MySqlSyncConfig {
26693    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26694    where
26695        S: serde::ser::Serializer,
26696    {
26697        use serde::ser::SerializeMap;
26698        #[allow(unused_imports)]
26699        use std::option::Option::Some;
26700        let mut state = serializer.serialize_map(std::option::Option::None)?;
26701        if !self.initial_sync_flags.is_empty() {
26702            state.serialize_entry("initialSyncFlags", &self.initial_sync_flags)?;
26703        }
26704        if !self._unknown_fields.is_empty() {
26705            for (key, value) in self._unknown_fields.iter() {
26706                state.serialize_entry(key, &value)?;
26707            }
26708        }
26709        state.end()
26710    }
26711}
26712
26713impl std::fmt::Debug for MySqlSyncConfig {
26714    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
26715        let mut debug_struct = f.debug_struct("MySqlSyncConfig");
26716        debug_struct.field("initial_sync_flags", &self.initial_sync_flags);
26717        if !self._unknown_fields.is_empty() {
26718            debug_struct.field("_unknown_fields", &self._unknown_fields);
26719        }
26720        debug_struct.finish()
26721    }
26722}
26723
26724/// Initial sync flags for certain Cloud SQL APIs.
26725/// Currently used for the MySQL external server initial dump.
26726#[derive(Clone, Default, PartialEq)]
26727#[non_exhaustive]
26728pub struct SyncFlags {
26729    /// The name of the flag.
26730    pub name: std::string::String,
26731
26732    /// The value of the flag. This field must be omitted if the flag
26733    /// doesn't take a value.
26734    pub value: std::string::String,
26735
26736    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26737}
26738
26739impl SyncFlags {
26740    pub fn new() -> Self {
26741        std::default::Default::default()
26742    }
26743
26744    /// Sets the value of [name][crate::model::SyncFlags::name].
26745    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26746        self.name = v.into();
26747        self
26748    }
26749
26750    /// Sets the value of [value][crate::model::SyncFlags::value].
26751    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26752        self.value = v.into();
26753        self
26754    }
26755}
26756
26757impl wkt::message::Message for SyncFlags {
26758    fn typename() -> &'static str {
26759        "type.googleapis.com/google.cloud.sql.v1.SyncFlags"
26760    }
26761}
26762
26763#[doc(hidden)]
26764impl<'de> serde::de::Deserialize<'de> for SyncFlags {
26765    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26766    where
26767        D: serde::Deserializer<'de>,
26768    {
26769        #[allow(non_camel_case_types)]
26770        #[doc(hidden)]
26771        #[derive(PartialEq, Eq, Hash)]
26772        enum __FieldTag {
26773            __name,
26774            __value,
26775            Unknown(std::string::String),
26776        }
26777        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
26778            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26779            where
26780                D: serde::Deserializer<'de>,
26781            {
26782                struct Visitor;
26783                impl<'de> serde::de::Visitor<'de> for Visitor {
26784                    type Value = __FieldTag;
26785                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
26786                        formatter.write_str("a field name for SyncFlags")
26787                    }
26788                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
26789                    where
26790                        E: serde::de::Error,
26791                    {
26792                        use std::result::Result::Ok;
26793                        use std::string::ToString;
26794                        match value {
26795                            "name" => Ok(__FieldTag::__name),
26796                            "value" => Ok(__FieldTag::__value),
26797                            _ => Ok(__FieldTag::Unknown(value.to_string())),
26798                        }
26799                    }
26800                }
26801                deserializer.deserialize_identifier(Visitor)
26802            }
26803        }
26804        struct Visitor;
26805        impl<'de> serde::de::Visitor<'de> for Visitor {
26806            type Value = SyncFlags;
26807            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
26808                formatter.write_str("struct SyncFlags")
26809            }
26810            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
26811            where
26812                A: serde::de::MapAccess<'de>,
26813            {
26814                #[allow(unused_imports)]
26815                use serde::de::Error;
26816                use std::option::Option::Some;
26817                let mut fields = std::collections::HashSet::new();
26818                let mut result = Self::Value::new();
26819                while let Some(tag) = map.next_key::<__FieldTag>()? {
26820                    #[allow(clippy::match_single_binding)]
26821                    match tag {
26822                        __FieldTag::__name => {
26823                            if !fields.insert(__FieldTag::__name) {
26824                                return std::result::Result::Err(A::Error::duplicate_field(
26825                                    "multiple values for name",
26826                                ));
26827                            }
26828                            result.name = map
26829                                .next_value::<std::option::Option<std::string::String>>()?
26830                                .unwrap_or_default();
26831                        }
26832                        __FieldTag::__value => {
26833                            if !fields.insert(__FieldTag::__value) {
26834                                return std::result::Result::Err(A::Error::duplicate_field(
26835                                    "multiple values for value",
26836                                ));
26837                            }
26838                            result.value = map
26839                                .next_value::<std::option::Option<std::string::String>>()?
26840                                .unwrap_or_default();
26841                        }
26842                        __FieldTag::Unknown(key) => {
26843                            let value = map.next_value::<serde_json::Value>()?;
26844                            result._unknown_fields.insert(key, value);
26845                        }
26846                    }
26847                }
26848                std::result::Result::Ok(result)
26849            }
26850        }
26851        deserializer.deserialize_any(Visitor)
26852    }
26853}
26854
26855#[doc(hidden)]
26856impl serde::ser::Serialize for SyncFlags {
26857    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26858    where
26859        S: serde::ser::Serializer,
26860    {
26861        use serde::ser::SerializeMap;
26862        #[allow(unused_imports)]
26863        use std::option::Option::Some;
26864        let mut state = serializer.serialize_map(std::option::Option::None)?;
26865        if !self.name.is_empty() {
26866            state.serialize_entry("name", &self.name)?;
26867        }
26868        if !self.value.is_empty() {
26869            state.serialize_entry("value", &self.value)?;
26870        }
26871        if !self._unknown_fields.is_empty() {
26872            for (key, value) in self._unknown_fields.iter() {
26873                state.serialize_entry(key, &value)?;
26874            }
26875        }
26876        state.end()
26877    }
26878}
26879
26880impl std::fmt::Debug for SyncFlags {
26881    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
26882        let mut debug_struct = f.debug_struct("SyncFlags");
26883        debug_struct.field("name", &self.name);
26884        debug_struct.field("value", &self.value);
26885        if !self._unknown_fields.is_empty() {
26886            debug_struct.field("_unknown_fields", &self._unknown_fields);
26887        }
26888        debug_struct.finish()
26889    }
26890}
26891
26892/// Reference to another Cloud SQL instance.
26893#[derive(Clone, Default, PartialEq)]
26894#[non_exhaustive]
26895pub struct InstanceReference {
26896    /// The name of the Cloud SQL instance being referenced.
26897    /// This does not include the project ID.
26898    pub name: std::string::String,
26899
26900    /// The region of the Cloud SQL instance being referenced.
26901    pub region: std::string::String,
26902
26903    /// The project ID of the Cloud SQL instance being referenced.
26904    /// The default is the same project ID as the instance references it.
26905    pub project: std::string::String,
26906
26907    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26908}
26909
26910impl InstanceReference {
26911    pub fn new() -> Self {
26912        std::default::Default::default()
26913    }
26914
26915    /// Sets the value of [name][crate::model::InstanceReference::name].
26916    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26917        self.name = v.into();
26918        self
26919    }
26920
26921    /// Sets the value of [region][crate::model::InstanceReference::region].
26922    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26923        self.region = v.into();
26924        self
26925    }
26926
26927    /// Sets the value of [project][crate::model::InstanceReference::project].
26928    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26929        self.project = v.into();
26930        self
26931    }
26932}
26933
26934impl wkt::message::Message for InstanceReference {
26935    fn typename() -> &'static str {
26936        "type.googleapis.com/google.cloud.sql.v1.InstanceReference"
26937    }
26938}
26939
26940#[doc(hidden)]
26941impl<'de> serde::de::Deserialize<'de> for InstanceReference {
26942    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26943    where
26944        D: serde::Deserializer<'de>,
26945    {
26946        #[allow(non_camel_case_types)]
26947        #[doc(hidden)]
26948        #[derive(PartialEq, Eq, Hash)]
26949        enum __FieldTag {
26950            __name,
26951            __region,
26952            __project,
26953            Unknown(std::string::String),
26954        }
26955        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
26956            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26957            where
26958                D: serde::Deserializer<'de>,
26959            {
26960                struct Visitor;
26961                impl<'de> serde::de::Visitor<'de> for Visitor {
26962                    type Value = __FieldTag;
26963                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
26964                        formatter.write_str("a field name for InstanceReference")
26965                    }
26966                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
26967                    where
26968                        E: serde::de::Error,
26969                    {
26970                        use std::result::Result::Ok;
26971                        use std::string::ToString;
26972                        match value {
26973                            "name" => Ok(__FieldTag::__name),
26974                            "region" => Ok(__FieldTag::__region),
26975                            "project" => Ok(__FieldTag::__project),
26976                            _ => Ok(__FieldTag::Unknown(value.to_string())),
26977                        }
26978                    }
26979                }
26980                deserializer.deserialize_identifier(Visitor)
26981            }
26982        }
26983        struct Visitor;
26984        impl<'de> serde::de::Visitor<'de> for Visitor {
26985            type Value = InstanceReference;
26986            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
26987                formatter.write_str("struct InstanceReference")
26988            }
26989            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
26990            where
26991                A: serde::de::MapAccess<'de>,
26992            {
26993                #[allow(unused_imports)]
26994                use serde::de::Error;
26995                use std::option::Option::Some;
26996                let mut fields = std::collections::HashSet::new();
26997                let mut result = Self::Value::new();
26998                while let Some(tag) = map.next_key::<__FieldTag>()? {
26999                    #[allow(clippy::match_single_binding)]
27000                    match tag {
27001                        __FieldTag::__name => {
27002                            if !fields.insert(__FieldTag::__name) {
27003                                return std::result::Result::Err(A::Error::duplicate_field(
27004                                    "multiple values for name",
27005                                ));
27006                            }
27007                            result.name = map
27008                                .next_value::<std::option::Option<std::string::String>>()?
27009                                .unwrap_or_default();
27010                        }
27011                        __FieldTag::__region => {
27012                            if !fields.insert(__FieldTag::__region) {
27013                                return std::result::Result::Err(A::Error::duplicate_field(
27014                                    "multiple values for region",
27015                                ));
27016                            }
27017                            result.region = map
27018                                .next_value::<std::option::Option<std::string::String>>()?
27019                                .unwrap_or_default();
27020                        }
27021                        __FieldTag::__project => {
27022                            if !fields.insert(__FieldTag::__project) {
27023                                return std::result::Result::Err(A::Error::duplicate_field(
27024                                    "multiple values for project",
27025                                ));
27026                            }
27027                            result.project = map
27028                                .next_value::<std::option::Option<std::string::String>>()?
27029                                .unwrap_or_default();
27030                        }
27031                        __FieldTag::Unknown(key) => {
27032                            let value = map.next_value::<serde_json::Value>()?;
27033                            result._unknown_fields.insert(key, value);
27034                        }
27035                    }
27036                }
27037                std::result::Result::Ok(result)
27038            }
27039        }
27040        deserializer.deserialize_any(Visitor)
27041    }
27042}
27043
27044#[doc(hidden)]
27045impl serde::ser::Serialize for InstanceReference {
27046    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27047    where
27048        S: serde::ser::Serializer,
27049    {
27050        use serde::ser::SerializeMap;
27051        #[allow(unused_imports)]
27052        use std::option::Option::Some;
27053        let mut state = serializer.serialize_map(std::option::Option::None)?;
27054        if !self.name.is_empty() {
27055            state.serialize_entry("name", &self.name)?;
27056        }
27057        if !self.region.is_empty() {
27058            state.serialize_entry("region", &self.region)?;
27059        }
27060        if !self.project.is_empty() {
27061            state.serialize_entry("project", &self.project)?;
27062        }
27063        if !self._unknown_fields.is_empty() {
27064            for (key, value) in self._unknown_fields.iter() {
27065                state.serialize_entry(key, &value)?;
27066            }
27067        }
27068        state.end()
27069    }
27070}
27071
27072impl std::fmt::Debug for InstanceReference {
27073    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27074        let mut debug_struct = f.debug_struct("InstanceReference");
27075        debug_struct.field("name", &self.name);
27076        debug_struct.field("region", &self.region);
27077        debug_struct.field("project", &self.project);
27078        if !self._unknown_fields.is_empty() {
27079            debug_struct.field("_unknown_fields", &self._unknown_fields);
27080        }
27081        debug_struct.finish()
27082    }
27083}
27084
27085/// Read-replica configuration for connecting to the on-premises primary
27086/// instance.
27087#[derive(Clone, Default, PartialEq)]
27088#[non_exhaustive]
27089pub struct DemoteMasterConfiguration {
27090    /// This is always `sql#demoteMasterConfiguration`.
27091    pub kind: std::string::String,
27092
27093    /// MySQL specific configuration when replicating from a MySQL on-premises
27094    /// primary instance. Replication configuration information such as the
27095    /// username, password, certificates, and keys are not stored in the instance
27096    /// metadata. The configuration information is used only to set up the
27097    /// replication connection and is stored by MySQL in a file named
27098    /// `master.info` in the data directory.
27099    pub mysql_replica_configuration:
27100        std::option::Option<crate::model::DemoteMasterMySqlReplicaConfiguration>,
27101
27102    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27103}
27104
27105impl DemoteMasterConfiguration {
27106    pub fn new() -> Self {
27107        std::default::Default::default()
27108    }
27109
27110    /// Sets the value of [kind][crate::model::DemoteMasterConfiguration::kind].
27111    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27112        self.kind = v.into();
27113        self
27114    }
27115
27116    /// Sets the value of [mysql_replica_configuration][crate::model::DemoteMasterConfiguration::mysql_replica_configuration].
27117    pub fn set_mysql_replica_configuration<T>(mut self, v: T) -> Self
27118    where
27119        T: std::convert::Into<crate::model::DemoteMasterMySqlReplicaConfiguration>,
27120    {
27121        self.mysql_replica_configuration = std::option::Option::Some(v.into());
27122        self
27123    }
27124
27125    /// Sets or clears the value of [mysql_replica_configuration][crate::model::DemoteMasterConfiguration::mysql_replica_configuration].
27126    pub fn set_or_clear_mysql_replica_configuration<T>(mut self, v: std::option::Option<T>) -> Self
27127    where
27128        T: std::convert::Into<crate::model::DemoteMasterMySqlReplicaConfiguration>,
27129    {
27130        self.mysql_replica_configuration = v.map(|x| x.into());
27131        self
27132    }
27133}
27134
27135impl wkt::message::Message for DemoteMasterConfiguration {
27136    fn typename() -> &'static str {
27137        "type.googleapis.com/google.cloud.sql.v1.DemoteMasterConfiguration"
27138    }
27139}
27140
27141#[doc(hidden)]
27142impl<'de> serde::de::Deserialize<'de> for DemoteMasterConfiguration {
27143    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27144    where
27145        D: serde::Deserializer<'de>,
27146    {
27147        #[allow(non_camel_case_types)]
27148        #[doc(hidden)]
27149        #[derive(PartialEq, Eq, Hash)]
27150        enum __FieldTag {
27151            __kind,
27152            __mysql_replica_configuration,
27153            Unknown(std::string::String),
27154        }
27155        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
27156            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27157            where
27158                D: serde::Deserializer<'de>,
27159            {
27160                struct Visitor;
27161                impl<'de> serde::de::Visitor<'de> for Visitor {
27162                    type Value = __FieldTag;
27163                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
27164                        formatter.write_str("a field name for DemoteMasterConfiguration")
27165                    }
27166                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
27167                    where
27168                        E: serde::de::Error,
27169                    {
27170                        use std::result::Result::Ok;
27171                        use std::string::ToString;
27172                        match value {
27173                            "kind" => Ok(__FieldTag::__kind),
27174                            "mysqlReplicaConfiguration" => {
27175                                Ok(__FieldTag::__mysql_replica_configuration)
27176                            }
27177                            "mysql_replica_configuration" => {
27178                                Ok(__FieldTag::__mysql_replica_configuration)
27179                            }
27180                            _ => Ok(__FieldTag::Unknown(value.to_string())),
27181                        }
27182                    }
27183                }
27184                deserializer.deserialize_identifier(Visitor)
27185            }
27186        }
27187        struct Visitor;
27188        impl<'de> serde::de::Visitor<'de> for Visitor {
27189            type Value = DemoteMasterConfiguration;
27190            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
27191                formatter.write_str("struct DemoteMasterConfiguration")
27192            }
27193            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
27194            where
27195                A: serde::de::MapAccess<'de>,
27196            {
27197                #[allow(unused_imports)]
27198                use serde::de::Error;
27199                use std::option::Option::Some;
27200                let mut fields = std::collections::HashSet::new();
27201                let mut result = Self::Value::new();
27202                while let Some(tag) = map.next_key::<__FieldTag>()? {
27203                    #[allow(clippy::match_single_binding)]
27204                    match tag {
27205                        __FieldTag::__kind => {
27206                            if !fields.insert(__FieldTag::__kind) {
27207                                return std::result::Result::Err(A::Error::duplicate_field(
27208                                    "multiple values for kind",
27209                                ));
27210                            }
27211                            result.kind = map
27212                                .next_value::<std::option::Option<std::string::String>>()?
27213                                .unwrap_or_default();
27214                        }
27215                        __FieldTag::__mysql_replica_configuration => {
27216                            if !fields.insert(__FieldTag::__mysql_replica_configuration) {
27217                                return std::result::Result::Err(A::Error::duplicate_field(
27218                                    "multiple values for mysql_replica_configuration",
27219                                ));
27220                            }
27221                            result.mysql_replica_configuration = map
27222                                .next_value::<std::option::Option<
27223                                    crate::model::DemoteMasterMySqlReplicaConfiguration,
27224                                >>()?;
27225                        }
27226                        __FieldTag::Unknown(key) => {
27227                            let value = map.next_value::<serde_json::Value>()?;
27228                            result._unknown_fields.insert(key, value);
27229                        }
27230                    }
27231                }
27232                std::result::Result::Ok(result)
27233            }
27234        }
27235        deserializer.deserialize_any(Visitor)
27236    }
27237}
27238
27239#[doc(hidden)]
27240impl serde::ser::Serialize for DemoteMasterConfiguration {
27241    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27242    where
27243        S: serde::ser::Serializer,
27244    {
27245        use serde::ser::SerializeMap;
27246        #[allow(unused_imports)]
27247        use std::option::Option::Some;
27248        let mut state = serializer.serialize_map(std::option::Option::None)?;
27249        if !self.kind.is_empty() {
27250            state.serialize_entry("kind", &self.kind)?;
27251        }
27252        if self.mysql_replica_configuration.is_some() {
27253            state.serialize_entry(
27254                "mysqlReplicaConfiguration",
27255                &self.mysql_replica_configuration,
27256            )?;
27257        }
27258        if !self._unknown_fields.is_empty() {
27259            for (key, value) in self._unknown_fields.iter() {
27260                state.serialize_entry(key, &value)?;
27261            }
27262        }
27263        state.end()
27264    }
27265}
27266
27267impl std::fmt::Debug for DemoteMasterConfiguration {
27268    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27269        let mut debug_struct = f.debug_struct("DemoteMasterConfiguration");
27270        debug_struct.field("kind", &self.kind);
27271        debug_struct.field(
27272            "mysql_replica_configuration",
27273            &self.mysql_replica_configuration,
27274        );
27275        if !self._unknown_fields.is_empty() {
27276            debug_struct.field("_unknown_fields", &self._unknown_fields);
27277        }
27278        debug_struct.finish()
27279    }
27280}
27281
27282/// Read-replica configuration specific to MySQL databases.
27283#[derive(Clone, Default, PartialEq)]
27284#[non_exhaustive]
27285pub struct DemoteMasterMySqlReplicaConfiguration {
27286    /// This is always `sql#demoteMasterMysqlReplicaConfiguration`.
27287    pub kind: std::string::String,
27288
27289    /// The username for the replication connection.
27290    pub username: std::string::String,
27291
27292    /// The password for the replication connection.
27293    pub password: std::string::String,
27294
27295    /// PEM representation of the replica's private key. The corresponsing public
27296    /// key is encoded in the client's certificate. The format of the replica's
27297    /// private key can be either PKCS #1 or PKCS #8.
27298    pub client_key: std::string::String,
27299
27300    /// PEM representation of the replica's x509 certificate.
27301    pub client_certificate: std::string::String,
27302
27303    /// PEM representation of the trusted CA's x509 certificate.
27304    pub ca_certificate: std::string::String,
27305
27306    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27307}
27308
27309impl DemoteMasterMySqlReplicaConfiguration {
27310    pub fn new() -> Self {
27311        std::default::Default::default()
27312    }
27313
27314    /// Sets the value of [kind][crate::model::DemoteMasterMySqlReplicaConfiguration::kind].
27315    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27316        self.kind = v.into();
27317        self
27318    }
27319
27320    /// Sets the value of [username][crate::model::DemoteMasterMySqlReplicaConfiguration::username].
27321    pub fn set_username<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27322        self.username = v.into();
27323        self
27324    }
27325
27326    /// Sets the value of [password][crate::model::DemoteMasterMySqlReplicaConfiguration::password].
27327    pub fn set_password<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27328        self.password = v.into();
27329        self
27330    }
27331
27332    /// Sets the value of [client_key][crate::model::DemoteMasterMySqlReplicaConfiguration::client_key].
27333    pub fn set_client_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27334        self.client_key = v.into();
27335        self
27336    }
27337
27338    /// Sets the value of [client_certificate][crate::model::DemoteMasterMySqlReplicaConfiguration::client_certificate].
27339    pub fn set_client_certificate<T: std::convert::Into<std::string::String>>(
27340        mut self,
27341        v: T,
27342    ) -> Self {
27343        self.client_certificate = v.into();
27344        self
27345    }
27346
27347    /// Sets the value of [ca_certificate][crate::model::DemoteMasterMySqlReplicaConfiguration::ca_certificate].
27348    pub fn set_ca_certificate<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27349        self.ca_certificate = v.into();
27350        self
27351    }
27352}
27353
27354impl wkt::message::Message for DemoteMasterMySqlReplicaConfiguration {
27355    fn typename() -> &'static str {
27356        "type.googleapis.com/google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration"
27357    }
27358}
27359
27360#[doc(hidden)]
27361impl<'de> serde::de::Deserialize<'de> for DemoteMasterMySqlReplicaConfiguration {
27362    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27363    where
27364        D: serde::Deserializer<'de>,
27365    {
27366        #[allow(non_camel_case_types)]
27367        #[doc(hidden)]
27368        #[derive(PartialEq, Eq, Hash)]
27369        enum __FieldTag {
27370            __kind,
27371            __username,
27372            __password,
27373            __client_key,
27374            __client_certificate,
27375            __ca_certificate,
27376            Unknown(std::string::String),
27377        }
27378        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
27379            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27380            where
27381                D: serde::Deserializer<'de>,
27382            {
27383                struct Visitor;
27384                impl<'de> serde::de::Visitor<'de> for Visitor {
27385                    type Value = __FieldTag;
27386                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
27387                        formatter
27388                            .write_str("a field name for DemoteMasterMySqlReplicaConfiguration")
27389                    }
27390                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
27391                    where
27392                        E: serde::de::Error,
27393                    {
27394                        use std::result::Result::Ok;
27395                        use std::string::ToString;
27396                        match value {
27397                            "kind" => Ok(__FieldTag::__kind),
27398                            "username" => Ok(__FieldTag::__username),
27399                            "password" => Ok(__FieldTag::__password),
27400                            "clientKey" => Ok(__FieldTag::__client_key),
27401                            "client_key" => Ok(__FieldTag::__client_key),
27402                            "clientCertificate" => Ok(__FieldTag::__client_certificate),
27403                            "client_certificate" => Ok(__FieldTag::__client_certificate),
27404                            "caCertificate" => Ok(__FieldTag::__ca_certificate),
27405                            "ca_certificate" => Ok(__FieldTag::__ca_certificate),
27406                            _ => Ok(__FieldTag::Unknown(value.to_string())),
27407                        }
27408                    }
27409                }
27410                deserializer.deserialize_identifier(Visitor)
27411            }
27412        }
27413        struct Visitor;
27414        impl<'de> serde::de::Visitor<'de> for Visitor {
27415            type Value = DemoteMasterMySqlReplicaConfiguration;
27416            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
27417                formatter.write_str("struct DemoteMasterMySqlReplicaConfiguration")
27418            }
27419            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
27420            where
27421                A: serde::de::MapAccess<'de>,
27422            {
27423                #[allow(unused_imports)]
27424                use serde::de::Error;
27425                use std::option::Option::Some;
27426                let mut fields = std::collections::HashSet::new();
27427                let mut result = Self::Value::new();
27428                while let Some(tag) = map.next_key::<__FieldTag>()? {
27429                    #[allow(clippy::match_single_binding)]
27430                    match tag {
27431                        __FieldTag::__kind => {
27432                            if !fields.insert(__FieldTag::__kind) {
27433                                return std::result::Result::Err(A::Error::duplicate_field(
27434                                    "multiple values for kind",
27435                                ));
27436                            }
27437                            result.kind = map
27438                                .next_value::<std::option::Option<std::string::String>>()?
27439                                .unwrap_or_default();
27440                        }
27441                        __FieldTag::__username => {
27442                            if !fields.insert(__FieldTag::__username) {
27443                                return std::result::Result::Err(A::Error::duplicate_field(
27444                                    "multiple values for username",
27445                                ));
27446                            }
27447                            result.username = map
27448                                .next_value::<std::option::Option<std::string::String>>()?
27449                                .unwrap_or_default();
27450                        }
27451                        __FieldTag::__password => {
27452                            if !fields.insert(__FieldTag::__password) {
27453                                return std::result::Result::Err(A::Error::duplicate_field(
27454                                    "multiple values for password",
27455                                ));
27456                            }
27457                            result.password = map
27458                                .next_value::<std::option::Option<std::string::String>>()?
27459                                .unwrap_or_default();
27460                        }
27461                        __FieldTag::__client_key => {
27462                            if !fields.insert(__FieldTag::__client_key) {
27463                                return std::result::Result::Err(A::Error::duplicate_field(
27464                                    "multiple values for client_key",
27465                                ));
27466                            }
27467                            result.client_key = map
27468                                .next_value::<std::option::Option<std::string::String>>()?
27469                                .unwrap_or_default();
27470                        }
27471                        __FieldTag::__client_certificate => {
27472                            if !fields.insert(__FieldTag::__client_certificate) {
27473                                return std::result::Result::Err(A::Error::duplicate_field(
27474                                    "multiple values for client_certificate",
27475                                ));
27476                            }
27477                            result.client_certificate = map
27478                                .next_value::<std::option::Option<std::string::String>>()?
27479                                .unwrap_or_default();
27480                        }
27481                        __FieldTag::__ca_certificate => {
27482                            if !fields.insert(__FieldTag::__ca_certificate) {
27483                                return std::result::Result::Err(A::Error::duplicate_field(
27484                                    "multiple values for ca_certificate",
27485                                ));
27486                            }
27487                            result.ca_certificate = map
27488                                .next_value::<std::option::Option<std::string::String>>()?
27489                                .unwrap_or_default();
27490                        }
27491                        __FieldTag::Unknown(key) => {
27492                            let value = map.next_value::<serde_json::Value>()?;
27493                            result._unknown_fields.insert(key, value);
27494                        }
27495                    }
27496                }
27497                std::result::Result::Ok(result)
27498            }
27499        }
27500        deserializer.deserialize_any(Visitor)
27501    }
27502}
27503
27504#[doc(hidden)]
27505impl serde::ser::Serialize for DemoteMasterMySqlReplicaConfiguration {
27506    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27507    where
27508        S: serde::ser::Serializer,
27509    {
27510        use serde::ser::SerializeMap;
27511        #[allow(unused_imports)]
27512        use std::option::Option::Some;
27513        let mut state = serializer.serialize_map(std::option::Option::None)?;
27514        if !self.kind.is_empty() {
27515            state.serialize_entry("kind", &self.kind)?;
27516        }
27517        if !self.username.is_empty() {
27518            state.serialize_entry("username", &self.username)?;
27519        }
27520        if !self.password.is_empty() {
27521            state.serialize_entry("password", &self.password)?;
27522        }
27523        if !self.client_key.is_empty() {
27524            state.serialize_entry("clientKey", &self.client_key)?;
27525        }
27526        if !self.client_certificate.is_empty() {
27527            state.serialize_entry("clientCertificate", &self.client_certificate)?;
27528        }
27529        if !self.ca_certificate.is_empty() {
27530            state.serialize_entry("caCertificate", &self.ca_certificate)?;
27531        }
27532        if !self._unknown_fields.is_empty() {
27533            for (key, value) in self._unknown_fields.iter() {
27534                state.serialize_entry(key, &value)?;
27535            }
27536        }
27537        state.end()
27538    }
27539}
27540
27541impl std::fmt::Debug for DemoteMasterMySqlReplicaConfiguration {
27542    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27543        let mut debug_struct = f.debug_struct("DemoteMasterMySqlReplicaConfiguration");
27544        debug_struct.field("kind", &self.kind);
27545        debug_struct.field("username", &self.username);
27546        debug_struct.field("password", &self.password);
27547        debug_struct.field("client_key", &self.client_key);
27548        debug_struct.field("client_certificate", &self.client_certificate);
27549        debug_struct.field("ca_certificate", &self.ca_certificate);
27550        if !self._unknown_fields.is_empty() {
27551            debug_struct.field("_unknown_fields", &self._unknown_fields);
27552        }
27553        debug_struct.finish()
27554    }
27555}
27556
27557/// Database instance export context.
27558#[derive(Clone, Default, PartialEq)]
27559#[non_exhaustive]
27560pub struct ExportContext {
27561    /// The path to the file in Google Cloud Storage where the export will be
27562    /// stored. The URI is in the form `gs://bucketName/fileName`. If the file
27563    /// already exists, the request succeeds, but the operation fails. If
27564    /// `fileType` is `SQL` and the filename ends with .gz,
27565    /// the contents are compressed.
27566    pub uri: std::string::String,
27567
27568    /// Databases to be exported. <br /> `MySQL instances:` If
27569    /// `fileType` is `SQL` and no database is specified, all
27570    /// databases are exported, except for the `mysql` system database.
27571    /// If `fileType` is `CSV`, you can specify one database,
27572    /// either by using this property or by using the
27573    /// `csvExportOptions.selectQuery` property, which takes precedence
27574    /// over this property. <br /> `PostgreSQL instances:` You must specify
27575    /// one database to be exported. If `fileType` is `CSV`,
27576    /// this database must match the one specified in the
27577    /// `csvExportOptions.selectQuery` property. <br /> `SQL Server
27578    /// instances:` You must specify one database to be exported, and the
27579    /// `fileType` must be `BAK`.
27580    pub databases: std::vec::Vec<std::string::String>,
27581
27582    /// This is always `sql#exportContext`.
27583    pub kind: std::string::String,
27584
27585    /// Options for exporting data as SQL statements.
27586    pub sql_export_options: std::option::Option<crate::model::export_context::SqlExportOptions>,
27587
27588    /// Options for exporting data as CSV. `MySQL` and `PostgreSQL`
27589    /// instances only.
27590    pub csv_export_options: std::option::Option<crate::model::export_context::SqlCsvExportOptions>,
27591
27592    /// The file type for the specified uri.
27593    pub file_type: crate::model::SqlFileType,
27594
27595    /// Option for export offload.
27596    pub offload: std::option::Option<wkt::BoolValue>,
27597
27598    /// Options for exporting data as BAK files.
27599    pub bak_export_options: std::option::Option<crate::model::export_context::SqlBakExportOptions>,
27600
27601    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27602}
27603
27604impl ExportContext {
27605    pub fn new() -> Self {
27606        std::default::Default::default()
27607    }
27608
27609    /// Sets the value of [uri][crate::model::ExportContext::uri].
27610    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27611        self.uri = v.into();
27612        self
27613    }
27614
27615    /// Sets the value of [databases][crate::model::ExportContext::databases].
27616    pub fn set_databases<T, V>(mut self, v: T) -> Self
27617    where
27618        T: std::iter::IntoIterator<Item = V>,
27619        V: std::convert::Into<std::string::String>,
27620    {
27621        use std::iter::Iterator;
27622        self.databases = v.into_iter().map(|i| i.into()).collect();
27623        self
27624    }
27625
27626    /// Sets the value of [kind][crate::model::ExportContext::kind].
27627    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27628        self.kind = v.into();
27629        self
27630    }
27631
27632    /// Sets the value of [sql_export_options][crate::model::ExportContext::sql_export_options].
27633    pub fn set_sql_export_options<T>(mut self, v: T) -> Self
27634    where
27635        T: std::convert::Into<crate::model::export_context::SqlExportOptions>,
27636    {
27637        self.sql_export_options = std::option::Option::Some(v.into());
27638        self
27639    }
27640
27641    /// Sets or clears the value of [sql_export_options][crate::model::ExportContext::sql_export_options].
27642    pub fn set_or_clear_sql_export_options<T>(mut self, v: std::option::Option<T>) -> Self
27643    where
27644        T: std::convert::Into<crate::model::export_context::SqlExportOptions>,
27645    {
27646        self.sql_export_options = v.map(|x| x.into());
27647        self
27648    }
27649
27650    /// Sets the value of [csv_export_options][crate::model::ExportContext::csv_export_options].
27651    pub fn set_csv_export_options<T>(mut self, v: T) -> Self
27652    where
27653        T: std::convert::Into<crate::model::export_context::SqlCsvExportOptions>,
27654    {
27655        self.csv_export_options = std::option::Option::Some(v.into());
27656        self
27657    }
27658
27659    /// Sets or clears the value of [csv_export_options][crate::model::ExportContext::csv_export_options].
27660    pub fn set_or_clear_csv_export_options<T>(mut self, v: std::option::Option<T>) -> Self
27661    where
27662        T: std::convert::Into<crate::model::export_context::SqlCsvExportOptions>,
27663    {
27664        self.csv_export_options = v.map(|x| x.into());
27665        self
27666    }
27667
27668    /// Sets the value of [file_type][crate::model::ExportContext::file_type].
27669    pub fn set_file_type<T: std::convert::Into<crate::model::SqlFileType>>(mut self, v: T) -> Self {
27670        self.file_type = v.into();
27671        self
27672    }
27673
27674    /// Sets the value of [offload][crate::model::ExportContext::offload].
27675    pub fn set_offload<T>(mut self, v: T) -> Self
27676    where
27677        T: std::convert::Into<wkt::BoolValue>,
27678    {
27679        self.offload = std::option::Option::Some(v.into());
27680        self
27681    }
27682
27683    /// Sets or clears the value of [offload][crate::model::ExportContext::offload].
27684    pub fn set_or_clear_offload<T>(mut self, v: std::option::Option<T>) -> Self
27685    where
27686        T: std::convert::Into<wkt::BoolValue>,
27687    {
27688        self.offload = v.map(|x| x.into());
27689        self
27690    }
27691
27692    /// Sets the value of [bak_export_options][crate::model::ExportContext::bak_export_options].
27693    pub fn set_bak_export_options<T>(mut self, v: T) -> Self
27694    where
27695        T: std::convert::Into<crate::model::export_context::SqlBakExportOptions>,
27696    {
27697        self.bak_export_options = std::option::Option::Some(v.into());
27698        self
27699    }
27700
27701    /// Sets or clears the value of [bak_export_options][crate::model::ExportContext::bak_export_options].
27702    pub fn set_or_clear_bak_export_options<T>(mut self, v: std::option::Option<T>) -> Self
27703    where
27704        T: std::convert::Into<crate::model::export_context::SqlBakExportOptions>,
27705    {
27706        self.bak_export_options = v.map(|x| x.into());
27707        self
27708    }
27709}
27710
27711impl wkt::message::Message for ExportContext {
27712    fn typename() -> &'static str {
27713        "type.googleapis.com/google.cloud.sql.v1.ExportContext"
27714    }
27715}
27716
27717#[doc(hidden)]
27718impl<'de> serde::de::Deserialize<'de> for ExportContext {
27719    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27720    where
27721        D: serde::Deserializer<'de>,
27722    {
27723        #[allow(non_camel_case_types)]
27724        #[doc(hidden)]
27725        #[derive(PartialEq, Eq, Hash)]
27726        enum __FieldTag {
27727            __uri,
27728            __databases,
27729            __kind,
27730            __sql_export_options,
27731            __csv_export_options,
27732            __file_type,
27733            __offload,
27734            __bak_export_options,
27735            Unknown(std::string::String),
27736        }
27737        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
27738            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27739            where
27740                D: serde::Deserializer<'de>,
27741            {
27742                struct Visitor;
27743                impl<'de> serde::de::Visitor<'de> for Visitor {
27744                    type Value = __FieldTag;
27745                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
27746                        formatter.write_str("a field name for ExportContext")
27747                    }
27748                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
27749                    where
27750                        E: serde::de::Error,
27751                    {
27752                        use std::result::Result::Ok;
27753                        use std::string::ToString;
27754                        match value {
27755                            "uri" => Ok(__FieldTag::__uri),
27756                            "databases" => Ok(__FieldTag::__databases),
27757                            "kind" => Ok(__FieldTag::__kind),
27758                            "sqlExportOptions" => Ok(__FieldTag::__sql_export_options),
27759                            "sql_export_options" => Ok(__FieldTag::__sql_export_options),
27760                            "csvExportOptions" => Ok(__FieldTag::__csv_export_options),
27761                            "csv_export_options" => Ok(__FieldTag::__csv_export_options),
27762                            "fileType" => Ok(__FieldTag::__file_type),
27763                            "file_type" => Ok(__FieldTag::__file_type),
27764                            "offload" => Ok(__FieldTag::__offload),
27765                            "bakExportOptions" => Ok(__FieldTag::__bak_export_options),
27766                            "bak_export_options" => Ok(__FieldTag::__bak_export_options),
27767                            _ => Ok(__FieldTag::Unknown(value.to_string())),
27768                        }
27769                    }
27770                }
27771                deserializer.deserialize_identifier(Visitor)
27772            }
27773        }
27774        struct Visitor;
27775        impl<'de> serde::de::Visitor<'de> for Visitor {
27776            type Value = ExportContext;
27777            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
27778                formatter.write_str("struct ExportContext")
27779            }
27780            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
27781            where
27782                A: serde::de::MapAccess<'de>,
27783            {
27784                #[allow(unused_imports)]
27785                use serde::de::Error;
27786                use std::option::Option::Some;
27787                let mut fields = std::collections::HashSet::new();
27788                let mut result = Self::Value::new();
27789                while let Some(tag) = map.next_key::<__FieldTag>()? {
27790                    #[allow(clippy::match_single_binding)]
27791                    match tag {
27792                        __FieldTag::__uri => {
27793                            if !fields.insert(__FieldTag::__uri) {
27794                                return std::result::Result::Err(A::Error::duplicate_field(
27795                                    "multiple values for uri",
27796                                ));
27797                            }
27798                            result.uri = map
27799                                .next_value::<std::option::Option<std::string::String>>()?
27800                                .unwrap_or_default();
27801                        }
27802                        __FieldTag::__databases => {
27803                            if !fields.insert(__FieldTag::__databases) {
27804                                return std::result::Result::Err(A::Error::duplicate_field(
27805                                    "multiple values for databases",
27806                                ));
27807                            }
27808                            result.databases = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
27809                        }
27810                        __FieldTag::__kind => {
27811                            if !fields.insert(__FieldTag::__kind) {
27812                                return std::result::Result::Err(A::Error::duplicate_field(
27813                                    "multiple values for kind",
27814                                ));
27815                            }
27816                            result.kind = map
27817                                .next_value::<std::option::Option<std::string::String>>()?
27818                                .unwrap_or_default();
27819                        }
27820                        __FieldTag::__sql_export_options => {
27821                            if !fields.insert(__FieldTag::__sql_export_options) {
27822                                return std::result::Result::Err(A::Error::duplicate_field(
27823                                    "multiple values for sql_export_options",
27824                                ));
27825                            }
27826                            result.sql_export_options = map.next_value::<std::option::Option<
27827                                crate::model::export_context::SqlExportOptions,
27828                            >>()?;
27829                        }
27830                        __FieldTag::__csv_export_options => {
27831                            if !fields.insert(__FieldTag::__csv_export_options) {
27832                                return std::result::Result::Err(A::Error::duplicate_field(
27833                                    "multiple values for csv_export_options",
27834                                ));
27835                            }
27836                            result.csv_export_options = map.next_value::<std::option::Option<
27837                                crate::model::export_context::SqlCsvExportOptions,
27838                            >>()?;
27839                        }
27840                        __FieldTag::__file_type => {
27841                            if !fields.insert(__FieldTag::__file_type) {
27842                                return std::result::Result::Err(A::Error::duplicate_field(
27843                                    "multiple values for file_type",
27844                                ));
27845                            }
27846                            result.file_type = map
27847                                .next_value::<std::option::Option<crate::model::SqlFileType>>()?
27848                                .unwrap_or_default();
27849                        }
27850                        __FieldTag::__offload => {
27851                            if !fields.insert(__FieldTag::__offload) {
27852                                return std::result::Result::Err(A::Error::duplicate_field(
27853                                    "multiple values for offload",
27854                                ));
27855                            }
27856                            result.offload =
27857                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
27858                        }
27859                        __FieldTag::__bak_export_options => {
27860                            if !fields.insert(__FieldTag::__bak_export_options) {
27861                                return std::result::Result::Err(A::Error::duplicate_field(
27862                                    "multiple values for bak_export_options",
27863                                ));
27864                            }
27865                            result.bak_export_options = map.next_value::<std::option::Option<
27866                                crate::model::export_context::SqlBakExportOptions,
27867                            >>()?;
27868                        }
27869                        __FieldTag::Unknown(key) => {
27870                            let value = map.next_value::<serde_json::Value>()?;
27871                            result._unknown_fields.insert(key, value);
27872                        }
27873                    }
27874                }
27875                std::result::Result::Ok(result)
27876            }
27877        }
27878        deserializer.deserialize_any(Visitor)
27879    }
27880}
27881
27882#[doc(hidden)]
27883impl serde::ser::Serialize for ExportContext {
27884    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27885    where
27886        S: serde::ser::Serializer,
27887    {
27888        use serde::ser::SerializeMap;
27889        #[allow(unused_imports)]
27890        use std::option::Option::Some;
27891        let mut state = serializer.serialize_map(std::option::Option::None)?;
27892        if !self.uri.is_empty() {
27893            state.serialize_entry("uri", &self.uri)?;
27894        }
27895        if !self.databases.is_empty() {
27896            state.serialize_entry("databases", &self.databases)?;
27897        }
27898        if !self.kind.is_empty() {
27899            state.serialize_entry("kind", &self.kind)?;
27900        }
27901        if self.sql_export_options.is_some() {
27902            state.serialize_entry("sqlExportOptions", &self.sql_export_options)?;
27903        }
27904        if self.csv_export_options.is_some() {
27905            state.serialize_entry("csvExportOptions", &self.csv_export_options)?;
27906        }
27907        if !wkt::internal::is_default(&self.file_type) {
27908            state.serialize_entry("fileType", &self.file_type)?;
27909        }
27910        if self.offload.is_some() {
27911            state.serialize_entry("offload", &self.offload)?;
27912        }
27913        if self.bak_export_options.is_some() {
27914            state.serialize_entry("bakExportOptions", &self.bak_export_options)?;
27915        }
27916        if !self._unknown_fields.is_empty() {
27917            for (key, value) in self._unknown_fields.iter() {
27918                state.serialize_entry(key, &value)?;
27919            }
27920        }
27921        state.end()
27922    }
27923}
27924
27925impl std::fmt::Debug for ExportContext {
27926    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27927        let mut debug_struct = f.debug_struct("ExportContext");
27928        debug_struct.field("uri", &self.uri);
27929        debug_struct.field("databases", &self.databases);
27930        debug_struct.field("kind", &self.kind);
27931        debug_struct.field("sql_export_options", &self.sql_export_options);
27932        debug_struct.field("csv_export_options", &self.csv_export_options);
27933        debug_struct.field("file_type", &self.file_type);
27934        debug_struct.field("offload", &self.offload);
27935        debug_struct.field("bak_export_options", &self.bak_export_options);
27936        if !self._unknown_fields.is_empty() {
27937            debug_struct.field("_unknown_fields", &self._unknown_fields);
27938        }
27939        debug_struct.finish()
27940    }
27941}
27942
27943/// Defines additional types related to [ExportContext].
27944pub mod export_context {
27945    #[allow(unused_imports)]
27946    use super::*;
27947
27948    #[derive(Clone, Default, PartialEq)]
27949    #[non_exhaustive]
27950    pub struct SqlCsvExportOptions {
27951        /// The select query used to extract the data.
27952        pub select_query: std::string::String,
27953
27954        /// Specifies the character that should appear before a data character that
27955        /// needs to be escaped.
27956        pub escape_character: std::string::String,
27957
27958        /// Specifies the quoting character to be used when a data value is quoted.
27959        pub quote_character: std::string::String,
27960
27961        /// Specifies the character that separates columns within each row (line) of
27962        /// the file.
27963        pub fields_terminated_by: std::string::String,
27964
27965        /// This is used to separate lines. If a line does not contain all fields,
27966        /// the rest of the columns are set to their default values.
27967        pub lines_terminated_by: std::string::String,
27968
27969        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27970    }
27971
27972    impl SqlCsvExportOptions {
27973        pub fn new() -> Self {
27974            std::default::Default::default()
27975        }
27976
27977        /// Sets the value of [select_query][crate::model::export_context::SqlCsvExportOptions::select_query].
27978        pub fn set_select_query<T: std::convert::Into<std::string::String>>(
27979            mut self,
27980            v: T,
27981        ) -> Self {
27982            self.select_query = v.into();
27983            self
27984        }
27985
27986        /// Sets the value of [escape_character][crate::model::export_context::SqlCsvExportOptions::escape_character].
27987        pub fn set_escape_character<T: std::convert::Into<std::string::String>>(
27988            mut self,
27989            v: T,
27990        ) -> Self {
27991            self.escape_character = v.into();
27992            self
27993        }
27994
27995        /// Sets the value of [quote_character][crate::model::export_context::SqlCsvExportOptions::quote_character].
27996        pub fn set_quote_character<T: std::convert::Into<std::string::String>>(
27997            mut self,
27998            v: T,
27999        ) -> Self {
28000            self.quote_character = v.into();
28001            self
28002        }
28003
28004        /// Sets the value of [fields_terminated_by][crate::model::export_context::SqlCsvExportOptions::fields_terminated_by].
28005        pub fn set_fields_terminated_by<T: std::convert::Into<std::string::String>>(
28006            mut self,
28007            v: T,
28008        ) -> Self {
28009            self.fields_terminated_by = v.into();
28010            self
28011        }
28012
28013        /// Sets the value of [lines_terminated_by][crate::model::export_context::SqlCsvExportOptions::lines_terminated_by].
28014        pub fn set_lines_terminated_by<T: std::convert::Into<std::string::String>>(
28015            mut self,
28016            v: T,
28017        ) -> Self {
28018            self.lines_terminated_by = v.into();
28019            self
28020        }
28021    }
28022
28023    impl wkt::message::Message for SqlCsvExportOptions {
28024        fn typename() -> &'static str {
28025            "type.googleapis.com/google.cloud.sql.v1.ExportContext.SqlCsvExportOptions"
28026        }
28027    }
28028
28029    #[doc(hidden)]
28030    impl<'de> serde::de::Deserialize<'de> for SqlCsvExportOptions {
28031        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28032        where
28033            D: serde::Deserializer<'de>,
28034        {
28035            #[allow(non_camel_case_types)]
28036            #[doc(hidden)]
28037            #[derive(PartialEq, Eq, Hash)]
28038            enum __FieldTag {
28039                __select_query,
28040                __escape_character,
28041                __quote_character,
28042                __fields_terminated_by,
28043                __lines_terminated_by,
28044                Unknown(std::string::String),
28045            }
28046            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
28047                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28048                where
28049                    D: serde::Deserializer<'de>,
28050                {
28051                    struct Visitor;
28052                    impl<'de> serde::de::Visitor<'de> for Visitor {
28053                        type Value = __FieldTag;
28054                        fn expecting(
28055                            &self,
28056                            formatter: &mut std::fmt::Formatter,
28057                        ) -> std::fmt::Result {
28058                            formatter.write_str("a field name for SqlCsvExportOptions")
28059                        }
28060                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
28061                        where
28062                            E: serde::de::Error,
28063                        {
28064                            use std::result::Result::Ok;
28065                            use std::string::ToString;
28066                            match value {
28067                                "selectQuery" => Ok(__FieldTag::__select_query),
28068                                "select_query" => Ok(__FieldTag::__select_query),
28069                                "escapeCharacter" => Ok(__FieldTag::__escape_character),
28070                                "escape_character" => Ok(__FieldTag::__escape_character),
28071                                "quoteCharacter" => Ok(__FieldTag::__quote_character),
28072                                "quote_character" => Ok(__FieldTag::__quote_character),
28073                                "fieldsTerminatedBy" => Ok(__FieldTag::__fields_terminated_by),
28074                                "fields_terminated_by" => Ok(__FieldTag::__fields_terminated_by),
28075                                "linesTerminatedBy" => Ok(__FieldTag::__lines_terminated_by),
28076                                "lines_terminated_by" => Ok(__FieldTag::__lines_terminated_by),
28077                                _ => Ok(__FieldTag::Unknown(value.to_string())),
28078                            }
28079                        }
28080                    }
28081                    deserializer.deserialize_identifier(Visitor)
28082                }
28083            }
28084            struct Visitor;
28085            impl<'de> serde::de::Visitor<'de> for Visitor {
28086                type Value = SqlCsvExportOptions;
28087                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
28088                    formatter.write_str("struct SqlCsvExportOptions")
28089                }
28090                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
28091                where
28092                    A: serde::de::MapAccess<'de>,
28093                {
28094                    #[allow(unused_imports)]
28095                    use serde::de::Error;
28096                    use std::option::Option::Some;
28097                    let mut fields = std::collections::HashSet::new();
28098                    let mut result = Self::Value::new();
28099                    while let Some(tag) = map.next_key::<__FieldTag>()? {
28100                        #[allow(clippy::match_single_binding)]
28101                        match tag {
28102                            __FieldTag::__select_query => {
28103                                if !fields.insert(__FieldTag::__select_query) {
28104                                    return std::result::Result::Err(A::Error::duplicate_field(
28105                                        "multiple values for select_query",
28106                                    ));
28107                                }
28108                                result.select_query = map
28109                                    .next_value::<std::option::Option<std::string::String>>()?
28110                                    .unwrap_or_default();
28111                            }
28112                            __FieldTag::__escape_character => {
28113                                if !fields.insert(__FieldTag::__escape_character) {
28114                                    return std::result::Result::Err(A::Error::duplicate_field(
28115                                        "multiple values for escape_character",
28116                                    ));
28117                                }
28118                                result.escape_character = map
28119                                    .next_value::<std::option::Option<std::string::String>>()?
28120                                    .unwrap_or_default();
28121                            }
28122                            __FieldTag::__quote_character => {
28123                                if !fields.insert(__FieldTag::__quote_character) {
28124                                    return std::result::Result::Err(A::Error::duplicate_field(
28125                                        "multiple values for quote_character",
28126                                    ));
28127                                }
28128                                result.quote_character = map
28129                                    .next_value::<std::option::Option<std::string::String>>()?
28130                                    .unwrap_or_default();
28131                            }
28132                            __FieldTag::__fields_terminated_by => {
28133                                if !fields.insert(__FieldTag::__fields_terminated_by) {
28134                                    return std::result::Result::Err(A::Error::duplicate_field(
28135                                        "multiple values for fields_terminated_by",
28136                                    ));
28137                                }
28138                                result.fields_terminated_by = map
28139                                    .next_value::<std::option::Option<std::string::String>>()?
28140                                    .unwrap_or_default();
28141                            }
28142                            __FieldTag::__lines_terminated_by => {
28143                                if !fields.insert(__FieldTag::__lines_terminated_by) {
28144                                    return std::result::Result::Err(A::Error::duplicate_field(
28145                                        "multiple values for lines_terminated_by",
28146                                    ));
28147                                }
28148                                result.lines_terminated_by = map
28149                                    .next_value::<std::option::Option<std::string::String>>()?
28150                                    .unwrap_or_default();
28151                            }
28152                            __FieldTag::Unknown(key) => {
28153                                let value = map.next_value::<serde_json::Value>()?;
28154                                result._unknown_fields.insert(key, value);
28155                            }
28156                        }
28157                    }
28158                    std::result::Result::Ok(result)
28159                }
28160            }
28161            deserializer.deserialize_any(Visitor)
28162        }
28163    }
28164
28165    #[doc(hidden)]
28166    impl serde::ser::Serialize for SqlCsvExportOptions {
28167        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28168        where
28169            S: serde::ser::Serializer,
28170        {
28171            use serde::ser::SerializeMap;
28172            #[allow(unused_imports)]
28173            use std::option::Option::Some;
28174            let mut state = serializer.serialize_map(std::option::Option::None)?;
28175            if !self.select_query.is_empty() {
28176                state.serialize_entry("selectQuery", &self.select_query)?;
28177            }
28178            if !self.escape_character.is_empty() {
28179                state.serialize_entry("escapeCharacter", &self.escape_character)?;
28180            }
28181            if !self.quote_character.is_empty() {
28182                state.serialize_entry("quoteCharacter", &self.quote_character)?;
28183            }
28184            if !self.fields_terminated_by.is_empty() {
28185                state.serialize_entry("fieldsTerminatedBy", &self.fields_terminated_by)?;
28186            }
28187            if !self.lines_terminated_by.is_empty() {
28188                state.serialize_entry("linesTerminatedBy", &self.lines_terminated_by)?;
28189            }
28190            if !self._unknown_fields.is_empty() {
28191                for (key, value) in self._unknown_fields.iter() {
28192                    state.serialize_entry(key, &value)?;
28193                }
28194            }
28195            state.end()
28196        }
28197    }
28198
28199    impl std::fmt::Debug for SqlCsvExportOptions {
28200        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
28201            let mut debug_struct = f.debug_struct("SqlCsvExportOptions");
28202            debug_struct.field("select_query", &self.select_query);
28203            debug_struct.field("escape_character", &self.escape_character);
28204            debug_struct.field("quote_character", &self.quote_character);
28205            debug_struct.field("fields_terminated_by", &self.fields_terminated_by);
28206            debug_struct.field("lines_terminated_by", &self.lines_terminated_by);
28207            if !self._unknown_fields.is_empty() {
28208                debug_struct.field("_unknown_fields", &self._unknown_fields);
28209            }
28210            debug_struct.finish()
28211        }
28212    }
28213
28214    #[derive(Clone, Default, PartialEq)]
28215    #[non_exhaustive]
28216    pub struct SqlExportOptions {
28217        /// Tables to export, or that were exported, from the specified database. If
28218        /// you specify tables, specify one and only one database. For PostgreSQL
28219        /// instances, you can specify only one table.
28220        pub tables: std::vec::Vec<std::string::String>,
28221
28222        /// Export only schemas.
28223        pub schema_only: std::option::Option<wkt::BoolValue>,
28224
28225        pub mysql_export_options: std::option::Option<
28226            crate::model::export_context::sql_export_options::MysqlExportOptions,
28227        >,
28228
28229        /// Optional. The number of threads to use for parallel export.
28230        pub threads: std::option::Option<wkt::Int32Value>,
28231
28232        /// Optional. Whether or not the export should be parallel.
28233        pub parallel: std::option::Option<wkt::BoolValue>,
28234
28235        /// Optional. Options for exporting from a Cloud SQL for PostgreSQL instance.
28236        pub postgres_export_options: std::option::Option<
28237            crate::model::export_context::sql_export_options::PostgresExportOptions,
28238        >,
28239
28240        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
28241    }
28242
28243    impl SqlExportOptions {
28244        pub fn new() -> Self {
28245            std::default::Default::default()
28246        }
28247
28248        /// Sets the value of [tables][crate::model::export_context::SqlExportOptions::tables].
28249        pub fn set_tables<T, V>(mut self, v: T) -> Self
28250        where
28251            T: std::iter::IntoIterator<Item = V>,
28252            V: std::convert::Into<std::string::String>,
28253        {
28254            use std::iter::Iterator;
28255            self.tables = v.into_iter().map(|i| i.into()).collect();
28256            self
28257        }
28258
28259        /// Sets the value of [schema_only][crate::model::export_context::SqlExportOptions::schema_only].
28260        pub fn set_schema_only<T>(mut self, v: T) -> Self
28261        where
28262            T: std::convert::Into<wkt::BoolValue>,
28263        {
28264            self.schema_only = std::option::Option::Some(v.into());
28265            self
28266        }
28267
28268        /// Sets or clears the value of [schema_only][crate::model::export_context::SqlExportOptions::schema_only].
28269        pub fn set_or_clear_schema_only<T>(mut self, v: std::option::Option<T>) -> Self
28270        where
28271            T: std::convert::Into<wkt::BoolValue>,
28272        {
28273            self.schema_only = v.map(|x| x.into());
28274            self
28275        }
28276
28277        /// Sets the value of [mysql_export_options][crate::model::export_context::SqlExportOptions::mysql_export_options].
28278        pub fn set_mysql_export_options<T>(mut self, v: T) -> Self
28279        where
28280            T: std::convert::Into<
28281                    crate::model::export_context::sql_export_options::MysqlExportOptions,
28282                >,
28283        {
28284            self.mysql_export_options = std::option::Option::Some(v.into());
28285            self
28286        }
28287
28288        /// Sets or clears the value of [mysql_export_options][crate::model::export_context::SqlExportOptions::mysql_export_options].
28289        pub fn set_or_clear_mysql_export_options<T>(mut self, v: std::option::Option<T>) -> Self
28290        where
28291            T: std::convert::Into<
28292                    crate::model::export_context::sql_export_options::MysqlExportOptions,
28293                >,
28294        {
28295            self.mysql_export_options = v.map(|x| x.into());
28296            self
28297        }
28298
28299        /// Sets the value of [threads][crate::model::export_context::SqlExportOptions::threads].
28300        pub fn set_threads<T>(mut self, v: T) -> Self
28301        where
28302            T: std::convert::Into<wkt::Int32Value>,
28303        {
28304            self.threads = std::option::Option::Some(v.into());
28305            self
28306        }
28307
28308        /// Sets or clears the value of [threads][crate::model::export_context::SqlExportOptions::threads].
28309        pub fn set_or_clear_threads<T>(mut self, v: std::option::Option<T>) -> Self
28310        where
28311            T: std::convert::Into<wkt::Int32Value>,
28312        {
28313            self.threads = v.map(|x| x.into());
28314            self
28315        }
28316
28317        /// Sets the value of [parallel][crate::model::export_context::SqlExportOptions::parallel].
28318        pub fn set_parallel<T>(mut self, v: T) -> Self
28319        where
28320            T: std::convert::Into<wkt::BoolValue>,
28321        {
28322            self.parallel = std::option::Option::Some(v.into());
28323            self
28324        }
28325
28326        /// Sets or clears the value of [parallel][crate::model::export_context::SqlExportOptions::parallel].
28327        pub fn set_or_clear_parallel<T>(mut self, v: std::option::Option<T>) -> Self
28328        where
28329            T: std::convert::Into<wkt::BoolValue>,
28330        {
28331            self.parallel = v.map(|x| x.into());
28332            self
28333        }
28334
28335        /// Sets the value of [postgres_export_options][crate::model::export_context::SqlExportOptions::postgres_export_options].
28336        pub fn set_postgres_export_options<T>(mut self, v: T) -> Self
28337        where
28338            T: std::convert::Into<
28339                    crate::model::export_context::sql_export_options::PostgresExportOptions,
28340                >,
28341        {
28342            self.postgres_export_options = std::option::Option::Some(v.into());
28343            self
28344        }
28345
28346        /// Sets or clears the value of [postgres_export_options][crate::model::export_context::SqlExportOptions::postgres_export_options].
28347        pub fn set_or_clear_postgres_export_options<T>(mut self, v: std::option::Option<T>) -> Self
28348        where
28349            T: std::convert::Into<
28350                    crate::model::export_context::sql_export_options::PostgresExportOptions,
28351                >,
28352        {
28353            self.postgres_export_options = v.map(|x| x.into());
28354            self
28355        }
28356    }
28357
28358    impl wkt::message::Message for SqlExportOptions {
28359        fn typename() -> &'static str {
28360            "type.googleapis.com/google.cloud.sql.v1.ExportContext.SqlExportOptions"
28361        }
28362    }
28363
28364    #[doc(hidden)]
28365    impl<'de> serde::de::Deserialize<'de> for SqlExportOptions {
28366        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28367        where
28368            D: serde::Deserializer<'de>,
28369        {
28370            #[allow(non_camel_case_types)]
28371            #[doc(hidden)]
28372            #[derive(PartialEq, Eq, Hash)]
28373            enum __FieldTag {
28374                __tables,
28375                __schema_only,
28376                __mysql_export_options,
28377                __threads,
28378                __parallel,
28379                __postgres_export_options,
28380                Unknown(std::string::String),
28381            }
28382            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
28383                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28384                where
28385                    D: serde::Deserializer<'de>,
28386                {
28387                    struct Visitor;
28388                    impl<'de> serde::de::Visitor<'de> for Visitor {
28389                        type Value = __FieldTag;
28390                        fn expecting(
28391                            &self,
28392                            formatter: &mut std::fmt::Formatter,
28393                        ) -> std::fmt::Result {
28394                            formatter.write_str("a field name for SqlExportOptions")
28395                        }
28396                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
28397                        where
28398                            E: serde::de::Error,
28399                        {
28400                            use std::result::Result::Ok;
28401                            use std::string::ToString;
28402                            match value {
28403                                "tables" => Ok(__FieldTag::__tables),
28404                                "schemaOnly" => Ok(__FieldTag::__schema_only),
28405                                "schema_only" => Ok(__FieldTag::__schema_only),
28406                                "mysqlExportOptions" => Ok(__FieldTag::__mysql_export_options),
28407                                "mysql_export_options" => Ok(__FieldTag::__mysql_export_options),
28408                                "threads" => Ok(__FieldTag::__threads),
28409                                "parallel" => Ok(__FieldTag::__parallel),
28410                                "postgresExportOptions" => {
28411                                    Ok(__FieldTag::__postgres_export_options)
28412                                }
28413                                "postgres_export_options" => {
28414                                    Ok(__FieldTag::__postgres_export_options)
28415                                }
28416                                _ => Ok(__FieldTag::Unknown(value.to_string())),
28417                            }
28418                        }
28419                    }
28420                    deserializer.deserialize_identifier(Visitor)
28421                }
28422            }
28423            struct Visitor;
28424            impl<'de> serde::de::Visitor<'de> for Visitor {
28425                type Value = SqlExportOptions;
28426                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
28427                    formatter.write_str("struct SqlExportOptions")
28428                }
28429                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
28430                where
28431                    A: serde::de::MapAccess<'de>,
28432                {
28433                    #[allow(unused_imports)]
28434                    use serde::de::Error;
28435                    use std::option::Option::Some;
28436                    let mut fields = std::collections::HashSet::new();
28437                    let mut result = Self::Value::new();
28438                    while let Some(tag) = map.next_key::<__FieldTag>()? {
28439                        #[allow(clippy::match_single_binding)]
28440                        match tag {
28441                            __FieldTag::__tables => {
28442                                if !fields.insert(__FieldTag::__tables) {
28443                                    return std::result::Result::Err(A::Error::duplicate_field(
28444                                        "multiple values for tables",
28445                                    ));
28446                                }
28447                                result.tables = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
28448                            }
28449                            __FieldTag::__schema_only => {
28450                                if !fields.insert(__FieldTag::__schema_only) {
28451                                    return std::result::Result::Err(A::Error::duplicate_field(
28452                                        "multiple values for schema_only",
28453                                    ));
28454                                }
28455                                result.schema_only =
28456                                    map.next_value::<std::option::Option<wkt::BoolValue>>()?;
28457                            }
28458                            __FieldTag::__mysql_export_options => {
28459                                if !fields.insert(__FieldTag::__mysql_export_options) {
28460                                    return std::result::Result::Err(A::Error::duplicate_field(
28461                                        "multiple values for mysql_export_options",
28462                                    ));
28463                                }
28464                                result.mysql_export_options = map.next_value::<std::option::Option<crate::model::export_context::sql_export_options::MysqlExportOptions>>()?
28465                                    ;
28466                            }
28467                            __FieldTag::__threads => {
28468                                if !fields.insert(__FieldTag::__threads) {
28469                                    return std::result::Result::Err(A::Error::duplicate_field(
28470                                        "multiple values for threads",
28471                                    ));
28472                                }
28473                                struct __With(std::option::Option<wkt::Int32Value>);
28474                                impl<'de> serde::de::Deserialize<'de> for __With {
28475                                    fn deserialize<D>(
28476                                        deserializer: D,
28477                                    ) -> std::result::Result<Self, D::Error>
28478                                    where
28479                                        D: serde::de::Deserializer<'de>,
28480                                    {
28481                                        serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
28482                                    }
28483                                }
28484                                result.threads = map.next_value::<__With>()?.0;
28485                            }
28486                            __FieldTag::__parallel => {
28487                                if !fields.insert(__FieldTag::__parallel) {
28488                                    return std::result::Result::Err(A::Error::duplicate_field(
28489                                        "multiple values for parallel",
28490                                    ));
28491                                }
28492                                result.parallel =
28493                                    map.next_value::<std::option::Option<wkt::BoolValue>>()?;
28494                            }
28495                            __FieldTag::__postgres_export_options => {
28496                                if !fields.insert(__FieldTag::__postgres_export_options) {
28497                                    return std::result::Result::Err(A::Error::duplicate_field(
28498                                        "multiple values for postgres_export_options",
28499                                    ));
28500                                }
28501                                result.postgres_export_options = map.next_value::<std::option::Option<crate::model::export_context::sql_export_options::PostgresExportOptions>>()?
28502                                    ;
28503                            }
28504                            __FieldTag::Unknown(key) => {
28505                                let value = map.next_value::<serde_json::Value>()?;
28506                                result._unknown_fields.insert(key, value);
28507                            }
28508                        }
28509                    }
28510                    std::result::Result::Ok(result)
28511                }
28512            }
28513            deserializer.deserialize_any(Visitor)
28514        }
28515    }
28516
28517    #[doc(hidden)]
28518    impl serde::ser::Serialize for SqlExportOptions {
28519        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28520        where
28521            S: serde::ser::Serializer,
28522        {
28523            use serde::ser::SerializeMap;
28524            #[allow(unused_imports)]
28525            use std::option::Option::Some;
28526            let mut state = serializer.serialize_map(std::option::Option::None)?;
28527            if !self.tables.is_empty() {
28528                state.serialize_entry("tables", &self.tables)?;
28529            }
28530            if self.schema_only.is_some() {
28531                state.serialize_entry("schemaOnly", &self.schema_only)?;
28532            }
28533            if self.mysql_export_options.is_some() {
28534                state.serialize_entry("mysqlExportOptions", &self.mysql_export_options)?;
28535            }
28536            if self.threads.is_some() {
28537                struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
28538                impl<'a> serde::ser::Serialize for __With<'a> {
28539                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28540                    where
28541                        S: serde::ser::Serializer,
28542                    {
28543                        serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
28544                            self.0, serializer,
28545                        )
28546                    }
28547                }
28548                state.serialize_entry("threads", &__With(&self.threads))?;
28549            }
28550            if self.parallel.is_some() {
28551                state.serialize_entry("parallel", &self.parallel)?;
28552            }
28553            if self.postgres_export_options.is_some() {
28554                state.serialize_entry("postgresExportOptions", &self.postgres_export_options)?;
28555            }
28556            if !self._unknown_fields.is_empty() {
28557                for (key, value) in self._unknown_fields.iter() {
28558                    state.serialize_entry(key, &value)?;
28559                }
28560            }
28561            state.end()
28562        }
28563    }
28564
28565    impl std::fmt::Debug for SqlExportOptions {
28566        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
28567            let mut debug_struct = f.debug_struct("SqlExportOptions");
28568            debug_struct.field("tables", &self.tables);
28569            debug_struct.field("schema_only", &self.schema_only);
28570            debug_struct.field("mysql_export_options", &self.mysql_export_options);
28571            debug_struct.field("threads", &self.threads);
28572            debug_struct.field("parallel", &self.parallel);
28573            debug_struct.field("postgres_export_options", &self.postgres_export_options);
28574            if !self._unknown_fields.is_empty() {
28575                debug_struct.field("_unknown_fields", &self._unknown_fields);
28576            }
28577            debug_struct.finish()
28578        }
28579    }
28580
28581    /// Defines additional types related to [SqlExportOptions].
28582    pub mod sql_export_options {
28583        #[allow(unused_imports)]
28584        use super::*;
28585
28586        /// Options for exporting from MySQL.
28587        #[derive(Clone, Default, PartialEq)]
28588        #[non_exhaustive]
28589        pub struct MysqlExportOptions {
28590            /// Option to include SQL statement required to set up replication. If set
28591            /// to `1`, the dump file includes a CHANGE MASTER TO statement with the
28592            /// binary log coordinates, and --set-gtid-purged is set to ON. If set to
28593            /// `2`, the CHANGE MASTER TO statement is written as a SQL comment and
28594            /// has no effect. If set to any value other than `1`, --set-gtid-purged
28595            /// is set to OFF.
28596            pub master_data: std::option::Option<wkt::Int32Value>,
28597
28598            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
28599        }
28600
28601        impl MysqlExportOptions {
28602            pub fn new() -> Self {
28603                std::default::Default::default()
28604            }
28605
28606            /// Sets the value of [master_data][crate::model::export_context::sql_export_options::MysqlExportOptions::master_data].
28607            pub fn set_master_data<T>(mut self, v: T) -> Self
28608            where
28609                T: std::convert::Into<wkt::Int32Value>,
28610            {
28611                self.master_data = std::option::Option::Some(v.into());
28612                self
28613            }
28614
28615            /// Sets or clears the value of [master_data][crate::model::export_context::sql_export_options::MysqlExportOptions::master_data].
28616            pub fn set_or_clear_master_data<T>(mut self, v: std::option::Option<T>) -> Self
28617            where
28618                T: std::convert::Into<wkt::Int32Value>,
28619            {
28620                self.master_data = v.map(|x| x.into());
28621                self
28622            }
28623        }
28624
28625        impl wkt::message::Message for MysqlExportOptions {
28626            fn typename() -> &'static str {
28627                "type.googleapis.com/google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions"
28628            }
28629        }
28630
28631        #[doc(hidden)]
28632        impl<'de> serde::de::Deserialize<'de> for MysqlExportOptions {
28633            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28634            where
28635                D: serde::Deserializer<'de>,
28636            {
28637                #[allow(non_camel_case_types)]
28638                #[doc(hidden)]
28639                #[derive(PartialEq, Eq, Hash)]
28640                enum __FieldTag {
28641                    __master_data,
28642                    Unknown(std::string::String),
28643                }
28644                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
28645                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28646                    where
28647                        D: serde::Deserializer<'de>,
28648                    {
28649                        struct Visitor;
28650                        impl<'de> serde::de::Visitor<'de> for Visitor {
28651                            type Value = __FieldTag;
28652                            fn expecting(
28653                                &self,
28654                                formatter: &mut std::fmt::Formatter,
28655                            ) -> std::fmt::Result {
28656                                formatter.write_str("a field name for MysqlExportOptions")
28657                            }
28658                            fn visit_str<E>(
28659                                self,
28660                                value: &str,
28661                            ) -> std::result::Result<Self::Value, E>
28662                            where
28663                                E: serde::de::Error,
28664                            {
28665                                use std::result::Result::Ok;
28666                                use std::string::ToString;
28667                                match value {
28668                                    "masterData" => Ok(__FieldTag::__master_data),
28669                                    "master_data" => Ok(__FieldTag::__master_data),
28670                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
28671                                }
28672                            }
28673                        }
28674                        deserializer.deserialize_identifier(Visitor)
28675                    }
28676                }
28677                struct Visitor;
28678                impl<'de> serde::de::Visitor<'de> for Visitor {
28679                    type Value = MysqlExportOptions;
28680                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
28681                        formatter.write_str("struct MysqlExportOptions")
28682                    }
28683                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
28684                    where
28685                        A: serde::de::MapAccess<'de>,
28686                    {
28687                        #[allow(unused_imports)]
28688                        use serde::de::Error;
28689                        use std::option::Option::Some;
28690                        let mut fields = std::collections::HashSet::new();
28691                        let mut result = Self::Value::new();
28692                        while let Some(tag) = map.next_key::<__FieldTag>()? {
28693                            #[allow(clippy::match_single_binding)]
28694                            match tag {
28695                                __FieldTag::__master_data => {
28696                                    if !fields.insert(__FieldTag::__master_data) {
28697                                        return std::result::Result::Err(
28698                                            A::Error::duplicate_field(
28699                                                "multiple values for master_data",
28700                                            ),
28701                                        );
28702                                    }
28703                                    struct __With(std::option::Option<wkt::Int32Value>);
28704                                    impl<'de> serde::de::Deserialize<'de> for __With {
28705                                        fn deserialize<D>(
28706                                            deserializer: D,
28707                                        ) -> std::result::Result<Self, D::Error>
28708                                        where
28709                                            D: serde::de::Deserializer<'de>,
28710                                        {
28711                                            serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
28712                                        }
28713                                    }
28714                                    result.master_data = map.next_value::<__With>()?.0;
28715                                }
28716                                __FieldTag::Unknown(key) => {
28717                                    let value = map.next_value::<serde_json::Value>()?;
28718                                    result._unknown_fields.insert(key, value);
28719                                }
28720                            }
28721                        }
28722                        std::result::Result::Ok(result)
28723                    }
28724                }
28725                deserializer.deserialize_any(Visitor)
28726            }
28727        }
28728
28729        #[doc(hidden)]
28730        impl serde::ser::Serialize for MysqlExportOptions {
28731            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28732            where
28733                S: serde::ser::Serializer,
28734            {
28735                use serde::ser::SerializeMap;
28736                #[allow(unused_imports)]
28737                use std::option::Option::Some;
28738                let mut state = serializer.serialize_map(std::option::Option::None)?;
28739                if self.master_data.is_some() {
28740                    struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
28741                    impl<'a> serde::ser::Serialize for __With<'a> {
28742                        fn serialize<S>(
28743                            &self,
28744                            serializer: S,
28745                        ) -> std::result::Result<S::Ok, S::Error>
28746                        where
28747                            S: serde::ser::Serializer,
28748                        {
28749                            serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
28750                                self.0, serializer,
28751                            )
28752                        }
28753                    }
28754                    state.serialize_entry("masterData", &__With(&self.master_data))?;
28755                }
28756                if !self._unknown_fields.is_empty() {
28757                    for (key, value) in self._unknown_fields.iter() {
28758                        state.serialize_entry(key, &value)?;
28759                    }
28760                }
28761                state.end()
28762            }
28763        }
28764
28765        impl std::fmt::Debug for MysqlExportOptions {
28766            fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
28767                let mut debug_struct = f.debug_struct("MysqlExportOptions");
28768                debug_struct.field("master_data", &self.master_data);
28769                if !self._unknown_fields.is_empty() {
28770                    debug_struct.field("_unknown_fields", &self._unknown_fields);
28771                }
28772                debug_struct.finish()
28773            }
28774        }
28775
28776        /// Options for exporting from a Cloud SQL for PostgreSQL instance.
28777        #[derive(Clone, Default, PartialEq)]
28778        #[non_exhaustive]
28779        pub struct PostgresExportOptions {
28780            /// Optional. Use this option to include DROP \<object\> SQL statements.
28781            /// These statements are used to delete database objects before running the
28782            /// import operation.
28783            pub clean: std::option::Option<wkt::BoolValue>,
28784
28785            /// Optional. Option to include an IF EXISTS SQL statement with each DROP
28786            /// statement produced by clean.
28787            pub if_exists: std::option::Option<wkt::BoolValue>,
28788
28789            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
28790        }
28791
28792        impl PostgresExportOptions {
28793            pub fn new() -> Self {
28794                std::default::Default::default()
28795            }
28796
28797            /// Sets the value of [clean][crate::model::export_context::sql_export_options::PostgresExportOptions::clean].
28798            pub fn set_clean<T>(mut self, v: T) -> Self
28799            where
28800                T: std::convert::Into<wkt::BoolValue>,
28801            {
28802                self.clean = std::option::Option::Some(v.into());
28803                self
28804            }
28805
28806            /// Sets or clears the value of [clean][crate::model::export_context::sql_export_options::PostgresExportOptions::clean].
28807            pub fn set_or_clear_clean<T>(mut self, v: std::option::Option<T>) -> Self
28808            where
28809                T: std::convert::Into<wkt::BoolValue>,
28810            {
28811                self.clean = v.map(|x| x.into());
28812                self
28813            }
28814
28815            /// Sets the value of [if_exists][crate::model::export_context::sql_export_options::PostgresExportOptions::if_exists].
28816            pub fn set_if_exists<T>(mut self, v: T) -> Self
28817            where
28818                T: std::convert::Into<wkt::BoolValue>,
28819            {
28820                self.if_exists = std::option::Option::Some(v.into());
28821                self
28822            }
28823
28824            /// Sets or clears the value of [if_exists][crate::model::export_context::sql_export_options::PostgresExportOptions::if_exists].
28825            pub fn set_or_clear_if_exists<T>(mut self, v: std::option::Option<T>) -> Self
28826            where
28827                T: std::convert::Into<wkt::BoolValue>,
28828            {
28829                self.if_exists = v.map(|x| x.into());
28830                self
28831            }
28832        }
28833
28834        impl wkt::message::Message for PostgresExportOptions {
28835            fn typename() -> &'static str {
28836                "type.googleapis.com/google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions"
28837            }
28838        }
28839
28840        #[doc(hidden)]
28841        impl<'de> serde::de::Deserialize<'de> for PostgresExportOptions {
28842            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28843            where
28844                D: serde::Deserializer<'de>,
28845            {
28846                #[allow(non_camel_case_types)]
28847                #[doc(hidden)]
28848                #[derive(PartialEq, Eq, Hash)]
28849                enum __FieldTag {
28850                    __clean,
28851                    __if_exists,
28852                    Unknown(std::string::String),
28853                }
28854                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
28855                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28856                    where
28857                        D: serde::Deserializer<'de>,
28858                    {
28859                        struct Visitor;
28860                        impl<'de> serde::de::Visitor<'de> for Visitor {
28861                            type Value = __FieldTag;
28862                            fn expecting(
28863                                &self,
28864                                formatter: &mut std::fmt::Formatter,
28865                            ) -> std::fmt::Result {
28866                                formatter.write_str("a field name for PostgresExportOptions")
28867                            }
28868                            fn visit_str<E>(
28869                                self,
28870                                value: &str,
28871                            ) -> std::result::Result<Self::Value, E>
28872                            where
28873                                E: serde::de::Error,
28874                            {
28875                                use std::result::Result::Ok;
28876                                use std::string::ToString;
28877                                match value {
28878                                    "clean" => Ok(__FieldTag::__clean),
28879                                    "ifExists" => Ok(__FieldTag::__if_exists),
28880                                    "if_exists" => Ok(__FieldTag::__if_exists),
28881                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
28882                                }
28883                            }
28884                        }
28885                        deserializer.deserialize_identifier(Visitor)
28886                    }
28887                }
28888                struct Visitor;
28889                impl<'de> serde::de::Visitor<'de> for Visitor {
28890                    type Value = PostgresExportOptions;
28891                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
28892                        formatter.write_str("struct PostgresExportOptions")
28893                    }
28894                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
28895                    where
28896                        A: serde::de::MapAccess<'de>,
28897                    {
28898                        #[allow(unused_imports)]
28899                        use serde::de::Error;
28900                        use std::option::Option::Some;
28901                        let mut fields = std::collections::HashSet::new();
28902                        let mut result = Self::Value::new();
28903                        while let Some(tag) = map.next_key::<__FieldTag>()? {
28904                            #[allow(clippy::match_single_binding)]
28905                            match tag {
28906                                __FieldTag::__clean => {
28907                                    if !fields.insert(__FieldTag::__clean) {
28908                                        return std::result::Result::Err(
28909                                            A::Error::duplicate_field("multiple values for clean"),
28910                                        );
28911                                    }
28912                                    result.clean =
28913                                        map.next_value::<std::option::Option<wkt::BoolValue>>()?;
28914                                }
28915                                __FieldTag::__if_exists => {
28916                                    if !fields.insert(__FieldTag::__if_exists) {
28917                                        return std::result::Result::Err(
28918                                            A::Error::duplicate_field(
28919                                                "multiple values for if_exists",
28920                                            ),
28921                                        );
28922                                    }
28923                                    result.if_exists =
28924                                        map.next_value::<std::option::Option<wkt::BoolValue>>()?;
28925                                }
28926                                __FieldTag::Unknown(key) => {
28927                                    let value = map.next_value::<serde_json::Value>()?;
28928                                    result._unknown_fields.insert(key, value);
28929                                }
28930                            }
28931                        }
28932                        std::result::Result::Ok(result)
28933                    }
28934                }
28935                deserializer.deserialize_any(Visitor)
28936            }
28937        }
28938
28939        #[doc(hidden)]
28940        impl serde::ser::Serialize for PostgresExportOptions {
28941            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28942            where
28943                S: serde::ser::Serializer,
28944            {
28945                use serde::ser::SerializeMap;
28946                #[allow(unused_imports)]
28947                use std::option::Option::Some;
28948                let mut state = serializer.serialize_map(std::option::Option::None)?;
28949                if self.clean.is_some() {
28950                    state.serialize_entry("clean", &self.clean)?;
28951                }
28952                if self.if_exists.is_some() {
28953                    state.serialize_entry("ifExists", &self.if_exists)?;
28954                }
28955                if !self._unknown_fields.is_empty() {
28956                    for (key, value) in self._unknown_fields.iter() {
28957                        state.serialize_entry(key, &value)?;
28958                    }
28959                }
28960                state.end()
28961            }
28962        }
28963
28964        impl std::fmt::Debug for PostgresExportOptions {
28965            fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
28966                let mut debug_struct = f.debug_struct("PostgresExportOptions");
28967                debug_struct.field("clean", &self.clean);
28968                debug_struct.field("if_exists", &self.if_exists);
28969                if !self._unknown_fields.is_empty() {
28970                    debug_struct.field("_unknown_fields", &self._unknown_fields);
28971                }
28972                debug_struct.finish()
28973            }
28974        }
28975    }
28976
28977    /// Options for exporting BAK files (SQL Server-only)
28978    #[derive(Clone, Default, PartialEq)]
28979    #[non_exhaustive]
28980    pub struct SqlBakExportOptions {
28981        /// Whether or not the export should be striped.
28982        pub striped: std::option::Option<wkt::BoolValue>,
28983
28984        /// Option for specifying how many stripes to use for the export.
28985        /// If blank, and the value of the striped field is true,
28986        /// the number of stripes is automatically chosen.
28987        pub stripe_count: std::option::Option<wkt::Int32Value>,
28988
28989        /// Type of this bak file will be export, FULL or DIFF, SQL Server only
28990        pub bak_type: crate::model::BakType,
28991
28992        /// Deprecated: copy_only is deprecated. Use differential_base instead
28993        #[deprecated]
28994        pub copy_only: std::option::Option<wkt::BoolValue>,
28995
28996        /// Whether or not the backup can be used as a differential base
28997        /// copy_only backup can not be served as differential base
28998        pub differential_base: std::option::Option<wkt::BoolValue>,
28999
29000        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
29001    }
29002
29003    impl SqlBakExportOptions {
29004        pub fn new() -> Self {
29005            std::default::Default::default()
29006        }
29007
29008        /// Sets the value of [striped][crate::model::export_context::SqlBakExportOptions::striped].
29009        pub fn set_striped<T>(mut self, v: T) -> Self
29010        where
29011            T: std::convert::Into<wkt::BoolValue>,
29012        {
29013            self.striped = std::option::Option::Some(v.into());
29014            self
29015        }
29016
29017        /// Sets or clears the value of [striped][crate::model::export_context::SqlBakExportOptions::striped].
29018        pub fn set_or_clear_striped<T>(mut self, v: std::option::Option<T>) -> Self
29019        where
29020            T: std::convert::Into<wkt::BoolValue>,
29021        {
29022            self.striped = v.map(|x| x.into());
29023            self
29024        }
29025
29026        /// Sets the value of [stripe_count][crate::model::export_context::SqlBakExportOptions::stripe_count].
29027        pub fn set_stripe_count<T>(mut self, v: T) -> Self
29028        where
29029            T: std::convert::Into<wkt::Int32Value>,
29030        {
29031            self.stripe_count = std::option::Option::Some(v.into());
29032            self
29033        }
29034
29035        /// Sets or clears the value of [stripe_count][crate::model::export_context::SqlBakExportOptions::stripe_count].
29036        pub fn set_or_clear_stripe_count<T>(mut self, v: std::option::Option<T>) -> Self
29037        where
29038            T: std::convert::Into<wkt::Int32Value>,
29039        {
29040            self.stripe_count = v.map(|x| x.into());
29041            self
29042        }
29043
29044        /// Sets the value of [bak_type][crate::model::export_context::SqlBakExportOptions::bak_type].
29045        pub fn set_bak_type<T: std::convert::Into<crate::model::BakType>>(mut self, v: T) -> Self {
29046            self.bak_type = v.into();
29047            self
29048        }
29049
29050        /// Sets the value of [copy_only][crate::model::export_context::SqlBakExportOptions::copy_only].
29051        #[deprecated]
29052        pub fn set_copy_only<T>(mut self, v: T) -> Self
29053        where
29054            T: std::convert::Into<wkt::BoolValue>,
29055        {
29056            self.copy_only = std::option::Option::Some(v.into());
29057            self
29058        }
29059
29060        /// Sets or clears the value of [copy_only][crate::model::export_context::SqlBakExportOptions::copy_only].
29061        #[deprecated]
29062        pub fn set_or_clear_copy_only<T>(mut self, v: std::option::Option<T>) -> Self
29063        where
29064            T: std::convert::Into<wkt::BoolValue>,
29065        {
29066            self.copy_only = v.map(|x| x.into());
29067            self
29068        }
29069
29070        /// Sets the value of [differential_base][crate::model::export_context::SqlBakExportOptions::differential_base].
29071        pub fn set_differential_base<T>(mut self, v: T) -> Self
29072        where
29073            T: std::convert::Into<wkt::BoolValue>,
29074        {
29075            self.differential_base = std::option::Option::Some(v.into());
29076            self
29077        }
29078
29079        /// Sets or clears the value of [differential_base][crate::model::export_context::SqlBakExportOptions::differential_base].
29080        pub fn set_or_clear_differential_base<T>(mut self, v: std::option::Option<T>) -> Self
29081        where
29082            T: std::convert::Into<wkt::BoolValue>,
29083        {
29084            self.differential_base = v.map(|x| x.into());
29085            self
29086        }
29087    }
29088
29089    impl wkt::message::Message for SqlBakExportOptions {
29090        fn typename() -> &'static str {
29091            "type.googleapis.com/google.cloud.sql.v1.ExportContext.SqlBakExportOptions"
29092        }
29093    }
29094
29095    #[doc(hidden)]
29096    impl<'de> serde::de::Deserialize<'de> for SqlBakExportOptions {
29097        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
29098        where
29099            D: serde::Deserializer<'de>,
29100        {
29101            #[allow(non_camel_case_types)]
29102            #[doc(hidden)]
29103            #[derive(PartialEq, Eq, Hash)]
29104            enum __FieldTag {
29105                __striped,
29106                __stripe_count,
29107                __bak_type,
29108                __copy_only,
29109                __differential_base,
29110                Unknown(std::string::String),
29111            }
29112            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
29113                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
29114                where
29115                    D: serde::Deserializer<'de>,
29116                {
29117                    struct Visitor;
29118                    impl<'de> serde::de::Visitor<'de> for Visitor {
29119                        type Value = __FieldTag;
29120                        fn expecting(
29121                            &self,
29122                            formatter: &mut std::fmt::Formatter,
29123                        ) -> std::fmt::Result {
29124                            formatter.write_str("a field name for SqlBakExportOptions")
29125                        }
29126                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
29127                        where
29128                            E: serde::de::Error,
29129                        {
29130                            use std::result::Result::Ok;
29131                            use std::string::ToString;
29132                            match value {
29133                                "striped" => Ok(__FieldTag::__striped),
29134                                "stripeCount" => Ok(__FieldTag::__stripe_count),
29135                                "stripe_count" => Ok(__FieldTag::__stripe_count),
29136                                "bakType" => Ok(__FieldTag::__bak_type),
29137                                "bak_type" => Ok(__FieldTag::__bak_type),
29138                                "copyOnly" => Ok(__FieldTag::__copy_only),
29139                                "copy_only" => Ok(__FieldTag::__copy_only),
29140                                "differentialBase" => Ok(__FieldTag::__differential_base),
29141                                "differential_base" => Ok(__FieldTag::__differential_base),
29142                                _ => Ok(__FieldTag::Unknown(value.to_string())),
29143                            }
29144                        }
29145                    }
29146                    deserializer.deserialize_identifier(Visitor)
29147                }
29148            }
29149            struct Visitor;
29150            impl<'de> serde::de::Visitor<'de> for Visitor {
29151                type Value = SqlBakExportOptions;
29152                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
29153                    formatter.write_str("struct SqlBakExportOptions")
29154                }
29155                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
29156                where
29157                    A: serde::de::MapAccess<'de>,
29158                {
29159                    #[allow(unused_imports)]
29160                    use serde::de::Error;
29161                    use std::option::Option::Some;
29162                    let mut fields = std::collections::HashSet::new();
29163                    let mut result = Self::Value::new();
29164                    while let Some(tag) = map.next_key::<__FieldTag>()? {
29165                        #[allow(clippy::match_single_binding)]
29166                        match tag {
29167                            __FieldTag::__striped => {
29168                                if !fields.insert(__FieldTag::__striped) {
29169                                    return std::result::Result::Err(A::Error::duplicate_field(
29170                                        "multiple values for striped",
29171                                    ));
29172                                }
29173                                result.striped =
29174                                    map.next_value::<std::option::Option<wkt::BoolValue>>()?;
29175                            }
29176                            __FieldTag::__stripe_count => {
29177                                if !fields.insert(__FieldTag::__stripe_count) {
29178                                    return std::result::Result::Err(A::Error::duplicate_field(
29179                                        "multiple values for stripe_count",
29180                                    ));
29181                                }
29182                                struct __With(std::option::Option<wkt::Int32Value>);
29183                                impl<'de> serde::de::Deserialize<'de> for __With {
29184                                    fn deserialize<D>(
29185                                        deserializer: D,
29186                                    ) -> std::result::Result<Self, D::Error>
29187                                    where
29188                                        D: serde::de::Deserializer<'de>,
29189                                    {
29190                                        serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
29191                                    }
29192                                }
29193                                result.stripe_count = map.next_value::<__With>()?.0;
29194                            }
29195                            __FieldTag::__bak_type => {
29196                                if !fields.insert(__FieldTag::__bak_type) {
29197                                    return std::result::Result::Err(A::Error::duplicate_field(
29198                                        "multiple values for bak_type",
29199                                    ));
29200                                }
29201                                result.bak_type = map
29202                                    .next_value::<std::option::Option<crate::model::BakType>>()?
29203                                    .unwrap_or_default();
29204                            }
29205                            __FieldTag::__copy_only => {
29206                                if !fields.insert(__FieldTag::__copy_only) {
29207                                    return std::result::Result::Err(A::Error::duplicate_field(
29208                                        "multiple values for copy_only",
29209                                    ));
29210                                }
29211                                result.copy_only =
29212                                    map.next_value::<std::option::Option<wkt::BoolValue>>()?;
29213                            }
29214                            __FieldTag::__differential_base => {
29215                                if !fields.insert(__FieldTag::__differential_base) {
29216                                    return std::result::Result::Err(A::Error::duplicate_field(
29217                                        "multiple values for differential_base",
29218                                    ));
29219                                }
29220                                result.differential_base =
29221                                    map.next_value::<std::option::Option<wkt::BoolValue>>()?;
29222                            }
29223                            __FieldTag::Unknown(key) => {
29224                                let value = map.next_value::<serde_json::Value>()?;
29225                                result._unknown_fields.insert(key, value);
29226                            }
29227                        }
29228                    }
29229                    std::result::Result::Ok(result)
29230                }
29231            }
29232            deserializer.deserialize_any(Visitor)
29233        }
29234    }
29235
29236    #[doc(hidden)]
29237    impl serde::ser::Serialize for SqlBakExportOptions {
29238        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
29239        where
29240            S: serde::ser::Serializer,
29241        {
29242            use serde::ser::SerializeMap;
29243            #[allow(unused_imports)]
29244            use std::option::Option::Some;
29245            let mut state = serializer.serialize_map(std::option::Option::None)?;
29246            if self.striped.is_some() {
29247                state.serialize_entry("striped", &self.striped)?;
29248            }
29249            if self.stripe_count.is_some() {
29250                struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
29251                impl<'a> serde::ser::Serialize for __With<'a> {
29252                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
29253                    where
29254                        S: serde::ser::Serializer,
29255                    {
29256                        serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
29257                            self.0, serializer,
29258                        )
29259                    }
29260                }
29261                state.serialize_entry("stripeCount", &__With(&self.stripe_count))?;
29262            }
29263            if !wkt::internal::is_default(&self.bak_type) {
29264                state.serialize_entry("bakType", &self.bak_type)?;
29265            }
29266            if self.copy_only.is_some() {
29267                state.serialize_entry("copyOnly", &self.copy_only)?;
29268            }
29269            if self.differential_base.is_some() {
29270                state.serialize_entry("differentialBase", &self.differential_base)?;
29271            }
29272            if !self._unknown_fields.is_empty() {
29273                for (key, value) in self._unknown_fields.iter() {
29274                    state.serialize_entry(key, &value)?;
29275                }
29276            }
29277            state.end()
29278        }
29279    }
29280
29281    impl std::fmt::Debug for SqlBakExportOptions {
29282        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
29283            let mut debug_struct = f.debug_struct("SqlBakExportOptions");
29284            debug_struct.field("striped", &self.striped);
29285            debug_struct.field("stripe_count", &self.stripe_count);
29286            debug_struct.field("bak_type", &self.bak_type);
29287            debug_struct.field("copy_only", &self.copy_only);
29288            debug_struct.field("differential_base", &self.differential_base);
29289            if !self._unknown_fields.is_empty() {
29290                debug_struct.field("_unknown_fields", &self._unknown_fields);
29291            }
29292            debug_struct.finish()
29293        }
29294    }
29295}
29296
29297/// Database instance import context.
29298#[derive(Clone, Default, PartialEq)]
29299#[non_exhaustive]
29300pub struct ImportContext {
29301    /// Path to the import file in Cloud Storage, in the form
29302    /// `gs://bucketName/fileName`. Compressed gzip files (.gz) are supported
29303    /// when `fileType` is `SQL`. The instance must have
29304    /// write permissions to the bucket and read access to the file.
29305    pub uri: std::string::String,
29306
29307    /// The target database for the import. If `fileType` is `SQL`, this field
29308    /// is required only if the import file does not specify a database, and is
29309    /// overridden by any database specification in the import file. If
29310    /// `fileType` is `CSV`, one database must be specified.
29311    pub database: std::string::String,
29312
29313    /// This is always `sql#importContext`.
29314    pub kind: std::string::String,
29315
29316    /// The file type for the specified uri.\`SQL`: The file
29317    /// contains SQL statements. \`CSV`: The file contains CSV data.
29318    pub file_type: crate::model::SqlFileType,
29319
29320    /// Options for importing data as CSV.
29321    pub csv_import_options: std::option::Option<crate::model::import_context::SqlCsvImportOptions>,
29322
29323    /// The PostgreSQL user for this import operation. PostgreSQL instances only.
29324    pub import_user: std::string::String,
29325
29326    /// Import parameters specific to SQL Server .BAK files
29327    pub bak_import_options: std::option::Option<crate::model::import_context::SqlBakImportOptions>,
29328
29329    /// Optional. Options for importing data from SQL statements.
29330    pub sql_import_options: std::option::Option<crate::model::import_context::SqlImportOptions>,
29331
29332    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
29333}
29334
29335impl ImportContext {
29336    pub fn new() -> Self {
29337        std::default::Default::default()
29338    }
29339
29340    /// Sets the value of [uri][crate::model::ImportContext::uri].
29341    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
29342        self.uri = v.into();
29343        self
29344    }
29345
29346    /// Sets the value of [database][crate::model::ImportContext::database].
29347    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
29348        self.database = v.into();
29349        self
29350    }
29351
29352    /// Sets the value of [kind][crate::model::ImportContext::kind].
29353    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
29354        self.kind = v.into();
29355        self
29356    }
29357
29358    /// Sets the value of [file_type][crate::model::ImportContext::file_type].
29359    pub fn set_file_type<T: std::convert::Into<crate::model::SqlFileType>>(mut self, v: T) -> Self {
29360        self.file_type = v.into();
29361        self
29362    }
29363
29364    /// Sets the value of [csv_import_options][crate::model::ImportContext::csv_import_options].
29365    pub fn set_csv_import_options<T>(mut self, v: T) -> Self
29366    where
29367        T: std::convert::Into<crate::model::import_context::SqlCsvImportOptions>,
29368    {
29369        self.csv_import_options = std::option::Option::Some(v.into());
29370        self
29371    }
29372
29373    /// Sets or clears the value of [csv_import_options][crate::model::ImportContext::csv_import_options].
29374    pub fn set_or_clear_csv_import_options<T>(mut self, v: std::option::Option<T>) -> Self
29375    where
29376        T: std::convert::Into<crate::model::import_context::SqlCsvImportOptions>,
29377    {
29378        self.csv_import_options = v.map(|x| x.into());
29379        self
29380    }
29381
29382    /// Sets the value of [import_user][crate::model::ImportContext::import_user].
29383    pub fn set_import_user<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
29384        self.import_user = v.into();
29385        self
29386    }
29387
29388    /// Sets the value of [bak_import_options][crate::model::ImportContext::bak_import_options].
29389    pub fn set_bak_import_options<T>(mut self, v: T) -> Self
29390    where
29391        T: std::convert::Into<crate::model::import_context::SqlBakImportOptions>,
29392    {
29393        self.bak_import_options = std::option::Option::Some(v.into());
29394        self
29395    }
29396
29397    /// Sets or clears the value of [bak_import_options][crate::model::ImportContext::bak_import_options].
29398    pub fn set_or_clear_bak_import_options<T>(mut self, v: std::option::Option<T>) -> Self
29399    where
29400        T: std::convert::Into<crate::model::import_context::SqlBakImportOptions>,
29401    {
29402        self.bak_import_options = v.map(|x| x.into());
29403        self
29404    }
29405
29406    /// Sets the value of [sql_import_options][crate::model::ImportContext::sql_import_options].
29407    pub fn set_sql_import_options<T>(mut self, v: T) -> Self
29408    where
29409        T: std::convert::Into<crate::model::import_context::SqlImportOptions>,
29410    {
29411        self.sql_import_options = std::option::Option::Some(v.into());
29412        self
29413    }
29414
29415    /// Sets or clears the value of [sql_import_options][crate::model::ImportContext::sql_import_options].
29416    pub fn set_or_clear_sql_import_options<T>(mut self, v: std::option::Option<T>) -> Self
29417    where
29418        T: std::convert::Into<crate::model::import_context::SqlImportOptions>,
29419    {
29420        self.sql_import_options = v.map(|x| x.into());
29421        self
29422    }
29423}
29424
29425impl wkt::message::Message for ImportContext {
29426    fn typename() -> &'static str {
29427        "type.googleapis.com/google.cloud.sql.v1.ImportContext"
29428    }
29429}
29430
29431#[doc(hidden)]
29432impl<'de> serde::de::Deserialize<'de> for ImportContext {
29433    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
29434    where
29435        D: serde::Deserializer<'de>,
29436    {
29437        #[allow(non_camel_case_types)]
29438        #[doc(hidden)]
29439        #[derive(PartialEq, Eq, Hash)]
29440        enum __FieldTag {
29441            __uri,
29442            __database,
29443            __kind,
29444            __file_type,
29445            __csv_import_options,
29446            __import_user,
29447            __bak_import_options,
29448            __sql_import_options,
29449            Unknown(std::string::String),
29450        }
29451        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
29452            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
29453            where
29454                D: serde::Deserializer<'de>,
29455            {
29456                struct Visitor;
29457                impl<'de> serde::de::Visitor<'de> for Visitor {
29458                    type Value = __FieldTag;
29459                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
29460                        formatter.write_str("a field name for ImportContext")
29461                    }
29462                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
29463                    where
29464                        E: serde::de::Error,
29465                    {
29466                        use std::result::Result::Ok;
29467                        use std::string::ToString;
29468                        match value {
29469                            "uri" => Ok(__FieldTag::__uri),
29470                            "database" => Ok(__FieldTag::__database),
29471                            "kind" => Ok(__FieldTag::__kind),
29472                            "fileType" => Ok(__FieldTag::__file_type),
29473                            "file_type" => Ok(__FieldTag::__file_type),
29474                            "csvImportOptions" => Ok(__FieldTag::__csv_import_options),
29475                            "csv_import_options" => Ok(__FieldTag::__csv_import_options),
29476                            "importUser" => Ok(__FieldTag::__import_user),
29477                            "import_user" => Ok(__FieldTag::__import_user),
29478                            "bakImportOptions" => Ok(__FieldTag::__bak_import_options),
29479                            "bak_import_options" => Ok(__FieldTag::__bak_import_options),
29480                            "sqlImportOptions" => Ok(__FieldTag::__sql_import_options),
29481                            "sql_import_options" => Ok(__FieldTag::__sql_import_options),
29482                            _ => Ok(__FieldTag::Unknown(value.to_string())),
29483                        }
29484                    }
29485                }
29486                deserializer.deserialize_identifier(Visitor)
29487            }
29488        }
29489        struct Visitor;
29490        impl<'de> serde::de::Visitor<'de> for Visitor {
29491            type Value = ImportContext;
29492            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
29493                formatter.write_str("struct ImportContext")
29494            }
29495            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
29496            where
29497                A: serde::de::MapAccess<'de>,
29498            {
29499                #[allow(unused_imports)]
29500                use serde::de::Error;
29501                use std::option::Option::Some;
29502                let mut fields = std::collections::HashSet::new();
29503                let mut result = Self::Value::new();
29504                while let Some(tag) = map.next_key::<__FieldTag>()? {
29505                    #[allow(clippy::match_single_binding)]
29506                    match tag {
29507                        __FieldTag::__uri => {
29508                            if !fields.insert(__FieldTag::__uri) {
29509                                return std::result::Result::Err(A::Error::duplicate_field(
29510                                    "multiple values for uri",
29511                                ));
29512                            }
29513                            result.uri = map
29514                                .next_value::<std::option::Option<std::string::String>>()?
29515                                .unwrap_or_default();
29516                        }
29517                        __FieldTag::__database => {
29518                            if !fields.insert(__FieldTag::__database) {
29519                                return std::result::Result::Err(A::Error::duplicate_field(
29520                                    "multiple values for database",
29521                                ));
29522                            }
29523                            result.database = map
29524                                .next_value::<std::option::Option<std::string::String>>()?
29525                                .unwrap_or_default();
29526                        }
29527                        __FieldTag::__kind => {
29528                            if !fields.insert(__FieldTag::__kind) {
29529                                return std::result::Result::Err(A::Error::duplicate_field(
29530                                    "multiple values for kind",
29531                                ));
29532                            }
29533                            result.kind = map
29534                                .next_value::<std::option::Option<std::string::String>>()?
29535                                .unwrap_or_default();
29536                        }
29537                        __FieldTag::__file_type => {
29538                            if !fields.insert(__FieldTag::__file_type) {
29539                                return std::result::Result::Err(A::Error::duplicate_field(
29540                                    "multiple values for file_type",
29541                                ));
29542                            }
29543                            result.file_type = map
29544                                .next_value::<std::option::Option<crate::model::SqlFileType>>()?
29545                                .unwrap_or_default();
29546                        }
29547                        __FieldTag::__csv_import_options => {
29548                            if !fields.insert(__FieldTag::__csv_import_options) {
29549                                return std::result::Result::Err(A::Error::duplicate_field(
29550                                    "multiple values for csv_import_options",
29551                                ));
29552                            }
29553                            result.csv_import_options = map.next_value::<std::option::Option<
29554                                crate::model::import_context::SqlCsvImportOptions,
29555                            >>()?;
29556                        }
29557                        __FieldTag::__import_user => {
29558                            if !fields.insert(__FieldTag::__import_user) {
29559                                return std::result::Result::Err(A::Error::duplicate_field(
29560                                    "multiple values for import_user",
29561                                ));
29562                            }
29563                            result.import_user = map
29564                                .next_value::<std::option::Option<std::string::String>>()?
29565                                .unwrap_or_default();
29566                        }
29567                        __FieldTag::__bak_import_options => {
29568                            if !fields.insert(__FieldTag::__bak_import_options) {
29569                                return std::result::Result::Err(A::Error::duplicate_field(
29570                                    "multiple values for bak_import_options",
29571                                ));
29572                            }
29573                            result.bak_import_options = map.next_value::<std::option::Option<
29574                                crate::model::import_context::SqlBakImportOptions,
29575                            >>()?;
29576                        }
29577                        __FieldTag::__sql_import_options => {
29578                            if !fields.insert(__FieldTag::__sql_import_options) {
29579                                return std::result::Result::Err(A::Error::duplicate_field(
29580                                    "multiple values for sql_import_options",
29581                                ));
29582                            }
29583                            result.sql_import_options = map.next_value::<std::option::Option<
29584                                crate::model::import_context::SqlImportOptions,
29585                            >>()?;
29586                        }
29587                        __FieldTag::Unknown(key) => {
29588                            let value = map.next_value::<serde_json::Value>()?;
29589                            result._unknown_fields.insert(key, value);
29590                        }
29591                    }
29592                }
29593                std::result::Result::Ok(result)
29594            }
29595        }
29596        deserializer.deserialize_any(Visitor)
29597    }
29598}
29599
29600#[doc(hidden)]
29601impl serde::ser::Serialize for ImportContext {
29602    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
29603    where
29604        S: serde::ser::Serializer,
29605    {
29606        use serde::ser::SerializeMap;
29607        #[allow(unused_imports)]
29608        use std::option::Option::Some;
29609        let mut state = serializer.serialize_map(std::option::Option::None)?;
29610        if !self.uri.is_empty() {
29611            state.serialize_entry("uri", &self.uri)?;
29612        }
29613        if !self.database.is_empty() {
29614            state.serialize_entry("database", &self.database)?;
29615        }
29616        if !self.kind.is_empty() {
29617            state.serialize_entry("kind", &self.kind)?;
29618        }
29619        if !wkt::internal::is_default(&self.file_type) {
29620            state.serialize_entry("fileType", &self.file_type)?;
29621        }
29622        if self.csv_import_options.is_some() {
29623            state.serialize_entry("csvImportOptions", &self.csv_import_options)?;
29624        }
29625        if !self.import_user.is_empty() {
29626            state.serialize_entry("importUser", &self.import_user)?;
29627        }
29628        if self.bak_import_options.is_some() {
29629            state.serialize_entry("bakImportOptions", &self.bak_import_options)?;
29630        }
29631        if self.sql_import_options.is_some() {
29632            state.serialize_entry("sqlImportOptions", &self.sql_import_options)?;
29633        }
29634        if !self._unknown_fields.is_empty() {
29635            for (key, value) in self._unknown_fields.iter() {
29636                state.serialize_entry(key, &value)?;
29637            }
29638        }
29639        state.end()
29640    }
29641}
29642
29643impl std::fmt::Debug for ImportContext {
29644    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
29645        let mut debug_struct = f.debug_struct("ImportContext");
29646        debug_struct.field("uri", &self.uri);
29647        debug_struct.field("database", &self.database);
29648        debug_struct.field("kind", &self.kind);
29649        debug_struct.field("file_type", &self.file_type);
29650        debug_struct.field("csv_import_options", &self.csv_import_options);
29651        debug_struct.field("import_user", &self.import_user);
29652        debug_struct.field("bak_import_options", &self.bak_import_options);
29653        debug_struct.field("sql_import_options", &self.sql_import_options);
29654        if !self._unknown_fields.is_empty() {
29655            debug_struct.field("_unknown_fields", &self._unknown_fields);
29656        }
29657        debug_struct.finish()
29658    }
29659}
29660
29661/// Defines additional types related to [ImportContext].
29662pub mod import_context {
29663    #[allow(unused_imports)]
29664    use super::*;
29665
29666    #[derive(Clone, Default, PartialEq)]
29667    #[non_exhaustive]
29668    pub struct SqlImportOptions {
29669        /// Optional. The number of threads to use for parallel import.
29670        pub threads: std::option::Option<wkt::Int32Value>,
29671
29672        /// Optional. Whether or not the import should be parallel.
29673        pub parallel: std::option::Option<wkt::BoolValue>,
29674
29675        /// Optional. Options for importing from a Cloud SQL for PostgreSQL instance.
29676        pub postgres_import_options: std::option::Option<
29677            crate::model::import_context::sql_import_options::PostgresImportOptions,
29678        >,
29679
29680        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
29681    }
29682
29683    impl SqlImportOptions {
29684        pub fn new() -> Self {
29685            std::default::Default::default()
29686        }
29687
29688        /// Sets the value of [threads][crate::model::import_context::SqlImportOptions::threads].
29689        pub fn set_threads<T>(mut self, v: T) -> Self
29690        where
29691            T: std::convert::Into<wkt::Int32Value>,
29692        {
29693            self.threads = std::option::Option::Some(v.into());
29694            self
29695        }
29696
29697        /// Sets or clears the value of [threads][crate::model::import_context::SqlImportOptions::threads].
29698        pub fn set_or_clear_threads<T>(mut self, v: std::option::Option<T>) -> Self
29699        where
29700            T: std::convert::Into<wkt::Int32Value>,
29701        {
29702            self.threads = v.map(|x| x.into());
29703            self
29704        }
29705
29706        /// Sets the value of [parallel][crate::model::import_context::SqlImportOptions::parallel].
29707        pub fn set_parallel<T>(mut self, v: T) -> Self
29708        where
29709            T: std::convert::Into<wkt::BoolValue>,
29710        {
29711            self.parallel = std::option::Option::Some(v.into());
29712            self
29713        }
29714
29715        /// Sets or clears the value of [parallel][crate::model::import_context::SqlImportOptions::parallel].
29716        pub fn set_or_clear_parallel<T>(mut self, v: std::option::Option<T>) -> Self
29717        where
29718            T: std::convert::Into<wkt::BoolValue>,
29719        {
29720            self.parallel = v.map(|x| x.into());
29721            self
29722        }
29723
29724        /// Sets the value of [postgres_import_options][crate::model::import_context::SqlImportOptions::postgres_import_options].
29725        pub fn set_postgres_import_options<T>(mut self, v: T) -> Self
29726        where
29727            T: std::convert::Into<
29728                    crate::model::import_context::sql_import_options::PostgresImportOptions,
29729                >,
29730        {
29731            self.postgres_import_options = std::option::Option::Some(v.into());
29732            self
29733        }
29734
29735        /// Sets or clears the value of [postgres_import_options][crate::model::import_context::SqlImportOptions::postgres_import_options].
29736        pub fn set_or_clear_postgres_import_options<T>(mut self, v: std::option::Option<T>) -> Self
29737        where
29738            T: std::convert::Into<
29739                    crate::model::import_context::sql_import_options::PostgresImportOptions,
29740                >,
29741        {
29742            self.postgres_import_options = v.map(|x| x.into());
29743            self
29744        }
29745    }
29746
29747    impl wkt::message::Message for SqlImportOptions {
29748        fn typename() -> &'static str {
29749            "type.googleapis.com/google.cloud.sql.v1.ImportContext.SqlImportOptions"
29750        }
29751    }
29752
29753    #[doc(hidden)]
29754    impl<'de> serde::de::Deserialize<'de> for SqlImportOptions {
29755        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
29756        where
29757            D: serde::Deserializer<'de>,
29758        {
29759            #[allow(non_camel_case_types)]
29760            #[doc(hidden)]
29761            #[derive(PartialEq, Eq, Hash)]
29762            enum __FieldTag {
29763                __threads,
29764                __parallel,
29765                __postgres_import_options,
29766                Unknown(std::string::String),
29767            }
29768            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
29769                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
29770                where
29771                    D: serde::Deserializer<'de>,
29772                {
29773                    struct Visitor;
29774                    impl<'de> serde::de::Visitor<'de> for Visitor {
29775                        type Value = __FieldTag;
29776                        fn expecting(
29777                            &self,
29778                            formatter: &mut std::fmt::Formatter,
29779                        ) -> std::fmt::Result {
29780                            formatter.write_str("a field name for SqlImportOptions")
29781                        }
29782                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
29783                        where
29784                            E: serde::de::Error,
29785                        {
29786                            use std::result::Result::Ok;
29787                            use std::string::ToString;
29788                            match value {
29789                                "threads" => Ok(__FieldTag::__threads),
29790                                "parallel" => Ok(__FieldTag::__parallel),
29791                                "postgresImportOptions" => {
29792                                    Ok(__FieldTag::__postgres_import_options)
29793                                }
29794                                "postgres_import_options" => {
29795                                    Ok(__FieldTag::__postgres_import_options)
29796                                }
29797                                _ => Ok(__FieldTag::Unknown(value.to_string())),
29798                            }
29799                        }
29800                    }
29801                    deserializer.deserialize_identifier(Visitor)
29802                }
29803            }
29804            struct Visitor;
29805            impl<'de> serde::de::Visitor<'de> for Visitor {
29806                type Value = SqlImportOptions;
29807                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
29808                    formatter.write_str("struct SqlImportOptions")
29809                }
29810                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
29811                where
29812                    A: serde::de::MapAccess<'de>,
29813                {
29814                    #[allow(unused_imports)]
29815                    use serde::de::Error;
29816                    use std::option::Option::Some;
29817                    let mut fields = std::collections::HashSet::new();
29818                    let mut result = Self::Value::new();
29819                    while let Some(tag) = map.next_key::<__FieldTag>()? {
29820                        #[allow(clippy::match_single_binding)]
29821                        match tag {
29822                            __FieldTag::__threads => {
29823                                if !fields.insert(__FieldTag::__threads) {
29824                                    return std::result::Result::Err(A::Error::duplicate_field(
29825                                        "multiple values for threads",
29826                                    ));
29827                                }
29828                                struct __With(std::option::Option<wkt::Int32Value>);
29829                                impl<'de> serde::de::Deserialize<'de> for __With {
29830                                    fn deserialize<D>(
29831                                        deserializer: D,
29832                                    ) -> std::result::Result<Self, D::Error>
29833                                    where
29834                                        D: serde::de::Deserializer<'de>,
29835                                    {
29836                                        serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
29837                                    }
29838                                }
29839                                result.threads = map.next_value::<__With>()?.0;
29840                            }
29841                            __FieldTag::__parallel => {
29842                                if !fields.insert(__FieldTag::__parallel) {
29843                                    return std::result::Result::Err(A::Error::duplicate_field(
29844                                        "multiple values for parallel",
29845                                    ));
29846                                }
29847                                result.parallel =
29848                                    map.next_value::<std::option::Option<wkt::BoolValue>>()?;
29849                            }
29850                            __FieldTag::__postgres_import_options => {
29851                                if !fields.insert(__FieldTag::__postgres_import_options) {
29852                                    return std::result::Result::Err(A::Error::duplicate_field(
29853                                        "multiple values for postgres_import_options",
29854                                    ));
29855                                }
29856                                result.postgres_import_options = map.next_value::<std::option::Option<crate::model::import_context::sql_import_options::PostgresImportOptions>>()?
29857                                    ;
29858                            }
29859                            __FieldTag::Unknown(key) => {
29860                                let value = map.next_value::<serde_json::Value>()?;
29861                                result._unknown_fields.insert(key, value);
29862                            }
29863                        }
29864                    }
29865                    std::result::Result::Ok(result)
29866                }
29867            }
29868            deserializer.deserialize_any(Visitor)
29869        }
29870    }
29871
29872    #[doc(hidden)]
29873    impl serde::ser::Serialize for SqlImportOptions {
29874        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
29875        where
29876            S: serde::ser::Serializer,
29877        {
29878            use serde::ser::SerializeMap;
29879            #[allow(unused_imports)]
29880            use std::option::Option::Some;
29881            let mut state = serializer.serialize_map(std::option::Option::None)?;
29882            if self.threads.is_some() {
29883                struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
29884                impl<'a> serde::ser::Serialize for __With<'a> {
29885                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
29886                    where
29887                        S: serde::ser::Serializer,
29888                    {
29889                        serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
29890                            self.0, serializer,
29891                        )
29892                    }
29893                }
29894                state.serialize_entry("threads", &__With(&self.threads))?;
29895            }
29896            if self.parallel.is_some() {
29897                state.serialize_entry("parallel", &self.parallel)?;
29898            }
29899            if self.postgres_import_options.is_some() {
29900                state.serialize_entry("postgresImportOptions", &self.postgres_import_options)?;
29901            }
29902            if !self._unknown_fields.is_empty() {
29903                for (key, value) in self._unknown_fields.iter() {
29904                    state.serialize_entry(key, &value)?;
29905                }
29906            }
29907            state.end()
29908        }
29909    }
29910
29911    impl std::fmt::Debug for SqlImportOptions {
29912        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
29913            let mut debug_struct = f.debug_struct("SqlImportOptions");
29914            debug_struct.field("threads", &self.threads);
29915            debug_struct.field("parallel", &self.parallel);
29916            debug_struct.field("postgres_import_options", &self.postgres_import_options);
29917            if !self._unknown_fields.is_empty() {
29918                debug_struct.field("_unknown_fields", &self._unknown_fields);
29919            }
29920            debug_struct.finish()
29921        }
29922    }
29923
29924    /// Defines additional types related to [SqlImportOptions].
29925    pub mod sql_import_options {
29926        #[allow(unused_imports)]
29927        use super::*;
29928
29929        #[derive(Clone, Default, PartialEq)]
29930        #[non_exhaustive]
29931        pub struct PostgresImportOptions {
29932            /// Optional. The --clean flag for the pg_restore utility. This flag
29933            /// applies only if you enabled Cloud SQL to import files in parallel.
29934            pub clean: std::option::Option<wkt::BoolValue>,
29935
29936            /// Optional. The --if-exists flag for the pg_restore utility. This flag
29937            /// applies only if you enabled Cloud SQL to import files in parallel.
29938            pub if_exists: std::option::Option<wkt::BoolValue>,
29939
29940            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
29941        }
29942
29943        impl PostgresImportOptions {
29944            pub fn new() -> Self {
29945                std::default::Default::default()
29946            }
29947
29948            /// Sets the value of [clean][crate::model::import_context::sql_import_options::PostgresImportOptions::clean].
29949            pub fn set_clean<T>(mut self, v: T) -> Self
29950            where
29951                T: std::convert::Into<wkt::BoolValue>,
29952            {
29953                self.clean = std::option::Option::Some(v.into());
29954                self
29955            }
29956
29957            /// Sets or clears the value of [clean][crate::model::import_context::sql_import_options::PostgresImportOptions::clean].
29958            pub fn set_or_clear_clean<T>(mut self, v: std::option::Option<T>) -> Self
29959            where
29960                T: std::convert::Into<wkt::BoolValue>,
29961            {
29962                self.clean = v.map(|x| x.into());
29963                self
29964            }
29965
29966            /// Sets the value of [if_exists][crate::model::import_context::sql_import_options::PostgresImportOptions::if_exists].
29967            pub fn set_if_exists<T>(mut self, v: T) -> Self
29968            where
29969                T: std::convert::Into<wkt::BoolValue>,
29970            {
29971                self.if_exists = std::option::Option::Some(v.into());
29972                self
29973            }
29974
29975            /// Sets or clears the value of [if_exists][crate::model::import_context::sql_import_options::PostgresImportOptions::if_exists].
29976            pub fn set_or_clear_if_exists<T>(mut self, v: std::option::Option<T>) -> Self
29977            where
29978                T: std::convert::Into<wkt::BoolValue>,
29979            {
29980                self.if_exists = v.map(|x| x.into());
29981                self
29982            }
29983        }
29984
29985        impl wkt::message::Message for PostgresImportOptions {
29986            fn typename() -> &'static str {
29987                "type.googleapis.com/google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions"
29988            }
29989        }
29990
29991        #[doc(hidden)]
29992        impl<'de> serde::de::Deserialize<'de> for PostgresImportOptions {
29993            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
29994            where
29995                D: serde::Deserializer<'de>,
29996            {
29997                #[allow(non_camel_case_types)]
29998                #[doc(hidden)]
29999                #[derive(PartialEq, Eq, Hash)]
30000                enum __FieldTag {
30001                    __clean,
30002                    __if_exists,
30003                    Unknown(std::string::String),
30004                }
30005                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
30006                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30007                    where
30008                        D: serde::Deserializer<'de>,
30009                    {
30010                        struct Visitor;
30011                        impl<'de> serde::de::Visitor<'de> for Visitor {
30012                            type Value = __FieldTag;
30013                            fn expecting(
30014                                &self,
30015                                formatter: &mut std::fmt::Formatter,
30016                            ) -> std::fmt::Result {
30017                                formatter.write_str("a field name for PostgresImportOptions")
30018                            }
30019                            fn visit_str<E>(
30020                                self,
30021                                value: &str,
30022                            ) -> std::result::Result<Self::Value, E>
30023                            where
30024                                E: serde::de::Error,
30025                            {
30026                                use std::result::Result::Ok;
30027                                use std::string::ToString;
30028                                match value {
30029                                    "clean" => Ok(__FieldTag::__clean),
30030                                    "ifExists" => Ok(__FieldTag::__if_exists),
30031                                    "if_exists" => Ok(__FieldTag::__if_exists),
30032                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
30033                                }
30034                            }
30035                        }
30036                        deserializer.deserialize_identifier(Visitor)
30037                    }
30038                }
30039                struct Visitor;
30040                impl<'de> serde::de::Visitor<'de> for Visitor {
30041                    type Value = PostgresImportOptions;
30042                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
30043                        formatter.write_str("struct PostgresImportOptions")
30044                    }
30045                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
30046                    where
30047                        A: serde::de::MapAccess<'de>,
30048                    {
30049                        #[allow(unused_imports)]
30050                        use serde::de::Error;
30051                        use std::option::Option::Some;
30052                        let mut fields = std::collections::HashSet::new();
30053                        let mut result = Self::Value::new();
30054                        while let Some(tag) = map.next_key::<__FieldTag>()? {
30055                            #[allow(clippy::match_single_binding)]
30056                            match tag {
30057                                __FieldTag::__clean => {
30058                                    if !fields.insert(__FieldTag::__clean) {
30059                                        return std::result::Result::Err(
30060                                            A::Error::duplicate_field("multiple values for clean"),
30061                                        );
30062                                    }
30063                                    result.clean =
30064                                        map.next_value::<std::option::Option<wkt::BoolValue>>()?;
30065                                }
30066                                __FieldTag::__if_exists => {
30067                                    if !fields.insert(__FieldTag::__if_exists) {
30068                                        return std::result::Result::Err(
30069                                            A::Error::duplicate_field(
30070                                                "multiple values for if_exists",
30071                                            ),
30072                                        );
30073                                    }
30074                                    result.if_exists =
30075                                        map.next_value::<std::option::Option<wkt::BoolValue>>()?;
30076                                }
30077                                __FieldTag::Unknown(key) => {
30078                                    let value = map.next_value::<serde_json::Value>()?;
30079                                    result._unknown_fields.insert(key, value);
30080                                }
30081                            }
30082                        }
30083                        std::result::Result::Ok(result)
30084                    }
30085                }
30086                deserializer.deserialize_any(Visitor)
30087            }
30088        }
30089
30090        #[doc(hidden)]
30091        impl serde::ser::Serialize for PostgresImportOptions {
30092            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
30093            where
30094                S: serde::ser::Serializer,
30095            {
30096                use serde::ser::SerializeMap;
30097                #[allow(unused_imports)]
30098                use std::option::Option::Some;
30099                let mut state = serializer.serialize_map(std::option::Option::None)?;
30100                if self.clean.is_some() {
30101                    state.serialize_entry("clean", &self.clean)?;
30102                }
30103                if self.if_exists.is_some() {
30104                    state.serialize_entry("ifExists", &self.if_exists)?;
30105                }
30106                if !self._unknown_fields.is_empty() {
30107                    for (key, value) in self._unknown_fields.iter() {
30108                        state.serialize_entry(key, &value)?;
30109                    }
30110                }
30111                state.end()
30112            }
30113        }
30114
30115        impl std::fmt::Debug for PostgresImportOptions {
30116            fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
30117                let mut debug_struct = f.debug_struct("PostgresImportOptions");
30118                debug_struct.field("clean", &self.clean);
30119                debug_struct.field("if_exists", &self.if_exists);
30120                if !self._unknown_fields.is_empty() {
30121                    debug_struct.field("_unknown_fields", &self._unknown_fields);
30122                }
30123                debug_struct.finish()
30124            }
30125        }
30126    }
30127
30128    #[derive(Clone, Default, PartialEq)]
30129    #[non_exhaustive]
30130    pub struct SqlCsvImportOptions {
30131        /// The table to which CSV data is imported.
30132        pub table: std::string::String,
30133
30134        /// The columns to which CSV data is imported. If not specified, all columns
30135        /// of the database table are loaded with CSV data.
30136        pub columns: std::vec::Vec<std::string::String>,
30137
30138        /// Specifies the character that should appear before a data character that
30139        /// needs to be escaped.
30140        pub escape_character: std::string::String,
30141
30142        /// Specifies the quoting character to be used when a data value is quoted.
30143        pub quote_character: std::string::String,
30144
30145        /// Specifies the character that separates columns within each row (line) of
30146        /// the file.
30147        pub fields_terminated_by: std::string::String,
30148
30149        /// This is used to separate lines. If a line does not contain all fields,
30150        /// the rest of the columns are set to their default values.
30151        pub lines_terminated_by: std::string::String,
30152
30153        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
30154    }
30155
30156    impl SqlCsvImportOptions {
30157        pub fn new() -> Self {
30158            std::default::Default::default()
30159        }
30160
30161        /// Sets the value of [table][crate::model::import_context::SqlCsvImportOptions::table].
30162        pub fn set_table<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
30163            self.table = v.into();
30164            self
30165        }
30166
30167        /// Sets the value of [columns][crate::model::import_context::SqlCsvImportOptions::columns].
30168        pub fn set_columns<T, V>(mut self, v: T) -> Self
30169        where
30170            T: std::iter::IntoIterator<Item = V>,
30171            V: std::convert::Into<std::string::String>,
30172        {
30173            use std::iter::Iterator;
30174            self.columns = v.into_iter().map(|i| i.into()).collect();
30175            self
30176        }
30177
30178        /// Sets the value of [escape_character][crate::model::import_context::SqlCsvImportOptions::escape_character].
30179        pub fn set_escape_character<T: std::convert::Into<std::string::String>>(
30180            mut self,
30181            v: T,
30182        ) -> Self {
30183            self.escape_character = v.into();
30184            self
30185        }
30186
30187        /// Sets the value of [quote_character][crate::model::import_context::SqlCsvImportOptions::quote_character].
30188        pub fn set_quote_character<T: std::convert::Into<std::string::String>>(
30189            mut self,
30190            v: T,
30191        ) -> Self {
30192            self.quote_character = v.into();
30193            self
30194        }
30195
30196        /// Sets the value of [fields_terminated_by][crate::model::import_context::SqlCsvImportOptions::fields_terminated_by].
30197        pub fn set_fields_terminated_by<T: std::convert::Into<std::string::String>>(
30198            mut self,
30199            v: T,
30200        ) -> Self {
30201            self.fields_terminated_by = v.into();
30202            self
30203        }
30204
30205        /// Sets the value of [lines_terminated_by][crate::model::import_context::SqlCsvImportOptions::lines_terminated_by].
30206        pub fn set_lines_terminated_by<T: std::convert::Into<std::string::String>>(
30207            mut self,
30208            v: T,
30209        ) -> Self {
30210            self.lines_terminated_by = v.into();
30211            self
30212        }
30213    }
30214
30215    impl wkt::message::Message for SqlCsvImportOptions {
30216        fn typename() -> &'static str {
30217            "type.googleapis.com/google.cloud.sql.v1.ImportContext.SqlCsvImportOptions"
30218        }
30219    }
30220
30221    #[doc(hidden)]
30222    impl<'de> serde::de::Deserialize<'de> for SqlCsvImportOptions {
30223        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30224        where
30225            D: serde::Deserializer<'de>,
30226        {
30227            #[allow(non_camel_case_types)]
30228            #[doc(hidden)]
30229            #[derive(PartialEq, Eq, Hash)]
30230            enum __FieldTag {
30231                __table,
30232                __columns,
30233                __escape_character,
30234                __quote_character,
30235                __fields_terminated_by,
30236                __lines_terminated_by,
30237                Unknown(std::string::String),
30238            }
30239            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
30240                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30241                where
30242                    D: serde::Deserializer<'de>,
30243                {
30244                    struct Visitor;
30245                    impl<'de> serde::de::Visitor<'de> for Visitor {
30246                        type Value = __FieldTag;
30247                        fn expecting(
30248                            &self,
30249                            formatter: &mut std::fmt::Formatter,
30250                        ) -> std::fmt::Result {
30251                            formatter.write_str("a field name for SqlCsvImportOptions")
30252                        }
30253                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
30254                        where
30255                            E: serde::de::Error,
30256                        {
30257                            use std::result::Result::Ok;
30258                            use std::string::ToString;
30259                            match value {
30260                                "table" => Ok(__FieldTag::__table),
30261                                "columns" => Ok(__FieldTag::__columns),
30262                                "escapeCharacter" => Ok(__FieldTag::__escape_character),
30263                                "escape_character" => Ok(__FieldTag::__escape_character),
30264                                "quoteCharacter" => Ok(__FieldTag::__quote_character),
30265                                "quote_character" => Ok(__FieldTag::__quote_character),
30266                                "fieldsTerminatedBy" => Ok(__FieldTag::__fields_terminated_by),
30267                                "fields_terminated_by" => Ok(__FieldTag::__fields_terminated_by),
30268                                "linesTerminatedBy" => Ok(__FieldTag::__lines_terminated_by),
30269                                "lines_terminated_by" => Ok(__FieldTag::__lines_terminated_by),
30270                                _ => Ok(__FieldTag::Unknown(value.to_string())),
30271                            }
30272                        }
30273                    }
30274                    deserializer.deserialize_identifier(Visitor)
30275                }
30276            }
30277            struct Visitor;
30278            impl<'de> serde::de::Visitor<'de> for Visitor {
30279                type Value = SqlCsvImportOptions;
30280                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
30281                    formatter.write_str("struct SqlCsvImportOptions")
30282                }
30283                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
30284                where
30285                    A: serde::de::MapAccess<'de>,
30286                {
30287                    #[allow(unused_imports)]
30288                    use serde::de::Error;
30289                    use std::option::Option::Some;
30290                    let mut fields = std::collections::HashSet::new();
30291                    let mut result = Self::Value::new();
30292                    while let Some(tag) = map.next_key::<__FieldTag>()? {
30293                        #[allow(clippy::match_single_binding)]
30294                        match tag {
30295                            __FieldTag::__table => {
30296                                if !fields.insert(__FieldTag::__table) {
30297                                    return std::result::Result::Err(A::Error::duplicate_field(
30298                                        "multiple values for table",
30299                                    ));
30300                                }
30301                                result.table = map
30302                                    .next_value::<std::option::Option<std::string::String>>()?
30303                                    .unwrap_or_default();
30304                            }
30305                            __FieldTag::__columns => {
30306                                if !fields.insert(__FieldTag::__columns) {
30307                                    return std::result::Result::Err(A::Error::duplicate_field(
30308                                        "multiple values for columns",
30309                                    ));
30310                                }
30311                                result.columns = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
30312                            }
30313                            __FieldTag::__escape_character => {
30314                                if !fields.insert(__FieldTag::__escape_character) {
30315                                    return std::result::Result::Err(A::Error::duplicate_field(
30316                                        "multiple values for escape_character",
30317                                    ));
30318                                }
30319                                result.escape_character = map
30320                                    .next_value::<std::option::Option<std::string::String>>()?
30321                                    .unwrap_or_default();
30322                            }
30323                            __FieldTag::__quote_character => {
30324                                if !fields.insert(__FieldTag::__quote_character) {
30325                                    return std::result::Result::Err(A::Error::duplicate_field(
30326                                        "multiple values for quote_character",
30327                                    ));
30328                                }
30329                                result.quote_character = map
30330                                    .next_value::<std::option::Option<std::string::String>>()?
30331                                    .unwrap_or_default();
30332                            }
30333                            __FieldTag::__fields_terminated_by => {
30334                                if !fields.insert(__FieldTag::__fields_terminated_by) {
30335                                    return std::result::Result::Err(A::Error::duplicate_field(
30336                                        "multiple values for fields_terminated_by",
30337                                    ));
30338                                }
30339                                result.fields_terminated_by = map
30340                                    .next_value::<std::option::Option<std::string::String>>()?
30341                                    .unwrap_or_default();
30342                            }
30343                            __FieldTag::__lines_terminated_by => {
30344                                if !fields.insert(__FieldTag::__lines_terminated_by) {
30345                                    return std::result::Result::Err(A::Error::duplicate_field(
30346                                        "multiple values for lines_terminated_by",
30347                                    ));
30348                                }
30349                                result.lines_terminated_by = map
30350                                    .next_value::<std::option::Option<std::string::String>>()?
30351                                    .unwrap_or_default();
30352                            }
30353                            __FieldTag::Unknown(key) => {
30354                                let value = map.next_value::<serde_json::Value>()?;
30355                                result._unknown_fields.insert(key, value);
30356                            }
30357                        }
30358                    }
30359                    std::result::Result::Ok(result)
30360                }
30361            }
30362            deserializer.deserialize_any(Visitor)
30363        }
30364    }
30365
30366    #[doc(hidden)]
30367    impl serde::ser::Serialize for SqlCsvImportOptions {
30368        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
30369        where
30370            S: serde::ser::Serializer,
30371        {
30372            use serde::ser::SerializeMap;
30373            #[allow(unused_imports)]
30374            use std::option::Option::Some;
30375            let mut state = serializer.serialize_map(std::option::Option::None)?;
30376            if !self.table.is_empty() {
30377                state.serialize_entry("table", &self.table)?;
30378            }
30379            if !self.columns.is_empty() {
30380                state.serialize_entry("columns", &self.columns)?;
30381            }
30382            if !self.escape_character.is_empty() {
30383                state.serialize_entry("escapeCharacter", &self.escape_character)?;
30384            }
30385            if !self.quote_character.is_empty() {
30386                state.serialize_entry("quoteCharacter", &self.quote_character)?;
30387            }
30388            if !self.fields_terminated_by.is_empty() {
30389                state.serialize_entry("fieldsTerminatedBy", &self.fields_terminated_by)?;
30390            }
30391            if !self.lines_terminated_by.is_empty() {
30392                state.serialize_entry("linesTerminatedBy", &self.lines_terminated_by)?;
30393            }
30394            if !self._unknown_fields.is_empty() {
30395                for (key, value) in self._unknown_fields.iter() {
30396                    state.serialize_entry(key, &value)?;
30397                }
30398            }
30399            state.end()
30400        }
30401    }
30402
30403    impl std::fmt::Debug for SqlCsvImportOptions {
30404        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
30405            let mut debug_struct = f.debug_struct("SqlCsvImportOptions");
30406            debug_struct.field("table", &self.table);
30407            debug_struct.field("columns", &self.columns);
30408            debug_struct.field("escape_character", &self.escape_character);
30409            debug_struct.field("quote_character", &self.quote_character);
30410            debug_struct.field("fields_terminated_by", &self.fields_terminated_by);
30411            debug_struct.field("lines_terminated_by", &self.lines_terminated_by);
30412            if !self._unknown_fields.is_empty() {
30413                debug_struct.field("_unknown_fields", &self._unknown_fields);
30414            }
30415            debug_struct.finish()
30416        }
30417    }
30418
30419    #[derive(Clone, Default, PartialEq)]
30420    #[non_exhaustive]
30421    pub struct SqlBakImportOptions {
30422        pub encryption_options: std::option::Option<
30423            crate::model::import_context::sql_bak_import_options::EncryptionOptions,
30424        >,
30425
30426        /// Whether or not the backup set being restored is striped.
30427        /// Applies only to Cloud SQL for SQL Server.
30428        pub striped: std::option::Option<wkt::BoolValue>,
30429
30430        /// Whether or not the backup importing will restore database
30431        /// with NORECOVERY option
30432        /// Applies only to Cloud SQL for SQL Server.
30433        pub no_recovery: std::option::Option<wkt::BoolValue>,
30434
30435        /// Whether or not the backup importing request will just bring database
30436        /// online without downloading Bak content only one of "no_recovery" and
30437        /// "recovery_only" can be true otherwise error will return. Applies only to
30438        /// Cloud SQL for SQL Server.
30439        pub recovery_only: std::option::Option<wkt::BoolValue>,
30440
30441        /// Type of the bak content, FULL or DIFF
30442        pub bak_type: crate::model::BakType,
30443
30444        /// Optional. The timestamp when the import should stop. This timestamp is in
30445        /// the [RFC 3339](https://tools.ietf.org/html/rfc3339) format (for example,
30446        /// `2023-10-01T16:19:00.094`). This field is equivalent to the STOPAT
30447        /// keyword and applies to Cloud SQL for SQL Server only.
30448        pub stop_at: std::option::Option<wkt::Timestamp>,
30449
30450        /// Optional. The marked transaction where the import should stop. This field
30451        /// is equivalent to the STOPATMARK keyword and applies to Cloud SQL for SQL
30452        /// Server only.
30453        pub stop_at_mark: std::string::String,
30454
30455        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
30456    }
30457
30458    impl SqlBakImportOptions {
30459        pub fn new() -> Self {
30460            std::default::Default::default()
30461        }
30462
30463        /// Sets the value of [encryption_options][crate::model::import_context::SqlBakImportOptions::encryption_options].
30464        pub fn set_encryption_options<T>(mut self, v: T) -> Self
30465        where
30466            T: std::convert::Into<
30467                    crate::model::import_context::sql_bak_import_options::EncryptionOptions,
30468                >,
30469        {
30470            self.encryption_options = std::option::Option::Some(v.into());
30471            self
30472        }
30473
30474        /// Sets or clears the value of [encryption_options][crate::model::import_context::SqlBakImportOptions::encryption_options].
30475        pub fn set_or_clear_encryption_options<T>(mut self, v: std::option::Option<T>) -> Self
30476        where
30477            T: std::convert::Into<
30478                    crate::model::import_context::sql_bak_import_options::EncryptionOptions,
30479                >,
30480        {
30481            self.encryption_options = v.map(|x| x.into());
30482            self
30483        }
30484
30485        /// Sets the value of [striped][crate::model::import_context::SqlBakImportOptions::striped].
30486        pub fn set_striped<T>(mut self, v: T) -> Self
30487        where
30488            T: std::convert::Into<wkt::BoolValue>,
30489        {
30490            self.striped = std::option::Option::Some(v.into());
30491            self
30492        }
30493
30494        /// Sets or clears the value of [striped][crate::model::import_context::SqlBakImportOptions::striped].
30495        pub fn set_or_clear_striped<T>(mut self, v: std::option::Option<T>) -> Self
30496        where
30497            T: std::convert::Into<wkt::BoolValue>,
30498        {
30499            self.striped = v.map(|x| x.into());
30500            self
30501        }
30502
30503        /// Sets the value of [no_recovery][crate::model::import_context::SqlBakImportOptions::no_recovery].
30504        pub fn set_no_recovery<T>(mut self, v: T) -> Self
30505        where
30506            T: std::convert::Into<wkt::BoolValue>,
30507        {
30508            self.no_recovery = std::option::Option::Some(v.into());
30509            self
30510        }
30511
30512        /// Sets or clears the value of [no_recovery][crate::model::import_context::SqlBakImportOptions::no_recovery].
30513        pub fn set_or_clear_no_recovery<T>(mut self, v: std::option::Option<T>) -> Self
30514        where
30515            T: std::convert::Into<wkt::BoolValue>,
30516        {
30517            self.no_recovery = v.map(|x| x.into());
30518            self
30519        }
30520
30521        /// Sets the value of [recovery_only][crate::model::import_context::SqlBakImportOptions::recovery_only].
30522        pub fn set_recovery_only<T>(mut self, v: T) -> Self
30523        where
30524            T: std::convert::Into<wkt::BoolValue>,
30525        {
30526            self.recovery_only = std::option::Option::Some(v.into());
30527            self
30528        }
30529
30530        /// Sets or clears the value of [recovery_only][crate::model::import_context::SqlBakImportOptions::recovery_only].
30531        pub fn set_or_clear_recovery_only<T>(mut self, v: std::option::Option<T>) -> Self
30532        where
30533            T: std::convert::Into<wkt::BoolValue>,
30534        {
30535            self.recovery_only = v.map(|x| x.into());
30536            self
30537        }
30538
30539        /// Sets the value of [bak_type][crate::model::import_context::SqlBakImportOptions::bak_type].
30540        pub fn set_bak_type<T: std::convert::Into<crate::model::BakType>>(mut self, v: T) -> Self {
30541            self.bak_type = v.into();
30542            self
30543        }
30544
30545        /// Sets the value of [stop_at][crate::model::import_context::SqlBakImportOptions::stop_at].
30546        pub fn set_stop_at<T>(mut self, v: T) -> Self
30547        where
30548            T: std::convert::Into<wkt::Timestamp>,
30549        {
30550            self.stop_at = std::option::Option::Some(v.into());
30551            self
30552        }
30553
30554        /// Sets or clears the value of [stop_at][crate::model::import_context::SqlBakImportOptions::stop_at].
30555        pub fn set_or_clear_stop_at<T>(mut self, v: std::option::Option<T>) -> Self
30556        where
30557            T: std::convert::Into<wkt::Timestamp>,
30558        {
30559            self.stop_at = v.map(|x| x.into());
30560            self
30561        }
30562
30563        /// Sets the value of [stop_at_mark][crate::model::import_context::SqlBakImportOptions::stop_at_mark].
30564        pub fn set_stop_at_mark<T: std::convert::Into<std::string::String>>(
30565            mut self,
30566            v: T,
30567        ) -> Self {
30568            self.stop_at_mark = v.into();
30569            self
30570        }
30571    }
30572
30573    impl wkt::message::Message for SqlBakImportOptions {
30574        fn typename() -> &'static str {
30575            "type.googleapis.com/google.cloud.sql.v1.ImportContext.SqlBakImportOptions"
30576        }
30577    }
30578
30579    #[doc(hidden)]
30580    impl<'de> serde::de::Deserialize<'de> for SqlBakImportOptions {
30581        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30582        where
30583            D: serde::Deserializer<'de>,
30584        {
30585            #[allow(non_camel_case_types)]
30586            #[doc(hidden)]
30587            #[derive(PartialEq, Eq, Hash)]
30588            enum __FieldTag {
30589                __encryption_options,
30590                __striped,
30591                __no_recovery,
30592                __recovery_only,
30593                __bak_type,
30594                __stop_at,
30595                __stop_at_mark,
30596                Unknown(std::string::String),
30597            }
30598            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
30599                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30600                where
30601                    D: serde::Deserializer<'de>,
30602                {
30603                    struct Visitor;
30604                    impl<'de> serde::de::Visitor<'de> for Visitor {
30605                        type Value = __FieldTag;
30606                        fn expecting(
30607                            &self,
30608                            formatter: &mut std::fmt::Formatter,
30609                        ) -> std::fmt::Result {
30610                            formatter.write_str("a field name for SqlBakImportOptions")
30611                        }
30612                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
30613                        where
30614                            E: serde::de::Error,
30615                        {
30616                            use std::result::Result::Ok;
30617                            use std::string::ToString;
30618                            match value {
30619                                "encryptionOptions" => Ok(__FieldTag::__encryption_options),
30620                                "encryption_options" => Ok(__FieldTag::__encryption_options),
30621                                "striped" => Ok(__FieldTag::__striped),
30622                                "noRecovery" => Ok(__FieldTag::__no_recovery),
30623                                "no_recovery" => Ok(__FieldTag::__no_recovery),
30624                                "recoveryOnly" => Ok(__FieldTag::__recovery_only),
30625                                "recovery_only" => Ok(__FieldTag::__recovery_only),
30626                                "bakType" => Ok(__FieldTag::__bak_type),
30627                                "bak_type" => Ok(__FieldTag::__bak_type),
30628                                "stopAt" => Ok(__FieldTag::__stop_at),
30629                                "stop_at" => Ok(__FieldTag::__stop_at),
30630                                "stopAtMark" => Ok(__FieldTag::__stop_at_mark),
30631                                "stop_at_mark" => Ok(__FieldTag::__stop_at_mark),
30632                                _ => Ok(__FieldTag::Unknown(value.to_string())),
30633                            }
30634                        }
30635                    }
30636                    deserializer.deserialize_identifier(Visitor)
30637                }
30638            }
30639            struct Visitor;
30640            impl<'de> serde::de::Visitor<'de> for Visitor {
30641                type Value = SqlBakImportOptions;
30642                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
30643                    formatter.write_str("struct SqlBakImportOptions")
30644                }
30645                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
30646                where
30647                    A: serde::de::MapAccess<'de>,
30648                {
30649                    #[allow(unused_imports)]
30650                    use serde::de::Error;
30651                    use std::option::Option::Some;
30652                    let mut fields = std::collections::HashSet::new();
30653                    let mut result = Self::Value::new();
30654                    while let Some(tag) = map.next_key::<__FieldTag>()? {
30655                        #[allow(clippy::match_single_binding)]
30656                        match tag {
30657                            __FieldTag::__encryption_options => {
30658                                if !fields.insert(__FieldTag::__encryption_options) {
30659                                    return std::result::Result::Err(A::Error::duplicate_field(
30660                                        "multiple values for encryption_options",
30661                                    ));
30662                                }
30663                                result.encryption_options = map.next_value::<std::option::Option<crate::model::import_context::sql_bak_import_options::EncryptionOptions>>()?
30664                                    ;
30665                            }
30666                            __FieldTag::__striped => {
30667                                if !fields.insert(__FieldTag::__striped) {
30668                                    return std::result::Result::Err(A::Error::duplicate_field(
30669                                        "multiple values for striped",
30670                                    ));
30671                                }
30672                                result.striped =
30673                                    map.next_value::<std::option::Option<wkt::BoolValue>>()?;
30674                            }
30675                            __FieldTag::__no_recovery => {
30676                                if !fields.insert(__FieldTag::__no_recovery) {
30677                                    return std::result::Result::Err(A::Error::duplicate_field(
30678                                        "multiple values for no_recovery",
30679                                    ));
30680                                }
30681                                result.no_recovery =
30682                                    map.next_value::<std::option::Option<wkt::BoolValue>>()?;
30683                            }
30684                            __FieldTag::__recovery_only => {
30685                                if !fields.insert(__FieldTag::__recovery_only) {
30686                                    return std::result::Result::Err(A::Error::duplicate_field(
30687                                        "multiple values for recovery_only",
30688                                    ));
30689                                }
30690                                result.recovery_only =
30691                                    map.next_value::<std::option::Option<wkt::BoolValue>>()?;
30692                            }
30693                            __FieldTag::__bak_type => {
30694                                if !fields.insert(__FieldTag::__bak_type) {
30695                                    return std::result::Result::Err(A::Error::duplicate_field(
30696                                        "multiple values for bak_type",
30697                                    ));
30698                                }
30699                                result.bak_type = map
30700                                    .next_value::<std::option::Option<crate::model::BakType>>()?
30701                                    .unwrap_or_default();
30702                            }
30703                            __FieldTag::__stop_at => {
30704                                if !fields.insert(__FieldTag::__stop_at) {
30705                                    return std::result::Result::Err(A::Error::duplicate_field(
30706                                        "multiple values for stop_at",
30707                                    ));
30708                                }
30709                                result.stop_at =
30710                                    map.next_value::<std::option::Option<wkt::Timestamp>>()?;
30711                            }
30712                            __FieldTag::__stop_at_mark => {
30713                                if !fields.insert(__FieldTag::__stop_at_mark) {
30714                                    return std::result::Result::Err(A::Error::duplicate_field(
30715                                        "multiple values for stop_at_mark",
30716                                    ));
30717                                }
30718                                result.stop_at_mark = map
30719                                    .next_value::<std::option::Option<std::string::String>>()?
30720                                    .unwrap_or_default();
30721                            }
30722                            __FieldTag::Unknown(key) => {
30723                                let value = map.next_value::<serde_json::Value>()?;
30724                                result._unknown_fields.insert(key, value);
30725                            }
30726                        }
30727                    }
30728                    std::result::Result::Ok(result)
30729                }
30730            }
30731            deserializer.deserialize_any(Visitor)
30732        }
30733    }
30734
30735    #[doc(hidden)]
30736    impl serde::ser::Serialize for SqlBakImportOptions {
30737        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
30738        where
30739            S: serde::ser::Serializer,
30740        {
30741            use serde::ser::SerializeMap;
30742            #[allow(unused_imports)]
30743            use std::option::Option::Some;
30744            let mut state = serializer.serialize_map(std::option::Option::None)?;
30745            if self.encryption_options.is_some() {
30746                state.serialize_entry("encryptionOptions", &self.encryption_options)?;
30747            }
30748            if self.striped.is_some() {
30749                state.serialize_entry("striped", &self.striped)?;
30750            }
30751            if self.no_recovery.is_some() {
30752                state.serialize_entry("noRecovery", &self.no_recovery)?;
30753            }
30754            if self.recovery_only.is_some() {
30755                state.serialize_entry("recoveryOnly", &self.recovery_only)?;
30756            }
30757            if !wkt::internal::is_default(&self.bak_type) {
30758                state.serialize_entry("bakType", &self.bak_type)?;
30759            }
30760            if self.stop_at.is_some() {
30761                state.serialize_entry("stopAt", &self.stop_at)?;
30762            }
30763            if !self.stop_at_mark.is_empty() {
30764                state.serialize_entry("stopAtMark", &self.stop_at_mark)?;
30765            }
30766            if !self._unknown_fields.is_empty() {
30767                for (key, value) in self._unknown_fields.iter() {
30768                    state.serialize_entry(key, &value)?;
30769                }
30770            }
30771            state.end()
30772        }
30773    }
30774
30775    impl std::fmt::Debug for SqlBakImportOptions {
30776        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
30777            let mut debug_struct = f.debug_struct("SqlBakImportOptions");
30778            debug_struct.field("encryption_options", &self.encryption_options);
30779            debug_struct.field("striped", &self.striped);
30780            debug_struct.field("no_recovery", &self.no_recovery);
30781            debug_struct.field("recovery_only", &self.recovery_only);
30782            debug_struct.field("bak_type", &self.bak_type);
30783            debug_struct.field("stop_at", &self.stop_at);
30784            debug_struct.field("stop_at_mark", &self.stop_at_mark);
30785            if !self._unknown_fields.is_empty() {
30786                debug_struct.field("_unknown_fields", &self._unknown_fields);
30787            }
30788            debug_struct.finish()
30789        }
30790    }
30791
30792    /// Defines additional types related to [SqlBakImportOptions].
30793    pub mod sql_bak_import_options {
30794        #[allow(unused_imports)]
30795        use super::*;
30796
30797        #[derive(Clone, Default, PartialEq)]
30798        #[non_exhaustive]
30799        pub struct EncryptionOptions {
30800            /// Path to the Certificate (.cer) in Cloud Storage, in the form
30801            /// `gs://bucketName/fileName`. The instance must have
30802            /// write permissions to the bucket and read access to the file.
30803            pub cert_path: std::string::String,
30804
30805            /// Path to the Certificate Private Key (.pvk)  in Cloud Storage, in the
30806            /// form `gs://bucketName/fileName`. The instance must have
30807            /// write permissions to the bucket and read access to the file.
30808            pub pvk_path: std::string::String,
30809
30810            /// Password that encrypts the private key
30811            pub pvk_password: std::string::String,
30812
30813            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
30814        }
30815
30816        impl EncryptionOptions {
30817            pub fn new() -> Self {
30818                std::default::Default::default()
30819            }
30820
30821            /// Sets the value of [cert_path][crate::model::import_context::sql_bak_import_options::EncryptionOptions::cert_path].
30822            pub fn set_cert_path<T: std::convert::Into<std::string::String>>(
30823                mut self,
30824                v: T,
30825            ) -> Self {
30826                self.cert_path = v.into();
30827                self
30828            }
30829
30830            /// Sets the value of [pvk_path][crate::model::import_context::sql_bak_import_options::EncryptionOptions::pvk_path].
30831            pub fn set_pvk_path<T: std::convert::Into<std::string::String>>(
30832                mut self,
30833                v: T,
30834            ) -> Self {
30835                self.pvk_path = v.into();
30836                self
30837            }
30838
30839            /// Sets the value of [pvk_password][crate::model::import_context::sql_bak_import_options::EncryptionOptions::pvk_password].
30840            pub fn set_pvk_password<T: std::convert::Into<std::string::String>>(
30841                mut self,
30842                v: T,
30843            ) -> Self {
30844                self.pvk_password = v.into();
30845                self
30846            }
30847        }
30848
30849        impl wkt::message::Message for EncryptionOptions {
30850            fn typename() -> &'static str {
30851                "type.googleapis.com/google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions"
30852            }
30853        }
30854
30855        #[doc(hidden)]
30856        impl<'de> serde::de::Deserialize<'de> for EncryptionOptions {
30857            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30858            where
30859                D: serde::Deserializer<'de>,
30860            {
30861                #[allow(non_camel_case_types)]
30862                #[doc(hidden)]
30863                #[derive(PartialEq, Eq, Hash)]
30864                enum __FieldTag {
30865                    __cert_path,
30866                    __pvk_path,
30867                    __pvk_password,
30868                    Unknown(std::string::String),
30869                }
30870                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
30871                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30872                    where
30873                        D: serde::Deserializer<'de>,
30874                    {
30875                        struct Visitor;
30876                        impl<'de> serde::de::Visitor<'de> for Visitor {
30877                            type Value = __FieldTag;
30878                            fn expecting(
30879                                &self,
30880                                formatter: &mut std::fmt::Formatter,
30881                            ) -> std::fmt::Result {
30882                                formatter.write_str("a field name for EncryptionOptions")
30883                            }
30884                            fn visit_str<E>(
30885                                self,
30886                                value: &str,
30887                            ) -> std::result::Result<Self::Value, E>
30888                            where
30889                                E: serde::de::Error,
30890                            {
30891                                use std::result::Result::Ok;
30892                                use std::string::ToString;
30893                                match value {
30894                                    "certPath" => Ok(__FieldTag::__cert_path),
30895                                    "cert_path" => Ok(__FieldTag::__cert_path),
30896                                    "pvkPath" => Ok(__FieldTag::__pvk_path),
30897                                    "pvk_path" => Ok(__FieldTag::__pvk_path),
30898                                    "pvkPassword" => Ok(__FieldTag::__pvk_password),
30899                                    "pvk_password" => Ok(__FieldTag::__pvk_password),
30900                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
30901                                }
30902                            }
30903                        }
30904                        deserializer.deserialize_identifier(Visitor)
30905                    }
30906                }
30907                struct Visitor;
30908                impl<'de> serde::de::Visitor<'de> for Visitor {
30909                    type Value = EncryptionOptions;
30910                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
30911                        formatter.write_str("struct EncryptionOptions")
30912                    }
30913                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
30914                    where
30915                        A: serde::de::MapAccess<'de>,
30916                    {
30917                        #[allow(unused_imports)]
30918                        use serde::de::Error;
30919                        use std::option::Option::Some;
30920                        let mut fields = std::collections::HashSet::new();
30921                        let mut result = Self::Value::new();
30922                        while let Some(tag) = map.next_key::<__FieldTag>()? {
30923                            #[allow(clippy::match_single_binding)]
30924                            match tag {
30925                                __FieldTag::__cert_path => {
30926                                    if !fields.insert(__FieldTag::__cert_path) {
30927                                        return std::result::Result::Err(
30928                                            A::Error::duplicate_field(
30929                                                "multiple values for cert_path",
30930                                            ),
30931                                        );
30932                                    }
30933                                    result.cert_path = map
30934                                        .next_value::<std::option::Option<std::string::String>>()?
30935                                        .unwrap_or_default();
30936                                }
30937                                __FieldTag::__pvk_path => {
30938                                    if !fields.insert(__FieldTag::__pvk_path) {
30939                                        return std::result::Result::Err(
30940                                            A::Error::duplicate_field(
30941                                                "multiple values for pvk_path",
30942                                            ),
30943                                        );
30944                                    }
30945                                    result.pvk_path = map
30946                                        .next_value::<std::option::Option<std::string::String>>()?
30947                                        .unwrap_or_default();
30948                                }
30949                                __FieldTag::__pvk_password => {
30950                                    if !fields.insert(__FieldTag::__pvk_password) {
30951                                        return std::result::Result::Err(
30952                                            A::Error::duplicate_field(
30953                                                "multiple values for pvk_password",
30954                                            ),
30955                                        );
30956                                    }
30957                                    result.pvk_password = map
30958                                        .next_value::<std::option::Option<std::string::String>>()?
30959                                        .unwrap_or_default();
30960                                }
30961                                __FieldTag::Unknown(key) => {
30962                                    let value = map.next_value::<serde_json::Value>()?;
30963                                    result._unknown_fields.insert(key, value);
30964                                }
30965                            }
30966                        }
30967                        std::result::Result::Ok(result)
30968                    }
30969                }
30970                deserializer.deserialize_any(Visitor)
30971            }
30972        }
30973
30974        #[doc(hidden)]
30975        impl serde::ser::Serialize for EncryptionOptions {
30976            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
30977            where
30978                S: serde::ser::Serializer,
30979            {
30980                use serde::ser::SerializeMap;
30981                #[allow(unused_imports)]
30982                use std::option::Option::Some;
30983                let mut state = serializer.serialize_map(std::option::Option::None)?;
30984                if !self.cert_path.is_empty() {
30985                    state.serialize_entry("certPath", &self.cert_path)?;
30986                }
30987                if !self.pvk_path.is_empty() {
30988                    state.serialize_entry("pvkPath", &self.pvk_path)?;
30989                }
30990                if !self.pvk_password.is_empty() {
30991                    state.serialize_entry("pvkPassword", &self.pvk_password)?;
30992                }
30993                if !self._unknown_fields.is_empty() {
30994                    for (key, value) in self._unknown_fields.iter() {
30995                        state.serialize_entry(key, &value)?;
30996                    }
30997                }
30998                state.end()
30999            }
31000        }
31001
31002        impl std::fmt::Debug for EncryptionOptions {
31003            fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
31004                let mut debug_struct = f.debug_struct("EncryptionOptions");
31005                debug_struct.field("cert_path", &self.cert_path);
31006                debug_struct.field("pvk_path", &self.pvk_path);
31007                debug_struct.field("pvk_password", &self.pvk_password);
31008                if !self._unknown_fields.is_empty() {
31009                    debug_struct.field("_unknown_fields", &self._unknown_fields);
31010                }
31011                debug_struct.finish()
31012            }
31013        }
31014    }
31015}
31016
31017/// IP Management configuration.
31018#[derive(Clone, Default, PartialEq)]
31019#[non_exhaustive]
31020pub struct IpConfiguration {
31021    /// Whether the instance is assigned a public IP address or not.
31022    pub ipv4_enabled: std::option::Option<wkt::BoolValue>,
31023
31024    /// The resource link for the VPC network from which the Cloud SQL instance is
31025    /// accessible for private IP. For example,
31026    /// `/projects/myProject/global/networks/default`. This setting can
31027    /// be updated, but it cannot be removed after it is set.
31028    pub private_network: std::string::String,
31029
31030    /// Use `ssl_mode` instead.
31031    ///
31032    /// Whether SSL/TLS connections over IP are enforced.
31033    /// If set to false, then allow both non-SSL/non-TLS and SSL/TLS connections.
31034    /// For SSL/TLS connections, the client certificate won't be verified. If
31035    /// set to true, then only allow connections encrypted with SSL/TLS and with
31036    /// valid client certificates. If you want to enforce SSL/TLS without enforcing
31037    /// the requirement for valid client certificates, then use the `ssl_mode` flag
31038    /// instead of the `require_ssl` flag.
31039    pub require_ssl: std::option::Option<wkt::BoolValue>,
31040
31041    /// The list of external networks that are allowed to connect to the instance
31042    /// using the IP. In 'CIDR' notation, also known as 'slash' notation (for
31043    /// example: `157.197.200.0/24`).
31044    pub authorized_networks: std::vec::Vec<crate::model::AclEntry>,
31045
31046    /// The name of the allocated ip range for the private ip Cloud SQL instance.
31047    /// For example: "google-managed-services-default". If set, the instance ip
31048    /// will be created in the allocated range. The range name must comply with
31049    /// [RFC 1035](https://tools.ietf.org/html/rfc1035). Specifically, the name
31050    /// must be 1-63 characters long and match the regular expression
31051    /// `[a-z]([-a-z0-9]*[a-z0-9])?.`
31052    pub allocated_ip_range: std::string::String,
31053
31054    /// Controls connectivity to private IP instances from Google services,
31055    /// such as BigQuery.
31056    pub enable_private_path_for_google_cloud_services: std::option::Option<wkt::BoolValue>,
31057
31058    /// Specify how SSL/TLS is enforced in database connections. If you must use
31059    /// the `require_ssl` flag for backward compatibility, then only the following
31060    /// value pairs are valid:
31061    ///
31062    /// For PostgreSQL and MySQL:
31063    ///
31064    /// * `ssl_mode=ALLOW_UNENCRYPTED_AND_ENCRYPTED` and `require_ssl=false`
31065    /// * `ssl_mode=ENCRYPTED_ONLY` and `require_ssl=false`
31066    /// * `ssl_mode=TRUSTED_CLIENT_CERTIFICATE_REQUIRED` and `require_ssl=true`
31067    ///
31068    /// For SQL Server:
31069    ///
31070    /// * `ssl_mode=ALLOW_UNENCRYPTED_AND_ENCRYPTED` and `require_ssl=false`
31071    /// * `ssl_mode=ENCRYPTED_ONLY` and `require_ssl=true`
31072    ///
31073    /// The value of `ssl_mode` has priority over the value of `require_ssl`.
31074    ///
31075    /// For example, for the pair `ssl_mode=ENCRYPTED_ONLY` and
31076    /// `require_ssl=false`, `ssl_mode=ENCRYPTED_ONLY` means accept only SSL
31077    /// connections, while `require_ssl=false` means accept both non-SSL
31078    /// and SSL connections. In this case, MySQL and PostgreSQL databases respect
31079    /// `ssl_mode` and accepts only SSL connections.
31080    pub ssl_mode: crate::model::ip_configuration::SslMode,
31081
31082    /// PSC settings for this instance.
31083    pub psc_config: std::option::Option<crate::model::PscConfig>,
31084
31085    /// Specify what type of CA is used for the server certificate.
31086    pub server_ca_mode: std::option::Option<crate::model::ip_configuration::CaMode>,
31087
31088    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
31089}
31090
31091impl IpConfiguration {
31092    pub fn new() -> Self {
31093        std::default::Default::default()
31094    }
31095
31096    /// Sets the value of [ipv4_enabled][crate::model::IpConfiguration::ipv4_enabled].
31097    pub fn set_ipv4_enabled<T>(mut self, v: T) -> Self
31098    where
31099        T: std::convert::Into<wkt::BoolValue>,
31100    {
31101        self.ipv4_enabled = std::option::Option::Some(v.into());
31102        self
31103    }
31104
31105    /// Sets or clears the value of [ipv4_enabled][crate::model::IpConfiguration::ipv4_enabled].
31106    pub fn set_or_clear_ipv4_enabled<T>(mut self, v: std::option::Option<T>) -> Self
31107    where
31108        T: std::convert::Into<wkt::BoolValue>,
31109    {
31110        self.ipv4_enabled = v.map(|x| x.into());
31111        self
31112    }
31113
31114    /// Sets the value of [private_network][crate::model::IpConfiguration::private_network].
31115    pub fn set_private_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
31116        self.private_network = v.into();
31117        self
31118    }
31119
31120    /// Sets the value of [require_ssl][crate::model::IpConfiguration::require_ssl].
31121    pub fn set_require_ssl<T>(mut self, v: T) -> Self
31122    where
31123        T: std::convert::Into<wkt::BoolValue>,
31124    {
31125        self.require_ssl = std::option::Option::Some(v.into());
31126        self
31127    }
31128
31129    /// Sets or clears the value of [require_ssl][crate::model::IpConfiguration::require_ssl].
31130    pub fn set_or_clear_require_ssl<T>(mut self, v: std::option::Option<T>) -> Self
31131    where
31132        T: std::convert::Into<wkt::BoolValue>,
31133    {
31134        self.require_ssl = v.map(|x| x.into());
31135        self
31136    }
31137
31138    /// Sets the value of [authorized_networks][crate::model::IpConfiguration::authorized_networks].
31139    pub fn set_authorized_networks<T, V>(mut self, v: T) -> Self
31140    where
31141        T: std::iter::IntoIterator<Item = V>,
31142        V: std::convert::Into<crate::model::AclEntry>,
31143    {
31144        use std::iter::Iterator;
31145        self.authorized_networks = v.into_iter().map(|i| i.into()).collect();
31146        self
31147    }
31148
31149    /// Sets the value of [allocated_ip_range][crate::model::IpConfiguration::allocated_ip_range].
31150    pub fn set_allocated_ip_range<T: std::convert::Into<std::string::String>>(
31151        mut self,
31152        v: T,
31153    ) -> Self {
31154        self.allocated_ip_range = v.into();
31155        self
31156    }
31157
31158    /// Sets the value of [enable_private_path_for_google_cloud_services][crate::model::IpConfiguration::enable_private_path_for_google_cloud_services].
31159    pub fn set_enable_private_path_for_google_cloud_services<T>(mut self, v: T) -> Self
31160    where
31161        T: std::convert::Into<wkt::BoolValue>,
31162    {
31163        self.enable_private_path_for_google_cloud_services = std::option::Option::Some(v.into());
31164        self
31165    }
31166
31167    /// Sets or clears the value of [enable_private_path_for_google_cloud_services][crate::model::IpConfiguration::enable_private_path_for_google_cloud_services].
31168    pub fn set_or_clear_enable_private_path_for_google_cloud_services<T>(
31169        mut self,
31170        v: std::option::Option<T>,
31171    ) -> Self
31172    where
31173        T: std::convert::Into<wkt::BoolValue>,
31174    {
31175        self.enable_private_path_for_google_cloud_services = v.map(|x| x.into());
31176        self
31177    }
31178
31179    /// Sets the value of [ssl_mode][crate::model::IpConfiguration::ssl_mode].
31180    pub fn set_ssl_mode<T: std::convert::Into<crate::model::ip_configuration::SslMode>>(
31181        mut self,
31182        v: T,
31183    ) -> Self {
31184        self.ssl_mode = v.into();
31185        self
31186    }
31187
31188    /// Sets the value of [psc_config][crate::model::IpConfiguration::psc_config].
31189    pub fn set_psc_config<T>(mut self, v: T) -> Self
31190    where
31191        T: std::convert::Into<crate::model::PscConfig>,
31192    {
31193        self.psc_config = std::option::Option::Some(v.into());
31194        self
31195    }
31196
31197    /// Sets or clears the value of [psc_config][crate::model::IpConfiguration::psc_config].
31198    pub fn set_or_clear_psc_config<T>(mut self, v: std::option::Option<T>) -> Self
31199    where
31200        T: std::convert::Into<crate::model::PscConfig>,
31201    {
31202        self.psc_config = v.map(|x| x.into());
31203        self
31204    }
31205
31206    /// Sets the value of [server_ca_mode][crate::model::IpConfiguration::server_ca_mode].
31207    pub fn set_server_ca_mode<T>(mut self, v: T) -> Self
31208    where
31209        T: std::convert::Into<crate::model::ip_configuration::CaMode>,
31210    {
31211        self.server_ca_mode = std::option::Option::Some(v.into());
31212        self
31213    }
31214
31215    /// Sets or clears the value of [server_ca_mode][crate::model::IpConfiguration::server_ca_mode].
31216    pub fn set_or_clear_server_ca_mode<T>(mut self, v: std::option::Option<T>) -> Self
31217    where
31218        T: std::convert::Into<crate::model::ip_configuration::CaMode>,
31219    {
31220        self.server_ca_mode = v.map(|x| x.into());
31221        self
31222    }
31223}
31224
31225impl wkt::message::Message for IpConfiguration {
31226    fn typename() -> &'static str {
31227        "type.googleapis.com/google.cloud.sql.v1.IpConfiguration"
31228    }
31229}
31230
31231#[doc(hidden)]
31232impl<'de> serde::de::Deserialize<'de> for IpConfiguration {
31233    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
31234    where
31235        D: serde::Deserializer<'de>,
31236    {
31237        #[allow(non_camel_case_types)]
31238        #[doc(hidden)]
31239        #[derive(PartialEq, Eq, Hash)]
31240        enum __FieldTag {
31241            __ipv4_enabled,
31242            __private_network,
31243            __require_ssl,
31244            __authorized_networks,
31245            __allocated_ip_range,
31246            __enable_private_path_for_google_cloud_services,
31247            __ssl_mode,
31248            __psc_config,
31249            __server_ca_mode,
31250            Unknown(std::string::String),
31251        }
31252        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
31253            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
31254            where
31255                D: serde::Deserializer<'de>,
31256            {
31257                struct Visitor;
31258                impl<'de> serde::de::Visitor<'de> for Visitor {
31259                    type Value = __FieldTag;
31260                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
31261                        formatter.write_str("a field name for IpConfiguration")
31262                    }
31263                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
31264                    where
31265                        E: serde::de::Error,
31266                    {
31267                        use std::result::Result::Ok;
31268                        use std::string::ToString;
31269                        match value {
31270                            "ipv4Enabled" => Ok(__FieldTag::__ipv4_enabled),
31271                            "ipv4_enabled" => Ok(__FieldTag::__ipv4_enabled),
31272                            "privateNetwork" => Ok(__FieldTag::__private_network),
31273                            "private_network" => Ok(__FieldTag::__private_network),
31274                            "requireSsl" => Ok(__FieldTag::__require_ssl),
31275                            "require_ssl" => Ok(__FieldTag::__require_ssl),
31276                            "authorizedNetworks" => Ok(__FieldTag::__authorized_networks),
31277                            "authorized_networks" => Ok(__FieldTag::__authorized_networks),
31278                            "allocatedIpRange" => Ok(__FieldTag::__allocated_ip_range),
31279                            "allocated_ip_range" => Ok(__FieldTag::__allocated_ip_range),
31280                            "enablePrivatePathForGoogleCloudServices" => {
31281                                Ok(__FieldTag::__enable_private_path_for_google_cloud_services)
31282                            }
31283                            "enable_private_path_for_google_cloud_services" => {
31284                                Ok(__FieldTag::__enable_private_path_for_google_cloud_services)
31285                            }
31286                            "sslMode" => Ok(__FieldTag::__ssl_mode),
31287                            "ssl_mode" => Ok(__FieldTag::__ssl_mode),
31288                            "pscConfig" => Ok(__FieldTag::__psc_config),
31289                            "psc_config" => Ok(__FieldTag::__psc_config),
31290                            "serverCaMode" => Ok(__FieldTag::__server_ca_mode),
31291                            "server_ca_mode" => Ok(__FieldTag::__server_ca_mode),
31292                            _ => Ok(__FieldTag::Unknown(value.to_string())),
31293                        }
31294                    }
31295                }
31296                deserializer.deserialize_identifier(Visitor)
31297            }
31298        }
31299        struct Visitor;
31300        impl<'de> serde::de::Visitor<'de> for Visitor {
31301            type Value = IpConfiguration;
31302            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
31303                formatter.write_str("struct IpConfiguration")
31304            }
31305            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
31306            where
31307                A: serde::de::MapAccess<'de>,
31308            {
31309                #[allow(unused_imports)]
31310                use serde::de::Error;
31311                use std::option::Option::Some;
31312                let mut fields = std::collections::HashSet::new();
31313                let mut result = Self::Value::new();
31314                while let Some(tag) = map.next_key::<__FieldTag>()? {
31315                    #[allow(clippy::match_single_binding)]
31316                    match tag {
31317                        __FieldTag::__ipv4_enabled => {
31318                            if !fields.insert(__FieldTag::__ipv4_enabled) {
31319                                return std::result::Result::Err(A::Error::duplicate_field(
31320                                    "multiple values for ipv4_enabled",
31321                                ));
31322                            }
31323                            result.ipv4_enabled =
31324                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
31325                        }
31326                        __FieldTag::__private_network => {
31327                            if !fields.insert(__FieldTag::__private_network) {
31328                                return std::result::Result::Err(A::Error::duplicate_field(
31329                                    "multiple values for private_network",
31330                                ));
31331                            }
31332                            result.private_network = map
31333                                .next_value::<std::option::Option<std::string::String>>()?
31334                                .unwrap_or_default();
31335                        }
31336                        __FieldTag::__require_ssl => {
31337                            if !fields.insert(__FieldTag::__require_ssl) {
31338                                return std::result::Result::Err(A::Error::duplicate_field(
31339                                    "multiple values for require_ssl",
31340                                ));
31341                            }
31342                            result.require_ssl =
31343                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
31344                        }
31345                        __FieldTag::__authorized_networks => {
31346                            if !fields.insert(__FieldTag::__authorized_networks) {
31347                                return std::result::Result::Err(A::Error::duplicate_field(
31348                                    "multiple values for authorized_networks",
31349                                ));
31350                            }
31351                            result.authorized_networks = map.next_value::<std::option::Option<std::vec::Vec<crate::model::AclEntry>>>()?.unwrap_or_default();
31352                        }
31353                        __FieldTag::__allocated_ip_range => {
31354                            if !fields.insert(__FieldTag::__allocated_ip_range) {
31355                                return std::result::Result::Err(A::Error::duplicate_field(
31356                                    "multiple values for allocated_ip_range",
31357                                ));
31358                            }
31359                            result.allocated_ip_range = map
31360                                .next_value::<std::option::Option<std::string::String>>()?
31361                                .unwrap_or_default();
31362                        }
31363                        __FieldTag::__enable_private_path_for_google_cloud_services => {
31364                            if !fields
31365                                .insert(__FieldTag::__enable_private_path_for_google_cloud_services)
31366                            {
31367                                return std::result::Result::Err(A::Error::duplicate_field(
31368                                    "multiple values for enable_private_path_for_google_cloud_services",
31369                                ));
31370                            }
31371                            result.enable_private_path_for_google_cloud_services =
31372                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
31373                        }
31374                        __FieldTag::__ssl_mode => {
31375                            if !fields.insert(__FieldTag::__ssl_mode) {
31376                                return std::result::Result::Err(A::Error::duplicate_field(
31377                                    "multiple values for ssl_mode",
31378                                ));
31379                            }
31380                            result.ssl_mode = map.next_value::<std::option::Option<crate::model::ip_configuration::SslMode>>()?.unwrap_or_default();
31381                        }
31382                        __FieldTag::__psc_config => {
31383                            if !fields.insert(__FieldTag::__psc_config) {
31384                                return std::result::Result::Err(A::Error::duplicate_field(
31385                                    "multiple values for psc_config",
31386                                ));
31387                            }
31388                            result.psc_config =
31389                                map.next_value::<std::option::Option<crate::model::PscConfig>>()?;
31390                        }
31391                        __FieldTag::__server_ca_mode => {
31392                            if !fields.insert(__FieldTag::__server_ca_mode) {
31393                                return std::result::Result::Err(A::Error::duplicate_field(
31394                                    "multiple values for server_ca_mode",
31395                                ));
31396                            }
31397                            result.server_ca_mode = map.next_value::<std::option::Option<crate::model::ip_configuration::CaMode>>()?
31398                                ;
31399                        }
31400                        __FieldTag::Unknown(key) => {
31401                            let value = map.next_value::<serde_json::Value>()?;
31402                            result._unknown_fields.insert(key, value);
31403                        }
31404                    }
31405                }
31406                std::result::Result::Ok(result)
31407            }
31408        }
31409        deserializer.deserialize_any(Visitor)
31410    }
31411}
31412
31413#[doc(hidden)]
31414impl serde::ser::Serialize for IpConfiguration {
31415    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
31416    where
31417        S: serde::ser::Serializer,
31418    {
31419        use serde::ser::SerializeMap;
31420        #[allow(unused_imports)]
31421        use std::option::Option::Some;
31422        let mut state = serializer.serialize_map(std::option::Option::None)?;
31423        if self.ipv4_enabled.is_some() {
31424            state.serialize_entry("ipv4Enabled", &self.ipv4_enabled)?;
31425        }
31426        if !self.private_network.is_empty() {
31427            state.serialize_entry("privateNetwork", &self.private_network)?;
31428        }
31429        if self.require_ssl.is_some() {
31430            state.serialize_entry("requireSsl", &self.require_ssl)?;
31431        }
31432        if !self.authorized_networks.is_empty() {
31433            state.serialize_entry("authorizedNetworks", &self.authorized_networks)?;
31434        }
31435        if !self.allocated_ip_range.is_empty() {
31436            state.serialize_entry("allocatedIpRange", &self.allocated_ip_range)?;
31437        }
31438        if self.enable_private_path_for_google_cloud_services.is_some() {
31439            state.serialize_entry(
31440                "enablePrivatePathForGoogleCloudServices",
31441                &self.enable_private_path_for_google_cloud_services,
31442            )?;
31443        }
31444        if !wkt::internal::is_default(&self.ssl_mode) {
31445            state.serialize_entry("sslMode", &self.ssl_mode)?;
31446        }
31447        if self.psc_config.is_some() {
31448            state.serialize_entry("pscConfig", &self.psc_config)?;
31449        }
31450        if self.server_ca_mode.is_some() {
31451            state.serialize_entry("serverCaMode", &self.server_ca_mode)?;
31452        }
31453        if !self._unknown_fields.is_empty() {
31454            for (key, value) in self._unknown_fields.iter() {
31455                state.serialize_entry(key, &value)?;
31456            }
31457        }
31458        state.end()
31459    }
31460}
31461
31462impl std::fmt::Debug for IpConfiguration {
31463    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
31464        let mut debug_struct = f.debug_struct("IpConfiguration");
31465        debug_struct.field("ipv4_enabled", &self.ipv4_enabled);
31466        debug_struct.field("private_network", &self.private_network);
31467        debug_struct.field("require_ssl", &self.require_ssl);
31468        debug_struct.field("authorized_networks", &self.authorized_networks);
31469        debug_struct.field("allocated_ip_range", &self.allocated_ip_range);
31470        debug_struct.field(
31471            "enable_private_path_for_google_cloud_services",
31472            &self.enable_private_path_for_google_cloud_services,
31473        );
31474        debug_struct.field("ssl_mode", &self.ssl_mode);
31475        debug_struct.field("psc_config", &self.psc_config);
31476        debug_struct.field("server_ca_mode", &self.server_ca_mode);
31477        if !self._unknown_fields.is_empty() {
31478            debug_struct.field("_unknown_fields", &self._unknown_fields);
31479        }
31480        debug_struct.finish()
31481    }
31482}
31483
31484/// Defines additional types related to [IpConfiguration].
31485pub mod ip_configuration {
31486    #[allow(unused_imports)]
31487    use super::*;
31488
31489    /// The SSL options for database connections.
31490    ///
31491    /// # Working with unknown values
31492    ///
31493    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
31494    /// additional enum variants at any time. Adding new variants is not considered
31495    /// a breaking change. Applications should write their code in anticipation of:
31496    ///
31497    /// - New values appearing in future releases of the client library, **and**
31498    /// - New values received dynamically, without application changes.
31499    ///
31500    /// Please consult the [Working with enums] section in the user guide for some
31501    /// guidelines.
31502    ///
31503    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
31504    #[derive(Clone, Debug, PartialEq)]
31505    #[non_exhaustive]
31506    pub enum SslMode {
31507        /// The SSL mode is unknown.
31508        Unspecified,
31509        /// Allow non-SSL/non-TLS and SSL/TLS connections.
31510        /// For SSL connections to MySQL and PostgreSQL, the client certificate
31511        /// isn't verified.
31512        ///
31513        /// When this value is used, the legacy `require_ssl` flag must be false or
31514        /// cleared to avoid a conflict between the values of the two flags.
31515        AllowUnencryptedAndEncrypted,
31516        /// Only allow connections encrypted with SSL/TLS.
31517        /// For SSL connections to MySQL and PostgreSQL, the client certificate
31518        /// isn't verified.
31519        ///
31520        /// When this value is used, the legacy `require_ssl` flag must be false or
31521        /// cleared to avoid a conflict between the values of the two flags.
31522        EncryptedOnly,
31523        /// Only allow connections encrypted with SSL/TLS and with valid
31524        /// client certificates.
31525        ///
31526        /// When this value is used, the legacy `require_ssl` flag must be true or
31527        /// cleared to avoid the conflict between values of two flags.
31528        /// PostgreSQL clients or users that connect using IAM database
31529        /// authentication must use either the
31530        /// [Cloud SQL Auth
31531        /// Proxy](https://cloud.google.com/sql/docs/postgres/connect-auth-proxy) or
31532        /// [Cloud SQL
31533        /// Connectors](https://cloud.google.com/sql/docs/postgres/connect-connectors)
31534        /// to enforce client identity verification.
31535        ///
31536        /// Only applicable to MySQL and PostgreSQL. Not applicable to SQL Server.
31537        TrustedClientCertificateRequired,
31538        /// If set, the enum was initialized with an unknown value.
31539        ///
31540        /// Applications can examine the value using [SslMode::value] or
31541        /// [SslMode::name].
31542        UnknownValue(ssl_mode::UnknownValue),
31543    }
31544
31545    #[doc(hidden)]
31546    pub mod ssl_mode {
31547        #[allow(unused_imports)]
31548        use super::*;
31549        #[derive(Clone, Debug, PartialEq)]
31550        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
31551    }
31552
31553    impl SslMode {
31554        /// Gets the enum value.
31555        ///
31556        /// Returns `None` if the enum contains an unknown value deserialized from
31557        /// the string representation of enums.
31558        pub fn value(&self) -> std::option::Option<i32> {
31559            match self {
31560                Self::Unspecified => std::option::Option::Some(0),
31561                Self::AllowUnencryptedAndEncrypted => std::option::Option::Some(1),
31562                Self::EncryptedOnly => std::option::Option::Some(2),
31563                Self::TrustedClientCertificateRequired => std::option::Option::Some(3),
31564                Self::UnknownValue(u) => u.0.value(),
31565            }
31566        }
31567
31568        /// Gets the enum value as a string.
31569        ///
31570        /// Returns `None` if the enum contains an unknown value deserialized from
31571        /// the integer representation of enums.
31572        pub fn name(&self) -> std::option::Option<&str> {
31573            match self {
31574                Self::Unspecified => std::option::Option::Some("SSL_MODE_UNSPECIFIED"),
31575                Self::AllowUnencryptedAndEncrypted => {
31576                    std::option::Option::Some("ALLOW_UNENCRYPTED_AND_ENCRYPTED")
31577                }
31578                Self::EncryptedOnly => std::option::Option::Some("ENCRYPTED_ONLY"),
31579                Self::TrustedClientCertificateRequired => {
31580                    std::option::Option::Some("TRUSTED_CLIENT_CERTIFICATE_REQUIRED")
31581                }
31582                Self::UnknownValue(u) => u.0.name(),
31583            }
31584        }
31585    }
31586
31587    impl std::default::Default for SslMode {
31588        fn default() -> Self {
31589            use std::convert::From;
31590            Self::from(0)
31591        }
31592    }
31593
31594    impl std::fmt::Display for SslMode {
31595        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
31596            wkt::internal::display_enum(f, self.name(), self.value())
31597        }
31598    }
31599
31600    impl std::convert::From<i32> for SslMode {
31601        fn from(value: i32) -> Self {
31602            match value {
31603                0 => Self::Unspecified,
31604                1 => Self::AllowUnencryptedAndEncrypted,
31605                2 => Self::EncryptedOnly,
31606                3 => Self::TrustedClientCertificateRequired,
31607                _ => Self::UnknownValue(ssl_mode::UnknownValue(
31608                    wkt::internal::UnknownEnumValue::Integer(value),
31609                )),
31610            }
31611        }
31612    }
31613
31614    impl std::convert::From<&str> for SslMode {
31615        fn from(value: &str) -> Self {
31616            use std::string::ToString;
31617            match value {
31618                "SSL_MODE_UNSPECIFIED" => Self::Unspecified,
31619                "ALLOW_UNENCRYPTED_AND_ENCRYPTED" => Self::AllowUnencryptedAndEncrypted,
31620                "ENCRYPTED_ONLY" => Self::EncryptedOnly,
31621                "TRUSTED_CLIENT_CERTIFICATE_REQUIRED" => Self::TrustedClientCertificateRequired,
31622                _ => Self::UnknownValue(ssl_mode::UnknownValue(
31623                    wkt::internal::UnknownEnumValue::String(value.to_string()),
31624                )),
31625            }
31626        }
31627    }
31628
31629    impl serde::ser::Serialize for SslMode {
31630        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
31631        where
31632            S: serde::Serializer,
31633        {
31634            match self {
31635                Self::Unspecified => serializer.serialize_i32(0),
31636                Self::AllowUnencryptedAndEncrypted => serializer.serialize_i32(1),
31637                Self::EncryptedOnly => serializer.serialize_i32(2),
31638                Self::TrustedClientCertificateRequired => serializer.serialize_i32(3),
31639                Self::UnknownValue(u) => u.0.serialize(serializer),
31640            }
31641        }
31642    }
31643
31644    impl<'de> serde::de::Deserialize<'de> for SslMode {
31645        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
31646        where
31647            D: serde::Deserializer<'de>,
31648        {
31649            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SslMode>::new(
31650                ".google.cloud.sql.v1.IpConfiguration.SslMode",
31651            ))
31652        }
31653    }
31654
31655    /// Various Certificate Authority (CA) modes for certificate signing.
31656    ///
31657    /// # Working with unknown values
31658    ///
31659    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
31660    /// additional enum variants at any time. Adding new variants is not considered
31661    /// a breaking change. Applications should write their code in anticipation of:
31662    ///
31663    /// - New values appearing in future releases of the client library, **and**
31664    /// - New values received dynamically, without application changes.
31665    ///
31666    /// Please consult the [Working with enums] section in the user guide for some
31667    /// guidelines.
31668    ///
31669    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
31670    #[derive(Clone, Debug, PartialEq)]
31671    #[non_exhaustive]
31672    pub enum CaMode {
31673        /// CA mode is unknown.
31674        Unspecified,
31675        /// Google-managed self-signed internal CA.
31676        GoogleManagedInternalCa,
31677        /// Google-managed regional CA part of root CA hierarchy hosted on Google
31678        /// Cloud's Certificate Authority Service (CAS).
31679        GoogleManagedCasCa,
31680        /// If set, the enum was initialized with an unknown value.
31681        ///
31682        /// Applications can examine the value using [CaMode::value] or
31683        /// [CaMode::name].
31684        UnknownValue(ca_mode::UnknownValue),
31685    }
31686
31687    #[doc(hidden)]
31688    pub mod ca_mode {
31689        #[allow(unused_imports)]
31690        use super::*;
31691        #[derive(Clone, Debug, PartialEq)]
31692        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
31693    }
31694
31695    impl CaMode {
31696        /// Gets the enum value.
31697        ///
31698        /// Returns `None` if the enum contains an unknown value deserialized from
31699        /// the string representation of enums.
31700        pub fn value(&self) -> std::option::Option<i32> {
31701            match self {
31702                Self::Unspecified => std::option::Option::Some(0),
31703                Self::GoogleManagedInternalCa => std::option::Option::Some(1),
31704                Self::GoogleManagedCasCa => std::option::Option::Some(2),
31705                Self::UnknownValue(u) => u.0.value(),
31706            }
31707        }
31708
31709        /// Gets the enum value as a string.
31710        ///
31711        /// Returns `None` if the enum contains an unknown value deserialized from
31712        /// the integer representation of enums.
31713        pub fn name(&self) -> std::option::Option<&str> {
31714            match self {
31715                Self::Unspecified => std::option::Option::Some("CA_MODE_UNSPECIFIED"),
31716                Self::GoogleManagedInternalCa => {
31717                    std::option::Option::Some("GOOGLE_MANAGED_INTERNAL_CA")
31718                }
31719                Self::GoogleManagedCasCa => std::option::Option::Some("GOOGLE_MANAGED_CAS_CA"),
31720                Self::UnknownValue(u) => u.0.name(),
31721            }
31722        }
31723    }
31724
31725    impl std::default::Default for CaMode {
31726        fn default() -> Self {
31727            use std::convert::From;
31728            Self::from(0)
31729        }
31730    }
31731
31732    impl std::fmt::Display for CaMode {
31733        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
31734            wkt::internal::display_enum(f, self.name(), self.value())
31735        }
31736    }
31737
31738    impl std::convert::From<i32> for CaMode {
31739        fn from(value: i32) -> Self {
31740            match value {
31741                0 => Self::Unspecified,
31742                1 => Self::GoogleManagedInternalCa,
31743                2 => Self::GoogleManagedCasCa,
31744                _ => Self::UnknownValue(ca_mode::UnknownValue(
31745                    wkt::internal::UnknownEnumValue::Integer(value),
31746                )),
31747            }
31748        }
31749    }
31750
31751    impl std::convert::From<&str> for CaMode {
31752        fn from(value: &str) -> Self {
31753            use std::string::ToString;
31754            match value {
31755                "CA_MODE_UNSPECIFIED" => Self::Unspecified,
31756                "GOOGLE_MANAGED_INTERNAL_CA" => Self::GoogleManagedInternalCa,
31757                "GOOGLE_MANAGED_CAS_CA" => Self::GoogleManagedCasCa,
31758                _ => Self::UnknownValue(ca_mode::UnknownValue(
31759                    wkt::internal::UnknownEnumValue::String(value.to_string()),
31760                )),
31761            }
31762        }
31763    }
31764
31765    impl serde::ser::Serialize for CaMode {
31766        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
31767        where
31768            S: serde::Serializer,
31769        {
31770            match self {
31771                Self::Unspecified => serializer.serialize_i32(0),
31772                Self::GoogleManagedInternalCa => serializer.serialize_i32(1),
31773                Self::GoogleManagedCasCa => serializer.serialize_i32(2),
31774                Self::UnknownValue(u) => u.0.serialize(serializer),
31775            }
31776        }
31777    }
31778
31779    impl<'de> serde::de::Deserialize<'de> for CaMode {
31780        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
31781        where
31782            D: serde::Deserializer<'de>,
31783        {
31784            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CaMode>::new(
31785                ".google.cloud.sql.v1.IpConfiguration.CaMode",
31786            ))
31787        }
31788    }
31789}
31790
31791/// PSC settings for a Cloud SQL instance.
31792#[derive(Clone, Default, PartialEq)]
31793#[non_exhaustive]
31794pub struct PscConfig {
31795    /// Whether PSC connectivity is enabled for this instance.
31796    pub psc_enabled: std::option::Option<bool>,
31797
31798    /// Optional. The list of consumer projects that are allow-listed for PSC
31799    /// connections to this instance. This instance can be connected to with PSC
31800    /// from any network in these projects.
31801    ///
31802    /// Each consumer project in this list may be represented by a project number
31803    /// (numeric) or by a project id (alphanumeric).
31804    pub allowed_consumer_projects: std::vec::Vec<std::string::String>,
31805
31806    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
31807}
31808
31809impl PscConfig {
31810    pub fn new() -> Self {
31811        std::default::Default::default()
31812    }
31813
31814    /// Sets the value of [psc_enabled][crate::model::PscConfig::psc_enabled].
31815    pub fn set_psc_enabled<T>(mut self, v: T) -> Self
31816    where
31817        T: std::convert::Into<bool>,
31818    {
31819        self.psc_enabled = std::option::Option::Some(v.into());
31820        self
31821    }
31822
31823    /// Sets or clears the value of [psc_enabled][crate::model::PscConfig::psc_enabled].
31824    pub fn set_or_clear_psc_enabled<T>(mut self, v: std::option::Option<T>) -> Self
31825    where
31826        T: std::convert::Into<bool>,
31827    {
31828        self.psc_enabled = v.map(|x| x.into());
31829        self
31830    }
31831
31832    /// Sets the value of [allowed_consumer_projects][crate::model::PscConfig::allowed_consumer_projects].
31833    pub fn set_allowed_consumer_projects<T, V>(mut self, v: T) -> Self
31834    where
31835        T: std::iter::IntoIterator<Item = V>,
31836        V: std::convert::Into<std::string::String>,
31837    {
31838        use std::iter::Iterator;
31839        self.allowed_consumer_projects = v.into_iter().map(|i| i.into()).collect();
31840        self
31841    }
31842}
31843
31844impl wkt::message::Message for PscConfig {
31845    fn typename() -> &'static str {
31846        "type.googleapis.com/google.cloud.sql.v1.PscConfig"
31847    }
31848}
31849
31850#[doc(hidden)]
31851impl<'de> serde::de::Deserialize<'de> for PscConfig {
31852    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
31853    where
31854        D: serde::Deserializer<'de>,
31855    {
31856        #[allow(non_camel_case_types)]
31857        #[doc(hidden)]
31858        #[derive(PartialEq, Eq, Hash)]
31859        enum __FieldTag {
31860            __psc_enabled,
31861            __allowed_consumer_projects,
31862            Unknown(std::string::String),
31863        }
31864        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
31865            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
31866            where
31867                D: serde::Deserializer<'de>,
31868            {
31869                struct Visitor;
31870                impl<'de> serde::de::Visitor<'de> for Visitor {
31871                    type Value = __FieldTag;
31872                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
31873                        formatter.write_str("a field name for PscConfig")
31874                    }
31875                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
31876                    where
31877                        E: serde::de::Error,
31878                    {
31879                        use std::result::Result::Ok;
31880                        use std::string::ToString;
31881                        match value {
31882                            "pscEnabled" => Ok(__FieldTag::__psc_enabled),
31883                            "psc_enabled" => Ok(__FieldTag::__psc_enabled),
31884                            "allowedConsumerProjects" => {
31885                                Ok(__FieldTag::__allowed_consumer_projects)
31886                            }
31887                            "allowed_consumer_projects" => {
31888                                Ok(__FieldTag::__allowed_consumer_projects)
31889                            }
31890                            _ => Ok(__FieldTag::Unknown(value.to_string())),
31891                        }
31892                    }
31893                }
31894                deserializer.deserialize_identifier(Visitor)
31895            }
31896        }
31897        struct Visitor;
31898        impl<'de> serde::de::Visitor<'de> for Visitor {
31899            type Value = PscConfig;
31900            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
31901                formatter.write_str("struct PscConfig")
31902            }
31903            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
31904            where
31905                A: serde::de::MapAccess<'de>,
31906            {
31907                #[allow(unused_imports)]
31908                use serde::de::Error;
31909                use std::option::Option::Some;
31910                let mut fields = std::collections::HashSet::new();
31911                let mut result = Self::Value::new();
31912                while let Some(tag) = map.next_key::<__FieldTag>()? {
31913                    #[allow(clippy::match_single_binding)]
31914                    match tag {
31915                        __FieldTag::__psc_enabled => {
31916                            if !fields.insert(__FieldTag::__psc_enabled) {
31917                                return std::result::Result::Err(A::Error::duplicate_field(
31918                                    "multiple values for psc_enabled",
31919                                ));
31920                            }
31921                            result.psc_enabled = map.next_value::<std::option::Option<bool>>()?;
31922                        }
31923                        __FieldTag::__allowed_consumer_projects => {
31924                            if !fields.insert(__FieldTag::__allowed_consumer_projects) {
31925                                return std::result::Result::Err(A::Error::duplicate_field(
31926                                    "multiple values for allowed_consumer_projects",
31927                                ));
31928                            }
31929                            result.allowed_consumer_projects = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
31930                        }
31931                        __FieldTag::Unknown(key) => {
31932                            let value = map.next_value::<serde_json::Value>()?;
31933                            result._unknown_fields.insert(key, value);
31934                        }
31935                    }
31936                }
31937                std::result::Result::Ok(result)
31938            }
31939        }
31940        deserializer.deserialize_any(Visitor)
31941    }
31942}
31943
31944#[doc(hidden)]
31945impl serde::ser::Serialize for PscConfig {
31946    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
31947    where
31948        S: serde::ser::Serializer,
31949    {
31950        use serde::ser::SerializeMap;
31951        #[allow(unused_imports)]
31952        use std::option::Option::Some;
31953        let mut state = serializer.serialize_map(std::option::Option::None)?;
31954        if self.psc_enabled.is_some() {
31955            state.serialize_entry("pscEnabled", &self.psc_enabled)?;
31956        }
31957        if !self.allowed_consumer_projects.is_empty() {
31958            state.serialize_entry("allowedConsumerProjects", &self.allowed_consumer_projects)?;
31959        }
31960        if !self._unknown_fields.is_empty() {
31961            for (key, value) in self._unknown_fields.iter() {
31962                state.serialize_entry(key, &value)?;
31963            }
31964        }
31965        state.end()
31966    }
31967}
31968
31969impl std::fmt::Debug for PscConfig {
31970    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
31971        let mut debug_struct = f.debug_struct("PscConfig");
31972        debug_struct.field("psc_enabled", &self.psc_enabled);
31973        debug_struct.field("allowed_consumer_projects", &self.allowed_consumer_projects);
31974        if !self._unknown_fields.is_empty() {
31975            debug_struct.field("_unknown_fields", &self._unknown_fields);
31976        }
31977        debug_struct.finish()
31978    }
31979}
31980
31981/// Preferred location. This specifies where a Cloud SQL instance is located.
31982/// Note that if the preferred location is not available, the instance will be
31983/// located as close as possible within the region. Only one location may be
31984/// specified.
31985#[derive(Clone, Default, PartialEq)]
31986#[non_exhaustive]
31987pub struct LocationPreference {
31988    /// The App Engine application to follow, it must be in the same region as the
31989    /// Cloud SQL instance. WARNING: Changing this might restart the instance.
31990    #[deprecated]
31991    pub follow_gae_application: std::string::String,
31992
31993    /// The preferred Compute Engine zone (for example: us-central1-a,
31994    /// us-central1-b, etc.). WARNING: Changing this might restart the instance.
31995    pub zone: std::string::String,
31996
31997    /// The preferred Compute Engine zone for the secondary/failover
31998    /// (for example: us-central1-a, us-central1-b, etc.).
31999    /// To disable this field, set it to 'no_secondary_zone'.
32000    pub secondary_zone: std::string::String,
32001
32002    /// This is always `sql#locationPreference`.
32003    pub kind: std::string::String,
32004
32005    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
32006}
32007
32008impl LocationPreference {
32009    pub fn new() -> Self {
32010        std::default::Default::default()
32011    }
32012
32013    /// Sets the value of [follow_gae_application][crate::model::LocationPreference::follow_gae_application].
32014    #[deprecated]
32015    pub fn set_follow_gae_application<T: std::convert::Into<std::string::String>>(
32016        mut self,
32017        v: T,
32018    ) -> Self {
32019        self.follow_gae_application = v.into();
32020        self
32021    }
32022
32023    /// Sets the value of [zone][crate::model::LocationPreference::zone].
32024    pub fn set_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
32025        self.zone = v.into();
32026        self
32027    }
32028
32029    /// Sets the value of [secondary_zone][crate::model::LocationPreference::secondary_zone].
32030    pub fn set_secondary_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
32031        self.secondary_zone = v.into();
32032        self
32033    }
32034
32035    /// Sets the value of [kind][crate::model::LocationPreference::kind].
32036    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
32037        self.kind = v.into();
32038        self
32039    }
32040}
32041
32042impl wkt::message::Message for LocationPreference {
32043    fn typename() -> &'static str {
32044        "type.googleapis.com/google.cloud.sql.v1.LocationPreference"
32045    }
32046}
32047
32048#[doc(hidden)]
32049impl<'de> serde::de::Deserialize<'de> for LocationPreference {
32050    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
32051    where
32052        D: serde::Deserializer<'de>,
32053    {
32054        #[allow(non_camel_case_types)]
32055        #[doc(hidden)]
32056        #[derive(PartialEq, Eq, Hash)]
32057        enum __FieldTag {
32058            __follow_gae_application,
32059            __zone,
32060            __secondary_zone,
32061            __kind,
32062            Unknown(std::string::String),
32063        }
32064        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
32065            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
32066            where
32067                D: serde::Deserializer<'de>,
32068            {
32069                struct Visitor;
32070                impl<'de> serde::de::Visitor<'de> for Visitor {
32071                    type Value = __FieldTag;
32072                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
32073                        formatter.write_str("a field name for LocationPreference")
32074                    }
32075                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
32076                    where
32077                        E: serde::de::Error,
32078                    {
32079                        use std::result::Result::Ok;
32080                        use std::string::ToString;
32081                        match value {
32082                            "followGaeApplication" => Ok(__FieldTag::__follow_gae_application),
32083                            "follow_gae_application" => Ok(__FieldTag::__follow_gae_application),
32084                            "zone" => Ok(__FieldTag::__zone),
32085                            "secondaryZone" => Ok(__FieldTag::__secondary_zone),
32086                            "secondary_zone" => Ok(__FieldTag::__secondary_zone),
32087                            "kind" => Ok(__FieldTag::__kind),
32088                            _ => Ok(__FieldTag::Unknown(value.to_string())),
32089                        }
32090                    }
32091                }
32092                deserializer.deserialize_identifier(Visitor)
32093            }
32094        }
32095        struct Visitor;
32096        impl<'de> serde::de::Visitor<'de> for Visitor {
32097            type Value = LocationPreference;
32098            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
32099                formatter.write_str("struct LocationPreference")
32100            }
32101            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
32102            where
32103                A: serde::de::MapAccess<'de>,
32104            {
32105                #[allow(unused_imports)]
32106                use serde::de::Error;
32107                use std::option::Option::Some;
32108                let mut fields = std::collections::HashSet::new();
32109                let mut result = Self::Value::new();
32110                while let Some(tag) = map.next_key::<__FieldTag>()? {
32111                    #[allow(clippy::match_single_binding)]
32112                    match tag {
32113                        __FieldTag::__follow_gae_application => {
32114                            if !fields.insert(__FieldTag::__follow_gae_application) {
32115                                return std::result::Result::Err(A::Error::duplicate_field(
32116                                    "multiple values for follow_gae_application",
32117                                ));
32118                            }
32119                            result.follow_gae_application = map
32120                                .next_value::<std::option::Option<std::string::String>>()?
32121                                .unwrap_or_default();
32122                        }
32123                        __FieldTag::__zone => {
32124                            if !fields.insert(__FieldTag::__zone) {
32125                                return std::result::Result::Err(A::Error::duplicate_field(
32126                                    "multiple values for zone",
32127                                ));
32128                            }
32129                            result.zone = map
32130                                .next_value::<std::option::Option<std::string::String>>()?
32131                                .unwrap_or_default();
32132                        }
32133                        __FieldTag::__secondary_zone => {
32134                            if !fields.insert(__FieldTag::__secondary_zone) {
32135                                return std::result::Result::Err(A::Error::duplicate_field(
32136                                    "multiple values for secondary_zone",
32137                                ));
32138                            }
32139                            result.secondary_zone = map
32140                                .next_value::<std::option::Option<std::string::String>>()?
32141                                .unwrap_or_default();
32142                        }
32143                        __FieldTag::__kind => {
32144                            if !fields.insert(__FieldTag::__kind) {
32145                                return std::result::Result::Err(A::Error::duplicate_field(
32146                                    "multiple values for kind",
32147                                ));
32148                            }
32149                            result.kind = map
32150                                .next_value::<std::option::Option<std::string::String>>()?
32151                                .unwrap_or_default();
32152                        }
32153                        __FieldTag::Unknown(key) => {
32154                            let value = map.next_value::<serde_json::Value>()?;
32155                            result._unknown_fields.insert(key, value);
32156                        }
32157                    }
32158                }
32159                std::result::Result::Ok(result)
32160            }
32161        }
32162        deserializer.deserialize_any(Visitor)
32163    }
32164}
32165
32166#[doc(hidden)]
32167impl serde::ser::Serialize for LocationPreference {
32168    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
32169    where
32170        S: serde::ser::Serializer,
32171    {
32172        use serde::ser::SerializeMap;
32173        #[allow(unused_imports)]
32174        use std::option::Option::Some;
32175        let mut state = serializer.serialize_map(std::option::Option::None)?;
32176        if !self.follow_gae_application.is_empty() {
32177            state.serialize_entry("followGaeApplication", &self.follow_gae_application)?;
32178        }
32179        if !self.zone.is_empty() {
32180            state.serialize_entry("zone", &self.zone)?;
32181        }
32182        if !self.secondary_zone.is_empty() {
32183            state.serialize_entry("secondaryZone", &self.secondary_zone)?;
32184        }
32185        if !self.kind.is_empty() {
32186            state.serialize_entry("kind", &self.kind)?;
32187        }
32188        if !self._unknown_fields.is_empty() {
32189            for (key, value) in self._unknown_fields.iter() {
32190                state.serialize_entry(key, &value)?;
32191            }
32192        }
32193        state.end()
32194    }
32195}
32196
32197impl std::fmt::Debug for LocationPreference {
32198    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
32199        let mut debug_struct = f.debug_struct("LocationPreference");
32200        debug_struct.field("follow_gae_application", &self.follow_gae_application);
32201        debug_struct.field("zone", &self.zone);
32202        debug_struct.field("secondary_zone", &self.secondary_zone);
32203        debug_struct.field("kind", &self.kind);
32204        if !self._unknown_fields.is_empty() {
32205            debug_struct.field("_unknown_fields", &self._unknown_fields);
32206        }
32207        debug_struct.finish()
32208    }
32209}
32210
32211/// Maintenance window. This specifies when a Cloud SQL instance is
32212/// restarted for system maintenance purposes.
32213#[derive(Clone, Default, PartialEq)]
32214#[non_exhaustive]
32215pub struct MaintenanceWindow {
32216    /// Hour of day - 0 to 23. Specify in the UTC time zone.
32217    pub hour: std::option::Option<wkt::Int32Value>,
32218
32219    /// Day of week - `MONDAY`, `TUESDAY`, `WEDNESDAY`, `THURSDAY`, `FRIDAY`,
32220    /// `SATURDAY`, or `SUNDAY`. Specify in the UTC time zone.
32221    /// Returned in output as an integer, 1 to 7, where `1` equals Monday.
32222    pub day: std::option::Option<wkt::Int32Value>,
32223
32224    /// Maintenance timing settings: `canary`, `stable`, or `week5`.
32225    /// For more information, see [About maintenance on Cloud SQL
32226    /// instances](https://cloud.google.com/sql/docs/mysql/maintenance).
32227    pub update_track: crate::model::SqlUpdateTrack,
32228
32229    /// This is always `sql#maintenanceWindow`.
32230    pub kind: std::string::String,
32231
32232    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
32233}
32234
32235impl MaintenanceWindow {
32236    pub fn new() -> Self {
32237        std::default::Default::default()
32238    }
32239
32240    /// Sets the value of [hour][crate::model::MaintenanceWindow::hour].
32241    pub fn set_hour<T>(mut self, v: T) -> Self
32242    where
32243        T: std::convert::Into<wkt::Int32Value>,
32244    {
32245        self.hour = std::option::Option::Some(v.into());
32246        self
32247    }
32248
32249    /// Sets or clears the value of [hour][crate::model::MaintenanceWindow::hour].
32250    pub fn set_or_clear_hour<T>(mut self, v: std::option::Option<T>) -> Self
32251    where
32252        T: std::convert::Into<wkt::Int32Value>,
32253    {
32254        self.hour = v.map(|x| x.into());
32255        self
32256    }
32257
32258    /// Sets the value of [day][crate::model::MaintenanceWindow::day].
32259    pub fn set_day<T>(mut self, v: T) -> Self
32260    where
32261        T: std::convert::Into<wkt::Int32Value>,
32262    {
32263        self.day = std::option::Option::Some(v.into());
32264        self
32265    }
32266
32267    /// Sets or clears the value of [day][crate::model::MaintenanceWindow::day].
32268    pub fn set_or_clear_day<T>(mut self, v: std::option::Option<T>) -> Self
32269    where
32270        T: std::convert::Into<wkt::Int32Value>,
32271    {
32272        self.day = v.map(|x| x.into());
32273        self
32274    }
32275
32276    /// Sets the value of [update_track][crate::model::MaintenanceWindow::update_track].
32277    pub fn set_update_track<T: std::convert::Into<crate::model::SqlUpdateTrack>>(
32278        mut self,
32279        v: T,
32280    ) -> Self {
32281        self.update_track = v.into();
32282        self
32283    }
32284
32285    /// Sets the value of [kind][crate::model::MaintenanceWindow::kind].
32286    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
32287        self.kind = v.into();
32288        self
32289    }
32290}
32291
32292impl wkt::message::Message for MaintenanceWindow {
32293    fn typename() -> &'static str {
32294        "type.googleapis.com/google.cloud.sql.v1.MaintenanceWindow"
32295    }
32296}
32297
32298#[doc(hidden)]
32299impl<'de> serde::de::Deserialize<'de> for MaintenanceWindow {
32300    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
32301    where
32302        D: serde::Deserializer<'de>,
32303    {
32304        #[allow(non_camel_case_types)]
32305        #[doc(hidden)]
32306        #[derive(PartialEq, Eq, Hash)]
32307        enum __FieldTag {
32308            __hour,
32309            __day,
32310            __update_track,
32311            __kind,
32312            Unknown(std::string::String),
32313        }
32314        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
32315            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
32316            where
32317                D: serde::Deserializer<'de>,
32318            {
32319                struct Visitor;
32320                impl<'de> serde::de::Visitor<'de> for Visitor {
32321                    type Value = __FieldTag;
32322                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
32323                        formatter.write_str("a field name for MaintenanceWindow")
32324                    }
32325                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
32326                    where
32327                        E: serde::de::Error,
32328                    {
32329                        use std::result::Result::Ok;
32330                        use std::string::ToString;
32331                        match value {
32332                            "hour" => Ok(__FieldTag::__hour),
32333                            "day" => Ok(__FieldTag::__day),
32334                            "updateTrack" => Ok(__FieldTag::__update_track),
32335                            "update_track" => Ok(__FieldTag::__update_track),
32336                            "kind" => Ok(__FieldTag::__kind),
32337                            _ => Ok(__FieldTag::Unknown(value.to_string())),
32338                        }
32339                    }
32340                }
32341                deserializer.deserialize_identifier(Visitor)
32342            }
32343        }
32344        struct Visitor;
32345        impl<'de> serde::de::Visitor<'de> for Visitor {
32346            type Value = MaintenanceWindow;
32347            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
32348                formatter.write_str("struct MaintenanceWindow")
32349            }
32350            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
32351            where
32352                A: serde::de::MapAccess<'de>,
32353            {
32354                #[allow(unused_imports)]
32355                use serde::de::Error;
32356                use std::option::Option::Some;
32357                let mut fields = std::collections::HashSet::new();
32358                let mut result = Self::Value::new();
32359                while let Some(tag) = map.next_key::<__FieldTag>()? {
32360                    #[allow(clippy::match_single_binding)]
32361                    match tag {
32362                        __FieldTag::__hour => {
32363                            if !fields.insert(__FieldTag::__hour) {
32364                                return std::result::Result::Err(A::Error::duplicate_field(
32365                                    "multiple values for hour",
32366                                ));
32367                            }
32368                            struct __With(std::option::Option<wkt::Int32Value>);
32369                            impl<'de> serde::de::Deserialize<'de> for __With {
32370                                fn deserialize<D>(
32371                                    deserializer: D,
32372                                ) -> std::result::Result<Self, D::Error>
32373                                where
32374                                    D: serde::de::Deserializer<'de>,
32375                                {
32376                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
32377                                }
32378                            }
32379                            result.hour = map.next_value::<__With>()?.0;
32380                        }
32381                        __FieldTag::__day => {
32382                            if !fields.insert(__FieldTag::__day) {
32383                                return std::result::Result::Err(A::Error::duplicate_field(
32384                                    "multiple values for day",
32385                                ));
32386                            }
32387                            struct __With(std::option::Option<wkt::Int32Value>);
32388                            impl<'de> serde::de::Deserialize<'de> for __With {
32389                                fn deserialize<D>(
32390                                    deserializer: D,
32391                                ) -> std::result::Result<Self, D::Error>
32392                                where
32393                                    D: serde::de::Deserializer<'de>,
32394                                {
32395                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
32396                                }
32397                            }
32398                            result.day = map.next_value::<__With>()?.0;
32399                        }
32400                        __FieldTag::__update_track => {
32401                            if !fields.insert(__FieldTag::__update_track) {
32402                                return std::result::Result::Err(A::Error::duplicate_field(
32403                                    "multiple values for update_track",
32404                                ));
32405                            }
32406                            result.update_track = map
32407                                .next_value::<std::option::Option<crate::model::SqlUpdateTrack>>()?
32408                                .unwrap_or_default();
32409                        }
32410                        __FieldTag::__kind => {
32411                            if !fields.insert(__FieldTag::__kind) {
32412                                return std::result::Result::Err(A::Error::duplicate_field(
32413                                    "multiple values for kind",
32414                                ));
32415                            }
32416                            result.kind = map
32417                                .next_value::<std::option::Option<std::string::String>>()?
32418                                .unwrap_or_default();
32419                        }
32420                        __FieldTag::Unknown(key) => {
32421                            let value = map.next_value::<serde_json::Value>()?;
32422                            result._unknown_fields.insert(key, value);
32423                        }
32424                    }
32425                }
32426                std::result::Result::Ok(result)
32427            }
32428        }
32429        deserializer.deserialize_any(Visitor)
32430    }
32431}
32432
32433#[doc(hidden)]
32434impl serde::ser::Serialize for MaintenanceWindow {
32435    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
32436    where
32437        S: serde::ser::Serializer,
32438    {
32439        use serde::ser::SerializeMap;
32440        #[allow(unused_imports)]
32441        use std::option::Option::Some;
32442        let mut state = serializer.serialize_map(std::option::Option::None)?;
32443        if self.hour.is_some() {
32444            struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
32445            impl<'a> serde::ser::Serialize for __With<'a> {
32446                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
32447                where
32448                    S: serde::ser::Serializer,
32449                {
32450                    serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
32451                        self.0, serializer,
32452                    )
32453                }
32454            }
32455            state.serialize_entry("hour", &__With(&self.hour))?;
32456        }
32457        if self.day.is_some() {
32458            struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
32459            impl<'a> serde::ser::Serialize for __With<'a> {
32460                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
32461                where
32462                    S: serde::ser::Serializer,
32463                {
32464                    serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
32465                        self.0, serializer,
32466                    )
32467                }
32468            }
32469            state.serialize_entry("day", &__With(&self.day))?;
32470        }
32471        if !wkt::internal::is_default(&self.update_track) {
32472            state.serialize_entry("updateTrack", &self.update_track)?;
32473        }
32474        if !self.kind.is_empty() {
32475            state.serialize_entry("kind", &self.kind)?;
32476        }
32477        if !self._unknown_fields.is_empty() {
32478            for (key, value) in self._unknown_fields.iter() {
32479                state.serialize_entry(key, &value)?;
32480            }
32481        }
32482        state.end()
32483    }
32484}
32485
32486impl std::fmt::Debug for MaintenanceWindow {
32487    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
32488        let mut debug_struct = f.debug_struct("MaintenanceWindow");
32489        debug_struct.field("hour", &self.hour);
32490        debug_struct.field("day", &self.day);
32491        debug_struct.field("update_track", &self.update_track);
32492        debug_struct.field("kind", &self.kind);
32493        if !self._unknown_fields.is_empty() {
32494            debug_struct.field("_unknown_fields", &self._unknown_fields);
32495        }
32496        debug_struct.finish()
32497    }
32498}
32499
32500/// Deny maintenance Periods. This specifies a date range during when all CSA
32501/// rollout will be denied.
32502#[derive(Clone, Default, PartialEq)]
32503#[non_exhaustive]
32504pub struct DenyMaintenancePeriod {
32505    /// "deny maintenance period" start date. If the year of the start date is
32506    /// empty, the year of the end date also must be empty. In this case, it means
32507    /// the deny maintenance period recurs every year. The date is in format
32508    /// yyyy-mm-dd i.e., 2020-11-01, or mm-dd, i.e., 11-01
32509    pub start_date: std::string::String,
32510
32511    /// "deny maintenance period" end date. If the year of the end date is empty,
32512    /// the year of the start date also must be empty. In this case, it means the
32513    /// no maintenance interval recurs every year. The date is in format yyyy-mm-dd
32514    /// i.e., 2020-11-01, or mm-dd, i.e., 11-01
32515    pub end_date: std::string::String,
32516
32517    /// Time in UTC when the "deny maintenance period" starts on start_date and
32518    /// ends on end_date. The time is in format: HH:mm:SS, i.e., 00:00:00
32519    pub time: std::string::String,
32520
32521    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
32522}
32523
32524impl DenyMaintenancePeriod {
32525    pub fn new() -> Self {
32526        std::default::Default::default()
32527    }
32528
32529    /// Sets the value of [start_date][crate::model::DenyMaintenancePeriod::start_date].
32530    pub fn set_start_date<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
32531        self.start_date = v.into();
32532        self
32533    }
32534
32535    /// Sets the value of [end_date][crate::model::DenyMaintenancePeriod::end_date].
32536    pub fn set_end_date<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
32537        self.end_date = v.into();
32538        self
32539    }
32540
32541    /// Sets the value of [time][crate::model::DenyMaintenancePeriod::time].
32542    pub fn set_time<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
32543        self.time = v.into();
32544        self
32545    }
32546}
32547
32548impl wkt::message::Message for DenyMaintenancePeriod {
32549    fn typename() -> &'static str {
32550        "type.googleapis.com/google.cloud.sql.v1.DenyMaintenancePeriod"
32551    }
32552}
32553
32554#[doc(hidden)]
32555impl<'de> serde::de::Deserialize<'de> for DenyMaintenancePeriod {
32556    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
32557    where
32558        D: serde::Deserializer<'de>,
32559    {
32560        #[allow(non_camel_case_types)]
32561        #[doc(hidden)]
32562        #[derive(PartialEq, Eq, Hash)]
32563        enum __FieldTag {
32564            __start_date,
32565            __end_date,
32566            __time,
32567            Unknown(std::string::String),
32568        }
32569        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
32570            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
32571            where
32572                D: serde::Deserializer<'de>,
32573            {
32574                struct Visitor;
32575                impl<'de> serde::de::Visitor<'de> for Visitor {
32576                    type Value = __FieldTag;
32577                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
32578                        formatter.write_str("a field name for DenyMaintenancePeriod")
32579                    }
32580                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
32581                    where
32582                        E: serde::de::Error,
32583                    {
32584                        use std::result::Result::Ok;
32585                        use std::string::ToString;
32586                        match value {
32587                            "startDate" => Ok(__FieldTag::__start_date),
32588                            "start_date" => Ok(__FieldTag::__start_date),
32589                            "endDate" => Ok(__FieldTag::__end_date),
32590                            "end_date" => Ok(__FieldTag::__end_date),
32591                            "time" => Ok(__FieldTag::__time),
32592                            _ => Ok(__FieldTag::Unknown(value.to_string())),
32593                        }
32594                    }
32595                }
32596                deserializer.deserialize_identifier(Visitor)
32597            }
32598        }
32599        struct Visitor;
32600        impl<'de> serde::de::Visitor<'de> for Visitor {
32601            type Value = DenyMaintenancePeriod;
32602            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
32603                formatter.write_str("struct DenyMaintenancePeriod")
32604            }
32605            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
32606            where
32607                A: serde::de::MapAccess<'de>,
32608            {
32609                #[allow(unused_imports)]
32610                use serde::de::Error;
32611                use std::option::Option::Some;
32612                let mut fields = std::collections::HashSet::new();
32613                let mut result = Self::Value::new();
32614                while let Some(tag) = map.next_key::<__FieldTag>()? {
32615                    #[allow(clippy::match_single_binding)]
32616                    match tag {
32617                        __FieldTag::__start_date => {
32618                            if !fields.insert(__FieldTag::__start_date) {
32619                                return std::result::Result::Err(A::Error::duplicate_field(
32620                                    "multiple values for start_date",
32621                                ));
32622                            }
32623                            result.start_date = map
32624                                .next_value::<std::option::Option<std::string::String>>()?
32625                                .unwrap_or_default();
32626                        }
32627                        __FieldTag::__end_date => {
32628                            if !fields.insert(__FieldTag::__end_date) {
32629                                return std::result::Result::Err(A::Error::duplicate_field(
32630                                    "multiple values for end_date",
32631                                ));
32632                            }
32633                            result.end_date = map
32634                                .next_value::<std::option::Option<std::string::String>>()?
32635                                .unwrap_or_default();
32636                        }
32637                        __FieldTag::__time => {
32638                            if !fields.insert(__FieldTag::__time) {
32639                                return std::result::Result::Err(A::Error::duplicate_field(
32640                                    "multiple values for time",
32641                                ));
32642                            }
32643                            result.time = map
32644                                .next_value::<std::option::Option<std::string::String>>()?
32645                                .unwrap_or_default();
32646                        }
32647                        __FieldTag::Unknown(key) => {
32648                            let value = map.next_value::<serde_json::Value>()?;
32649                            result._unknown_fields.insert(key, value);
32650                        }
32651                    }
32652                }
32653                std::result::Result::Ok(result)
32654            }
32655        }
32656        deserializer.deserialize_any(Visitor)
32657    }
32658}
32659
32660#[doc(hidden)]
32661impl serde::ser::Serialize for DenyMaintenancePeriod {
32662    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
32663    where
32664        S: serde::ser::Serializer,
32665    {
32666        use serde::ser::SerializeMap;
32667        #[allow(unused_imports)]
32668        use std::option::Option::Some;
32669        let mut state = serializer.serialize_map(std::option::Option::None)?;
32670        if !self.start_date.is_empty() {
32671            state.serialize_entry("startDate", &self.start_date)?;
32672        }
32673        if !self.end_date.is_empty() {
32674            state.serialize_entry("endDate", &self.end_date)?;
32675        }
32676        if !self.time.is_empty() {
32677            state.serialize_entry("time", &self.time)?;
32678        }
32679        if !self._unknown_fields.is_empty() {
32680            for (key, value) in self._unknown_fields.iter() {
32681                state.serialize_entry(key, &value)?;
32682            }
32683        }
32684        state.end()
32685    }
32686}
32687
32688impl std::fmt::Debug for DenyMaintenancePeriod {
32689    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
32690        let mut debug_struct = f.debug_struct("DenyMaintenancePeriod");
32691        debug_struct.field("start_date", &self.start_date);
32692        debug_struct.field("end_date", &self.end_date);
32693        debug_struct.field("time", &self.time);
32694        if !self._unknown_fields.is_empty() {
32695            debug_struct.field("_unknown_fields", &self._unknown_fields);
32696        }
32697        debug_struct.finish()
32698    }
32699}
32700
32701/// Insights configuration. This specifies when Cloud SQL Insights feature is
32702/// enabled and optional configuration.
32703#[derive(Clone, Default, PartialEq)]
32704#[non_exhaustive]
32705pub struct InsightsConfig {
32706    /// Whether Query Insights feature is enabled.
32707    pub query_insights_enabled: bool,
32708
32709    /// Whether Query Insights will record client address when enabled.
32710    pub record_client_address: bool,
32711
32712    /// Whether Query Insights will record application tags from query when
32713    /// enabled.
32714    pub record_application_tags: bool,
32715
32716    /// Maximum query length stored in bytes. Default value: 1024 bytes.
32717    /// Range: 256-4500 bytes. Query length more than this field value will be
32718    /// truncated to this value. When unset, query length will be the default
32719    /// value. Changing query length will restart the database.
32720    pub query_string_length: std::option::Option<wkt::Int32Value>,
32721
32722    /// Number of query execution plans captured by Insights per minute
32723    /// for all queries combined. Default is 5.
32724    pub query_plans_per_minute: std::option::Option<wkt::Int32Value>,
32725
32726    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
32727}
32728
32729impl InsightsConfig {
32730    pub fn new() -> Self {
32731        std::default::Default::default()
32732    }
32733
32734    /// Sets the value of [query_insights_enabled][crate::model::InsightsConfig::query_insights_enabled].
32735    pub fn set_query_insights_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
32736        self.query_insights_enabled = v.into();
32737        self
32738    }
32739
32740    /// Sets the value of [record_client_address][crate::model::InsightsConfig::record_client_address].
32741    pub fn set_record_client_address<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
32742        self.record_client_address = v.into();
32743        self
32744    }
32745
32746    /// Sets the value of [record_application_tags][crate::model::InsightsConfig::record_application_tags].
32747    pub fn set_record_application_tags<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
32748        self.record_application_tags = v.into();
32749        self
32750    }
32751
32752    /// Sets the value of [query_string_length][crate::model::InsightsConfig::query_string_length].
32753    pub fn set_query_string_length<T>(mut self, v: T) -> Self
32754    where
32755        T: std::convert::Into<wkt::Int32Value>,
32756    {
32757        self.query_string_length = std::option::Option::Some(v.into());
32758        self
32759    }
32760
32761    /// Sets or clears the value of [query_string_length][crate::model::InsightsConfig::query_string_length].
32762    pub fn set_or_clear_query_string_length<T>(mut self, v: std::option::Option<T>) -> Self
32763    where
32764        T: std::convert::Into<wkt::Int32Value>,
32765    {
32766        self.query_string_length = v.map(|x| x.into());
32767        self
32768    }
32769
32770    /// Sets the value of [query_plans_per_minute][crate::model::InsightsConfig::query_plans_per_minute].
32771    pub fn set_query_plans_per_minute<T>(mut self, v: T) -> Self
32772    where
32773        T: std::convert::Into<wkt::Int32Value>,
32774    {
32775        self.query_plans_per_minute = std::option::Option::Some(v.into());
32776        self
32777    }
32778
32779    /// Sets or clears the value of [query_plans_per_minute][crate::model::InsightsConfig::query_plans_per_minute].
32780    pub fn set_or_clear_query_plans_per_minute<T>(mut self, v: std::option::Option<T>) -> Self
32781    where
32782        T: std::convert::Into<wkt::Int32Value>,
32783    {
32784        self.query_plans_per_minute = v.map(|x| x.into());
32785        self
32786    }
32787}
32788
32789impl wkt::message::Message for InsightsConfig {
32790    fn typename() -> &'static str {
32791        "type.googleapis.com/google.cloud.sql.v1.InsightsConfig"
32792    }
32793}
32794
32795#[doc(hidden)]
32796impl<'de> serde::de::Deserialize<'de> for InsightsConfig {
32797    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
32798    where
32799        D: serde::Deserializer<'de>,
32800    {
32801        #[allow(non_camel_case_types)]
32802        #[doc(hidden)]
32803        #[derive(PartialEq, Eq, Hash)]
32804        enum __FieldTag {
32805            __query_insights_enabled,
32806            __record_client_address,
32807            __record_application_tags,
32808            __query_string_length,
32809            __query_plans_per_minute,
32810            Unknown(std::string::String),
32811        }
32812        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
32813            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
32814            where
32815                D: serde::Deserializer<'de>,
32816            {
32817                struct Visitor;
32818                impl<'de> serde::de::Visitor<'de> for Visitor {
32819                    type Value = __FieldTag;
32820                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
32821                        formatter.write_str("a field name for InsightsConfig")
32822                    }
32823                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
32824                    where
32825                        E: serde::de::Error,
32826                    {
32827                        use std::result::Result::Ok;
32828                        use std::string::ToString;
32829                        match value {
32830                            "queryInsightsEnabled" => Ok(__FieldTag::__query_insights_enabled),
32831                            "query_insights_enabled" => Ok(__FieldTag::__query_insights_enabled),
32832                            "recordClientAddress" => Ok(__FieldTag::__record_client_address),
32833                            "record_client_address" => Ok(__FieldTag::__record_client_address),
32834                            "recordApplicationTags" => Ok(__FieldTag::__record_application_tags),
32835                            "record_application_tags" => Ok(__FieldTag::__record_application_tags),
32836                            "queryStringLength" => Ok(__FieldTag::__query_string_length),
32837                            "query_string_length" => Ok(__FieldTag::__query_string_length),
32838                            "queryPlansPerMinute" => Ok(__FieldTag::__query_plans_per_minute),
32839                            "query_plans_per_minute" => Ok(__FieldTag::__query_plans_per_minute),
32840                            _ => Ok(__FieldTag::Unknown(value.to_string())),
32841                        }
32842                    }
32843                }
32844                deserializer.deserialize_identifier(Visitor)
32845            }
32846        }
32847        struct Visitor;
32848        impl<'de> serde::de::Visitor<'de> for Visitor {
32849            type Value = InsightsConfig;
32850            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
32851                formatter.write_str("struct InsightsConfig")
32852            }
32853            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
32854            where
32855                A: serde::de::MapAccess<'de>,
32856            {
32857                #[allow(unused_imports)]
32858                use serde::de::Error;
32859                use std::option::Option::Some;
32860                let mut fields = std::collections::HashSet::new();
32861                let mut result = Self::Value::new();
32862                while let Some(tag) = map.next_key::<__FieldTag>()? {
32863                    #[allow(clippy::match_single_binding)]
32864                    match tag {
32865                        __FieldTag::__query_insights_enabled => {
32866                            if !fields.insert(__FieldTag::__query_insights_enabled) {
32867                                return std::result::Result::Err(A::Error::duplicate_field(
32868                                    "multiple values for query_insights_enabled",
32869                                ));
32870                            }
32871                            result.query_insights_enabled = map
32872                                .next_value::<std::option::Option<bool>>()?
32873                                .unwrap_or_default();
32874                        }
32875                        __FieldTag::__record_client_address => {
32876                            if !fields.insert(__FieldTag::__record_client_address) {
32877                                return std::result::Result::Err(A::Error::duplicate_field(
32878                                    "multiple values for record_client_address",
32879                                ));
32880                            }
32881                            result.record_client_address = map
32882                                .next_value::<std::option::Option<bool>>()?
32883                                .unwrap_or_default();
32884                        }
32885                        __FieldTag::__record_application_tags => {
32886                            if !fields.insert(__FieldTag::__record_application_tags) {
32887                                return std::result::Result::Err(A::Error::duplicate_field(
32888                                    "multiple values for record_application_tags",
32889                                ));
32890                            }
32891                            result.record_application_tags = map
32892                                .next_value::<std::option::Option<bool>>()?
32893                                .unwrap_or_default();
32894                        }
32895                        __FieldTag::__query_string_length => {
32896                            if !fields.insert(__FieldTag::__query_string_length) {
32897                                return std::result::Result::Err(A::Error::duplicate_field(
32898                                    "multiple values for query_string_length",
32899                                ));
32900                            }
32901                            struct __With(std::option::Option<wkt::Int32Value>);
32902                            impl<'de> serde::de::Deserialize<'de> for __With {
32903                                fn deserialize<D>(
32904                                    deserializer: D,
32905                                ) -> std::result::Result<Self, D::Error>
32906                                where
32907                                    D: serde::de::Deserializer<'de>,
32908                                {
32909                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
32910                                }
32911                            }
32912                            result.query_string_length = map.next_value::<__With>()?.0;
32913                        }
32914                        __FieldTag::__query_plans_per_minute => {
32915                            if !fields.insert(__FieldTag::__query_plans_per_minute) {
32916                                return std::result::Result::Err(A::Error::duplicate_field(
32917                                    "multiple values for query_plans_per_minute",
32918                                ));
32919                            }
32920                            struct __With(std::option::Option<wkt::Int32Value>);
32921                            impl<'de> serde::de::Deserialize<'de> for __With {
32922                                fn deserialize<D>(
32923                                    deserializer: D,
32924                                ) -> std::result::Result<Self, D::Error>
32925                                where
32926                                    D: serde::de::Deserializer<'de>,
32927                                {
32928                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
32929                                }
32930                            }
32931                            result.query_plans_per_minute = map.next_value::<__With>()?.0;
32932                        }
32933                        __FieldTag::Unknown(key) => {
32934                            let value = map.next_value::<serde_json::Value>()?;
32935                            result._unknown_fields.insert(key, value);
32936                        }
32937                    }
32938                }
32939                std::result::Result::Ok(result)
32940            }
32941        }
32942        deserializer.deserialize_any(Visitor)
32943    }
32944}
32945
32946#[doc(hidden)]
32947impl serde::ser::Serialize for InsightsConfig {
32948    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
32949    where
32950        S: serde::ser::Serializer,
32951    {
32952        use serde::ser::SerializeMap;
32953        #[allow(unused_imports)]
32954        use std::option::Option::Some;
32955        let mut state = serializer.serialize_map(std::option::Option::None)?;
32956        if !wkt::internal::is_default(&self.query_insights_enabled) {
32957            state.serialize_entry("queryInsightsEnabled", &self.query_insights_enabled)?;
32958        }
32959        if !wkt::internal::is_default(&self.record_client_address) {
32960            state.serialize_entry("recordClientAddress", &self.record_client_address)?;
32961        }
32962        if !wkt::internal::is_default(&self.record_application_tags) {
32963            state.serialize_entry("recordApplicationTags", &self.record_application_tags)?;
32964        }
32965        if self.query_string_length.is_some() {
32966            struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
32967            impl<'a> serde::ser::Serialize for __With<'a> {
32968                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
32969                where
32970                    S: serde::ser::Serializer,
32971                {
32972                    serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
32973                        self.0, serializer,
32974                    )
32975                }
32976            }
32977            state.serialize_entry("queryStringLength", &__With(&self.query_string_length))?;
32978        }
32979        if self.query_plans_per_minute.is_some() {
32980            struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
32981            impl<'a> serde::ser::Serialize for __With<'a> {
32982                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
32983                where
32984                    S: serde::ser::Serializer,
32985                {
32986                    serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
32987                        self.0, serializer,
32988                    )
32989                }
32990            }
32991            state.serialize_entry("queryPlansPerMinute", &__With(&self.query_plans_per_minute))?;
32992        }
32993        if !self._unknown_fields.is_empty() {
32994            for (key, value) in self._unknown_fields.iter() {
32995                state.serialize_entry(key, &value)?;
32996            }
32997        }
32998        state.end()
32999    }
33000}
33001
33002impl std::fmt::Debug for InsightsConfig {
33003    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
33004        let mut debug_struct = f.debug_struct("InsightsConfig");
33005        debug_struct.field("query_insights_enabled", &self.query_insights_enabled);
33006        debug_struct.field("record_client_address", &self.record_client_address);
33007        debug_struct.field("record_application_tags", &self.record_application_tags);
33008        debug_struct.field("query_string_length", &self.query_string_length);
33009        debug_struct.field("query_plans_per_minute", &self.query_plans_per_minute);
33010        if !self._unknown_fields.is_empty() {
33011            debug_struct.field("_unknown_fields", &self._unknown_fields);
33012        }
33013        debug_struct.finish()
33014    }
33015}
33016
33017/// Read-replica configuration specific to MySQL databases.
33018#[derive(Clone, Default, PartialEq)]
33019#[non_exhaustive]
33020pub struct MySqlReplicaConfiguration {
33021    /// Path to a SQL dump file in Google Cloud Storage from which the replica
33022    /// instance is to be created. The URI is in the form gs://bucketName/fileName.
33023    /// Compressed gzip files (.gz) are also supported.
33024    /// Dumps have the binlog co-ordinates from which replication
33025    /// begins. This can be accomplished by setting --master-data to 1 when using
33026    /// mysqldump.
33027    pub dump_file_path: std::string::String,
33028
33029    /// The username for the replication connection.
33030    pub username: std::string::String,
33031
33032    /// The password for the replication connection.
33033    pub password: std::string::String,
33034
33035    /// Seconds to wait between connect retries. MySQL's default is 60 seconds.
33036    pub connect_retry_interval: std::option::Option<wkt::Int32Value>,
33037
33038    /// Interval in milliseconds between replication heartbeats.
33039    pub master_heartbeat_period: std::option::Option<wkt::Int64Value>,
33040
33041    /// PEM representation of the trusted CA's x509 certificate.
33042    pub ca_certificate: std::string::String,
33043
33044    /// PEM representation of the replica's x509 certificate.
33045    pub client_certificate: std::string::String,
33046
33047    /// PEM representation of the replica's private key. The corresponsing public
33048    /// key is encoded in the client's certificate.
33049    pub client_key: std::string::String,
33050
33051    /// A list of permissible ciphers to use for SSL encryption.
33052    pub ssl_cipher: std::string::String,
33053
33054    /// Whether or not to check the primary instance's Common Name value in the
33055    /// certificate that it sends during the SSL handshake.
33056    pub verify_server_certificate: std::option::Option<wkt::BoolValue>,
33057
33058    /// This is always `sql#mysqlReplicaConfiguration`.
33059    pub kind: std::string::String,
33060
33061    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
33062}
33063
33064impl MySqlReplicaConfiguration {
33065    pub fn new() -> Self {
33066        std::default::Default::default()
33067    }
33068
33069    /// Sets the value of [dump_file_path][crate::model::MySqlReplicaConfiguration::dump_file_path].
33070    pub fn set_dump_file_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
33071        self.dump_file_path = v.into();
33072        self
33073    }
33074
33075    /// Sets the value of [username][crate::model::MySqlReplicaConfiguration::username].
33076    pub fn set_username<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
33077        self.username = v.into();
33078        self
33079    }
33080
33081    /// Sets the value of [password][crate::model::MySqlReplicaConfiguration::password].
33082    pub fn set_password<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
33083        self.password = v.into();
33084        self
33085    }
33086
33087    /// Sets the value of [connect_retry_interval][crate::model::MySqlReplicaConfiguration::connect_retry_interval].
33088    pub fn set_connect_retry_interval<T>(mut self, v: T) -> Self
33089    where
33090        T: std::convert::Into<wkt::Int32Value>,
33091    {
33092        self.connect_retry_interval = std::option::Option::Some(v.into());
33093        self
33094    }
33095
33096    /// Sets or clears the value of [connect_retry_interval][crate::model::MySqlReplicaConfiguration::connect_retry_interval].
33097    pub fn set_or_clear_connect_retry_interval<T>(mut self, v: std::option::Option<T>) -> Self
33098    where
33099        T: std::convert::Into<wkt::Int32Value>,
33100    {
33101        self.connect_retry_interval = v.map(|x| x.into());
33102        self
33103    }
33104
33105    /// Sets the value of [master_heartbeat_period][crate::model::MySqlReplicaConfiguration::master_heartbeat_period].
33106    pub fn set_master_heartbeat_period<T>(mut self, v: T) -> Self
33107    where
33108        T: std::convert::Into<wkt::Int64Value>,
33109    {
33110        self.master_heartbeat_period = std::option::Option::Some(v.into());
33111        self
33112    }
33113
33114    /// Sets or clears the value of [master_heartbeat_period][crate::model::MySqlReplicaConfiguration::master_heartbeat_period].
33115    pub fn set_or_clear_master_heartbeat_period<T>(mut self, v: std::option::Option<T>) -> Self
33116    where
33117        T: std::convert::Into<wkt::Int64Value>,
33118    {
33119        self.master_heartbeat_period = v.map(|x| x.into());
33120        self
33121    }
33122
33123    /// Sets the value of [ca_certificate][crate::model::MySqlReplicaConfiguration::ca_certificate].
33124    pub fn set_ca_certificate<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
33125        self.ca_certificate = v.into();
33126        self
33127    }
33128
33129    /// Sets the value of [client_certificate][crate::model::MySqlReplicaConfiguration::client_certificate].
33130    pub fn set_client_certificate<T: std::convert::Into<std::string::String>>(
33131        mut self,
33132        v: T,
33133    ) -> Self {
33134        self.client_certificate = v.into();
33135        self
33136    }
33137
33138    /// Sets the value of [client_key][crate::model::MySqlReplicaConfiguration::client_key].
33139    pub fn set_client_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
33140        self.client_key = v.into();
33141        self
33142    }
33143
33144    /// Sets the value of [ssl_cipher][crate::model::MySqlReplicaConfiguration::ssl_cipher].
33145    pub fn set_ssl_cipher<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
33146        self.ssl_cipher = v.into();
33147        self
33148    }
33149
33150    /// Sets the value of [verify_server_certificate][crate::model::MySqlReplicaConfiguration::verify_server_certificate].
33151    pub fn set_verify_server_certificate<T>(mut self, v: T) -> Self
33152    where
33153        T: std::convert::Into<wkt::BoolValue>,
33154    {
33155        self.verify_server_certificate = std::option::Option::Some(v.into());
33156        self
33157    }
33158
33159    /// Sets or clears the value of [verify_server_certificate][crate::model::MySqlReplicaConfiguration::verify_server_certificate].
33160    pub fn set_or_clear_verify_server_certificate<T>(mut self, v: std::option::Option<T>) -> Self
33161    where
33162        T: std::convert::Into<wkt::BoolValue>,
33163    {
33164        self.verify_server_certificate = v.map(|x| x.into());
33165        self
33166    }
33167
33168    /// Sets the value of [kind][crate::model::MySqlReplicaConfiguration::kind].
33169    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
33170        self.kind = v.into();
33171        self
33172    }
33173}
33174
33175impl wkt::message::Message for MySqlReplicaConfiguration {
33176    fn typename() -> &'static str {
33177        "type.googleapis.com/google.cloud.sql.v1.MySqlReplicaConfiguration"
33178    }
33179}
33180
33181#[doc(hidden)]
33182impl<'de> serde::de::Deserialize<'de> for MySqlReplicaConfiguration {
33183    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
33184    where
33185        D: serde::Deserializer<'de>,
33186    {
33187        #[allow(non_camel_case_types)]
33188        #[doc(hidden)]
33189        #[derive(PartialEq, Eq, Hash)]
33190        enum __FieldTag {
33191            __dump_file_path,
33192            __username,
33193            __password,
33194            __connect_retry_interval,
33195            __master_heartbeat_period,
33196            __ca_certificate,
33197            __client_certificate,
33198            __client_key,
33199            __ssl_cipher,
33200            __verify_server_certificate,
33201            __kind,
33202            Unknown(std::string::String),
33203        }
33204        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
33205            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
33206            where
33207                D: serde::Deserializer<'de>,
33208            {
33209                struct Visitor;
33210                impl<'de> serde::de::Visitor<'de> for Visitor {
33211                    type Value = __FieldTag;
33212                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
33213                        formatter.write_str("a field name for MySqlReplicaConfiguration")
33214                    }
33215                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
33216                    where
33217                        E: serde::de::Error,
33218                    {
33219                        use std::result::Result::Ok;
33220                        use std::string::ToString;
33221                        match value {
33222                            "dumpFilePath" => Ok(__FieldTag::__dump_file_path),
33223                            "dump_file_path" => Ok(__FieldTag::__dump_file_path),
33224                            "username" => Ok(__FieldTag::__username),
33225                            "password" => Ok(__FieldTag::__password),
33226                            "connectRetryInterval" => Ok(__FieldTag::__connect_retry_interval),
33227                            "connect_retry_interval" => Ok(__FieldTag::__connect_retry_interval),
33228                            "masterHeartbeatPeriod" => Ok(__FieldTag::__master_heartbeat_period),
33229                            "master_heartbeat_period" => Ok(__FieldTag::__master_heartbeat_period),
33230                            "caCertificate" => Ok(__FieldTag::__ca_certificate),
33231                            "ca_certificate" => Ok(__FieldTag::__ca_certificate),
33232                            "clientCertificate" => Ok(__FieldTag::__client_certificate),
33233                            "client_certificate" => Ok(__FieldTag::__client_certificate),
33234                            "clientKey" => Ok(__FieldTag::__client_key),
33235                            "client_key" => Ok(__FieldTag::__client_key),
33236                            "sslCipher" => Ok(__FieldTag::__ssl_cipher),
33237                            "ssl_cipher" => Ok(__FieldTag::__ssl_cipher),
33238                            "verifyServerCertificate" => {
33239                                Ok(__FieldTag::__verify_server_certificate)
33240                            }
33241                            "verify_server_certificate" => {
33242                                Ok(__FieldTag::__verify_server_certificate)
33243                            }
33244                            "kind" => Ok(__FieldTag::__kind),
33245                            _ => Ok(__FieldTag::Unknown(value.to_string())),
33246                        }
33247                    }
33248                }
33249                deserializer.deserialize_identifier(Visitor)
33250            }
33251        }
33252        struct Visitor;
33253        impl<'de> serde::de::Visitor<'de> for Visitor {
33254            type Value = MySqlReplicaConfiguration;
33255            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
33256                formatter.write_str("struct MySqlReplicaConfiguration")
33257            }
33258            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
33259            where
33260                A: serde::de::MapAccess<'de>,
33261            {
33262                #[allow(unused_imports)]
33263                use serde::de::Error;
33264                use std::option::Option::Some;
33265                let mut fields = std::collections::HashSet::new();
33266                let mut result = Self::Value::new();
33267                while let Some(tag) = map.next_key::<__FieldTag>()? {
33268                    #[allow(clippy::match_single_binding)]
33269                    match tag {
33270                        __FieldTag::__dump_file_path => {
33271                            if !fields.insert(__FieldTag::__dump_file_path) {
33272                                return std::result::Result::Err(A::Error::duplicate_field(
33273                                    "multiple values for dump_file_path",
33274                                ));
33275                            }
33276                            result.dump_file_path = map
33277                                .next_value::<std::option::Option<std::string::String>>()?
33278                                .unwrap_or_default();
33279                        }
33280                        __FieldTag::__username => {
33281                            if !fields.insert(__FieldTag::__username) {
33282                                return std::result::Result::Err(A::Error::duplicate_field(
33283                                    "multiple values for username",
33284                                ));
33285                            }
33286                            result.username = map
33287                                .next_value::<std::option::Option<std::string::String>>()?
33288                                .unwrap_or_default();
33289                        }
33290                        __FieldTag::__password => {
33291                            if !fields.insert(__FieldTag::__password) {
33292                                return std::result::Result::Err(A::Error::duplicate_field(
33293                                    "multiple values for password",
33294                                ));
33295                            }
33296                            result.password = map
33297                                .next_value::<std::option::Option<std::string::String>>()?
33298                                .unwrap_or_default();
33299                        }
33300                        __FieldTag::__connect_retry_interval => {
33301                            if !fields.insert(__FieldTag::__connect_retry_interval) {
33302                                return std::result::Result::Err(A::Error::duplicate_field(
33303                                    "multiple values for connect_retry_interval",
33304                                ));
33305                            }
33306                            struct __With(std::option::Option<wkt::Int32Value>);
33307                            impl<'de> serde::de::Deserialize<'de> for __With {
33308                                fn deserialize<D>(
33309                                    deserializer: D,
33310                                ) -> std::result::Result<Self, D::Error>
33311                                where
33312                                    D: serde::de::Deserializer<'de>,
33313                                {
33314                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
33315                                }
33316                            }
33317                            result.connect_retry_interval = map.next_value::<__With>()?.0;
33318                        }
33319                        __FieldTag::__master_heartbeat_period => {
33320                            if !fields.insert(__FieldTag::__master_heartbeat_period) {
33321                                return std::result::Result::Err(A::Error::duplicate_field(
33322                                    "multiple values for master_heartbeat_period",
33323                                ));
33324                            }
33325                            struct __With(std::option::Option<wkt::Int64Value>);
33326                            impl<'de> serde::de::Deserialize<'de> for __With {
33327                                fn deserialize<D>(
33328                                    deserializer: D,
33329                                ) -> std::result::Result<Self, D::Error>
33330                                where
33331                                    D: serde::de::Deserializer<'de>,
33332                                {
33333                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
33334                                }
33335                            }
33336                            result.master_heartbeat_period = map.next_value::<__With>()?.0;
33337                        }
33338                        __FieldTag::__ca_certificate => {
33339                            if !fields.insert(__FieldTag::__ca_certificate) {
33340                                return std::result::Result::Err(A::Error::duplicate_field(
33341                                    "multiple values for ca_certificate",
33342                                ));
33343                            }
33344                            result.ca_certificate = map
33345                                .next_value::<std::option::Option<std::string::String>>()?
33346                                .unwrap_or_default();
33347                        }
33348                        __FieldTag::__client_certificate => {
33349                            if !fields.insert(__FieldTag::__client_certificate) {
33350                                return std::result::Result::Err(A::Error::duplicate_field(
33351                                    "multiple values for client_certificate",
33352                                ));
33353                            }
33354                            result.client_certificate = map
33355                                .next_value::<std::option::Option<std::string::String>>()?
33356                                .unwrap_or_default();
33357                        }
33358                        __FieldTag::__client_key => {
33359                            if !fields.insert(__FieldTag::__client_key) {
33360                                return std::result::Result::Err(A::Error::duplicate_field(
33361                                    "multiple values for client_key",
33362                                ));
33363                            }
33364                            result.client_key = map
33365                                .next_value::<std::option::Option<std::string::String>>()?
33366                                .unwrap_or_default();
33367                        }
33368                        __FieldTag::__ssl_cipher => {
33369                            if !fields.insert(__FieldTag::__ssl_cipher) {
33370                                return std::result::Result::Err(A::Error::duplicate_field(
33371                                    "multiple values for ssl_cipher",
33372                                ));
33373                            }
33374                            result.ssl_cipher = map
33375                                .next_value::<std::option::Option<std::string::String>>()?
33376                                .unwrap_or_default();
33377                        }
33378                        __FieldTag::__verify_server_certificate => {
33379                            if !fields.insert(__FieldTag::__verify_server_certificate) {
33380                                return std::result::Result::Err(A::Error::duplicate_field(
33381                                    "multiple values for verify_server_certificate",
33382                                ));
33383                            }
33384                            result.verify_server_certificate =
33385                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
33386                        }
33387                        __FieldTag::__kind => {
33388                            if !fields.insert(__FieldTag::__kind) {
33389                                return std::result::Result::Err(A::Error::duplicate_field(
33390                                    "multiple values for kind",
33391                                ));
33392                            }
33393                            result.kind = map
33394                                .next_value::<std::option::Option<std::string::String>>()?
33395                                .unwrap_or_default();
33396                        }
33397                        __FieldTag::Unknown(key) => {
33398                            let value = map.next_value::<serde_json::Value>()?;
33399                            result._unknown_fields.insert(key, value);
33400                        }
33401                    }
33402                }
33403                std::result::Result::Ok(result)
33404            }
33405        }
33406        deserializer.deserialize_any(Visitor)
33407    }
33408}
33409
33410#[doc(hidden)]
33411impl serde::ser::Serialize for MySqlReplicaConfiguration {
33412    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
33413    where
33414        S: serde::ser::Serializer,
33415    {
33416        use serde::ser::SerializeMap;
33417        #[allow(unused_imports)]
33418        use std::option::Option::Some;
33419        let mut state = serializer.serialize_map(std::option::Option::None)?;
33420        if !self.dump_file_path.is_empty() {
33421            state.serialize_entry("dumpFilePath", &self.dump_file_path)?;
33422        }
33423        if !self.username.is_empty() {
33424            state.serialize_entry("username", &self.username)?;
33425        }
33426        if !self.password.is_empty() {
33427            state.serialize_entry("password", &self.password)?;
33428        }
33429        if self.connect_retry_interval.is_some() {
33430            struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
33431            impl<'a> serde::ser::Serialize for __With<'a> {
33432                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
33433                where
33434                    S: serde::ser::Serializer,
33435                {
33436                    serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
33437                        self.0, serializer,
33438                    )
33439                }
33440            }
33441            state.serialize_entry(
33442                "connectRetryInterval",
33443                &__With(&self.connect_retry_interval),
33444            )?;
33445        }
33446        if self.master_heartbeat_period.is_some() {
33447            struct __With<'a>(&'a std::option::Option<wkt::Int64Value>);
33448            impl<'a> serde::ser::Serialize for __With<'a> {
33449                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
33450                where
33451                    S: serde::ser::Serializer,
33452                {
33453                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
33454                        self.0, serializer,
33455                    )
33456                }
33457            }
33458            state.serialize_entry(
33459                "masterHeartbeatPeriod",
33460                &__With(&self.master_heartbeat_period),
33461            )?;
33462        }
33463        if !self.ca_certificate.is_empty() {
33464            state.serialize_entry("caCertificate", &self.ca_certificate)?;
33465        }
33466        if !self.client_certificate.is_empty() {
33467            state.serialize_entry("clientCertificate", &self.client_certificate)?;
33468        }
33469        if !self.client_key.is_empty() {
33470            state.serialize_entry("clientKey", &self.client_key)?;
33471        }
33472        if !self.ssl_cipher.is_empty() {
33473            state.serialize_entry("sslCipher", &self.ssl_cipher)?;
33474        }
33475        if self.verify_server_certificate.is_some() {
33476            state.serialize_entry("verifyServerCertificate", &self.verify_server_certificate)?;
33477        }
33478        if !self.kind.is_empty() {
33479            state.serialize_entry("kind", &self.kind)?;
33480        }
33481        if !self._unknown_fields.is_empty() {
33482            for (key, value) in self._unknown_fields.iter() {
33483                state.serialize_entry(key, &value)?;
33484            }
33485        }
33486        state.end()
33487    }
33488}
33489
33490impl std::fmt::Debug for MySqlReplicaConfiguration {
33491    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
33492        let mut debug_struct = f.debug_struct("MySqlReplicaConfiguration");
33493        debug_struct.field("dump_file_path", &self.dump_file_path);
33494        debug_struct.field("username", &self.username);
33495        debug_struct.field("password", &self.password);
33496        debug_struct.field("connect_retry_interval", &self.connect_retry_interval);
33497        debug_struct.field("master_heartbeat_period", &self.master_heartbeat_period);
33498        debug_struct.field("ca_certificate", &self.ca_certificate);
33499        debug_struct.field("client_certificate", &self.client_certificate);
33500        debug_struct.field("client_key", &self.client_key);
33501        debug_struct.field("ssl_cipher", &self.ssl_cipher);
33502        debug_struct.field("verify_server_certificate", &self.verify_server_certificate);
33503        debug_struct.field("kind", &self.kind);
33504        if !self._unknown_fields.is_empty() {
33505            debug_struct.field("_unknown_fields", &self._unknown_fields);
33506        }
33507        debug_struct.finish()
33508    }
33509}
33510
33511/// Disk encryption configuration for an instance.
33512#[derive(Clone, Default, PartialEq)]
33513#[non_exhaustive]
33514pub struct DiskEncryptionConfiguration {
33515    /// Resource name of KMS key for disk encryption
33516    pub kms_key_name: std::string::String,
33517
33518    /// This is always `sql#diskEncryptionConfiguration`.
33519    pub kind: std::string::String,
33520
33521    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
33522}
33523
33524impl DiskEncryptionConfiguration {
33525    pub fn new() -> Self {
33526        std::default::Default::default()
33527    }
33528
33529    /// Sets the value of [kms_key_name][crate::model::DiskEncryptionConfiguration::kms_key_name].
33530    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
33531        self.kms_key_name = v.into();
33532        self
33533    }
33534
33535    /// Sets the value of [kind][crate::model::DiskEncryptionConfiguration::kind].
33536    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
33537        self.kind = v.into();
33538        self
33539    }
33540}
33541
33542impl wkt::message::Message for DiskEncryptionConfiguration {
33543    fn typename() -> &'static str {
33544        "type.googleapis.com/google.cloud.sql.v1.DiskEncryptionConfiguration"
33545    }
33546}
33547
33548#[doc(hidden)]
33549impl<'de> serde::de::Deserialize<'de> for DiskEncryptionConfiguration {
33550    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
33551    where
33552        D: serde::Deserializer<'de>,
33553    {
33554        #[allow(non_camel_case_types)]
33555        #[doc(hidden)]
33556        #[derive(PartialEq, Eq, Hash)]
33557        enum __FieldTag {
33558            __kms_key_name,
33559            __kind,
33560            Unknown(std::string::String),
33561        }
33562        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
33563            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
33564            where
33565                D: serde::Deserializer<'de>,
33566            {
33567                struct Visitor;
33568                impl<'de> serde::de::Visitor<'de> for Visitor {
33569                    type Value = __FieldTag;
33570                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
33571                        formatter.write_str("a field name for DiskEncryptionConfiguration")
33572                    }
33573                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
33574                    where
33575                        E: serde::de::Error,
33576                    {
33577                        use std::result::Result::Ok;
33578                        use std::string::ToString;
33579                        match value {
33580                            "kmsKeyName" => Ok(__FieldTag::__kms_key_name),
33581                            "kms_key_name" => Ok(__FieldTag::__kms_key_name),
33582                            "kind" => Ok(__FieldTag::__kind),
33583                            _ => Ok(__FieldTag::Unknown(value.to_string())),
33584                        }
33585                    }
33586                }
33587                deserializer.deserialize_identifier(Visitor)
33588            }
33589        }
33590        struct Visitor;
33591        impl<'de> serde::de::Visitor<'de> for Visitor {
33592            type Value = DiskEncryptionConfiguration;
33593            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
33594                formatter.write_str("struct DiskEncryptionConfiguration")
33595            }
33596            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
33597            where
33598                A: serde::de::MapAccess<'de>,
33599            {
33600                #[allow(unused_imports)]
33601                use serde::de::Error;
33602                use std::option::Option::Some;
33603                let mut fields = std::collections::HashSet::new();
33604                let mut result = Self::Value::new();
33605                while let Some(tag) = map.next_key::<__FieldTag>()? {
33606                    #[allow(clippy::match_single_binding)]
33607                    match tag {
33608                        __FieldTag::__kms_key_name => {
33609                            if !fields.insert(__FieldTag::__kms_key_name) {
33610                                return std::result::Result::Err(A::Error::duplicate_field(
33611                                    "multiple values for kms_key_name",
33612                                ));
33613                            }
33614                            result.kms_key_name = map
33615                                .next_value::<std::option::Option<std::string::String>>()?
33616                                .unwrap_or_default();
33617                        }
33618                        __FieldTag::__kind => {
33619                            if !fields.insert(__FieldTag::__kind) {
33620                                return std::result::Result::Err(A::Error::duplicate_field(
33621                                    "multiple values for kind",
33622                                ));
33623                            }
33624                            result.kind = map
33625                                .next_value::<std::option::Option<std::string::String>>()?
33626                                .unwrap_or_default();
33627                        }
33628                        __FieldTag::Unknown(key) => {
33629                            let value = map.next_value::<serde_json::Value>()?;
33630                            result._unknown_fields.insert(key, value);
33631                        }
33632                    }
33633                }
33634                std::result::Result::Ok(result)
33635            }
33636        }
33637        deserializer.deserialize_any(Visitor)
33638    }
33639}
33640
33641#[doc(hidden)]
33642impl serde::ser::Serialize for DiskEncryptionConfiguration {
33643    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
33644    where
33645        S: serde::ser::Serializer,
33646    {
33647        use serde::ser::SerializeMap;
33648        #[allow(unused_imports)]
33649        use std::option::Option::Some;
33650        let mut state = serializer.serialize_map(std::option::Option::None)?;
33651        if !self.kms_key_name.is_empty() {
33652            state.serialize_entry("kmsKeyName", &self.kms_key_name)?;
33653        }
33654        if !self.kind.is_empty() {
33655            state.serialize_entry("kind", &self.kind)?;
33656        }
33657        if !self._unknown_fields.is_empty() {
33658            for (key, value) in self._unknown_fields.iter() {
33659                state.serialize_entry(key, &value)?;
33660            }
33661        }
33662        state.end()
33663    }
33664}
33665
33666impl std::fmt::Debug for DiskEncryptionConfiguration {
33667    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
33668        let mut debug_struct = f.debug_struct("DiskEncryptionConfiguration");
33669        debug_struct.field("kms_key_name", &self.kms_key_name);
33670        debug_struct.field("kind", &self.kind);
33671        if !self._unknown_fields.is_empty() {
33672            debug_struct.field("_unknown_fields", &self._unknown_fields);
33673        }
33674        debug_struct.finish()
33675    }
33676}
33677
33678/// Disk encryption status for an instance.
33679#[derive(Clone, Default, PartialEq)]
33680#[non_exhaustive]
33681pub struct DiskEncryptionStatus {
33682    /// KMS key version used to encrypt the Cloud SQL instance resource
33683    pub kms_key_version_name: std::string::String,
33684
33685    /// This is always `sql#diskEncryptionStatus`.
33686    pub kind: std::string::String,
33687
33688    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
33689}
33690
33691impl DiskEncryptionStatus {
33692    pub fn new() -> Self {
33693        std::default::Default::default()
33694    }
33695
33696    /// Sets the value of [kms_key_version_name][crate::model::DiskEncryptionStatus::kms_key_version_name].
33697    pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
33698        mut self,
33699        v: T,
33700    ) -> Self {
33701        self.kms_key_version_name = v.into();
33702        self
33703    }
33704
33705    /// Sets the value of [kind][crate::model::DiskEncryptionStatus::kind].
33706    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
33707        self.kind = v.into();
33708        self
33709    }
33710}
33711
33712impl wkt::message::Message for DiskEncryptionStatus {
33713    fn typename() -> &'static str {
33714        "type.googleapis.com/google.cloud.sql.v1.DiskEncryptionStatus"
33715    }
33716}
33717
33718#[doc(hidden)]
33719impl<'de> serde::de::Deserialize<'de> for DiskEncryptionStatus {
33720    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
33721    where
33722        D: serde::Deserializer<'de>,
33723    {
33724        #[allow(non_camel_case_types)]
33725        #[doc(hidden)]
33726        #[derive(PartialEq, Eq, Hash)]
33727        enum __FieldTag {
33728            __kms_key_version_name,
33729            __kind,
33730            Unknown(std::string::String),
33731        }
33732        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
33733            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
33734            where
33735                D: serde::Deserializer<'de>,
33736            {
33737                struct Visitor;
33738                impl<'de> serde::de::Visitor<'de> for Visitor {
33739                    type Value = __FieldTag;
33740                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
33741                        formatter.write_str("a field name for DiskEncryptionStatus")
33742                    }
33743                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
33744                    where
33745                        E: serde::de::Error,
33746                    {
33747                        use std::result::Result::Ok;
33748                        use std::string::ToString;
33749                        match value {
33750                            "kmsKeyVersionName" => Ok(__FieldTag::__kms_key_version_name),
33751                            "kms_key_version_name" => Ok(__FieldTag::__kms_key_version_name),
33752                            "kind" => Ok(__FieldTag::__kind),
33753                            _ => Ok(__FieldTag::Unknown(value.to_string())),
33754                        }
33755                    }
33756                }
33757                deserializer.deserialize_identifier(Visitor)
33758            }
33759        }
33760        struct Visitor;
33761        impl<'de> serde::de::Visitor<'de> for Visitor {
33762            type Value = DiskEncryptionStatus;
33763            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
33764                formatter.write_str("struct DiskEncryptionStatus")
33765            }
33766            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
33767            where
33768                A: serde::de::MapAccess<'de>,
33769            {
33770                #[allow(unused_imports)]
33771                use serde::de::Error;
33772                use std::option::Option::Some;
33773                let mut fields = std::collections::HashSet::new();
33774                let mut result = Self::Value::new();
33775                while let Some(tag) = map.next_key::<__FieldTag>()? {
33776                    #[allow(clippy::match_single_binding)]
33777                    match tag {
33778                        __FieldTag::__kms_key_version_name => {
33779                            if !fields.insert(__FieldTag::__kms_key_version_name) {
33780                                return std::result::Result::Err(A::Error::duplicate_field(
33781                                    "multiple values for kms_key_version_name",
33782                                ));
33783                            }
33784                            result.kms_key_version_name = map
33785                                .next_value::<std::option::Option<std::string::String>>()?
33786                                .unwrap_or_default();
33787                        }
33788                        __FieldTag::__kind => {
33789                            if !fields.insert(__FieldTag::__kind) {
33790                                return std::result::Result::Err(A::Error::duplicate_field(
33791                                    "multiple values for kind",
33792                                ));
33793                            }
33794                            result.kind = map
33795                                .next_value::<std::option::Option<std::string::String>>()?
33796                                .unwrap_or_default();
33797                        }
33798                        __FieldTag::Unknown(key) => {
33799                            let value = map.next_value::<serde_json::Value>()?;
33800                            result._unknown_fields.insert(key, value);
33801                        }
33802                    }
33803                }
33804                std::result::Result::Ok(result)
33805            }
33806        }
33807        deserializer.deserialize_any(Visitor)
33808    }
33809}
33810
33811#[doc(hidden)]
33812impl serde::ser::Serialize for DiskEncryptionStatus {
33813    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
33814    where
33815        S: serde::ser::Serializer,
33816    {
33817        use serde::ser::SerializeMap;
33818        #[allow(unused_imports)]
33819        use std::option::Option::Some;
33820        let mut state = serializer.serialize_map(std::option::Option::None)?;
33821        if !self.kms_key_version_name.is_empty() {
33822            state.serialize_entry("kmsKeyVersionName", &self.kms_key_version_name)?;
33823        }
33824        if !self.kind.is_empty() {
33825            state.serialize_entry("kind", &self.kind)?;
33826        }
33827        if !self._unknown_fields.is_empty() {
33828            for (key, value) in self._unknown_fields.iter() {
33829                state.serialize_entry(key, &value)?;
33830            }
33831        }
33832        state.end()
33833    }
33834}
33835
33836impl std::fmt::Debug for DiskEncryptionStatus {
33837    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
33838        let mut debug_struct = f.debug_struct("DiskEncryptionStatus");
33839        debug_struct.field("kms_key_version_name", &self.kms_key_version_name);
33840        debug_struct.field("kind", &self.kind);
33841        if !self._unknown_fields.is_empty() {
33842            debug_struct.field("_unknown_fields", &self._unknown_fields);
33843        }
33844        debug_struct.finish()
33845    }
33846}
33847
33848/// Database instance IP mapping
33849#[derive(Clone, Default, PartialEq)]
33850#[non_exhaustive]
33851pub struct IpMapping {
33852    /// The type of this IP address. A `PRIMARY` address is a public address that
33853    /// can accept incoming connections. A `PRIVATE` address is a private address
33854    /// that can accept incoming connections. An `OUTGOING` address is the source
33855    /// address of connections originating from the instance, if supported.
33856    pub r#type: crate::model::SqlIpAddressType,
33857
33858    /// The IP address assigned.
33859    pub ip_address: std::string::String,
33860
33861    /// The due time for this IP to be retired in
33862    /// [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example
33863    /// `2012-11-15T16:19:00.094Z`. This field is only available when
33864    /// the IP is scheduled to be retired.
33865    pub time_to_retire: std::option::Option<wkt::Timestamp>,
33866
33867    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
33868}
33869
33870impl IpMapping {
33871    pub fn new() -> Self {
33872        std::default::Default::default()
33873    }
33874
33875    /// Sets the value of [r#type][crate::model::IpMapping::type].
33876    pub fn set_type<T: std::convert::Into<crate::model::SqlIpAddressType>>(mut self, v: T) -> Self {
33877        self.r#type = v.into();
33878        self
33879    }
33880
33881    /// Sets the value of [ip_address][crate::model::IpMapping::ip_address].
33882    pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
33883        self.ip_address = v.into();
33884        self
33885    }
33886
33887    /// Sets the value of [time_to_retire][crate::model::IpMapping::time_to_retire].
33888    pub fn set_time_to_retire<T>(mut self, v: T) -> Self
33889    where
33890        T: std::convert::Into<wkt::Timestamp>,
33891    {
33892        self.time_to_retire = std::option::Option::Some(v.into());
33893        self
33894    }
33895
33896    /// Sets or clears the value of [time_to_retire][crate::model::IpMapping::time_to_retire].
33897    pub fn set_or_clear_time_to_retire<T>(mut self, v: std::option::Option<T>) -> Self
33898    where
33899        T: std::convert::Into<wkt::Timestamp>,
33900    {
33901        self.time_to_retire = v.map(|x| x.into());
33902        self
33903    }
33904}
33905
33906impl wkt::message::Message for IpMapping {
33907    fn typename() -> &'static str {
33908        "type.googleapis.com/google.cloud.sql.v1.IpMapping"
33909    }
33910}
33911
33912#[doc(hidden)]
33913impl<'de> serde::de::Deserialize<'de> for IpMapping {
33914    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
33915    where
33916        D: serde::Deserializer<'de>,
33917    {
33918        #[allow(non_camel_case_types)]
33919        #[doc(hidden)]
33920        #[derive(PartialEq, Eq, Hash)]
33921        enum __FieldTag {
33922            __type,
33923            __ip_address,
33924            __time_to_retire,
33925            Unknown(std::string::String),
33926        }
33927        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
33928            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
33929            where
33930                D: serde::Deserializer<'de>,
33931            {
33932                struct Visitor;
33933                impl<'de> serde::de::Visitor<'de> for Visitor {
33934                    type Value = __FieldTag;
33935                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
33936                        formatter.write_str("a field name for IpMapping")
33937                    }
33938                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
33939                    where
33940                        E: serde::de::Error,
33941                    {
33942                        use std::result::Result::Ok;
33943                        use std::string::ToString;
33944                        match value {
33945                            "type" => Ok(__FieldTag::__type),
33946                            "ipAddress" => Ok(__FieldTag::__ip_address),
33947                            "ip_address" => Ok(__FieldTag::__ip_address),
33948                            "timeToRetire" => Ok(__FieldTag::__time_to_retire),
33949                            "time_to_retire" => Ok(__FieldTag::__time_to_retire),
33950                            _ => Ok(__FieldTag::Unknown(value.to_string())),
33951                        }
33952                    }
33953                }
33954                deserializer.deserialize_identifier(Visitor)
33955            }
33956        }
33957        struct Visitor;
33958        impl<'de> serde::de::Visitor<'de> for Visitor {
33959            type Value = IpMapping;
33960            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
33961                formatter.write_str("struct IpMapping")
33962            }
33963            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
33964            where
33965                A: serde::de::MapAccess<'de>,
33966            {
33967                #[allow(unused_imports)]
33968                use serde::de::Error;
33969                use std::option::Option::Some;
33970                let mut fields = std::collections::HashSet::new();
33971                let mut result = Self::Value::new();
33972                while let Some(tag) = map.next_key::<__FieldTag>()? {
33973                    #[allow(clippy::match_single_binding)]
33974                    match tag {
33975                        __FieldTag::__type => {
33976                            if !fields.insert(__FieldTag::__type) {
33977                                return std::result::Result::Err(A::Error::duplicate_field(
33978                                    "multiple values for type",
33979                                ));
33980                            }
33981                            result.r#type = map
33982                                .next_value::<std::option::Option<crate::model::SqlIpAddressType>>(
33983                                )?
33984                                .unwrap_or_default();
33985                        }
33986                        __FieldTag::__ip_address => {
33987                            if !fields.insert(__FieldTag::__ip_address) {
33988                                return std::result::Result::Err(A::Error::duplicate_field(
33989                                    "multiple values for ip_address",
33990                                ));
33991                            }
33992                            result.ip_address = map
33993                                .next_value::<std::option::Option<std::string::String>>()?
33994                                .unwrap_or_default();
33995                        }
33996                        __FieldTag::__time_to_retire => {
33997                            if !fields.insert(__FieldTag::__time_to_retire) {
33998                                return std::result::Result::Err(A::Error::duplicate_field(
33999                                    "multiple values for time_to_retire",
34000                                ));
34001                            }
34002                            result.time_to_retire =
34003                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
34004                        }
34005                        __FieldTag::Unknown(key) => {
34006                            let value = map.next_value::<serde_json::Value>()?;
34007                            result._unknown_fields.insert(key, value);
34008                        }
34009                    }
34010                }
34011                std::result::Result::Ok(result)
34012            }
34013        }
34014        deserializer.deserialize_any(Visitor)
34015    }
34016}
34017
34018#[doc(hidden)]
34019impl serde::ser::Serialize for IpMapping {
34020    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
34021    where
34022        S: serde::ser::Serializer,
34023    {
34024        use serde::ser::SerializeMap;
34025        #[allow(unused_imports)]
34026        use std::option::Option::Some;
34027        let mut state = serializer.serialize_map(std::option::Option::None)?;
34028        if !wkt::internal::is_default(&self.r#type) {
34029            state.serialize_entry("type", &self.r#type)?;
34030        }
34031        if !self.ip_address.is_empty() {
34032            state.serialize_entry("ipAddress", &self.ip_address)?;
34033        }
34034        if self.time_to_retire.is_some() {
34035            state.serialize_entry("timeToRetire", &self.time_to_retire)?;
34036        }
34037        if !self._unknown_fields.is_empty() {
34038            for (key, value) in self._unknown_fields.iter() {
34039                state.serialize_entry(key, &value)?;
34040            }
34041        }
34042        state.end()
34043    }
34044}
34045
34046impl std::fmt::Debug for IpMapping {
34047    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
34048        let mut debug_struct = f.debug_struct("IpMapping");
34049        debug_struct.field("r#type", &self.r#type);
34050        debug_struct.field("ip_address", &self.ip_address);
34051        debug_struct.field("time_to_retire", &self.time_to_retire);
34052        if !self._unknown_fields.is_empty() {
34053            debug_struct.field("_unknown_fields", &self._unknown_fields);
34054        }
34055        debug_struct.finish()
34056    }
34057}
34058
34059/// An Operation resource.&nbsp;For successful operations that return an
34060/// Operation resource, only the fields relevant to the operation are populated
34061/// in the resource.
34062#[derive(Clone, Default, PartialEq)]
34063#[non_exhaustive]
34064pub struct Operation {
34065    /// This is always `sql#operation`.
34066    pub kind: std::string::String,
34067
34068    pub target_link: std::string::String,
34069
34070    /// The status of an operation.
34071    pub status: crate::model::operation::SqlOperationStatus,
34072
34073    /// The email address of the user who initiated this operation.
34074    pub user: std::string::String,
34075
34076    /// The time this operation was enqueued in UTC timezone in [RFC
34077    /// 3339](https://tools.ietf.org/html/rfc3339) format, for example
34078    /// `2012-11-15T16:19:00.094Z`.
34079    pub insert_time: std::option::Option<wkt::Timestamp>,
34080
34081    /// The time this operation actually started in UTC timezone in [RFC
34082    /// 3339](https://tools.ietf.org/html/rfc3339) format, for example
34083    /// `2012-11-15T16:19:00.094Z`.
34084    pub start_time: std::option::Option<wkt::Timestamp>,
34085
34086    /// The time this operation finished in UTC timezone in [RFC
34087    /// 3339](https://tools.ietf.org/html/rfc3339) format, for example
34088    /// `2012-11-15T16:19:00.094Z`.
34089    pub end_time: std::option::Option<wkt::Timestamp>,
34090
34091    /// If errors occurred during processing of this operation, this field will be
34092    /// populated.
34093    pub error: std::option::Option<crate::model::OperationErrors>,
34094
34095    /// An Admin API warning message.
34096    pub api_warning: std::option::Option<crate::model::ApiWarning>,
34097
34098    /// The type of the operation. Valid values are:
34099    ///
34100    /// * `CREATE`
34101    /// * `DELETE`
34102    /// * `UPDATE`
34103    /// * `RESTART`
34104    /// * `IMPORT`
34105    /// * `EXPORT`
34106    /// * `BACKUP_VOLUME`
34107    /// * `RESTORE_VOLUME`
34108    /// * `CREATE_USER`
34109    /// * `DELETE_USER`
34110    /// * `CREATE_DATABASE`
34111    /// * `DELETE_DATABASE`
34112    pub operation_type: crate::model::operation::SqlOperationType,
34113
34114    /// The context for import operation, if applicable.
34115    pub import_context: std::option::Option<crate::model::ImportContext>,
34116
34117    /// The context for export operation, if applicable.
34118    pub export_context: std::option::Option<crate::model::ExportContext>,
34119
34120    /// The context for backup operation, if applicable.
34121    pub backup_context: std::option::Option<crate::model::BackupContext>,
34122
34123    /// An identifier that uniquely identifies the operation. You can use this
34124    /// identifier to retrieve the Operations resource that has information about
34125    /// the operation.
34126    pub name: std::string::String,
34127
34128    /// Name of the database instance related to this operation.
34129    pub target_id: std::string::String,
34130
34131    /// The URI of this resource.
34132    pub self_link: std::string::String,
34133
34134    /// The project ID of the target instance related to this operation.
34135    pub target_project: std::string::String,
34136
34137    /// The context for acquire SSRS lease operation, if applicable.
34138    pub acquire_ssrs_lease_context: std::option::Option<crate::model::AcquireSsrsLeaseContext>,
34139
34140    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
34141}
34142
34143impl Operation {
34144    pub fn new() -> Self {
34145        std::default::Default::default()
34146    }
34147
34148    /// Sets the value of [kind][crate::model::Operation::kind].
34149    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
34150        self.kind = v.into();
34151        self
34152    }
34153
34154    /// Sets the value of [target_link][crate::model::Operation::target_link].
34155    pub fn set_target_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
34156        self.target_link = v.into();
34157        self
34158    }
34159
34160    /// Sets the value of [status][crate::model::Operation::status].
34161    pub fn set_status<T: std::convert::Into<crate::model::operation::SqlOperationStatus>>(
34162        mut self,
34163        v: T,
34164    ) -> Self {
34165        self.status = v.into();
34166        self
34167    }
34168
34169    /// Sets the value of [user][crate::model::Operation::user].
34170    pub fn set_user<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
34171        self.user = v.into();
34172        self
34173    }
34174
34175    /// Sets the value of [insert_time][crate::model::Operation::insert_time].
34176    pub fn set_insert_time<T>(mut self, v: T) -> Self
34177    where
34178        T: std::convert::Into<wkt::Timestamp>,
34179    {
34180        self.insert_time = std::option::Option::Some(v.into());
34181        self
34182    }
34183
34184    /// Sets or clears the value of [insert_time][crate::model::Operation::insert_time].
34185    pub fn set_or_clear_insert_time<T>(mut self, v: std::option::Option<T>) -> Self
34186    where
34187        T: std::convert::Into<wkt::Timestamp>,
34188    {
34189        self.insert_time = v.map(|x| x.into());
34190        self
34191    }
34192
34193    /// Sets the value of [start_time][crate::model::Operation::start_time].
34194    pub fn set_start_time<T>(mut self, v: T) -> Self
34195    where
34196        T: std::convert::Into<wkt::Timestamp>,
34197    {
34198        self.start_time = std::option::Option::Some(v.into());
34199        self
34200    }
34201
34202    /// Sets or clears the value of [start_time][crate::model::Operation::start_time].
34203    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
34204    where
34205        T: std::convert::Into<wkt::Timestamp>,
34206    {
34207        self.start_time = v.map(|x| x.into());
34208        self
34209    }
34210
34211    /// Sets the value of [end_time][crate::model::Operation::end_time].
34212    pub fn set_end_time<T>(mut self, v: T) -> Self
34213    where
34214        T: std::convert::Into<wkt::Timestamp>,
34215    {
34216        self.end_time = std::option::Option::Some(v.into());
34217        self
34218    }
34219
34220    /// Sets or clears the value of [end_time][crate::model::Operation::end_time].
34221    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
34222    where
34223        T: std::convert::Into<wkt::Timestamp>,
34224    {
34225        self.end_time = v.map(|x| x.into());
34226        self
34227    }
34228
34229    /// Sets the value of [error][crate::model::Operation::error].
34230    pub fn set_error<T>(mut self, v: T) -> Self
34231    where
34232        T: std::convert::Into<crate::model::OperationErrors>,
34233    {
34234        self.error = std::option::Option::Some(v.into());
34235        self
34236    }
34237
34238    /// Sets or clears the value of [error][crate::model::Operation::error].
34239    pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
34240    where
34241        T: std::convert::Into<crate::model::OperationErrors>,
34242    {
34243        self.error = v.map(|x| x.into());
34244        self
34245    }
34246
34247    /// Sets the value of [api_warning][crate::model::Operation::api_warning].
34248    pub fn set_api_warning<T>(mut self, v: T) -> Self
34249    where
34250        T: std::convert::Into<crate::model::ApiWarning>,
34251    {
34252        self.api_warning = std::option::Option::Some(v.into());
34253        self
34254    }
34255
34256    /// Sets or clears the value of [api_warning][crate::model::Operation::api_warning].
34257    pub fn set_or_clear_api_warning<T>(mut self, v: std::option::Option<T>) -> Self
34258    where
34259        T: std::convert::Into<crate::model::ApiWarning>,
34260    {
34261        self.api_warning = v.map(|x| x.into());
34262        self
34263    }
34264
34265    /// Sets the value of [operation_type][crate::model::Operation::operation_type].
34266    pub fn set_operation_type<T: std::convert::Into<crate::model::operation::SqlOperationType>>(
34267        mut self,
34268        v: T,
34269    ) -> Self {
34270        self.operation_type = v.into();
34271        self
34272    }
34273
34274    /// Sets the value of [import_context][crate::model::Operation::import_context].
34275    pub fn set_import_context<T>(mut self, v: T) -> Self
34276    where
34277        T: std::convert::Into<crate::model::ImportContext>,
34278    {
34279        self.import_context = std::option::Option::Some(v.into());
34280        self
34281    }
34282
34283    /// Sets or clears the value of [import_context][crate::model::Operation::import_context].
34284    pub fn set_or_clear_import_context<T>(mut self, v: std::option::Option<T>) -> Self
34285    where
34286        T: std::convert::Into<crate::model::ImportContext>,
34287    {
34288        self.import_context = v.map(|x| x.into());
34289        self
34290    }
34291
34292    /// Sets the value of [export_context][crate::model::Operation::export_context].
34293    pub fn set_export_context<T>(mut self, v: T) -> Self
34294    where
34295        T: std::convert::Into<crate::model::ExportContext>,
34296    {
34297        self.export_context = std::option::Option::Some(v.into());
34298        self
34299    }
34300
34301    /// Sets or clears the value of [export_context][crate::model::Operation::export_context].
34302    pub fn set_or_clear_export_context<T>(mut self, v: std::option::Option<T>) -> Self
34303    where
34304        T: std::convert::Into<crate::model::ExportContext>,
34305    {
34306        self.export_context = v.map(|x| x.into());
34307        self
34308    }
34309
34310    /// Sets the value of [backup_context][crate::model::Operation::backup_context].
34311    pub fn set_backup_context<T>(mut self, v: T) -> Self
34312    where
34313        T: std::convert::Into<crate::model::BackupContext>,
34314    {
34315        self.backup_context = std::option::Option::Some(v.into());
34316        self
34317    }
34318
34319    /// Sets or clears the value of [backup_context][crate::model::Operation::backup_context].
34320    pub fn set_or_clear_backup_context<T>(mut self, v: std::option::Option<T>) -> Self
34321    where
34322        T: std::convert::Into<crate::model::BackupContext>,
34323    {
34324        self.backup_context = v.map(|x| x.into());
34325        self
34326    }
34327
34328    /// Sets the value of [name][crate::model::Operation::name].
34329    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
34330        self.name = v.into();
34331        self
34332    }
34333
34334    /// Sets the value of [target_id][crate::model::Operation::target_id].
34335    pub fn set_target_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
34336        self.target_id = v.into();
34337        self
34338    }
34339
34340    /// Sets the value of [self_link][crate::model::Operation::self_link].
34341    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
34342        self.self_link = v.into();
34343        self
34344    }
34345
34346    /// Sets the value of [target_project][crate::model::Operation::target_project].
34347    pub fn set_target_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
34348        self.target_project = v.into();
34349        self
34350    }
34351
34352    /// Sets the value of [acquire_ssrs_lease_context][crate::model::Operation::acquire_ssrs_lease_context].
34353    pub fn set_acquire_ssrs_lease_context<T>(mut self, v: T) -> Self
34354    where
34355        T: std::convert::Into<crate::model::AcquireSsrsLeaseContext>,
34356    {
34357        self.acquire_ssrs_lease_context = std::option::Option::Some(v.into());
34358        self
34359    }
34360
34361    /// Sets or clears the value of [acquire_ssrs_lease_context][crate::model::Operation::acquire_ssrs_lease_context].
34362    pub fn set_or_clear_acquire_ssrs_lease_context<T>(mut self, v: std::option::Option<T>) -> Self
34363    where
34364        T: std::convert::Into<crate::model::AcquireSsrsLeaseContext>,
34365    {
34366        self.acquire_ssrs_lease_context = v.map(|x| x.into());
34367        self
34368    }
34369}
34370
34371impl wkt::message::Message for Operation {
34372    fn typename() -> &'static str {
34373        "type.googleapis.com/google.cloud.sql.v1.Operation"
34374    }
34375}
34376
34377#[doc(hidden)]
34378impl<'de> serde::de::Deserialize<'de> for Operation {
34379    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
34380    where
34381        D: serde::Deserializer<'de>,
34382    {
34383        #[allow(non_camel_case_types)]
34384        #[doc(hidden)]
34385        #[derive(PartialEq, Eq, Hash)]
34386        enum __FieldTag {
34387            __kind,
34388            __target_link,
34389            __status,
34390            __user,
34391            __insert_time,
34392            __start_time,
34393            __end_time,
34394            __error,
34395            __api_warning,
34396            __operation_type,
34397            __import_context,
34398            __export_context,
34399            __backup_context,
34400            __name,
34401            __target_id,
34402            __self_link,
34403            __target_project,
34404            __acquire_ssrs_lease_context,
34405            Unknown(std::string::String),
34406        }
34407        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
34408            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
34409            where
34410                D: serde::Deserializer<'de>,
34411            {
34412                struct Visitor;
34413                impl<'de> serde::de::Visitor<'de> for Visitor {
34414                    type Value = __FieldTag;
34415                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
34416                        formatter.write_str("a field name for Operation")
34417                    }
34418                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
34419                    where
34420                        E: serde::de::Error,
34421                    {
34422                        use std::result::Result::Ok;
34423                        use std::string::ToString;
34424                        match value {
34425                            "kind" => Ok(__FieldTag::__kind),
34426                            "targetLink" => Ok(__FieldTag::__target_link),
34427                            "target_link" => Ok(__FieldTag::__target_link),
34428                            "status" => Ok(__FieldTag::__status),
34429                            "user" => Ok(__FieldTag::__user),
34430                            "insertTime" => Ok(__FieldTag::__insert_time),
34431                            "insert_time" => Ok(__FieldTag::__insert_time),
34432                            "startTime" => Ok(__FieldTag::__start_time),
34433                            "start_time" => Ok(__FieldTag::__start_time),
34434                            "endTime" => Ok(__FieldTag::__end_time),
34435                            "end_time" => Ok(__FieldTag::__end_time),
34436                            "error" => Ok(__FieldTag::__error),
34437                            "apiWarning" => Ok(__FieldTag::__api_warning),
34438                            "api_warning" => Ok(__FieldTag::__api_warning),
34439                            "operationType" => Ok(__FieldTag::__operation_type),
34440                            "operation_type" => Ok(__FieldTag::__operation_type),
34441                            "importContext" => Ok(__FieldTag::__import_context),
34442                            "import_context" => Ok(__FieldTag::__import_context),
34443                            "exportContext" => Ok(__FieldTag::__export_context),
34444                            "export_context" => Ok(__FieldTag::__export_context),
34445                            "backupContext" => Ok(__FieldTag::__backup_context),
34446                            "backup_context" => Ok(__FieldTag::__backup_context),
34447                            "name" => Ok(__FieldTag::__name),
34448                            "targetId" => Ok(__FieldTag::__target_id),
34449                            "target_id" => Ok(__FieldTag::__target_id),
34450                            "selfLink" => Ok(__FieldTag::__self_link),
34451                            "self_link" => Ok(__FieldTag::__self_link),
34452                            "targetProject" => Ok(__FieldTag::__target_project),
34453                            "target_project" => Ok(__FieldTag::__target_project),
34454                            "acquireSsrsLeaseContext" => {
34455                                Ok(__FieldTag::__acquire_ssrs_lease_context)
34456                            }
34457                            "acquire_ssrs_lease_context" => {
34458                                Ok(__FieldTag::__acquire_ssrs_lease_context)
34459                            }
34460                            _ => Ok(__FieldTag::Unknown(value.to_string())),
34461                        }
34462                    }
34463                }
34464                deserializer.deserialize_identifier(Visitor)
34465            }
34466        }
34467        struct Visitor;
34468        impl<'de> serde::de::Visitor<'de> for Visitor {
34469            type Value = Operation;
34470            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
34471                formatter.write_str("struct Operation")
34472            }
34473            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
34474            where
34475                A: serde::de::MapAccess<'de>,
34476            {
34477                #[allow(unused_imports)]
34478                use serde::de::Error;
34479                use std::option::Option::Some;
34480                let mut fields = std::collections::HashSet::new();
34481                let mut result = Self::Value::new();
34482                while let Some(tag) = map.next_key::<__FieldTag>()? {
34483                    #[allow(clippy::match_single_binding)]
34484                    match tag {
34485                        __FieldTag::__kind => {
34486                            if !fields.insert(__FieldTag::__kind) {
34487                                return std::result::Result::Err(A::Error::duplicate_field(
34488                                    "multiple values for kind",
34489                                ));
34490                            }
34491                            result.kind = map
34492                                .next_value::<std::option::Option<std::string::String>>()?
34493                                .unwrap_or_default();
34494                        }
34495                        __FieldTag::__target_link => {
34496                            if !fields.insert(__FieldTag::__target_link) {
34497                                return std::result::Result::Err(A::Error::duplicate_field(
34498                                    "multiple values for target_link",
34499                                ));
34500                            }
34501                            result.target_link = map
34502                                .next_value::<std::option::Option<std::string::String>>()?
34503                                .unwrap_or_default();
34504                        }
34505                        __FieldTag::__status => {
34506                            if !fields.insert(__FieldTag::__status) {
34507                                return std::result::Result::Err(A::Error::duplicate_field(
34508                                    "multiple values for status",
34509                                ));
34510                            }
34511                            result.status =
34512                                map.next_value::<std::option::Option<
34513                                    crate::model::operation::SqlOperationStatus,
34514                                >>()?
34515                                .unwrap_or_default();
34516                        }
34517                        __FieldTag::__user => {
34518                            if !fields.insert(__FieldTag::__user) {
34519                                return std::result::Result::Err(A::Error::duplicate_field(
34520                                    "multiple values for user",
34521                                ));
34522                            }
34523                            result.user = map
34524                                .next_value::<std::option::Option<std::string::String>>()?
34525                                .unwrap_or_default();
34526                        }
34527                        __FieldTag::__insert_time => {
34528                            if !fields.insert(__FieldTag::__insert_time) {
34529                                return std::result::Result::Err(A::Error::duplicate_field(
34530                                    "multiple values for insert_time",
34531                                ));
34532                            }
34533                            result.insert_time =
34534                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
34535                        }
34536                        __FieldTag::__start_time => {
34537                            if !fields.insert(__FieldTag::__start_time) {
34538                                return std::result::Result::Err(A::Error::duplicate_field(
34539                                    "multiple values for start_time",
34540                                ));
34541                            }
34542                            result.start_time =
34543                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
34544                        }
34545                        __FieldTag::__end_time => {
34546                            if !fields.insert(__FieldTag::__end_time) {
34547                                return std::result::Result::Err(A::Error::duplicate_field(
34548                                    "multiple values for end_time",
34549                                ));
34550                            }
34551                            result.end_time =
34552                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
34553                        }
34554                        __FieldTag::__error => {
34555                            if !fields.insert(__FieldTag::__error) {
34556                                return std::result::Result::Err(A::Error::duplicate_field(
34557                                    "multiple values for error",
34558                                ));
34559                            }
34560                            result.error = map
34561                                .next_value::<std::option::Option<crate::model::OperationErrors>>(
34562                                )?;
34563                        }
34564                        __FieldTag::__api_warning => {
34565                            if !fields.insert(__FieldTag::__api_warning) {
34566                                return std::result::Result::Err(A::Error::duplicate_field(
34567                                    "multiple values for api_warning",
34568                                ));
34569                            }
34570                            result.api_warning =
34571                                map.next_value::<std::option::Option<crate::model::ApiWarning>>()?;
34572                        }
34573                        __FieldTag::__operation_type => {
34574                            if !fields.insert(__FieldTag::__operation_type) {
34575                                return std::result::Result::Err(A::Error::duplicate_field(
34576                                    "multiple values for operation_type",
34577                                ));
34578                            }
34579                            result.operation_type = map.next_value::<std::option::Option<crate::model::operation::SqlOperationType>>()?.unwrap_or_default();
34580                        }
34581                        __FieldTag::__import_context => {
34582                            if !fields.insert(__FieldTag::__import_context) {
34583                                return std::result::Result::Err(A::Error::duplicate_field(
34584                                    "multiple values for import_context",
34585                                ));
34586                            }
34587                            result.import_context = map
34588                                .next_value::<std::option::Option<crate::model::ImportContext>>()?;
34589                        }
34590                        __FieldTag::__export_context => {
34591                            if !fields.insert(__FieldTag::__export_context) {
34592                                return std::result::Result::Err(A::Error::duplicate_field(
34593                                    "multiple values for export_context",
34594                                ));
34595                            }
34596                            result.export_context = map
34597                                .next_value::<std::option::Option<crate::model::ExportContext>>()?;
34598                        }
34599                        __FieldTag::__backup_context => {
34600                            if !fields.insert(__FieldTag::__backup_context) {
34601                                return std::result::Result::Err(A::Error::duplicate_field(
34602                                    "multiple values for backup_context",
34603                                ));
34604                            }
34605                            result.backup_context = map
34606                                .next_value::<std::option::Option<crate::model::BackupContext>>()?;
34607                        }
34608                        __FieldTag::__name => {
34609                            if !fields.insert(__FieldTag::__name) {
34610                                return std::result::Result::Err(A::Error::duplicate_field(
34611                                    "multiple values for name",
34612                                ));
34613                            }
34614                            result.name = map
34615                                .next_value::<std::option::Option<std::string::String>>()?
34616                                .unwrap_or_default();
34617                        }
34618                        __FieldTag::__target_id => {
34619                            if !fields.insert(__FieldTag::__target_id) {
34620                                return std::result::Result::Err(A::Error::duplicate_field(
34621                                    "multiple values for target_id",
34622                                ));
34623                            }
34624                            result.target_id = map
34625                                .next_value::<std::option::Option<std::string::String>>()?
34626                                .unwrap_or_default();
34627                        }
34628                        __FieldTag::__self_link => {
34629                            if !fields.insert(__FieldTag::__self_link) {
34630                                return std::result::Result::Err(A::Error::duplicate_field(
34631                                    "multiple values for self_link",
34632                                ));
34633                            }
34634                            result.self_link = map
34635                                .next_value::<std::option::Option<std::string::String>>()?
34636                                .unwrap_or_default();
34637                        }
34638                        __FieldTag::__target_project => {
34639                            if !fields.insert(__FieldTag::__target_project) {
34640                                return std::result::Result::Err(A::Error::duplicate_field(
34641                                    "multiple values for target_project",
34642                                ));
34643                            }
34644                            result.target_project = map
34645                                .next_value::<std::option::Option<std::string::String>>()?
34646                                .unwrap_or_default();
34647                        }
34648                        __FieldTag::__acquire_ssrs_lease_context => {
34649                            if !fields.insert(__FieldTag::__acquire_ssrs_lease_context) {
34650                                return std::result::Result::Err(A::Error::duplicate_field(
34651                                    "multiple values for acquire_ssrs_lease_context",
34652                                ));
34653                            }
34654                            result.acquire_ssrs_lease_context = map.next_value::<std::option::Option<crate::model::AcquireSsrsLeaseContext>>()?
34655                                ;
34656                        }
34657                        __FieldTag::Unknown(key) => {
34658                            let value = map.next_value::<serde_json::Value>()?;
34659                            result._unknown_fields.insert(key, value);
34660                        }
34661                    }
34662                }
34663                std::result::Result::Ok(result)
34664            }
34665        }
34666        deserializer.deserialize_any(Visitor)
34667    }
34668}
34669
34670#[doc(hidden)]
34671impl serde::ser::Serialize for Operation {
34672    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
34673    where
34674        S: serde::ser::Serializer,
34675    {
34676        use serde::ser::SerializeMap;
34677        #[allow(unused_imports)]
34678        use std::option::Option::Some;
34679        let mut state = serializer.serialize_map(std::option::Option::None)?;
34680        if !self.kind.is_empty() {
34681            state.serialize_entry("kind", &self.kind)?;
34682        }
34683        if !self.target_link.is_empty() {
34684            state.serialize_entry("targetLink", &self.target_link)?;
34685        }
34686        if !wkt::internal::is_default(&self.status) {
34687            state.serialize_entry("status", &self.status)?;
34688        }
34689        if !self.user.is_empty() {
34690            state.serialize_entry("user", &self.user)?;
34691        }
34692        if self.insert_time.is_some() {
34693            state.serialize_entry("insertTime", &self.insert_time)?;
34694        }
34695        if self.start_time.is_some() {
34696            state.serialize_entry("startTime", &self.start_time)?;
34697        }
34698        if self.end_time.is_some() {
34699            state.serialize_entry("endTime", &self.end_time)?;
34700        }
34701        if self.error.is_some() {
34702            state.serialize_entry("error", &self.error)?;
34703        }
34704        if self.api_warning.is_some() {
34705            state.serialize_entry("apiWarning", &self.api_warning)?;
34706        }
34707        if !wkt::internal::is_default(&self.operation_type) {
34708            state.serialize_entry("operationType", &self.operation_type)?;
34709        }
34710        if self.import_context.is_some() {
34711            state.serialize_entry("importContext", &self.import_context)?;
34712        }
34713        if self.export_context.is_some() {
34714            state.serialize_entry("exportContext", &self.export_context)?;
34715        }
34716        if self.backup_context.is_some() {
34717            state.serialize_entry("backupContext", &self.backup_context)?;
34718        }
34719        if !self.name.is_empty() {
34720            state.serialize_entry("name", &self.name)?;
34721        }
34722        if !self.target_id.is_empty() {
34723            state.serialize_entry("targetId", &self.target_id)?;
34724        }
34725        if !self.self_link.is_empty() {
34726            state.serialize_entry("selfLink", &self.self_link)?;
34727        }
34728        if !self.target_project.is_empty() {
34729            state.serialize_entry("targetProject", &self.target_project)?;
34730        }
34731        if self.acquire_ssrs_lease_context.is_some() {
34732            state.serialize_entry("acquireSsrsLeaseContext", &self.acquire_ssrs_lease_context)?;
34733        }
34734        if !self._unknown_fields.is_empty() {
34735            for (key, value) in self._unknown_fields.iter() {
34736                state.serialize_entry(key, &value)?;
34737            }
34738        }
34739        state.end()
34740    }
34741}
34742
34743impl std::fmt::Debug for Operation {
34744    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
34745        let mut debug_struct = f.debug_struct("Operation");
34746        debug_struct.field("kind", &self.kind);
34747        debug_struct.field("target_link", &self.target_link);
34748        debug_struct.field("status", &self.status);
34749        debug_struct.field("user", &self.user);
34750        debug_struct.field("insert_time", &self.insert_time);
34751        debug_struct.field("start_time", &self.start_time);
34752        debug_struct.field("end_time", &self.end_time);
34753        debug_struct.field("error", &self.error);
34754        debug_struct.field("api_warning", &self.api_warning);
34755        debug_struct.field("operation_type", &self.operation_type);
34756        debug_struct.field("import_context", &self.import_context);
34757        debug_struct.field("export_context", &self.export_context);
34758        debug_struct.field("backup_context", &self.backup_context);
34759        debug_struct.field("name", &self.name);
34760        debug_struct.field("target_id", &self.target_id);
34761        debug_struct.field("self_link", &self.self_link);
34762        debug_struct.field("target_project", &self.target_project);
34763        debug_struct.field(
34764            "acquire_ssrs_lease_context",
34765            &self.acquire_ssrs_lease_context,
34766        );
34767        if !self._unknown_fields.is_empty() {
34768            debug_struct.field("_unknown_fields", &self._unknown_fields);
34769        }
34770        debug_struct.finish()
34771    }
34772}
34773
34774/// Defines additional types related to [Operation].
34775pub mod operation {
34776    #[allow(unused_imports)]
34777    use super::*;
34778
34779    /// The type of Cloud SQL operation.
34780    ///
34781    /// # Working with unknown values
34782    ///
34783    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
34784    /// additional enum variants at any time. Adding new variants is not considered
34785    /// a breaking change. Applications should write their code in anticipation of:
34786    ///
34787    /// - New values appearing in future releases of the client library, **and**
34788    /// - New values received dynamically, without application changes.
34789    ///
34790    /// Please consult the [Working with enums] section in the user guide for some
34791    /// guidelines.
34792    ///
34793    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
34794    #[derive(Clone, Debug, PartialEq)]
34795    #[non_exhaustive]
34796    pub enum SqlOperationType {
34797        /// Unknown operation type.
34798        Unspecified,
34799        /// Imports data into a Cloud SQL instance.
34800        Import,
34801        /// Exports data from a Cloud SQL instance to a Cloud Storage
34802        /// bucket.
34803        Export,
34804        /// Creates a new Cloud SQL instance.
34805        Create,
34806        /// Updates the settings of a Cloud SQL instance.
34807        Update,
34808        /// Deletes a Cloud SQL instance.
34809        Delete,
34810        /// Restarts the Cloud SQL instance.
34811        Restart,
34812        #[deprecated]
34813        Backup,
34814        #[deprecated]
34815        Snapshot,
34816        /// Performs instance backup.
34817        BackupVolume,
34818        /// Deletes an instance backup.
34819        DeleteVolume,
34820        /// Restores an instance backup.
34821        RestoreVolume,
34822        /// Injects a privileged user in mysql for MOB instances.
34823        InjectUser,
34824        /// Clones a Cloud SQL instance.
34825        Clone,
34826        /// Stops replication on a Cloud SQL read replica instance.
34827        StopReplica,
34828        /// Starts replication on a Cloud SQL read replica instance.
34829        StartReplica,
34830        /// Promotes a Cloud SQL replica instance.
34831        PromoteReplica,
34832        /// Creates a Cloud SQL replica instance.
34833        CreateReplica,
34834        /// Creates a new user in a Cloud SQL instance.
34835        CreateUser,
34836        /// Deletes a user from a Cloud SQL instance.
34837        DeleteUser,
34838        /// Updates an existing user in a Cloud SQL instance.
34839        UpdateUser,
34840        /// Creates a database in the Cloud SQL instance.
34841        CreateDatabase,
34842        /// Deletes a database in the Cloud SQL instance.
34843        DeleteDatabase,
34844        /// Updates a database in the Cloud SQL instance.
34845        UpdateDatabase,
34846        /// Performs failover of an HA-enabled Cloud SQL
34847        /// failover replica.
34848        Failover,
34849        /// Deletes the backup taken by a backup run.
34850        DeleteBackup,
34851        RecreateReplica,
34852        /// Truncates a general or slow log table in MySQL.
34853        TruncateLog,
34854        /// Demotes the stand-alone instance to be a Cloud SQL
34855        /// read replica for an external database server.
34856        DemoteMaster,
34857        /// Indicates that the instance is currently in maintenance. Maintenance
34858        /// typically causes the instance to be unavailable for 1-3 minutes.
34859        Maintenance,
34860        /// This field is deprecated, and will be removed in future version of API.
34861        #[deprecated]
34862        EnablePrivateIp,
34863        #[deprecated]
34864        DeferMaintenance,
34865        /// Creates clone instance.
34866        #[deprecated]
34867        CreateClone,
34868        /// Reschedule maintenance to another time.
34869        RescheduleMaintenance,
34870        /// Starts external sync of a Cloud SQL EM replica to an external primary
34871        /// instance.
34872        StartExternalSync,
34873        /// Recovers logs from an instance's old data disk.
34874        LogCleanup,
34875        /// Performs auto-restart of an HA-enabled Cloud SQL database for auto
34876        /// recovery.
34877        AutoRestart,
34878        /// Re-encrypts CMEK instances with latest key version.
34879        Reencrypt,
34880        /// Switches the roles of the primary and replica pair. The target instance
34881        /// should be the replica.
34882        Switchover,
34883        /// Acquire a lease for the setup of SQL Server Reporting Services (SSRS).
34884        AcquireSsrsLease,
34885        /// Release a lease for the setup of SQL Server Reporting Services (SSRS).
34886        ReleaseSsrsLease,
34887        /// Reconfigures old primary after a promote replica operation. Effect of a
34888        /// promote operation to the old primary is executed in this operation,
34889        /// asynchronously from the promote replica operation executed to the
34890        /// replica.
34891        ReconfigureOldPrimary,
34892        /// Indicates that the instance, its read replicas, and its cascading
34893        /// replicas are in maintenance. Maintenance typically gets initiated on
34894        /// groups of replicas first, followed by the primary instance. For each
34895        /// instance, maintenance typically causes the instance to be unavailable for
34896        /// 1-3 minutes.
34897        ClusterMaintenance,
34898        /// Indicates that the instance (and any of its replicas) are currently in
34899        /// maintenance. This is initiated as a self-service request by using SSM.
34900        /// Maintenance typically causes the instance to be unavailable for 1-3
34901        /// minutes.
34902        SelfServiceMaintenance,
34903        /// Switches a primary instance to a replica. This operation runs as part of
34904        /// a switchover operation to the original primary instance.
34905        SwitchoverToReplica,
34906        /// Updates the major version of a Cloud SQL instance.
34907        MajorVersionUpgrade,
34908        /// If set, the enum was initialized with an unknown value.
34909        ///
34910        /// Applications can examine the value using [SqlOperationType::value] or
34911        /// [SqlOperationType::name].
34912        UnknownValue(sql_operation_type::UnknownValue),
34913    }
34914
34915    #[doc(hidden)]
34916    pub mod sql_operation_type {
34917        #[allow(unused_imports)]
34918        use super::*;
34919        #[derive(Clone, Debug, PartialEq)]
34920        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
34921    }
34922
34923    impl SqlOperationType {
34924        /// Gets the enum value.
34925        ///
34926        /// Returns `None` if the enum contains an unknown value deserialized from
34927        /// the string representation of enums.
34928        pub fn value(&self) -> std::option::Option<i32> {
34929            match self {
34930                Self::Unspecified => std::option::Option::Some(0),
34931                Self::Import => std::option::Option::Some(1),
34932                Self::Export => std::option::Option::Some(2),
34933                Self::Create => std::option::Option::Some(3),
34934                Self::Update => std::option::Option::Some(4),
34935                Self::Delete => std::option::Option::Some(5),
34936                Self::Restart => std::option::Option::Some(6),
34937                Self::Backup => std::option::Option::Some(7),
34938                Self::Snapshot => std::option::Option::Some(8),
34939                Self::BackupVolume => std::option::Option::Some(9),
34940                Self::DeleteVolume => std::option::Option::Some(10),
34941                Self::RestoreVolume => std::option::Option::Some(11),
34942                Self::InjectUser => std::option::Option::Some(12),
34943                Self::Clone => std::option::Option::Some(14),
34944                Self::StopReplica => std::option::Option::Some(15),
34945                Self::StartReplica => std::option::Option::Some(16),
34946                Self::PromoteReplica => std::option::Option::Some(17),
34947                Self::CreateReplica => std::option::Option::Some(18),
34948                Self::CreateUser => std::option::Option::Some(19),
34949                Self::DeleteUser => std::option::Option::Some(20),
34950                Self::UpdateUser => std::option::Option::Some(21),
34951                Self::CreateDatabase => std::option::Option::Some(22),
34952                Self::DeleteDatabase => std::option::Option::Some(23),
34953                Self::UpdateDatabase => std::option::Option::Some(24),
34954                Self::Failover => std::option::Option::Some(25),
34955                Self::DeleteBackup => std::option::Option::Some(26),
34956                Self::RecreateReplica => std::option::Option::Some(27),
34957                Self::TruncateLog => std::option::Option::Some(28),
34958                Self::DemoteMaster => std::option::Option::Some(29),
34959                Self::Maintenance => std::option::Option::Some(30),
34960                Self::EnablePrivateIp => std::option::Option::Some(31),
34961                Self::DeferMaintenance => std::option::Option::Some(32),
34962                Self::CreateClone => std::option::Option::Some(33),
34963                Self::RescheduleMaintenance => std::option::Option::Some(34),
34964                Self::StartExternalSync => std::option::Option::Some(35),
34965                Self::LogCleanup => std::option::Option::Some(36),
34966                Self::AutoRestart => std::option::Option::Some(37),
34967                Self::Reencrypt => std::option::Option::Some(38),
34968                Self::Switchover => std::option::Option::Some(39),
34969                Self::AcquireSsrsLease => std::option::Option::Some(42),
34970                Self::ReleaseSsrsLease => std::option::Option::Some(43),
34971                Self::ReconfigureOldPrimary => std::option::Option::Some(44),
34972                Self::ClusterMaintenance => std::option::Option::Some(45),
34973                Self::SelfServiceMaintenance => std::option::Option::Some(46),
34974                Self::SwitchoverToReplica => std::option::Option::Some(47),
34975                Self::MajorVersionUpgrade => std::option::Option::Some(48),
34976                Self::UnknownValue(u) => u.0.value(),
34977            }
34978        }
34979
34980        /// Gets the enum value as a string.
34981        ///
34982        /// Returns `None` if the enum contains an unknown value deserialized from
34983        /// the integer representation of enums.
34984        pub fn name(&self) -> std::option::Option<&str> {
34985            match self {
34986                Self::Unspecified => std::option::Option::Some("SQL_OPERATION_TYPE_UNSPECIFIED"),
34987                Self::Import => std::option::Option::Some("IMPORT"),
34988                Self::Export => std::option::Option::Some("EXPORT"),
34989                Self::Create => std::option::Option::Some("CREATE"),
34990                Self::Update => std::option::Option::Some("UPDATE"),
34991                Self::Delete => std::option::Option::Some("DELETE"),
34992                Self::Restart => std::option::Option::Some("RESTART"),
34993                Self::Backup => std::option::Option::Some("BACKUP"),
34994                Self::Snapshot => std::option::Option::Some("SNAPSHOT"),
34995                Self::BackupVolume => std::option::Option::Some("BACKUP_VOLUME"),
34996                Self::DeleteVolume => std::option::Option::Some("DELETE_VOLUME"),
34997                Self::RestoreVolume => std::option::Option::Some("RESTORE_VOLUME"),
34998                Self::InjectUser => std::option::Option::Some("INJECT_USER"),
34999                Self::Clone => std::option::Option::Some("CLONE"),
35000                Self::StopReplica => std::option::Option::Some("STOP_REPLICA"),
35001                Self::StartReplica => std::option::Option::Some("START_REPLICA"),
35002                Self::PromoteReplica => std::option::Option::Some("PROMOTE_REPLICA"),
35003                Self::CreateReplica => std::option::Option::Some("CREATE_REPLICA"),
35004                Self::CreateUser => std::option::Option::Some("CREATE_USER"),
35005                Self::DeleteUser => std::option::Option::Some("DELETE_USER"),
35006                Self::UpdateUser => std::option::Option::Some("UPDATE_USER"),
35007                Self::CreateDatabase => std::option::Option::Some("CREATE_DATABASE"),
35008                Self::DeleteDatabase => std::option::Option::Some("DELETE_DATABASE"),
35009                Self::UpdateDatabase => std::option::Option::Some("UPDATE_DATABASE"),
35010                Self::Failover => std::option::Option::Some("FAILOVER"),
35011                Self::DeleteBackup => std::option::Option::Some("DELETE_BACKUP"),
35012                Self::RecreateReplica => std::option::Option::Some("RECREATE_REPLICA"),
35013                Self::TruncateLog => std::option::Option::Some("TRUNCATE_LOG"),
35014                Self::DemoteMaster => std::option::Option::Some("DEMOTE_MASTER"),
35015                Self::Maintenance => std::option::Option::Some("MAINTENANCE"),
35016                Self::EnablePrivateIp => std::option::Option::Some("ENABLE_PRIVATE_IP"),
35017                Self::DeferMaintenance => std::option::Option::Some("DEFER_MAINTENANCE"),
35018                Self::CreateClone => std::option::Option::Some("CREATE_CLONE"),
35019                Self::RescheduleMaintenance => std::option::Option::Some("RESCHEDULE_MAINTENANCE"),
35020                Self::StartExternalSync => std::option::Option::Some("START_EXTERNAL_SYNC"),
35021                Self::LogCleanup => std::option::Option::Some("LOG_CLEANUP"),
35022                Self::AutoRestart => std::option::Option::Some("AUTO_RESTART"),
35023                Self::Reencrypt => std::option::Option::Some("REENCRYPT"),
35024                Self::Switchover => std::option::Option::Some("SWITCHOVER"),
35025                Self::AcquireSsrsLease => std::option::Option::Some("ACQUIRE_SSRS_LEASE"),
35026                Self::ReleaseSsrsLease => std::option::Option::Some("RELEASE_SSRS_LEASE"),
35027                Self::ReconfigureOldPrimary => std::option::Option::Some("RECONFIGURE_OLD_PRIMARY"),
35028                Self::ClusterMaintenance => std::option::Option::Some("CLUSTER_MAINTENANCE"),
35029                Self::SelfServiceMaintenance => {
35030                    std::option::Option::Some("SELF_SERVICE_MAINTENANCE")
35031                }
35032                Self::SwitchoverToReplica => std::option::Option::Some("SWITCHOVER_TO_REPLICA"),
35033                Self::MajorVersionUpgrade => std::option::Option::Some("MAJOR_VERSION_UPGRADE"),
35034                Self::UnknownValue(u) => u.0.name(),
35035            }
35036        }
35037    }
35038
35039    impl std::default::Default for SqlOperationType {
35040        fn default() -> Self {
35041            use std::convert::From;
35042            Self::from(0)
35043        }
35044    }
35045
35046    impl std::fmt::Display for SqlOperationType {
35047        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
35048            wkt::internal::display_enum(f, self.name(), self.value())
35049        }
35050    }
35051
35052    impl std::convert::From<i32> for SqlOperationType {
35053        fn from(value: i32) -> Self {
35054            match value {
35055                0 => Self::Unspecified,
35056                1 => Self::Import,
35057                2 => Self::Export,
35058                3 => Self::Create,
35059                4 => Self::Update,
35060                5 => Self::Delete,
35061                6 => Self::Restart,
35062                7 => Self::Backup,
35063                8 => Self::Snapshot,
35064                9 => Self::BackupVolume,
35065                10 => Self::DeleteVolume,
35066                11 => Self::RestoreVolume,
35067                12 => Self::InjectUser,
35068                14 => Self::Clone,
35069                15 => Self::StopReplica,
35070                16 => Self::StartReplica,
35071                17 => Self::PromoteReplica,
35072                18 => Self::CreateReplica,
35073                19 => Self::CreateUser,
35074                20 => Self::DeleteUser,
35075                21 => Self::UpdateUser,
35076                22 => Self::CreateDatabase,
35077                23 => Self::DeleteDatabase,
35078                24 => Self::UpdateDatabase,
35079                25 => Self::Failover,
35080                26 => Self::DeleteBackup,
35081                27 => Self::RecreateReplica,
35082                28 => Self::TruncateLog,
35083                29 => Self::DemoteMaster,
35084                30 => Self::Maintenance,
35085                31 => Self::EnablePrivateIp,
35086                32 => Self::DeferMaintenance,
35087                33 => Self::CreateClone,
35088                34 => Self::RescheduleMaintenance,
35089                35 => Self::StartExternalSync,
35090                36 => Self::LogCleanup,
35091                37 => Self::AutoRestart,
35092                38 => Self::Reencrypt,
35093                39 => Self::Switchover,
35094                42 => Self::AcquireSsrsLease,
35095                43 => Self::ReleaseSsrsLease,
35096                44 => Self::ReconfigureOldPrimary,
35097                45 => Self::ClusterMaintenance,
35098                46 => Self::SelfServiceMaintenance,
35099                47 => Self::SwitchoverToReplica,
35100                48 => Self::MajorVersionUpgrade,
35101                _ => Self::UnknownValue(sql_operation_type::UnknownValue(
35102                    wkt::internal::UnknownEnumValue::Integer(value),
35103                )),
35104            }
35105        }
35106    }
35107
35108    impl std::convert::From<&str> for SqlOperationType {
35109        fn from(value: &str) -> Self {
35110            use std::string::ToString;
35111            match value {
35112                "SQL_OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
35113                "IMPORT" => Self::Import,
35114                "EXPORT" => Self::Export,
35115                "CREATE" => Self::Create,
35116                "UPDATE" => Self::Update,
35117                "DELETE" => Self::Delete,
35118                "RESTART" => Self::Restart,
35119                "BACKUP" => Self::Backup,
35120                "SNAPSHOT" => Self::Snapshot,
35121                "BACKUP_VOLUME" => Self::BackupVolume,
35122                "DELETE_VOLUME" => Self::DeleteVolume,
35123                "RESTORE_VOLUME" => Self::RestoreVolume,
35124                "INJECT_USER" => Self::InjectUser,
35125                "CLONE" => Self::Clone,
35126                "STOP_REPLICA" => Self::StopReplica,
35127                "START_REPLICA" => Self::StartReplica,
35128                "PROMOTE_REPLICA" => Self::PromoteReplica,
35129                "CREATE_REPLICA" => Self::CreateReplica,
35130                "CREATE_USER" => Self::CreateUser,
35131                "DELETE_USER" => Self::DeleteUser,
35132                "UPDATE_USER" => Self::UpdateUser,
35133                "CREATE_DATABASE" => Self::CreateDatabase,
35134                "DELETE_DATABASE" => Self::DeleteDatabase,
35135                "UPDATE_DATABASE" => Self::UpdateDatabase,
35136                "FAILOVER" => Self::Failover,
35137                "DELETE_BACKUP" => Self::DeleteBackup,
35138                "RECREATE_REPLICA" => Self::RecreateReplica,
35139                "TRUNCATE_LOG" => Self::TruncateLog,
35140                "DEMOTE_MASTER" => Self::DemoteMaster,
35141                "MAINTENANCE" => Self::Maintenance,
35142                "ENABLE_PRIVATE_IP" => Self::EnablePrivateIp,
35143                "DEFER_MAINTENANCE" => Self::DeferMaintenance,
35144                "CREATE_CLONE" => Self::CreateClone,
35145                "RESCHEDULE_MAINTENANCE" => Self::RescheduleMaintenance,
35146                "START_EXTERNAL_SYNC" => Self::StartExternalSync,
35147                "LOG_CLEANUP" => Self::LogCleanup,
35148                "AUTO_RESTART" => Self::AutoRestart,
35149                "REENCRYPT" => Self::Reencrypt,
35150                "SWITCHOVER" => Self::Switchover,
35151                "ACQUIRE_SSRS_LEASE" => Self::AcquireSsrsLease,
35152                "RELEASE_SSRS_LEASE" => Self::ReleaseSsrsLease,
35153                "RECONFIGURE_OLD_PRIMARY" => Self::ReconfigureOldPrimary,
35154                "CLUSTER_MAINTENANCE" => Self::ClusterMaintenance,
35155                "SELF_SERVICE_MAINTENANCE" => Self::SelfServiceMaintenance,
35156                "SWITCHOVER_TO_REPLICA" => Self::SwitchoverToReplica,
35157                "MAJOR_VERSION_UPGRADE" => Self::MajorVersionUpgrade,
35158                _ => Self::UnknownValue(sql_operation_type::UnknownValue(
35159                    wkt::internal::UnknownEnumValue::String(value.to_string()),
35160                )),
35161            }
35162        }
35163    }
35164
35165    impl serde::ser::Serialize for SqlOperationType {
35166        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
35167        where
35168            S: serde::Serializer,
35169        {
35170            match self {
35171                Self::Unspecified => serializer.serialize_i32(0),
35172                Self::Import => serializer.serialize_i32(1),
35173                Self::Export => serializer.serialize_i32(2),
35174                Self::Create => serializer.serialize_i32(3),
35175                Self::Update => serializer.serialize_i32(4),
35176                Self::Delete => serializer.serialize_i32(5),
35177                Self::Restart => serializer.serialize_i32(6),
35178                Self::Backup => serializer.serialize_i32(7),
35179                Self::Snapshot => serializer.serialize_i32(8),
35180                Self::BackupVolume => serializer.serialize_i32(9),
35181                Self::DeleteVolume => serializer.serialize_i32(10),
35182                Self::RestoreVolume => serializer.serialize_i32(11),
35183                Self::InjectUser => serializer.serialize_i32(12),
35184                Self::Clone => serializer.serialize_i32(14),
35185                Self::StopReplica => serializer.serialize_i32(15),
35186                Self::StartReplica => serializer.serialize_i32(16),
35187                Self::PromoteReplica => serializer.serialize_i32(17),
35188                Self::CreateReplica => serializer.serialize_i32(18),
35189                Self::CreateUser => serializer.serialize_i32(19),
35190                Self::DeleteUser => serializer.serialize_i32(20),
35191                Self::UpdateUser => serializer.serialize_i32(21),
35192                Self::CreateDatabase => serializer.serialize_i32(22),
35193                Self::DeleteDatabase => serializer.serialize_i32(23),
35194                Self::UpdateDatabase => serializer.serialize_i32(24),
35195                Self::Failover => serializer.serialize_i32(25),
35196                Self::DeleteBackup => serializer.serialize_i32(26),
35197                Self::RecreateReplica => serializer.serialize_i32(27),
35198                Self::TruncateLog => serializer.serialize_i32(28),
35199                Self::DemoteMaster => serializer.serialize_i32(29),
35200                Self::Maintenance => serializer.serialize_i32(30),
35201                Self::EnablePrivateIp => serializer.serialize_i32(31),
35202                Self::DeferMaintenance => serializer.serialize_i32(32),
35203                Self::CreateClone => serializer.serialize_i32(33),
35204                Self::RescheduleMaintenance => serializer.serialize_i32(34),
35205                Self::StartExternalSync => serializer.serialize_i32(35),
35206                Self::LogCleanup => serializer.serialize_i32(36),
35207                Self::AutoRestart => serializer.serialize_i32(37),
35208                Self::Reencrypt => serializer.serialize_i32(38),
35209                Self::Switchover => serializer.serialize_i32(39),
35210                Self::AcquireSsrsLease => serializer.serialize_i32(42),
35211                Self::ReleaseSsrsLease => serializer.serialize_i32(43),
35212                Self::ReconfigureOldPrimary => serializer.serialize_i32(44),
35213                Self::ClusterMaintenance => serializer.serialize_i32(45),
35214                Self::SelfServiceMaintenance => serializer.serialize_i32(46),
35215                Self::SwitchoverToReplica => serializer.serialize_i32(47),
35216                Self::MajorVersionUpgrade => serializer.serialize_i32(48),
35217                Self::UnknownValue(u) => u.0.serialize(serializer),
35218            }
35219        }
35220    }
35221
35222    impl<'de> serde::de::Deserialize<'de> for SqlOperationType {
35223        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
35224        where
35225            D: serde::Deserializer<'de>,
35226        {
35227            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlOperationType>::new(
35228                ".google.cloud.sql.v1.Operation.SqlOperationType",
35229            ))
35230        }
35231    }
35232
35233    /// The status of an operation.
35234    ///
35235    /// # Working with unknown values
35236    ///
35237    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
35238    /// additional enum variants at any time. Adding new variants is not considered
35239    /// a breaking change. Applications should write their code in anticipation of:
35240    ///
35241    /// - New values appearing in future releases of the client library, **and**
35242    /// - New values received dynamically, without application changes.
35243    ///
35244    /// Please consult the [Working with enums] section in the user guide for some
35245    /// guidelines.
35246    ///
35247    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
35248    #[derive(Clone, Debug, PartialEq)]
35249    #[non_exhaustive]
35250    pub enum SqlOperationStatus {
35251        /// The state of the operation is unknown.
35252        Unspecified,
35253        /// The operation has been queued, but has not started yet.
35254        Pending,
35255        /// The operation is running.
35256        Running,
35257        /// The operation completed.
35258        Done,
35259        /// If set, the enum was initialized with an unknown value.
35260        ///
35261        /// Applications can examine the value using [SqlOperationStatus::value] or
35262        /// [SqlOperationStatus::name].
35263        UnknownValue(sql_operation_status::UnknownValue),
35264    }
35265
35266    #[doc(hidden)]
35267    pub mod sql_operation_status {
35268        #[allow(unused_imports)]
35269        use super::*;
35270        #[derive(Clone, Debug, PartialEq)]
35271        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
35272    }
35273
35274    impl SqlOperationStatus {
35275        /// Gets the enum value.
35276        ///
35277        /// Returns `None` if the enum contains an unknown value deserialized from
35278        /// the string representation of enums.
35279        pub fn value(&self) -> std::option::Option<i32> {
35280            match self {
35281                Self::Unspecified => std::option::Option::Some(0),
35282                Self::Pending => std::option::Option::Some(1),
35283                Self::Running => std::option::Option::Some(2),
35284                Self::Done => std::option::Option::Some(3),
35285                Self::UnknownValue(u) => u.0.value(),
35286            }
35287        }
35288
35289        /// Gets the enum value as a string.
35290        ///
35291        /// Returns `None` if the enum contains an unknown value deserialized from
35292        /// the integer representation of enums.
35293        pub fn name(&self) -> std::option::Option<&str> {
35294            match self {
35295                Self::Unspecified => std::option::Option::Some("SQL_OPERATION_STATUS_UNSPECIFIED"),
35296                Self::Pending => std::option::Option::Some("PENDING"),
35297                Self::Running => std::option::Option::Some("RUNNING"),
35298                Self::Done => std::option::Option::Some("DONE"),
35299                Self::UnknownValue(u) => u.0.name(),
35300            }
35301        }
35302    }
35303
35304    impl std::default::Default for SqlOperationStatus {
35305        fn default() -> Self {
35306            use std::convert::From;
35307            Self::from(0)
35308        }
35309    }
35310
35311    impl std::fmt::Display for SqlOperationStatus {
35312        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
35313            wkt::internal::display_enum(f, self.name(), self.value())
35314        }
35315    }
35316
35317    impl std::convert::From<i32> for SqlOperationStatus {
35318        fn from(value: i32) -> Self {
35319            match value {
35320                0 => Self::Unspecified,
35321                1 => Self::Pending,
35322                2 => Self::Running,
35323                3 => Self::Done,
35324                _ => Self::UnknownValue(sql_operation_status::UnknownValue(
35325                    wkt::internal::UnknownEnumValue::Integer(value),
35326                )),
35327            }
35328        }
35329    }
35330
35331    impl std::convert::From<&str> for SqlOperationStatus {
35332        fn from(value: &str) -> Self {
35333            use std::string::ToString;
35334            match value {
35335                "SQL_OPERATION_STATUS_UNSPECIFIED" => Self::Unspecified,
35336                "PENDING" => Self::Pending,
35337                "RUNNING" => Self::Running,
35338                "DONE" => Self::Done,
35339                _ => Self::UnknownValue(sql_operation_status::UnknownValue(
35340                    wkt::internal::UnknownEnumValue::String(value.to_string()),
35341                )),
35342            }
35343        }
35344    }
35345
35346    impl serde::ser::Serialize for SqlOperationStatus {
35347        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
35348        where
35349            S: serde::Serializer,
35350        {
35351            match self {
35352                Self::Unspecified => serializer.serialize_i32(0),
35353                Self::Pending => serializer.serialize_i32(1),
35354                Self::Running => serializer.serialize_i32(2),
35355                Self::Done => serializer.serialize_i32(3),
35356                Self::UnknownValue(u) => u.0.serialize(serializer),
35357            }
35358        }
35359    }
35360
35361    impl<'de> serde::de::Deserialize<'de> for SqlOperationStatus {
35362        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
35363        where
35364            D: serde::Deserializer<'de>,
35365        {
35366            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlOperationStatus>::new(
35367                ".google.cloud.sql.v1.Operation.SqlOperationStatus",
35368            ))
35369        }
35370    }
35371}
35372
35373/// Database instance operation error.
35374#[derive(Clone, Default, PartialEq)]
35375#[non_exhaustive]
35376pub struct OperationError {
35377    /// This is always `sql#operationError`.
35378    pub kind: std::string::String,
35379
35380    /// Identifies the specific error that occurred.
35381    pub code: std::string::String,
35382
35383    /// Additional information about the error encountered.
35384    pub message: std::string::String,
35385
35386    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
35387}
35388
35389impl OperationError {
35390    pub fn new() -> Self {
35391        std::default::Default::default()
35392    }
35393
35394    /// Sets the value of [kind][crate::model::OperationError::kind].
35395    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
35396        self.kind = v.into();
35397        self
35398    }
35399
35400    /// Sets the value of [code][crate::model::OperationError::code].
35401    pub fn set_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
35402        self.code = v.into();
35403        self
35404    }
35405
35406    /// Sets the value of [message][crate::model::OperationError::message].
35407    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
35408        self.message = v.into();
35409        self
35410    }
35411}
35412
35413impl wkt::message::Message for OperationError {
35414    fn typename() -> &'static str {
35415        "type.googleapis.com/google.cloud.sql.v1.OperationError"
35416    }
35417}
35418
35419#[doc(hidden)]
35420impl<'de> serde::de::Deserialize<'de> for OperationError {
35421    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
35422    where
35423        D: serde::Deserializer<'de>,
35424    {
35425        #[allow(non_camel_case_types)]
35426        #[doc(hidden)]
35427        #[derive(PartialEq, Eq, Hash)]
35428        enum __FieldTag {
35429            __kind,
35430            __code,
35431            __message,
35432            Unknown(std::string::String),
35433        }
35434        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
35435            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
35436            where
35437                D: serde::Deserializer<'de>,
35438            {
35439                struct Visitor;
35440                impl<'de> serde::de::Visitor<'de> for Visitor {
35441                    type Value = __FieldTag;
35442                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
35443                        formatter.write_str("a field name for OperationError")
35444                    }
35445                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
35446                    where
35447                        E: serde::de::Error,
35448                    {
35449                        use std::result::Result::Ok;
35450                        use std::string::ToString;
35451                        match value {
35452                            "kind" => Ok(__FieldTag::__kind),
35453                            "code" => Ok(__FieldTag::__code),
35454                            "message" => Ok(__FieldTag::__message),
35455                            _ => Ok(__FieldTag::Unknown(value.to_string())),
35456                        }
35457                    }
35458                }
35459                deserializer.deserialize_identifier(Visitor)
35460            }
35461        }
35462        struct Visitor;
35463        impl<'de> serde::de::Visitor<'de> for Visitor {
35464            type Value = OperationError;
35465            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
35466                formatter.write_str("struct OperationError")
35467            }
35468            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
35469            where
35470                A: serde::de::MapAccess<'de>,
35471            {
35472                #[allow(unused_imports)]
35473                use serde::de::Error;
35474                use std::option::Option::Some;
35475                let mut fields = std::collections::HashSet::new();
35476                let mut result = Self::Value::new();
35477                while let Some(tag) = map.next_key::<__FieldTag>()? {
35478                    #[allow(clippy::match_single_binding)]
35479                    match tag {
35480                        __FieldTag::__kind => {
35481                            if !fields.insert(__FieldTag::__kind) {
35482                                return std::result::Result::Err(A::Error::duplicate_field(
35483                                    "multiple values for kind",
35484                                ));
35485                            }
35486                            result.kind = map
35487                                .next_value::<std::option::Option<std::string::String>>()?
35488                                .unwrap_or_default();
35489                        }
35490                        __FieldTag::__code => {
35491                            if !fields.insert(__FieldTag::__code) {
35492                                return std::result::Result::Err(A::Error::duplicate_field(
35493                                    "multiple values for code",
35494                                ));
35495                            }
35496                            result.code = map
35497                                .next_value::<std::option::Option<std::string::String>>()?
35498                                .unwrap_or_default();
35499                        }
35500                        __FieldTag::__message => {
35501                            if !fields.insert(__FieldTag::__message) {
35502                                return std::result::Result::Err(A::Error::duplicate_field(
35503                                    "multiple values for message",
35504                                ));
35505                            }
35506                            result.message = map
35507                                .next_value::<std::option::Option<std::string::String>>()?
35508                                .unwrap_or_default();
35509                        }
35510                        __FieldTag::Unknown(key) => {
35511                            let value = map.next_value::<serde_json::Value>()?;
35512                            result._unknown_fields.insert(key, value);
35513                        }
35514                    }
35515                }
35516                std::result::Result::Ok(result)
35517            }
35518        }
35519        deserializer.deserialize_any(Visitor)
35520    }
35521}
35522
35523#[doc(hidden)]
35524impl serde::ser::Serialize for OperationError {
35525    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
35526    where
35527        S: serde::ser::Serializer,
35528    {
35529        use serde::ser::SerializeMap;
35530        #[allow(unused_imports)]
35531        use std::option::Option::Some;
35532        let mut state = serializer.serialize_map(std::option::Option::None)?;
35533        if !self.kind.is_empty() {
35534            state.serialize_entry("kind", &self.kind)?;
35535        }
35536        if !self.code.is_empty() {
35537            state.serialize_entry("code", &self.code)?;
35538        }
35539        if !self.message.is_empty() {
35540            state.serialize_entry("message", &self.message)?;
35541        }
35542        if !self._unknown_fields.is_empty() {
35543            for (key, value) in self._unknown_fields.iter() {
35544                state.serialize_entry(key, &value)?;
35545            }
35546        }
35547        state.end()
35548    }
35549}
35550
35551impl std::fmt::Debug for OperationError {
35552    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
35553        let mut debug_struct = f.debug_struct("OperationError");
35554        debug_struct.field("kind", &self.kind);
35555        debug_struct.field("code", &self.code);
35556        debug_struct.field("message", &self.message);
35557        if !self._unknown_fields.is_empty() {
35558            debug_struct.field("_unknown_fields", &self._unknown_fields);
35559        }
35560        debug_struct.finish()
35561    }
35562}
35563
35564/// Database instance operation errors list wrapper.
35565#[derive(Clone, Default, PartialEq)]
35566#[non_exhaustive]
35567pub struct OperationErrors {
35568    /// This is always `sql#operationErrors`.
35569    pub kind: std::string::String,
35570
35571    /// The list of errors encountered while processing this operation.
35572    pub errors: std::vec::Vec<crate::model::OperationError>,
35573
35574    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
35575}
35576
35577impl OperationErrors {
35578    pub fn new() -> Self {
35579        std::default::Default::default()
35580    }
35581
35582    /// Sets the value of [kind][crate::model::OperationErrors::kind].
35583    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
35584        self.kind = v.into();
35585        self
35586    }
35587
35588    /// Sets the value of [errors][crate::model::OperationErrors::errors].
35589    pub fn set_errors<T, V>(mut self, v: T) -> Self
35590    where
35591        T: std::iter::IntoIterator<Item = V>,
35592        V: std::convert::Into<crate::model::OperationError>,
35593    {
35594        use std::iter::Iterator;
35595        self.errors = v.into_iter().map(|i| i.into()).collect();
35596        self
35597    }
35598}
35599
35600impl wkt::message::Message for OperationErrors {
35601    fn typename() -> &'static str {
35602        "type.googleapis.com/google.cloud.sql.v1.OperationErrors"
35603    }
35604}
35605
35606#[doc(hidden)]
35607impl<'de> serde::de::Deserialize<'de> for OperationErrors {
35608    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
35609    where
35610        D: serde::Deserializer<'de>,
35611    {
35612        #[allow(non_camel_case_types)]
35613        #[doc(hidden)]
35614        #[derive(PartialEq, Eq, Hash)]
35615        enum __FieldTag {
35616            __kind,
35617            __errors,
35618            Unknown(std::string::String),
35619        }
35620        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
35621            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
35622            where
35623                D: serde::Deserializer<'de>,
35624            {
35625                struct Visitor;
35626                impl<'de> serde::de::Visitor<'de> for Visitor {
35627                    type Value = __FieldTag;
35628                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
35629                        formatter.write_str("a field name for OperationErrors")
35630                    }
35631                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
35632                    where
35633                        E: serde::de::Error,
35634                    {
35635                        use std::result::Result::Ok;
35636                        use std::string::ToString;
35637                        match value {
35638                            "kind" => Ok(__FieldTag::__kind),
35639                            "errors" => Ok(__FieldTag::__errors),
35640                            _ => Ok(__FieldTag::Unknown(value.to_string())),
35641                        }
35642                    }
35643                }
35644                deserializer.deserialize_identifier(Visitor)
35645            }
35646        }
35647        struct Visitor;
35648        impl<'de> serde::de::Visitor<'de> for Visitor {
35649            type Value = OperationErrors;
35650            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
35651                formatter.write_str("struct OperationErrors")
35652            }
35653            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
35654            where
35655                A: serde::de::MapAccess<'de>,
35656            {
35657                #[allow(unused_imports)]
35658                use serde::de::Error;
35659                use std::option::Option::Some;
35660                let mut fields = std::collections::HashSet::new();
35661                let mut result = Self::Value::new();
35662                while let Some(tag) = map.next_key::<__FieldTag>()? {
35663                    #[allow(clippy::match_single_binding)]
35664                    match tag {
35665                        __FieldTag::__kind => {
35666                            if !fields.insert(__FieldTag::__kind) {
35667                                return std::result::Result::Err(A::Error::duplicate_field(
35668                                    "multiple values for kind",
35669                                ));
35670                            }
35671                            result.kind = map
35672                                .next_value::<std::option::Option<std::string::String>>()?
35673                                .unwrap_or_default();
35674                        }
35675                        __FieldTag::__errors => {
35676                            if !fields.insert(__FieldTag::__errors) {
35677                                return std::result::Result::Err(A::Error::duplicate_field(
35678                                    "multiple values for errors",
35679                                ));
35680                            }
35681                            result.errors =
35682                                map.next_value::<std::option::Option<
35683                                    std::vec::Vec<crate::model::OperationError>,
35684                                >>()?
35685                                .unwrap_or_default();
35686                        }
35687                        __FieldTag::Unknown(key) => {
35688                            let value = map.next_value::<serde_json::Value>()?;
35689                            result._unknown_fields.insert(key, value);
35690                        }
35691                    }
35692                }
35693                std::result::Result::Ok(result)
35694            }
35695        }
35696        deserializer.deserialize_any(Visitor)
35697    }
35698}
35699
35700#[doc(hidden)]
35701impl serde::ser::Serialize for OperationErrors {
35702    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
35703    where
35704        S: serde::ser::Serializer,
35705    {
35706        use serde::ser::SerializeMap;
35707        #[allow(unused_imports)]
35708        use std::option::Option::Some;
35709        let mut state = serializer.serialize_map(std::option::Option::None)?;
35710        if !self.kind.is_empty() {
35711            state.serialize_entry("kind", &self.kind)?;
35712        }
35713        if !self.errors.is_empty() {
35714            state.serialize_entry("errors", &self.errors)?;
35715        }
35716        if !self._unknown_fields.is_empty() {
35717            for (key, value) in self._unknown_fields.iter() {
35718                state.serialize_entry(key, &value)?;
35719            }
35720        }
35721        state.end()
35722    }
35723}
35724
35725impl std::fmt::Debug for OperationErrors {
35726    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
35727        let mut debug_struct = f.debug_struct("OperationErrors");
35728        debug_struct.field("kind", &self.kind);
35729        debug_struct.field("errors", &self.errors);
35730        if !self._unknown_fields.is_empty() {
35731            debug_struct.field("_unknown_fields", &self._unknown_fields);
35732        }
35733        debug_struct.finish()
35734    }
35735}
35736
35737/// Database instance local user password validation policy
35738#[derive(Clone, Default, PartialEq)]
35739#[non_exhaustive]
35740pub struct PasswordValidationPolicy {
35741    /// Minimum number of characters allowed.
35742    pub min_length: std::option::Option<wkt::Int32Value>,
35743
35744    /// The complexity of the password.
35745    pub complexity: crate::model::password_validation_policy::Complexity,
35746
35747    /// Number of previous passwords that cannot be reused.
35748    pub reuse_interval: std::option::Option<wkt::Int32Value>,
35749
35750    /// Disallow username as a part of the password.
35751    pub disallow_username_substring: std::option::Option<wkt::BoolValue>,
35752
35753    /// Minimum interval after which the password can be changed. This flag is only
35754    /// supported for PostgreSQL.
35755    pub password_change_interval: std::option::Option<wkt::Duration>,
35756
35757    /// Whether the password policy is enabled or not.
35758    pub enable_password_policy: std::option::Option<wkt::BoolValue>,
35759
35760    /// This field is deprecated and will be removed in a future version of the
35761    /// API.
35762    #[deprecated]
35763    pub disallow_compromised_credentials: std::option::Option<wkt::BoolValue>,
35764
35765    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
35766}
35767
35768impl PasswordValidationPolicy {
35769    pub fn new() -> Self {
35770        std::default::Default::default()
35771    }
35772
35773    /// Sets the value of [min_length][crate::model::PasswordValidationPolicy::min_length].
35774    pub fn set_min_length<T>(mut self, v: T) -> Self
35775    where
35776        T: std::convert::Into<wkt::Int32Value>,
35777    {
35778        self.min_length = std::option::Option::Some(v.into());
35779        self
35780    }
35781
35782    /// Sets or clears the value of [min_length][crate::model::PasswordValidationPolicy::min_length].
35783    pub fn set_or_clear_min_length<T>(mut self, v: std::option::Option<T>) -> Self
35784    where
35785        T: std::convert::Into<wkt::Int32Value>,
35786    {
35787        self.min_length = v.map(|x| x.into());
35788        self
35789    }
35790
35791    /// Sets the value of [complexity][crate::model::PasswordValidationPolicy::complexity].
35792    pub fn set_complexity<
35793        T: std::convert::Into<crate::model::password_validation_policy::Complexity>,
35794    >(
35795        mut self,
35796        v: T,
35797    ) -> Self {
35798        self.complexity = v.into();
35799        self
35800    }
35801
35802    /// Sets the value of [reuse_interval][crate::model::PasswordValidationPolicy::reuse_interval].
35803    pub fn set_reuse_interval<T>(mut self, v: T) -> Self
35804    where
35805        T: std::convert::Into<wkt::Int32Value>,
35806    {
35807        self.reuse_interval = std::option::Option::Some(v.into());
35808        self
35809    }
35810
35811    /// Sets or clears the value of [reuse_interval][crate::model::PasswordValidationPolicy::reuse_interval].
35812    pub fn set_or_clear_reuse_interval<T>(mut self, v: std::option::Option<T>) -> Self
35813    where
35814        T: std::convert::Into<wkt::Int32Value>,
35815    {
35816        self.reuse_interval = v.map(|x| x.into());
35817        self
35818    }
35819
35820    /// Sets the value of [disallow_username_substring][crate::model::PasswordValidationPolicy::disallow_username_substring].
35821    pub fn set_disallow_username_substring<T>(mut self, v: T) -> Self
35822    where
35823        T: std::convert::Into<wkt::BoolValue>,
35824    {
35825        self.disallow_username_substring = std::option::Option::Some(v.into());
35826        self
35827    }
35828
35829    /// Sets or clears the value of [disallow_username_substring][crate::model::PasswordValidationPolicy::disallow_username_substring].
35830    pub fn set_or_clear_disallow_username_substring<T>(mut self, v: std::option::Option<T>) -> Self
35831    where
35832        T: std::convert::Into<wkt::BoolValue>,
35833    {
35834        self.disallow_username_substring = v.map(|x| x.into());
35835        self
35836    }
35837
35838    /// Sets the value of [password_change_interval][crate::model::PasswordValidationPolicy::password_change_interval].
35839    pub fn set_password_change_interval<T>(mut self, v: T) -> Self
35840    where
35841        T: std::convert::Into<wkt::Duration>,
35842    {
35843        self.password_change_interval = std::option::Option::Some(v.into());
35844        self
35845    }
35846
35847    /// Sets or clears the value of [password_change_interval][crate::model::PasswordValidationPolicy::password_change_interval].
35848    pub fn set_or_clear_password_change_interval<T>(mut self, v: std::option::Option<T>) -> Self
35849    where
35850        T: std::convert::Into<wkt::Duration>,
35851    {
35852        self.password_change_interval = v.map(|x| x.into());
35853        self
35854    }
35855
35856    /// Sets the value of [enable_password_policy][crate::model::PasswordValidationPolicy::enable_password_policy].
35857    pub fn set_enable_password_policy<T>(mut self, v: T) -> Self
35858    where
35859        T: std::convert::Into<wkt::BoolValue>,
35860    {
35861        self.enable_password_policy = std::option::Option::Some(v.into());
35862        self
35863    }
35864
35865    /// Sets or clears the value of [enable_password_policy][crate::model::PasswordValidationPolicy::enable_password_policy].
35866    pub fn set_or_clear_enable_password_policy<T>(mut self, v: std::option::Option<T>) -> Self
35867    where
35868        T: std::convert::Into<wkt::BoolValue>,
35869    {
35870        self.enable_password_policy = v.map(|x| x.into());
35871        self
35872    }
35873
35874    /// Sets the value of [disallow_compromised_credentials][crate::model::PasswordValidationPolicy::disallow_compromised_credentials].
35875    #[deprecated]
35876    pub fn set_disallow_compromised_credentials<T>(mut self, v: T) -> Self
35877    where
35878        T: std::convert::Into<wkt::BoolValue>,
35879    {
35880        self.disallow_compromised_credentials = std::option::Option::Some(v.into());
35881        self
35882    }
35883
35884    /// Sets or clears the value of [disallow_compromised_credentials][crate::model::PasswordValidationPolicy::disallow_compromised_credentials].
35885    #[deprecated]
35886    pub fn set_or_clear_disallow_compromised_credentials<T>(
35887        mut self,
35888        v: std::option::Option<T>,
35889    ) -> Self
35890    where
35891        T: std::convert::Into<wkt::BoolValue>,
35892    {
35893        self.disallow_compromised_credentials = v.map(|x| x.into());
35894        self
35895    }
35896}
35897
35898impl wkt::message::Message for PasswordValidationPolicy {
35899    fn typename() -> &'static str {
35900        "type.googleapis.com/google.cloud.sql.v1.PasswordValidationPolicy"
35901    }
35902}
35903
35904#[doc(hidden)]
35905impl<'de> serde::de::Deserialize<'de> for PasswordValidationPolicy {
35906    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
35907    where
35908        D: serde::Deserializer<'de>,
35909    {
35910        #[allow(non_camel_case_types)]
35911        #[doc(hidden)]
35912        #[derive(PartialEq, Eq, Hash)]
35913        enum __FieldTag {
35914            __min_length,
35915            __complexity,
35916            __reuse_interval,
35917            __disallow_username_substring,
35918            __password_change_interval,
35919            __enable_password_policy,
35920            __disallow_compromised_credentials,
35921            Unknown(std::string::String),
35922        }
35923        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
35924            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
35925            where
35926                D: serde::Deserializer<'de>,
35927            {
35928                struct Visitor;
35929                impl<'de> serde::de::Visitor<'de> for Visitor {
35930                    type Value = __FieldTag;
35931                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
35932                        formatter.write_str("a field name for PasswordValidationPolicy")
35933                    }
35934                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
35935                    where
35936                        E: serde::de::Error,
35937                    {
35938                        use std::result::Result::Ok;
35939                        use std::string::ToString;
35940                        match value {
35941                            "minLength" => Ok(__FieldTag::__min_length),
35942                            "min_length" => Ok(__FieldTag::__min_length),
35943                            "complexity" => Ok(__FieldTag::__complexity),
35944                            "reuseInterval" => Ok(__FieldTag::__reuse_interval),
35945                            "reuse_interval" => Ok(__FieldTag::__reuse_interval),
35946                            "disallowUsernameSubstring" => {
35947                                Ok(__FieldTag::__disallow_username_substring)
35948                            }
35949                            "disallow_username_substring" => {
35950                                Ok(__FieldTag::__disallow_username_substring)
35951                            }
35952                            "passwordChangeInterval" => Ok(__FieldTag::__password_change_interval),
35953                            "password_change_interval" => {
35954                                Ok(__FieldTag::__password_change_interval)
35955                            }
35956                            "enablePasswordPolicy" => Ok(__FieldTag::__enable_password_policy),
35957                            "enable_password_policy" => Ok(__FieldTag::__enable_password_policy),
35958                            "disallowCompromisedCredentials" => {
35959                                Ok(__FieldTag::__disallow_compromised_credentials)
35960                            }
35961                            "disallow_compromised_credentials" => {
35962                                Ok(__FieldTag::__disallow_compromised_credentials)
35963                            }
35964                            _ => Ok(__FieldTag::Unknown(value.to_string())),
35965                        }
35966                    }
35967                }
35968                deserializer.deserialize_identifier(Visitor)
35969            }
35970        }
35971        struct Visitor;
35972        impl<'de> serde::de::Visitor<'de> for Visitor {
35973            type Value = PasswordValidationPolicy;
35974            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
35975                formatter.write_str("struct PasswordValidationPolicy")
35976            }
35977            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
35978            where
35979                A: serde::de::MapAccess<'de>,
35980            {
35981                #[allow(unused_imports)]
35982                use serde::de::Error;
35983                use std::option::Option::Some;
35984                let mut fields = std::collections::HashSet::new();
35985                let mut result = Self::Value::new();
35986                while let Some(tag) = map.next_key::<__FieldTag>()? {
35987                    #[allow(clippy::match_single_binding)]
35988                    match tag {
35989                        __FieldTag::__min_length => {
35990                            if !fields.insert(__FieldTag::__min_length) {
35991                                return std::result::Result::Err(A::Error::duplicate_field(
35992                                    "multiple values for min_length",
35993                                ));
35994                            }
35995                            struct __With(std::option::Option<wkt::Int32Value>);
35996                            impl<'de> serde::de::Deserialize<'de> for __With {
35997                                fn deserialize<D>(
35998                                    deserializer: D,
35999                                ) -> std::result::Result<Self, D::Error>
36000                                where
36001                                    D: serde::de::Deserializer<'de>,
36002                                {
36003                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
36004                                }
36005                            }
36006                            result.min_length = map.next_value::<__With>()?.0;
36007                        }
36008                        __FieldTag::__complexity => {
36009                            if !fields.insert(__FieldTag::__complexity) {
36010                                return std::result::Result::Err(A::Error::duplicate_field(
36011                                    "multiple values for complexity",
36012                                ));
36013                            }
36014                            result.complexity = map
36015                                .next_value::<std::option::Option<
36016                                    crate::model::password_validation_policy::Complexity,
36017                                >>()?
36018                                .unwrap_or_default();
36019                        }
36020                        __FieldTag::__reuse_interval => {
36021                            if !fields.insert(__FieldTag::__reuse_interval) {
36022                                return std::result::Result::Err(A::Error::duplicate_field(
36023                                    "multiple values for reuse_interval",
36024                                ));
36025                            }
36026                            struct __With(std::option::Option<wkt::Int32Value>);
36027                            impl<'de> serde::de::Deserialize<'de> for __With {
36028                                fn deserialize<D>(
36029                                    deserializer: D,
36030                                ) -> std::result::Result<Self, D::Error>
36031                                where
36032                                    D: serde::de::Deserializer<'de>,
36033                                {
36034                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
36035                                }
36036                            }
36037                            result.reuse_interval = map.next_value::<__With>()?.0;
36038                        }
36039                        __FieldTag::__disallow_username_substring => {
36040                            if !fields.insert(__FieldTag::__disallow_username_substring) {
36041                                return std::result::Result::Err(A::Error::duplicate_field(
36042                                    "multiple values for disallow_username_substring",
36043                                ));
36044                            }
36045                            result.disallow_username_substring =
36046                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
36047                        }
36048                        __FieldTag::__password_change_interval => {
36049                            if !fields.insert(__FieldTag::__password_change_interval) {
36050                                return std::result::Result::Err(A::Error::duplicate_field(
36051                                    "multiple values for password_change_interval",
36052                                ));
36053                            }
36054                            result.password_change_interval =
36055                                map.next_value::<std::option::Option<wkt::Duration>>()?;
36056                        }
36057                        __FieldTag::__enable_password_policy => {
36058                            if !fields.insert(__FieldTag::__enable_password_policy) {
36059                                return std::result::Result::Err(A::Error::duplicate_field(
36060                                    "multiple values for enable_password_policy",
36061                                ));
36062                            }
36063                            result.enable_password_policy =
36064                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
36065                        }
36066                        __FieldTag::__disallow_compromised_credentials => {
36067                            if !fields.insert(__FieldTag::__disallow_compromised_credentials) {
36068                                return std::result::Result::Err(A::Error::duplicate_field(
36069                                    "multiple values for disallow_compromised_credentials",
36070                                ));
36071                            }
36072                            result.disallow_compromised_credentials =
36073                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
36074                        }
36075                        __FieldTag::Unknown(key) => {
36076                            let value = map.next_value::<serde_json::Value>()?;
36077                            result._unknown_fields.insert(key, value);
36078                        }
36079                    }
36080                }
36081                std::result::Result::Ok(result)
36082            }
36083        }
36084        deserializer.deserialize_any(Visitor)
36085    }
36086}
36087
36088#[doc(hidden)]
36089impl serde::ser::Serialize for PasswordValidationPolicy {
36090    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
36091    where
36092        S: serde::ser::Serializer,
36093    {
36094        use serde::ser::SerializeMap;
36095        #[allow(unused_imports)]
36096        use std::option::Option::Some;
36097        let mut state = serializer.serialize_map(std::option::Option::None)?;
36098        if self.min_length.is_some() {
36099            struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
36100            impl<'a> serde::ser::Serialize for __With<'a> {
36101                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
36102                where
36103                    S: serde::ser::Serializer,
36104                {
36105                    serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
36106                        self.0, serializer,
36107                    )
36108                }
36109            }
36110            state.serialize_entry("minLength", &__With(&self.min_length))?;
36111        }
36112        if !wkt::internal::is_default(&self.complexity) {
36113            state.serialize_entry("complexity", &self.complexity)?;
36114        }
36115        if self.reuse_interval.is_some() {
36116            struct __With<'a>(&'a std::option::Option<wkt::Int32Value>);
36117            impl<'a> serde::ser::Serialize for __With<'a> {
36118                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
36119                where
36120                    S: serde::ser::Serializer,
36121                {
36122                    serde_with::As::<std::option::Option<wkt::internal::I32>>::serialize(
36123                        self.0, serializer,
36124                    )
36125                }
36126            }
36127            state.serialize_entry("reuseInterval", &__With(&self.reuse_interval))?;
36128        }
36129        if self.disallow_username_substring.is_some() {
36130            state.serialize_entry(
36131                "disallowUsernameSubstring",
36132                &self.disallow_username_substring,
36133            )?;
36134        }
36135        if self.password_change_interval.is_some() {
36136            state.serialize_entry("passwordChangeInterval", &self.password_change_interval)?;
36137        }
36138        if self.enable_password_policy.is_some() {
36139            state.serialize_entry("enablePasswordPolicy", &self.enable_password_policy)?;
36140        }
36141        if self.disallow_compromised_credentials.is_some() {
36142            state.serialize_entry(
36143                "disallowCompromisedCredentials",
36144                &self.disallow_compromised_credentials,
36145            )?;
36146        }
36147        if !self._unknown_fields.is_empty() {
36148            for (key, value) in self._unknown_fields.iter() {
36149                state.serialize_entry(key, &value)?;
36150            }
36151        }
36152        state.end()
36153    }
36154}
36155
36156impl std::fmt::Debug for PasswordValidationPolicy {
36157    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
36158        let mut debug_struct = f.debug_struct("PasswordValidationPolicy");
36159        debug_struct.field("min_length", &self.min_length);
36160        debug_struct.field("complexity", &self.complexity);
36161        debug_struct.field("reuse_interval", &self.reuse_interval);
36162        debug_struct.field(
36163            "disallow_username_substring",
36164            &self.disallow_username_substring,
36165        );
36166        debug_struct.field("password_change_interval", &self.password_change_interval);
36167        debug_struct.field("enable_password_policy", &self.enable_password_policy);
36168        debug_struct.field(
36169            "disallow_compromised_credentials",
36170            &self.disallow_compromised_credentials,
36171        );
36172        if !self._unknown_fields.is_empty() {
36173            debug_struct.field("_unknown_fields", &self._unknown_fields);
36174        }
36175        debug_struct.finish()
36176    }
36177}
36178
36179/// Defines additional types related to [PasswordValidationPolicy].
36180pub mod password_validation_policy {
36181    #[allow(unused_imports)]
36182    use super::*;
36183
36184    /// The complexity choices of the password.
36185    ///
36186    /// # Working with unknown values
36187    ///
36188    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
36189    /// additional enum variants at any time. Adding new variants is not considered
36190    /// a breaking change. Applications should write their code in anticipation of:
36191    ///
36192    /// - New values appearing in future releases of the client library, **and**
36193    /// - New values received dynamically, without application changes.
36194    ///
36195    /// Please consult the [Working with enums] section in the user guide for some
36196    /// guidelines.
36197    ///
36198    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
36199    #[derive(Clone, Debug, PartialEq)]
36200    #[non_exhaustive]
36201    pub enum Complexity {
36202        /// Complexity check is not specified.
36203        Unspecified,
36204        /// A combination of lowercase, uppercase, numeric, and non-alphanumeric
36205        /// characters.
36206        Default,
36207        /// If set, the enum was initialized with an unknown value.
36208        ///
36209        /// Applications can examine the value using [Complexity::value] or
36210        /// [Complexity::name].
36211        UnknownValue(complexity::UnknownValue),
36212    }
36213
36214    #[doc(hidden)]
36215    pub mod complexity {
36216        #[allow(unused_imports)]
36217        use super::*;
36218        #[derive(Clone, Debug, PartialEq)]
36219        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
36220    }
36221
36222    impl Complexity {
36223        /// Gets the enum value.
36224        ///
36225        /// Returns `None` if the enum contains an unknown value deserialized from
36226        /// the string representation of enums.
36227        pub fn value(&self) -> std::option::Option<i32> {
36228            match self {
36229                Self::Unspecified => std::option::Option::Some(0),
36230                Self::Default => std::option::Option::Some(1),
36231                Self::UnknownValue(u) => u.0.value(),
36232            }
36233        }
36234
36235        /// Gets the enum value as a string.
36236        ///
36237        /// Returns `None` if the enum contains an unknown value deserialized from
36238        /// the integer representation of enums.
36239        pub fn name(&self) -> std::option::Option<&str> {
36240            match self {
36241                Self::Unspecified => std::option::Option::Some("COMPLEXITY_UNSPECIFIED"),
36242                Self::Default => std::option::Option::Some("COMPLEXITY_DEFAULT"),
36243                Self::UnknownValue(u) => u.0.name(),
36244            }
36245        }
36246    }
36247
36248    impl std::default::Default for Complexity {
36249        fn default() -> Self {
36250            use std::convert::From;
36251            Self::from(0)
36252        }
36253    }
36254
36255    impl std::fmt::Display for Complexity {
36256        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
36257            wkt::internal::display_enum(f, self.name(), self.value())
36258        }
36259    }
36260
36261    impl std::convert::From<i32> for Complexity {
36262        fn from(value: i32) -> Self {
36263            match value {
36264                0 => Self::Unspecified,
36265                1 => Self::Default,
36266                _ => Self::UnknownValue(complexity::UnknownValue(
36267                    wkt::internal::UnknownEnumValue::Integer(value),
36268                )),
36269            }
36270        }
36271    }
36272
36273    impl std::convert::From<&str> for Complexity {
36274        fn from(value: &str) -> Self {
36275            use std::string::ToString;
36276            match value {
36277                "COMPLEXITY_UNSPECIFIED" => Self::Unspecified,
36278                "COMPLEXITY_DEFAULT" => Self::Default,
36279                _ => Self::UnknownValue(complexity::UnknownValue(
36280                    wkt::internal::UnknownEnumValue::String(value.to_string()),
36281                )),
36282            }
36283        }
36284    }
36285
36286    impl serde::ser::Serialize for Complexity {
36287        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
36288        where
36289            S: serde::Serializer,
36290        {
36291            match self {
36292                Self::Unspecified => serializer.serialize_i32(0),
36293                Self::Default => serializer.serialize_i32(1),
36294                Self::UnknownValue(u) => u.0.serialize(serializer),
36295            }
36296        }
36297    }
36298
36299    impl<'de> serde::de::Deserialize<'de> for Complexity {
36300        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
36301        where
36302            D: serde::Deserializer<'de>,
36303        {
36304            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Complexity>::new(
36305                ".google.cloud.sql.v1.PasswordValidationPolicy.Complexity",
36306            ))
36307        }
36308    }
36309}
36310
36311/// Data cache configurations.
36312#[derive(Clone, Default, PartialEq)]
36313#[non_exhaustive]
36314pub struct DataCacheConfig {
36315    /// Whether data cache is enabled for the instance.
36316    pub data_cache_enabled: bool,
36317
36318    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
36319}
36320
36321impl DataCacheConfig {
36322    pub fn new() -> Self {
36323        std::default::Default::default()
36324    }
36325
36326    /// Sets the value of [data_cache_enabled][crate::model::DataCacheConfig::data_cache_enabled].
36327    pub fn set_data_cache_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
36328        self.data_cache_enabled = v.into();
36329        self
36330    }
36331}
36332
36333impl wkt::message::Message for DataCacheConfig {
36334    fn typename() -> &'static str {
36335        "type.googleapis.com/google.cloud.sql.v1.DataCacheConfig"
36336    }
36337}
36338
36339#[doc(hidden)]
36340impl<'de> serde::de::Deserialize<'de> for DataCacheConfig {
36341    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
36342    where
36343        D: serde::Deserializer<'de>,
36344    {
36345        #[allow(non_camel_case_types)]
36346        #[doc(hidden)]
36347        #[derive(PartialEq, Eq, Hash)]
36348        enum __FieldTag {
36349            __data_cache_enabled,
36350            Unknown(std::string::String),
36351        }
36352        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
36353            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
36354            where
36355                D: serde::Deserializer<'de>,
36356            {
36357                struct Visitor;
36358                impl<'de> serde::de::Visitor<'de> for Visitor {
36359                    type Value = __FieldTag;
36360                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
36361                        formatter.write_str("a field name for DataCacheConfig")
36362                    }
36363                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
36364                    where
36365                        E: serde::de::Error,
36366                    {
36367                        use std::result::Result::Ok;
36368                        use std::string::ToString;
36369                        match value {
36370                            "dataCacheEnabled" => Ok(__FieldTag::__data_cache_enabled),
36371                            "data_cache_enabled" => Ok(__FieldTag::__data_cache_enabled),
36372                            _ => Ok(__FieldTag::Unknown(value.to_string())),
36373                        }
36374                    }
36375                }
36376                deserializer.deserialize_identifier(Visitor)
36377            }
36378        }
36379        struct Visitor;
36380        impl<'de> serde::de::Visitor<'de> for Visitor {
36381            type Value = DataCacheConfig;
36382            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
36383                formatter.write_str("struct DataCacheConfig")
36384            }
36385            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
36386            where
36387                A: serde::de::MapAccess<'de>,
36388            {
36389                #[allow(unused_imports)]
36390                use serde::de::Error;
36391                use std::option::Option::Some;
36392                let mut fields = std::collections::HashSet::new();
36393                let mut result = Self::Value::new();
36394                while let Some(tag) = map.next_key::<__FieldTag>()? {
36395                    #[allow(clippy::match_single_binding)]
36396                    match tag {
36397                        __FieldTag::__data_cache_enabled => {
36398                            if !fields.insert(__FieldTag::__data_cache_enabled) {
36399                                return std::result::Result::Err(A::Error::duplicate_field(
36400                                    "multiple values for data_cache_enabled",
36401                                ));
36402                            }
36403                            result.data_cache_enabled = map
36404                                .next_value::<std::option::Option<bool>>()?
36405                                .unwrap_or_default();
36406                        }
36407                        __FieldTag::Unknown(key) => {
36408                            let value = map.next_value::<serde_json::Value>()?;
36409                            result._unknown_fields.insert(key, value);
36410                        }
36411                    }
36412                }
36413                std::result::Result::Ok(result)
36414            }
36415        }
36416        deserializer.deserialize_any(Visitor)
36417    }
36418}
36419
36420#[doc(hidden)]
36421impl serde::ser::Serialize for DataCacheConfig {
36422    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
36423    where
36424        S: serde::ser::Serializer,
36425    {
36426        use serde::ser::SerializeMap;
36427        #[allow(unused_imports)]
36428        use std::option::Option::Some;
36429        let mut state = serializer.serialize_map(std::option::Option::None)?;
36430        if !wkt::internal::is_default(&self.data_cache_enabled) {
36431            state.serialize_entry("dataCacheEnabled", &self.data_cache_enabled)?;
36432        }
36433        if !self._unknown_fields.is_empty() {
36434            for (key, value) in self._unknown_fields.iter() {
36435                state.serialize_entry(key, &value)?;
36436            }
36437        }
36438        state.end()
36439    }
36440}
36441
36442impl std::fmt::Debug for DataCacheConfig {
36443    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
36444        let mut debug_struct = f.debug_struct("DataCacheConfig");
36445        debug_struct.field("data_cache_enabled", &self.data_cache_enabled);
36446        if !self._unknown_fields.is_empty() {
36447            debug_struct.field("_unknown_fields", &self._unknown_fields);
36448        }
36449        debug_struct.finish()
36450    }
36451}
36452
36453/// Database instance settings.
36454#[derive(Clone, Default, PartialEq)]
36455#[non_exhaustive]
36456pub struct Settings {
36457    /// The version of instance settings. This is a required field for update
36458    /// method to make sure concurrent updates are handled properly. During update,
36459    /// use the most recent settingsVersion value for this instance and do not try
36460    /// to update this value.
36461    pub settings_version: std::option::Option<wkt::Int64Value>,
36462
36463    /// The App Engine app IDs that can access this instance.
36464    /// (Deprecated) Applied to First Generation instances only.
36465    #[deprecated]
36466    pub authorized_gae_applications: std::vec::Vec<std::string::String>,
36467
36468    /// The tier (or machine type) for this instance, for example
36469    /// `db-custom-1-3840`. WARNING: Changing this restarts the instance.
36470    pub tier: std::string::String,
36471
36472    /// This is always `sql#settings`.
36473    pub kind: std::string::String,
36474
36475    /// User-provided labels, represented as a dictionary where each label is a
36476    /// single key value pair.
36477    pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
36478
36479    /// Availability type. Potential values:
36480    ///
36481    /// * `ZONAL`: The instance serves data from only one zone. Outages in that
36482    ///   zone affect data accessibility.
36483    /// * `REGIONAL`: The instance can serve data from more than one zone in a
36484    ///   region (it is highly available)./
36485    ///
36486    /// For more information, see [Overview of the High Availability
36487    /// Configuration](https://cloud.google.com/sql/docs/mysql/high-availability).
36488    pub availability_type: crate::model::SqlAvailabilityType,
36489
36490    /// The pricing plan for this instance. This can be either `PER_USE` or
36491    /// `PACKAGE`. Only `PER_USE` is supported for Second Generation instances.
36492    pub pricing_plan: crate::model::SqlPricingPlan,
36493
36494    /// The type of replication this instance uses. This can be either
36495    /// `ASYNCHRONOUS` or `SYNCHRONOUS`. (Deprecated) This property was only
36496    /// applicable to First Generation instances.
36497    #[deprecated]
36498    pub replication_type: crate::model::SqlReplicationType,
36499
36500    /// The maximum size to which storage capacity can be automatically increased.
36501    /// The default value is 0, which specifies that there is no limit.
36502    pub storage_auto_resize_limit: std::option::Option<wkt::Int64Value>,
36503
36504    /// The activation policy specifies when the instance is activated; it is
36505    /// applicable only when the instance state is RUNNABLE. Valid values:
36506    ///
36507    /// * `ALWAYS`: The instance is on, and remains so even in the absence of
36508    ///   connection requests.
36509    /// * `NEVER`: The instance is off; it is not activated, even if a
36510    ///   connection request arrives.
36511    pub activation_policy: crate::model::settings::SqlActivationPolicy,
36512
36513    /// The settings for IP Management. This allows to enable or disable the
36514    /// instance IP and manage which external networks can connect to the instance.
36515    /// The IPv4 address cannot be disabled for Second Generation instances.
36516    pub ip_configuration: std::option::Option<crate::model::IpConfiguration>,
36517
36518    /// Configuration to increase storage size automatically. The default value is
36519    /// true.
36520    pub storage_auto_resize: std::option::Option<wkt::BoolValue>,
36521
36522    /// The location preference settings. This allows the instance to be located as
36523    /// near as possible to either an App Engine app or Compute Engine zone for
36524    /// better performance. App Engine co-location was only applicable to First
36525    /// Generation instances.
36526    pub location_preference: std::option::Option<crate::model::LocationPreference>,
36527
36528    /// The database flags passed to the instance at startup.
36529    pub database_flags: std::vec::Vec<crate::model::DatabaseFlags>,
36530
36531    /// The type of data disk: `PD_SSD` (default) or `PD_HDD`. Not used for
36532    /// First Generation instances.
36533    pub data_disk_type: crate::model::SqlDataDiskType,
36534
36535    /// The maintenance window for this instance. This specifies when the instance
36536    /// can be restarted for maintenance purposes.
36537    pub maintenance_window: std::option::Option<crate::model::MaintenanceWindow>,
36538
36539    /// The daily backup configuration for the instance.
36540    pub backup_configuration: std::option::Option<crate::model::BackupConfiguration>,
36541
36542    /// Configuration specific to read replica instances. Indicates whether
36543    /// replication is enabled or not. WARNING: Changing this restarts the
36544    /// instance.
36545    pub database_replication_enabled: std::option::Option<wkt::BoolValue>,
36546
36547    /// Configuration specific to read replica instances. Indicates whether
36548    /// database flags for crash-safe replication are enabled. This property was
36549    /// only applicable to First Generation instances.
36550    #[deprecated]
36551    pub crash_safe_replication_enabled: std::option::Option<wkt::BoolValue>,
36552
36553    /// The size of data disk, in GB. The data disk size minimum is 10GB.
36554    pub data_disk_size_gb: std::option::Option<wkt::Int64Value>,
36555
36556    /// Active Directory configuration, relevant only for Cloud SQL for SQL Server.
36557    pub active_directory_config: std::option::Option<crate::model::SqlActiveDirectoryConfig>,
36558
36559    /// The name of server Instance collation.
36560    pub collation: std::string::String,
36561
36562    /// Deny maintenance periods
36563    pub deny_maintenance_periods: std::vec::Vec<crate::model::DenyMaintenancePeriod>,
36564
36565    /// Insights configuration, for now relevant only for Postgres.
36566    pub insights_config: std::option::Option<crate::model::InsightsConfig>,
36567
36568    /// The local user password validation policy of the instance.
36569    pub password_validation_policy: std::option::Option<crate::model::PasswordValidationPolicy>,
36570
36571    /// SQL Server specific audit configuration.
36572    pub sql_server_audit_config: std::option::Option<crate::model::SqlServerAuditConfig>,
36573
36574    /// Optional. The edition of the instance.
36575    pub edition: crate::model::settings::Edition,
36576
36577    /// Specifies if connections must use Cloud SQL connectors.
36578    /// Option values include the following: `NOT_REQUIRED` (Cloud SQL instances
36579    /// can be connected without Cloud SQL
36580    /// Connectors) and `REQUIRED` (Only allow connections that use Cloud SQL
36581    /// Connectors).
36582    ///
36583    /// Note that using REQUIRED disables all existing authorized networks. If
36584    /// this field is not specified when creating a new instance, NOT_REQUIRED is
36585    /// used. If this field is not specified when patching or updating an existing
36586    /// instance, it is left unchanged in the instance.
36587    pub connector_enforcement: crate::model::settings::ConnectorEnforcement,
36588
36589    /// Configuration to protect against accidental instance deletion.
36590    pub deletion_protection_enabled: std::option::Option<wkt::BoolValue>,
36591
36592    /// Server timezone, relevant only for Cloud SQL for SQL Server.
36593    pub time_zone: std::string::String,
36594
36595    /// Specifies advanced machine configuration for the instances relevant only
36596    /// for SQL Server.
36597    pub advanced_machine_features: std::option::Option<crate::model::AdvancedMachineFeatures>,
36598
36599    /// Configuration for data cache.
36600    pub data_cache_config: std::option::Option<crate::model::DataCacheConfig>,
36601
36602    /// Optional. When this parameter is set to true, Cloud SQL instances can
36603    /// connect to Vertex AI to pass requests for real-time predictions and
36604    /// insights to the AI. The default value is false. This applies only to Cloud
36605    /// SQL for PostgreSQL instances.
36606    pub enable_google_ml_integration: std::option::Option<wkt::BoolValue>,
36607
36608    /// Optional. By default, Cloud SQL instances have schema extraction disabled
36609    /// for Dataplex. When this parameter is set to true, schema extraction for
36610    /// Dataplex on Cloud SQL instances is activated.
36611    pub enable_dataplex_integration: std::option::Option<wkt::BoolValue>,
36612
36613    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
36614}
36615
36616impl Settings {
36617    pub fn new() -> Self {
36618        std::default::Default::default()
36619    }
36620
36621    /// Sets the value of [settings_version][crate::model::Settings::settings_version].
36622    pub fn set_settings_version<T>(mut self, v: T) -> Self
36623    where
36624        T: std::convert::Into<wkt::Int64Value>,
36625    {
36626        self.settings_version = std::option::Option::Some(v.into());
36627        self
36628    }
36629
36630    /// Sets or clears the value of [settings_version][crate::model::Settings::settings_version].
36631    pub fn set_or_clear_settings_version<T>(mut self, v: std::option::Option<T>) -> Self
36632    where
36633        T: std::convert::Into<wkt::Int64Value>,
36634    {
36635        self.settings_version = v.map(|x| x.into());
36636        self
36637    }
36638
36639    /// Sets the value of [authorized_gae_applications][crate::model::Settings::authorized_gae_applications].
36640    #[deprecated]
36641    pub fn set_authorized_gae_applications<T, V>(mut self, v: T) -> Self
36642    where
36643        T: std::iter::IntoIterator<Item = V>,
36644        V: std::convert::Into<std::string::String>,
36645    {
36646        use std::iter::Iterator;
36647        self.authorized_gae_applications = v.into_iter().map(|i| i.into()).collect();
36648        self
36649    }
36650
36651    /// Sets the value of [tier][crate::model::Settings::tier].
36652    pub fn set_tier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
36653        self.tier = v.into();
36654        self
36655    }
36656
36657    /// Sets the value of [kind][crate::model::Settings::kind].
36658    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
36659        self.kind = v.into();
36660        self
36661    }
36662
36663    /// Sets the value of [user_labels][crate::model::Settings::user_labels].
36664    pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
36665    where
36666        T: std::iter::IntoIterator<Item = (K, V)>,
36667        K: std::convert::Into<std::string::String>,
36668        V: std::convert::Into<std::string::String>,
36669    {
36670        use std::iter::Iterator;
36671        self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
36672        self
36673    }
36674
36675    /// Sets the value of [availability_type][crate::model::Settings::availability_type].
36676    pub fn set_availability_type<T: std::convert::Into<crate::model::SqlAvailabilityType>>(
36677        mut self,
36678        v: T,
36679    ) -> Self {
36680        self.availability_type = v.into();
36681        self
36682    }
36683
36684    /// Sets the value of [pricing_plan][crate::model::Settings::pricing_plan].
36685    pub fn set_pricing_plan<T: std::convert::Into<crate::model::SqlPricingPlan>>(
36686        mut self,
36687        v: T,
36688    ) -> Self {
36689        self.pricing_plan = v.into();
36690        self
36691    }
36692
36693    /// Sets the value of [replication_type][crate::model::Settings::replication_type].
36694    #[deprecated]
36695    pub fn set_replication_type<T: std::convert::Into<crate::model::SqlReplicationType>>(
36696        mut self,
36697        v: T,
36698    ) -> Self {
36699        self.replication_type = v.into();
36700        self
36701    }
36702
36703    /// Sets the value of [storage_auto_resize_limit][crate::model::Settings::storage_auto_resize_limit].
36704    pub fn set_storage_auto_resize_limit<T>(mut self, v: T) -> Self
36705    where
36706        T: std::convert::Into<wkt::Int64Value>,
36707    {
36708        self.storage_auto_resize_limit = std::option::Option::Some(v.into());
36709        self
36710    }
36711
36712    /// Sets or clears the value of [storage_auto_resize_limit][crate::model::Settings::storage_auto_resize_limit].
36713    pub fn set_or_clear_storage_auto_resize_limit<T>(mut self, v: std::option::Option<T>) -> Self
36714    where
36715        T: std::convert::Into<wkt::Int64Value>,
36716    {
36717        self.storage_auto_resize_limit = v.map(|x| x.into());
36718        self
36719    }
36720
36721    /// Sets the value of [activation_policy][crate::model::Settings::activation_policy].
36722    pub fn set_activation_policy<
36723        T: std::convert::Into<crate::model::settings::SqlActivationPolicy>,
36724    >(
36725        mut self,
36726        v: T,
36727    ) -> Self {
36728        self.activation_policy = v.into();
36729        self
36730    }
36731
36732    /// Sets the value of [ip_configuration][crate::model::Settings::ip_configuration].
36733    pub fn set_ip_configuration<T>(mut self, v: T) -> Self
36734    where
36735        T: std::convert::Into<crate::model::IpConfiguration>,
36736    {
36737        self.ip_configuration = std::option::Option::Some(v.into());
36738        self
36739    }
36740
36741    /// Sets or clears the value of [ip_configuration][crate::model::Settings::ip_configuration].
36742    pub fn set_or_clear_ip_configuration<T>(mut self, v: std::option::Option<T>) -> Self
36743    where
36744        T: std::convert::Into<crate::model::IpConfiguration>,
36745    {
36746        self.ip_configuration = v.map(|x| x.into());
36747        self
36748    }
36749
36750    /// Sets the value of [storage_auto_resize][crate::model::Settings::storage_auto_resize].
36751    pub fn set_storage_auto_resize<T>(mut self, v: T) -> Self
36752    where
36753        T: std::convert::Into<wkt::BoolValue>,
36754    {
36755        self.storage_auto_resize = std::option::Option::Some(v.into());
36756        self
36757    }
36758
36759    /// Sets or clears the value of [storage_auto_resize][crate::model::Settings::storage_auto_resize].
36760    pub fn set_or_clear_storage_auto_resize<T>(mut self, v: std::option::Option<T>) -> Self
36761    where
36762        T: std::convert::Into<wkt::BoolValue>,
36763    {
36764        self.storage_auto_resize = v.map(|x| x.into());
36765        self
36766    }
36767
36768    /// Sets the value of [location_preference][crate::model::Settings::location_preference].
36769    pub fn set_location_preference<T>(mut self, v: T) -> Self
36770    where
36771        T: std::convert::Into<crate::model::LocationPreference>,
36772    {
36773        self.location_preference = std::option::Option::Some(v.into());
36774        self
36775    }
36776
36777    /// Sets or clears the value of [location_preference][crate::model::Settings::location_preference].
36778    pub fn set_or_clear_location_preference<T>(mut self, v: std::option::Option<T>) -> Self
36779    where
36780        T: std::convert::Into<crate::model::LocationPreference>,
36781    {
36782        self.location_preference = v.map(|x| x.into());
36783        self
36784    }
36785
36786    /// Sets the value of [database_flags][crate::model::Settings::database_flags].
36787    pub fn set_database_flags<T, V>(mut self, v: T) -> Self
36788    where
36789        T: std::iter::IntoIterator<Item = V>,
36790        V: std::convert::Into<crate::model::DatabaseFlags>,
36791    {
36792        use std::iter::Iterator;
36793        self.database_flags = v.into_iter().map(|i| i.into()).collect();
36794        self
36795    }
36796
36797    /// Sets the value of [data_disk_type][crate::model::Settings::data_disk_type].
36798    pub fn set_data_disk_type<T: std::convert::Into<crate::model::SqlDataDiskType>>(
36799        mut self,
36800        v: T,
36801    ) -> Self {
36802        self.data_disk_type = v.into();
36803        self
36804    }
36805
36806    /// Sets the value of [maintenance_window][crate::model::Settings::maintenance_window].
36807    pub fn set_maintenance_window<T>(mut self, v: T) -> Self
36808    where
36809        T: std::convert::Into<crate::model::MaintenanceWindow>,
36810    {
36811        self.maintenance_window = std::option::Option::Some(v.into());
36812        self
36813    }
36814
36815    /// Sets or clears the value of [maintenance_window][crate::model::Settings::maintenance_window].
36816    pub fn set_or_clear_maintenance_window<T>(mut self, v: std::option::Option<T>) -> Self
36817    where
36818        T: std::convert::Into<crate::model::MaintenanceWindow>,
36819    {
36820        self.maintenance_window = v.map(|x| x.into());
36821        self
36822    }
36823
36824    /// Sets the value of [backup_configuration][crate::model::Settings::backup_configuration].
36825    pub fn set_backup_configuration<T>(mut self, v: T) -> Self
36826    where
36827        T: std::convert::Into<crate::model::BackupConfiguration>,
36828    {
36829        self.backup_configuration = std::option::Option::Some(v.into());
36830        self
36831    }
36832
36833    /// Sets or clears the value of [backup_configuration][crate::model::Settings::backup_configuration].
36834    pub fn set_or_clear_backup_configuration<T>(mut self, v: std::option::Option<T>) -> Self
36835    where
36836        T: std::convert::Into<crate::model::BackupConfiguration>,
36837    {
36838        self.backup_configuration = v.map(|x| x.into());
36839        self
36840    }
36841
36842    /// Sets the value of [database_replication_enabled][crate::model::Settings::database_replication_enabled].
36843    pub fn set_database_replication_enabled<T>(mut self, v: T) -> Self
36844    where
36845        T: std::convert::Into<wkt::BoolValue>,
36846    {
36847        self.database_replication_enabled = std::option::Option::Some(v.into());
36848        self
36849    }
36850
36851    /// Sets or clears the value of [database_replication_enabled][crate::model::Settings::database_replication_enabled].
36852    pub fn set_or_clear_database_replication_enabled<T>(mut self, v: std::option::Option<T>) -> Self
36853    where
36854        T: std::convert::Into<wkt::BoolValue>,
36855    {
36856        self.database_replication_enabled = v.map(|x| x.into());
36857        self
36858    }
36859
36860    /// Sets the value of [crash_safe_replication_enabled][crate::model::Settings::crash_safe_replication_enabled].
36861    #[deprecated]
36862    pub fn set_crash_safe_replication_enabled<T>(mut self, v: T) -> Self
36863    where
36864        T: std::convert::Into<wkt::BoolValue>,
36865    {
36866        self.crash_safe_replication_enabled = std::option::Option::Some(v.into());
36867        self
36868    }
36869
36870    /// Sets or clears the value of [crash_safe_replication_enabled][crate::model::Settings::crash_safe_replication_enabled].
36871    #[deprecated]
36872    pub fn set_or_clear_crash_safe_replication_enabled<T>(
36873        mut self,
36874        v: std::option::Option<T>,
36875    ) -> Self
36876    where
36877        T: std::convert::Into<wkt::BoolValue>,
36878    {
36879        self.crash_safe_replication_enabled = v.map(|x| x.into());
36880        self
36881    }
36882
36883    /// Sets the value of [data_disk_size_gb][crate::model::Settings::data_disk_size_gb].
36884    pub fn set_data_disk_size_gb<T>(mut self, v: T) -> Self
36885    where
36886        T: std::convert::Into<wkt::Int64Value>,
36887    {
36888        self.data_disk_size_gb = std::option::Option::Some(v.into());
36889        self
36890    }
36891
36892    /// Sets or clears the value of [data_disk_size_gb][crate::model::Settings::data_disk_size_gb].
36893    pub fn set_or_clear_data_disk_size_gb<T>(mut self, v: std::option::Option<T>) -> Self
36894    where
36895        T: std::convert::Into<wkt::Int64Value>,
36896    {
36897        self.data_disk_size_gb = v.map(|x| x.into());
36898        self
36899    }
36900
36901    /// Sets the value of [active_directory_config][crate::model::Settings::active_directory_config].
36902    pub fn set_active_directory_config<T>(mut self, v: T) -> Self
36903    where
36904        T: std::convert::Into<crate::model::SqlActiveDirectoryConfig>,
36905    {
36906        self.active_directory_config = std::option::Option::Some(v.into());
36907        self
36908    }
36909
36910    /// Sets or clears the value of [active_directory_config][crate::model::Settings::active_directory_config].
36911    pub fn set_or_clear_active_directory_config<T>(mut self, v: std::option::Option<T>) -> Self
36912    where
36913        T: std::convert::Into<crate::model::SqlActiveDirectoryConfig>,
36914    {
36915        self.active_directory_config = v.map(|x| x.into());
36916        self
36917    }
36918
36919    /// Sets the value of [collation][crate::model::Settings::collation].
36920    pub fn set_collation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
36921        self.collation = v.into();
36922        self
36923    }
36924
36925    /// Sets the value of [deny_maintenance_periods][crate::model::Settings::deny_maintenance_periods].
36926    pub fn set_deny_maintenance_periods<T, V>(mut self, v: T) -> Self
36927    where
36928        T: std::iter::IntoIterator<Item = V>,
36929        V: std::convert::Into<crate::model::DenyMaintenancePeriod>,
36930    {
36931        use std::iter::Iterator;
36932        self.deny_maintenance_periods = v.into_iter().map(|i| i.into()).collect();
36933        self
36934    }
36935
36936    /// Sets the value of [insights_config][crate::model::Settings::insights_config].
36937    pub fn set_insights_config<T>(mut self, v: T) -> Self
36938    where
36939        T: std::convert::Into<crate::model::InsightsConfig>,
36940    {
36941        self.insights_config = std::option::Option::Some(v.into());
36942        self
36943    }
36944
36945    /// Sets or clears the value of [insights_config][crate::model::Settings::insights_config].
36946    pub fn set_or_clear_insights_config<T>(mut self, v: std::option::Option<T>) -> Self
36947    where
36948        T: std::convert::Into<crate::model::InsightsConfig>,
36949    {
36950        self.insights_config = v.map(|x| x.into());
36951        self
36952    }
36953
36954    /// Sets the value of [password_validation_policy][crate::model::Settings::password_validation_policy].
36955    pub fn set_password_validation_policy<T>(mut self, v: T) -> Self
36956    where
36957        T: std::convert::Into<crate::model::PasswordValidationPolicy>,
36958    {
36959        self.password_validation_policy = std::option::Option::Some(v.into());
36960        self
36961    }
36962
36963    /// Sets or clears the value of [password_validation_policy][crate::model::Settings::password_validation_policy].
36964    pub fn set_or_clear_password_validation_policy<T>(mut self, v: std::option::Option<T>) -> Self
36965    where
36966        T: std::convert::Into<crate::model::PasswordValidationPolicy>,
36967    {
36968        self.password_validation_policy = v.map(|x| x.into());
36969        self
36970    }
36971
36972    /// Sets the value of [sql_server_audit_config][crate::model::Settings::sql_server_audit_config].
36973    pub fn set_sql_server_audit_config<T>(mut self, v: T) -> Self
36974    where
36975        T: std::convert::Into<crate::model::SqlServerAuditConfig>,
36976    {
36977        self.sql_server_audit_config = std::option::Option::Some(v.into());
36978        self
36979    }
36980
36981    /// Sets or clears the value of [sql_server_audit_config][crate::model::Settings::sql_server_audit_config].
36982    pub fn set_or_clear_sql_server_audit_config<T>(mut self, v: std::option::Option<T>) -> Self
36983    where
36984        T: std::convert::Into<crate::model::SqlServerAuditConfig>,
36985    {
36986        self.sql_server_audit_config = v.map(|x| x.into());
36987        self
36988    }
36989
36990    /// Sets the value of [edition][crate::model::Settings::edition].
36991    pub fn set_edition<T: std::convert::Into<crate::model::settings::Edition>>(
36992        mut self,
36993        v: T,
36994    ) -> Self {
36995        self.edition = v.into();
36996        self
36997    }
36998
36999    /// Sets the value of [connector_enforcement][crate::model::Settings::connector_enforcement].
37000    pub fn set_connector_enforcement<
37001        T: std::convert::Into<crate::model::settings::ConnectorEnforcement>,
37002    >(
37003        mut self,
37004        v: T,
37005    ) -> Self {
37006        self.connector_enforcement = v.into();
37007        self
37008    }
37009
37010    /// Sets the value of [deletion_protection_enabled][crate::model::Settings::deletion_protection_enabled].
37011    pub fn set_deletion_protection_enabled<T>(mut self, v: T) -> Self
37012    where
37013        T: std::convert::Into<wkt::BoolValue>,
37014    {
37015        self.deletion_protection_enabled = std::option::Option::Some(v.into());
37016        self
37017    }
37018
37019    /// Sets or clears the value of [deletion_protection_enabled][crate::model::Settings::deletion_protection_enabled].
37020    pub fn set_or_clear_deletion_protection_enabled<T>(mut self, v: std::option::Option<T>) -> Self
37021    where
37022        T: std::convert::Into<wkt::BoolValue>,
37023    {
37024        self.deletion_protection_enabled = v.map(|x| x.into());
37025        self
37026    }
37027
37028    /// Sets the value of [time_zone][crate::model::Settings::time_zone].
37029    pub fn set_time_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
37030        self.time_zone = v.into();
37031        self
37032    }
37033
37034    /// Sets the value of [advanced_machine_features][crate::model::Settings::advanced_machine_features].
37035    pub fn set_advanced_machine_features<T>(mut self, v: T) -> Self
37036    where
37037        T: std::convert::Into<crate::model::AdvancedMachineFeatures>,
37038    {
37039        self.advanced_machine_features = std::option::Option::Some(v.into());
37040        self
37041    }
37042
37043    /// Sets or clears the value of [advanced_machine_features][crate::model::Settings::advanced_machine_features].
37044    pub fn set_or_clear_advanced_machine_features<T>(mut self, v: std::option::Option<T>) -> Self
37045    where
37046        T: std::convert::Into<crate::model::AdvancedMachineFeatures>,
37047    {
37048        self.advanced_machine_features = v.map(|x| x.into());
37049        self
37050    }
37051
37052    /// Sets the value of [data_cache_config][crate::model::Settings::data_cache_config].
37053    pub fn set_data_cache_config<T>(mut self, v: T) -> Self
37054    where
37055        T: std::convert::Into<crate::model::DataCacheConfig>,
37056    {
37057        self.data_cache_config = std::option::Option::Some(v.into());
37058        self
37059    }
37060
37061    /// Sets or clears the value of [data_cache_config][crate::model::Settings::data_cache_config].
37062    pub fn set_or_clear_data_cache_config<T>(mut self, v: std::option::Option<T>) -> Self
37063    where
37064        T: std::convert::Into<crate::model::DataCacheConfig>,
37065    {
37066        self.data_cache_config = v.map(|x| x.into());
37067        self
37068    }
37069
37070    /// Sets the value of [enable_google_ml_integration][crate::model::Settings::enable_google_ml_integration].
37071    pub fn set_enable_google_ml_integration<T>(mut self, v: T) -> Self
37072    where
37073        T: std::convert::Into<wkt::BoolValue>,
37074    {
37075        self.enable_google_ml_integration = std::option::Option::Some(v.into());
37076        self
37077    }
37078
37079    /// Sets or clears the value of [enable_google_ml_integration][crate::model::Settings::enable_google_ml_integration].
37080    pub fn set_or_clear_enable_google_ml_integration<T>(mut self, v: std::option::Option<T>) -> Self
37081    where
37082        T: std::convert::Into<wkt::BoolValue>,
37083    {
37084        self.enable_google_ml_integration = v.map(|x| x.into());
37085        self
37086    }
37087
37088    /// Sets the value of [enable_dataplex_integration][crate::model::Settings::enable_dataplex_integration].
37089    pub fn set_enable_dataplex_integration<T>(mut self, v: T) -> Self
37090    where
37091        T: std::convert::Into<wkt::BoolValue>,
37092    {
37093        self.enable_dataplex_integration = std::option::Option::Some(v.into());
37094        self
37095    }
37096
37097    /// Sets or clears the value of [enable_dataplex_integration][crate::model::Settings::enable_dataplex_integration].
37098    pub fn set_or_clear_enable_dataplex_integration<T>(mut self, v: std::option::Option<T>) -> Self
37099    where
37100        T: std::convert::Into<wkt::BoolValue>,
37101    {
37102        self.enable_dataplex_integration = v.map(|x| x.into());
37103        self
37104    }
37105}
37106
37107impl wkt::message::Message for Settings {
37108    fn typename() -> &'static str {
37109        "type.googleapis.com/google.cloud.sql.v1.Settings"
37110    }
37111}
37112
37113#[doc(hidden)]
37114impl<'de> serde::de::Deserialize<'de> for Settings {
37115    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
37116    where
37117        D: serde::Deserializer<'de>,
37118    {
37119        #[allow(non_camel_case_types)]
37120        #[doc(hidden)]
37121        #[derive(PartialEq, Eq, Hash)]
37122        enum __FieldTag {
37123            __settings_version,
37124            __authorized_gae_applications,
37125            __tier,
37126            __kind,
37127            __user_labels,
37128            __availability_type,
37129            __pricing_plan,
37130            __replication_type,
37131            __storage_auto_resize_limit,
37132            __activation_policy,
37133            __ip_configuration,
37134            __storage_auto_resize,
37135            __location_preference,
37136            __database_flags,
37137            __data_disk_type,
37138            __maintenance_window,
37139            __backup_configuration,
37140            __database_replication_enabled,
37141            __crash_safe_replication_enabled,
37142            __data_disk_size_gb,
37143            __active_directory_config,
37144            __collation,
37145            __deny_maintenance_periods,
37146            __insights_config,
37147            __password_validation_policy,
37148            __sql_server_audit_config,
37149            __edition,
37150            __connector_enforcement,
37151            __deletion_protection_enabled,
37152            __time_zone,
37153            __advanced_machine_features,
37154            __data_cache_config,
37155            __enable_google_ml_integration,
37156            __enable_dataplex_integration,
37157            Unknown(std::string::String),
37158        }
37159        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
37160            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
37161            where
37162                D: serde::Deserializer<'de>,
37163            {
37164                struct Visitor;
37165                impl<'de> serde::de::Visitor<'de> for Visitor {
37166                    type Value = __FieldTag;
37167                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
37168                        formatter.write_str("a field name for Settings")
37169                    }
37170                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
37171                    where
37172                        E: serde::de::Error,
37173                    {
37174                        use std::result::Result::Ok;
37175                        use std::string::ToString;
37176                        match value {
37177                            "settingsVersion" => Ok(__FieldTag::__settings_version),
37178                            "settings_version" => Ok(__FieldTag::__settings_version),
37179                            "authorizedGaeApplications" => {
37180                                Ok(__FieldTag::__authorized_gae_applications)
37181                            }
37182                            "authorized_gae_applications" => {
37183                                Ok(__FieldTag::__authorized_gae_applications)
37184                            }
37185                            "tier" => Ok(__FieldTag::__tier),
37186                            "kind" => Ok(__FieldTag::__kind),
37187                            "userLabels" => Ok(__FieldTag::__user_labels),
37188                            "user_labels" => Ok(__FieldTag::__user_labels),
37189                            "availabilityType" => Ok(__FieldTag::__availability_type),
37190                            "availability_type" => Ok(__FieldTag::__availability_type),
37191                            "pricingPlan" => Ok(__FieldTag::__pricing_plan),
37192                            "pricing_plan" => Ok(__FieldTag::__pricing_plan),
37193                            "replicationType" => Ok(__FieldTag::__replication_type),
37194                            "replication_type" => Ok(__FieldTag::__replication_type),
37195                            "storageAutoResizeLimit" => Ok(__FieldTag::__storage_auto_resize_limit),
37196                            "storage_auto_resize_limit" => {
37197                                Ok(__FieldTag::__storage_auto_resize_limit)
37198                            }
37199                            "activationPolicy" => Ok(__FieldTag::__activation_policy),
37200                            "activation_policy" => Ok(__FieldTag::__activation_policy),
37201                            "ipConfiguration" => Ok(__FieldTag::__ip_configuration),
37202                            "ip_configuration" => Ok(__FieldTag::__ip_configuration),
37203                            "storageAutoResize" => Ok(__FieldTag::__storage_auto_resize),
37204                            "storage_auto_resize" => Ok(__FieldTag::__storage_auto_resize),
37205                            "locationPreference" => Ok(__FieldTag::__location_preference),
37206                            "location_preference" => Ok(__FieldTag::__location_preference),
37207                            "databaseFlags" => Ok(__FieldTag::__database_flags),
37208                            "database_flags" => Ok(__FieldTag::__database_flags),
37209                            "dataDiskType" => Ok(__FieldTag::__data_disk_type),
37210                            "data_disk_type" => Ok(__FieldTag::__data_disk_type),
37211                            "maintenanceWindow" => Ok(__FieldTag::__maintenance_window),
37212                            "maintenance_window" => Ok(__FieldTag::__maintenance_window),
37213                            "backupConfiguration" => Ok(__FieldTag::__backup_configuration),
37214                            "backup_configuration" => Ok(__FieldTag::__backup_configuration),
37215                            "databaseReplicationEnabled" => {
37216                                Ok(__FieldTag::__database_replication_enabled)
37217                            }
37218                            "database_replication_enabled" => {
37219                                Ok(__FieldTag::__database_replication_enabled)
37220                            }
37221                            "crashSafeReplicationEnabled" => {
37222                                Ok(__FieldTag::__crash_safe_replication_enabled)
37223                            }
37224                            "crash_safe_replication_enabled" => {
37225                                Ok(__FieldTag::__crash_safe_replication_enabled)
37226                            }
37227                            "dataDiskSizeGb" => Ok(__FieldTag::__data_disk_size_gb),
37228                            "data_disk_size_gb" => Ok(__FieldTag::__data_disk_size_gb),
37229                            "activeDirectoryConfig" => Ok(__FieldTag::__active_directory_config),
37230                            "active_directory_config" => Ok(__FieldTag::__active_directory_config),
37231                            "collation" => Ok(__FieldTag::__collation),
37232                            "denyMaintenancePeriods" => Ok(__FieldTag::__deny_maintenance_periods),
37233                            "deny_maintenance_periods" => {
37234                                Ok(__FieldTag::__deny_maintenance_periods)
37235                            }
37236                            "insightsConfig" => Ok(__FieldTag::__insights_config),
37237                            "insights_config" => Ok(__FieldTag::__insights_config),
37238                            "passwordValidationPolicy" => {
37239                                Ok(__FieldTag::__password_validation_policy)
37240                            }
37241                            "password_validation_policy" => {
37242                                Ok(__FieldTag::__password_validation_policy)
37243                            }
37244                            "sqlServerAuditConfig" => Ok(__FieldTag::__sql_server_audit_config),
37245                            "sql_server_audit_config" => Ok(__FieldTag::__sql_server_audit_config),
37246                            "edition" => Ok(__FieldTag::__edition),
37247                            "connectorEnforcement" => Ok(__FieldTag::__connector_enforcement),
37248                            "connector_enforcement" => Ok(__FieldTag::__connector_enforcement),
37249                            "deletionProtectionEnabled" => {
37250                                Ok(__FieldTag::__deletion_protection_enabled)
37251                            }
37252                            "deletion_protection_enabled" => {
37253                                Ok(__FieldTag::__deletion_protection_enabled)
37254                            }
37255                            "timeZone" => Ok(__FieldTag::__time_zone),
37256                            "time_zone" => Ok(__FieldTag::__time_zone),
37257                            "advancedMachineFeatures" => {
37258                                Ok(__FieldTag::__advanced_machine_features)
37259                            }
37260                            "advanced_machine_features" => {
37261                                Ok(__FieldTag::__advanced_machine_features)
37262                            }
37263                            "dataCacheConfig" => Ok(__FieldTag::__data_cache_config),
37264                            "data_cache_config" => Ok(__FieldTag::__data_cache_config),
37265                            "enableGoogleMlIntegration" => {
37266                                Ok(__FieldTag::__enable_google_ml_integration)
37267                            }
37268                            "enable_google_ml_integration" => {
37269                                Ok(__FieldTag::__enable_google_ml_integration)
37270                            }
37271                            "enableDataplexIntegration" => {
37272                                Ok(__FieldTag::__enable_dataplex_integration)
37273                            }
37274                            "enable_dataplex_integration" => {
37275                                Ok(__FieldTag::__enable_dataplex_integration)
37276                            }
37277                            _ => Ok(__FieldTag::Unknown(value.to_string())),
37278                        }
37279                    }
37280                }
37281                deserializer.deserialize_identifier(Visitor)
37282            }
37283        }
37284        struct Visitor;
37285        impl<'de> serde::de::Visitor<'de> for Visitor {
37286            type Value = Settings;
37287            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
37288                formatter.write_str("struct Settings")
37289            }
37290            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
37291            where
37292                A: serde::de::MapAccess<'de>,
37293            {
37294                #[allow(unused_imports)]
37295                use serde::de::Error;
37296                use std::option::Option::Some;
37297                let mut fields = std::collections::HashSet::new();
37298                let mut result = Self::Value::new();
37299                while let Some(tag) = map.next_key::<__FieldTag>()? {
37300                    #[allow(clippy::match_single_binding)]
37301                    match tag {
37302                        __FieldTag::__settings_version => {
37303                            if !fields.insert(__FieldTag::__settings_version) {
37304                                return std::result::Result::Err(A::Error::duplicate_field(
37305                                    "multiple values for settings_version",
37306                                ));
37307                            }
37308                            struct __With(std::option::Option<wkt::Int64Value>);
37309                            impl<'de> serde::de::Deserialize<'de> for __With {
37310                                fn deserialize<D>(
37311                                    deserializer: D,
37312                                ) -> std::result::Result<Self, D::Error>
37313                                where
37314                                    D: serde::de::Deserializer<'de>,
37315                                {
37316                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
37317                                }
37318                            }
37319                            result.settings_version = map.next_value::<__With>()?.0;
37320                        }
37321                        __FieldTag::__authorized_gae_applications => {
37322                            if !fields.insert(__FieldTag::__authorized_gae_applications) {
37323                                return std::result::Result::Err(A::Error::duplicate_field(
37324                                    "multiple values for authorized_gae_applications",
37325                                ));
37326                            }
37327                            result.authorized_gae_applications = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
37328                        }
37329                        __FieldTag::__tier => {
37330                            if !fields.insert(__FieldTag::__tier) {
37331                                return std::result::Result::Err(A::Error::duplicate_field(
37332                                    "multiple values for tier",
37333                                ));
37334                            }
37335                            result.tier = map
37336                                .next_value::<std::option::Option<std::string::String>>()?
37337                                .unwrap_or_default();
37338                        }
37339                        __FieldTag::__kind => {
37340                            if !fields.insert(__FieldTag::__kind) {
37341                                return std::result::Result::Err(A::Error::duplicate_field(
37342                                    "multiple values for kind",
37343                                ));
37344                            }
37345                            result.kind = map
37346                                .next_value::<std::option::Option<std::string::String>>()?
37347                                .unwrap_or_default();
37348                        }
37349                        __FieldTag::__user_labels => {
37350                            if !fields.insert(__FieldTag::__user_labels) {
37351                                return std::result::Result::Err(A::Error::duplicate_field(
37352                                    "multiple values for user_labels",
37353                                ));
37354                            }
37355                            result.user_labels = map
37356                                .next_value::<std::option::Option<
37357                                    std::collections::HashMap<
37358                                        std::string::String,
37359                                        std::string::String,
37360                                    >,
37361                                >>()?
37362                                .unwrap_or_default();
37363                        }
37364                        __FieldTag::__availability_type => {
37365                            if !fields.insert(__FieldTag::__availability_type) {
37366                                return std::result::Result::Err(A::Error::duplicate_field(
37367                                    "multiple values for availability_type",
37368                                ));
37369                            }
37370                            result.availability_type = map.next_value::<std::option::Option<crate::model::SqlAvailabilityType>>()?.unwrap_or_default();
37371                        }
37372                        __FieldTag::__pricing_plan => {
37373                            if !fields.insert(__FieldTag::__pricing_plan) {
37374                                return std::result::Result::Err(A::Error::duplicate_field(
37375                                    "multiple values for pricing_plan",
37376                                ));
37377                            }
37378                            result.pricing_plan = map
37379                                .next_value::<std::option::Option<crate::model::SqlPricingPlan>>()?
37380                                .unwrap_or_default();
37381                        }
37382                        __FieldTag::__replication_type => {
37383                            if !fields.insert(__FieldTag::__replication_type) {
37384                                return std::result::Result::Err(A::Error::duplicate_field(
37385                                    "multiple values for replication_type",
37386                                ));
37387                            }
37388                            result.replication_type = map.next_value::<std::option::Option<crate::model::SqlReplicationType>>()?.unwrap_or_default();
37389                        }
37390                        __FieldTag::__storage_auto_resize_limit => {
37391                            if !fields.insert(__FieldTag::__storage_auto_resize_limit) {
37392                                return std::result::Result::Err(A::Error::duplicate_field(
37393                                    "multiple values for storage_auto_resize_limit",
37394                                ));
37395                            }
37396                            struct __With(std::option::Option<wkt::Int64Value>);
37397                            impl<'de> serde::de::Deserialize<'de> for __With {
37398                                fn deserialize<D>(
37399                                    deserializer: D,
37400                                ) -> std::result::Result<Self, D::Error>
37401                                where
37402                                    D: serde::de::Deserializer<'de>,
37403                                {
37404                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
37405                                }
37406                            }
37407                            result.storage_auto_resize_limit = map.next_value::<__With>()?.0;
37408                        }
37409                        __FieldTag::__activation_policy => {
37410                            if !fields.insert(__FieldTag::__activation_policy) {
37411                                return std::result::Result::Err(A::Error::duplicate_field(
37412                                    "multiple values for activation_policy",
37413                                ));
37414                            }
37415                            result.activation_policy =
37416                                map.next_value::<std::option::Option<
37417                                    crate::model::settings::SqlActivationPolicy,
37418                                >>()?
37419                                .unwrap_or_default();
37420                        }
37421                        __FieldTag::__ip_configuration => {
37422                            if !fields.insert(__FieldTag::__ip_configuration) {
37423                                return std::result::Result::Err(A::Error::duplicate_field(
37424                                    "multiple values for ip_configuration",
37425                                ));
37426                            }
37427                            result.ip_configuration = map
37428                                .next_value::<std::option::Option<crate::model::IpConfiguration>>(
37429                                )?;
37430                        }
37431                        __FieldTag::__storage_auto_resize => {
37432                            if !fields.insert(__FieldTag::__storage_auto_resize) {
37433                                return std::result::Result::Err(A::Error::duplicate_field(
37434                                    "multiple values for storage_auto_resize",
37435                                ));
37436                            }
37437                            result.storage_auto_resize =
37438                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
37439                        }
37440                        __FieldTag::__location_preference => {
37441                            if !fields.insert(__FieldTag::__location_preference) {
37442                                return std::result::Result::Err(A::Error::duplicate_field(
37443                                    "multiple values for location_preference",
37444                                ));
37445                            }
37446                            result.location_preference = map.next_value::<std::option::Option<crate::model::LocationPreference>>()?
37447                                ;
37448                        }
37449                        __FieldTag::__database_flags => {
37450                            if !fields.insert(__FieldTag::__database_flags) {
37451                                return std::result::Result::Err(A::Error::duplicate_field(
37452                                    "multiple values for database_flags",
37453                                ));
37454                            }
37455                            result.database_flags = map.next_value::<std::option::Option<std::vec::Vec<crate::model::DatabaseFlags>>>()?.unwrap_or_default();
37456                        }
37457                        __FieldTag::__data_disk_type => {
37458                            if !fields.insert(__FieldTag::__data_disk_type) {
37459                                return std::result::Result::Err(A::Error::duplicate_field(
37460                                    "multiple values for data_disk_type",
37461                                ));
37462                            }
37463                            result.data_disk_type = map
37464                                .next_value::<std::option::Option<crate::model::SqlDataDiskType>>()?
37465                                .unwrap_or_default();
37466                        }
37467                        __FieldTag::__maintenance_window => {
37468                            if !fields.insert(__FieldTag::__maintenance_window) {
37469                                return std::result::Result::Err(A::Error::duplicate_field(
37470                                    "multiple values for maintenance_window",
37471                                ));
37472                            }
37473                            result.maintenance_window = map
37474                                .next_value::<std::option::Option<crate::model::MaintenanceWindow>>(
37475                                )?;
37476                        }
37477                        __FieldTag::__backup_configuration => {
37478                            if !fields.insert(__FieldTag::__backup_configuration) {
37479                                return std::result::Result::Err(A::Error::duplicate_field(
37480                                    "multiple values for backup_configuration",
37481                                ));
37482                            }
37483                            result.backup_configuration = map.next_value::<std::option::Option<crate::model::BackupConfiguration>>()?
37484                                ;
37485                        }
37486                        __FieldTag::__database_replication_enabled => {
37487                            if !fields.insert(__FieldTag::__database_replication_enabled) {
37488                                return std::result::Result::Err(A::Error::duplicate_field(
37489                                    "multiple values for database_replication_enabled",
37490                                ));
37491                            }
37492                            result.database_replication_enabled =
37493                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
37494                        }
37495                        __FieldTag::__crash_safe_replication_enabled => {
37496                            if !fields.insert(__FieldTag::__crash_safe_replication_enabled) {
37497                                return std::result::Result::Err(A::Error::duplicate_field(
37498                                    "multiple values for crash_safe_replication_enabled",
37499                                ));
37500                            }
37501                            result.crash_safe_replication_enabled =
37502                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
37503                        }
37504                        __FieldTag::__data_disk_size_gb => {
37505                            if !fields.insert(__FieldTag::__data_disk_size_gb) {
37506                                return std::result::Result::Err(A::Error::duplicate_field(
37507                                    "multiple values for data_disk_size_gb",
37508                                ));
37509                            }
37510                            struct __With(std::option::Option<wkt::Int64Value>);
37511                            impl<'de> serde::de::Deserialize<'de> for __With {
37512                                fn deserialize<D>(
37513                                    deserializer: D,
37514                                ) -> std::result::Result<Self, D::Error>
37515                                where
37516                                    D: serde::de::Deserializer<'de>,
37517                                {
37518                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
37519                                }
37520                            }
37521                            result.data_disk_size_gb = map.next_value::<__With>()?.0;
37522                        }
37523                        __FieldTag::__active_directory_config => {
37524                            if !fields.insert(__FieldTag::__active_directory_config) {
37525                                return std::result::Result::Err(A::Error::duplicate_field(
37526                                    "multiple values for active_directory_config",
37527                                ));
37528                            }
37529                            result.active_directory_config = map.next_value::<std::option::Option<crate::model::SqlActiveDirectoryConfig>>()?
37530                                ;
37531                        }
37532                        __FieldTag::__collation => {
37533                            if !fields.insert(__FieldTag::__collation) {
37534                                return std::result::Result::Err(A::Error::duplicate_field(
37535                                    "multiple values for collation",
37536                                ));
37537                            }
37538                            result.collation = map
37539                                .next_value::<std::option::Option<std::string::String>>()?
37540                                .unwrap_or_default();
37541                        }
37542                        __FieldTag::__deny_maintenance_periods => {
37543                            if !fields.insert(__FieldTag::__deny_maintenance_periods) {
37544                                return std::result::Result::Err(A::Error::duplicate_field(
37545                                    "multiple values for deny_maintenance_periods",
37546                                ));
37547                            }
37548                            result.deny_maintenance_periods = map
37549                                .next_value::<std::option::Option<
37550                                    std::vec::Vec<crate::model::DenyMaintenancePeriod>,
37551                                >>()?
37552                                .unwrap_or_default();
37553                        }
37554                        __FieldTag::__insights_config => {
37555                            if !fields.insert(__FieldTag::__insights_config) {
37556                                return std::result::Result::Err(A::Error::duplicate_field(
37557                                    "multiple values for insights_config",
37558                                ));
37559                            }
37560                            result.insights_config = map
37561                                .next_value::<std::option::Option<crate::model::InsightsConfig>>(
37562                                )?;
37563                        }
37564                        __FieldTag::__password_validation_policy => {
37565                            if !fields.insert(__FieldTag::__password_validation_policy) {
37566                                return std::result::Result::Err(A::Error::duplicate_field(
37567                                    "multiple values for password_validation_policy",
37568                                ));
37569                            }
37570                            result.password_validation_policy = map.next_value::<std::option::Option<crate::model::PasswordValidationPolicy>>()?
37571                                ;
37572                        }
37573                        __FieldTag::__sql_server_audit_config => {
37574                            if !fields.insert(__FieldTag::__sql_server_audit_config) {
37575                                return std::result::Result::Err(A::Error::duplicate_field(
37576                                    "multiple values for sql_server_audit_config",
37577                                ));
37578                            }
37579                            result.sql_server_audit_config = map.next_value::<std::option::Option<crate::model::SqlServerAuditConfig>>()?
37580                                ;
37581                        }
37582                        __FieldTag::__edition => {
37583                            if !fields.insert(__FieldTag::__edition) {
37584                                return std::result::Result::Err(A::Error::duplicate_field(
37585                                    "multiple values for edition",
37586                                ));
37587                            }
37588                            result.edition = map
37589                                .next_value::<std::option::Option<crate::model::settings::Edition>>(
37590                                )?
37591                                .unwrap_or_default();
37592                        }
37593                        __FieldTag::__connector_enforcement => {
37594                            if !fields.insert(__FieldTag::__connector_enforcement) {
37595                                return std::result::Result::Err(A::Error::duplicate_field(
37596                                    "multiple values for connector_enforcement",
37597                                ));
37598                            }
37599                            result.connector_enforcement =
37600                                map.next_value::<std::option::Option<
37601                                    crate::model::settings::ConnectorEnforcement,
37602                                >>()?
37603                                .unwrap_or_default();
37604                        }
37605                        __FieldTag::__deletion_protection_enabled => {
37606                            if !fields.insert(__FieldTag::__deletion_protection_enabled) {
37607                                return std::result::Result::Err(A::Error::duplicate_field(
37608                                    "multiple values for deletion_protection_enabled",
37609                                ));
37610                            }
37611                            result.deletion_protection_enabled =
37612                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
37613                        }
37614                        __FieldTag::__time_zone => {
37615                            if !fields.insert(__FieldTag::__time_zone) {
37616                                return std::result::Result::Err(A::Error::duplicate_field(
37617                                    "multiple values for time_zone",
37618                                ));
37619                            }
37620                            result.time_zone = map
37621                                .next_value::<std::option::Option<std::string::String>>()?
37622                                .unwrap_or_default();
37623                        }
37624                        __FieldTag::__advanced_machine_features => {
37625                            if !fields.insert(__FieldTag::__advanced_machine_features) {
37626                                return std::result::Result::Err(A::Error::duplicate_field(
37627                                    "multiple values for advanced_machine_features",
37628                                ));
37629                            }
37630                            result.advanced_machine_features = map.next_value::<std::option::Option<crate::model::AdvancedMachineFeatures>>()?
37631                                ;
37632                        }
37633                        __FieldTag::__data_cache_config => {
37634                            if !fields.insert(__FieldTag::__data_cache_config) {
37635                                return std::result::Result::Err(A::Error::duplicate_field(
37636                                    "multiple values for data_cache_config",
37637                                ));
37638                            }
37639                            result.data_cache_config = map
37640                                .next_value::<std::option::Option<crate::model::DataCacheConfig>>(
37641                                )?;
37642                        }
37643                        __FieldTag::__enable_google_ml_integration => {
37644                            if !fields.insert(__FieldTag::__enable_google_ml_integration) {
37645                                return std::result::Result::Err(A::Error::duplicate_field(
37646                                    "multiple values for enable_google_ml_integration",
37647                                ));
37648                            }
37649                            result.enable_google_ml_integration =
37650                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
37651                        }
37652                        __FieldTag::__enable_dataplex_integration => {
37653                            if !fields.insert(__FieldTag::__enable_dataplex_integration) {
37654                                return std::result::Result::Err(A::Error::duplicate_field(
37655                                    "multiple values for enable_dataplex_integration",
37656                                ));
37657                            }
37658                            result.enable_dataplex_integration =
37659                                map.next_value::<std::option::Option<wkt::BoolValue>>()?;
37660                        }
37661                        __FieldTag::Unknown(key) => {
37662                            let value = map.next_value::<serde_json::Value>()?;
37663                            result._unknown_fields.insert(key, value);
37664                        }
37665                    }
37666                }
37667                std::result::Result::Ok(result)
37668            }
37669        }
37670        deserializer.deserialize_any(Visitor)
37671    }
37672}
37673
37674#[doc(hidden)]
37675impl serde::ser::Serialize for Settings {
37676    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
37677    where
37678        S: serde::ser::Serializer,
37679    {
37680        use serde::ser::SerializeMap;
37681        #[allow(unused_imports)]
37682        use std::option::Option::Some;
37683        let mut state = serializer.serialize_map(std::option::Option::None)?;
37684        if self.settings_version.is_some() {
37685            struct __With<'a>(&'a std::option::Option<wkt::Int64Value>);
37686            impl<'a> serde::ser::Serialize for __With<'a> {
37687                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
37688                where
37689                    S: serde::ser::Serializer,
37690                {
37691                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
37692                        self.0, serializer,
37693                    )
37694                }
37695            }
37696            state.serialize_entry("settingsVersion", &__With(&self.settings_version))?;
37697        }
37698        if !self.authorized_gae_applications.is_empty() {
37699            state.serialize_entry(
37700                "authorizedGaeApplications",
37701                &self.authorized_gae_applications,
37702            )?;
37703        }
37704        if !self.tier.is_empty() {
37705            state.serialize_entry("tier", &self.tier)?;
37706        }
37707        if !self.kind.is_empty() {
37708            state.serialize_entry("kind", &self.kind)?;
37709        }
37710        if !self.user_labels.is_empty() {
37711            state.serialize_entry("userLabels", &self.user_labels)?;
37712        }
37713        if !wkt::internal::is_default(&self.availability_type) {
37714            state.serialize_entry("availabilityType", &self.availability_type)?;
37715        }
37716        if !wkt::internal::is_default(&self.pricing_plan) {
37717            state.serialize_entry("pricingPlan", &self.pricing_plan)?;
37718        }
37719        if !wkt::internal::is_default(&self.replication_type) {
37720            state.serialize_entry("replicationType", &self.replication_type)?;
37721        }
37722        if self.storage_auto_resize_limit.is_some() {
37723            struct __With<'a>(&'a std::option::Option<wkt::Int64Value>);
37724            impl<'a> serde::ser::Serialize for __With<'a> {
37725                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
37726                where
37727                    S: serde::ser::Serializer,
37728                {
37729                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
37730                        self.0, serializer,
37731                    )
37732                }
37733            }
37734            state.serialize_entry(
37735                "storageAutoResizeLimit",
37736                &__With(&self.storage_auto_resize_limit),
37737            )?;
37738        }
37739        if !wkt::internal::is_default(&self.activation_policy) {
37740            state.serialize_entry("activationPolicy", &self.activation_policy)?;
37741        }
37742        if self.ip_configuration.is_some() {
37743            state.serialize_entry("ipConfiguration", &self.ip_configuration)?;
37744        }
37745        if self.storage_auto_resize.is_some() {
37746            state.serialize_entry("storageAutoResize", &self.storage_auto_resize)?;
37747        }
37748        if self.location_preference.is_some() {
37749            state.serialize_entry("locationPreference", &self.location_preference)?;
37750        }
37751        if !self.database_flags.is_empty() {
37752            state.serialize_entry("databaseFlags", &self.database_flags)?;
37753        }
37754        if !wkt::internal::is_default(&self.data_disk_type) {
37755            state.serialize_entry("dataDiskType", &self.data_disk_type)?;
37756        }
37757        if self.maintenance_window.is_some() {
37758            state.serialize_entry("maintenanceWindow", &self.maintenance_window)?;
37759        }
37760        if self.backup_configuration.is_some() {
37761            state.serialize_entry("backupConfiguration", &self.backup_configuration)?;
37762        }
37763        if self.database_replication_enabled.is_some() {
37764            state.serialize_entry(
37765                "databaseReplicationEnabled",
37766                &self.database_replication_enabled,
37767            )?;
37768        }
37769        if self.crash_safe_replication_enabled.is_some() {
37770            state.serialize_entry(
37771                "crashSafeReplicationEnabled",
37772                &self.crash_safe_replication_enabled,
37773            )?;
37774        }
37775        if self.data_disk_size_gb.is_some() {
37776            struct __With<'a>(&'a std::option::Option<wkt::Int64Value>);
37777            impl<'a> serde::ser::Serialize for __With<'a> {
37778                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
37779                where
37780                    S: serde::ser::Serializer,
37781                {
37782                    serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
37783                        self.0, serializer,
37784                    )
37785                }
37786            }
37787            state.serialize_entry("dataDiskSizeGb", &__With(&self.data_disk_size_gb))?;
37788        }
37789        if self.active_directory_config.is_some() {
37790            state.serialize_entry("activeDirectoryConfig", &self.active_directory_config)?;
37791        }
37792        if !self.collation.is_empty() {
37793            state.serialize_entry("collation", &self.collation)?;
37794        }
37795        if !self.deny_maintenance_periods.is_empty() {
37796            state.serialize_entry("denyMaintenancePeriods", &self.deny_maintenance_periods)?;
37797        }
37798        if self.insights_config.is_some() {
37799            state.serialize_entry("insightsConfig", &self.insights_config)?;
37800        }
37801        if self.password_validation_policy.is_some() {
37802            state.serialize_entry("passwordValidationPolicy", &self.password_validation_policy)?;
37803        }
37804        if self.sql_server_audit_config.is_some() {
37805            state.serialize_entry("sqlServerAuditConfig", &self.sql_server_audit_config)?;
37806        }
37807        if !wkt::internal::is_default(&self.edition) {
37808            state.serialize_entry("edition", &self.edition)?;
37809        }
37810        if !wkt::internal::is_default(&self.connector_enforcement) {
37811            state.serialize_entry("connectorEnforcement", &self.connector_enforcement)?;
37812        }
37813        if self.deletion_protection_enabled.is_some() {
37814            state.serialize_entry(
37815                "deletionProtectionEnabled",
37816                &self.deletion_protection_enabled,
37817            )?;
37818        }
37819        if !self.time_zone.is_empty() {
37820            state.serialize_entry("timeZone", &self.time_zone)?;
37821        }
37822        if self.advanced_machine_features.is_some() {
37823            state.serialize_entry("advancedMachineFeatures", &self.advanced_machine_features)?;
37824        }
37825        if self.data_cache_config.is_some() {
37826            state.serialize_entry("dataCacheConfig", &self.data_cache_config)?;
37827        }
37828        if self.enable_google_ml_integration.is_some() {
37829            state.serialize_entry(
37830                "enableGoogleMlIntegration",
37831                &self.enable_google_ml_integration,
37832            )?;
37833        }
37834        if self.enable_dataplex_integration.is_some() {
37835            state.serialize_entry(
37836                "enableDataplexIntegration",
37837                &self.enable_dataplex_integration,
37838            )?;
37839        }
37840        if !self._unknown_fields.is_empty() {
37841            for (key, value) in self._unknown_fields.iter() {
37842                state.serialize_entry(key, &value)?;
37843            }
37844        }
37845        state.end()
37846    }
37847}
37848
37849impl std::fmt::Debug for Settings {
37850    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
37851        let mut debug_struct = f.debug_struct("Settings");
37852        debug_struct.field("settings_version", &self.settings_version);
37853        debug_struct.field(
37854            "authorized_gae_applications",
37855            &self.authorized_gae_applications,
37856        );
37857        debug_struct.field("tier", &self.tier);
37858        debug_struct.field("kind", &self.kind);
37859        debug_struct.field("user_labels", &self.user_labels);
37860        debug_struct.field("availability_type", &self.availability_type);
37861        debug_struct.field("pricing_plan", &self.pricing_plan);
37862        debug_struct.field("replication_type", &self.replication_type);
37863        debug_struct.field("storage_auto_resize_limit", &self.storage_auto_resize_limit);
37864        debug_struct.field("activation_policy", &self.activation_policy);
37865        debug_struct.field("ip_configuration", &self.ip_configuration);
37866        debug_struct.field("storage_auto_resize", &self.storage_auto_resize);
37867        debug_struct.field("location_preference", &self.location_preference);
37868        debug_struct.field("database_flags", &self.database_flags);
37869        debug_struct.field("data_disk_type", &self.data_disk_type);
37870        debug_struct.field("maintenance_window", &self.maintenance_window);
37871        debug_struct.field("backup_configuration", &self.backup_configuration);
37872        debug_struct.field(
37873            "database_replication_enabled",
37874            &self.database_replication_enabled,
37875        );
37876        debug_struct.field(
37877            "crash_safe_replication_enabled",
37878            &self.crash_safe_replication_enabled,
37879        );
37880        debug_struct.field("data_disk_size_gb", &self.data_disk_size_gb);
37881        debug_struct.field("active_directory_config", &self.active_directory_config);
37882        debug_struct.field("collation", &self.collation);
37883        debug_struct.field("deny_maintenance_periods", &self.deny_maintenance_periods);
37884        debug_struct.field("insights_config", &self.insights_config);
37885        debug_struct.field(
37886            "password_validation_policy",
37887            &self.password_validation_policy,
37888        );
37889        debug_struct.field("sql_server_audit_config", &self.sql_server_audit_config);
37890        debug_struct.field("edition", &self.edition);
37891        debug_struct.field("connector_enforcement", &self.connector_enforcement);
37892        debug_struct.field(
37893            "deletion_protection_enabled",
37894            &self.deletion_protection_enabled,
37895        );
37896        debug_struct.field("time_zone", &self.time_zone);
37897        debug_struct.field("advanced_machine_features", &self.advanced_machine_features);
37898        debug_struct.field("data_cache_config", &self.data_cache_config);
37899        debug_struct.field(
37900            "enable_google_ml_integration",
37901            &self.enable_google_ml_integration,
37902        );
37903        debug_struct.field(
37904            "enable_dataplex_integration",
37905            &self.enable_dataplex_integration,
37906        );
37907        if !self._unknown_fields.is_empty() {
37908            debug_struct.field("_unknown_fields", &self._unknown_fields);
37909        }
37910        debug_struct.finish()
37911    }
37912}
37913
37914/// Defines additional types related to [Settings].
37915pub mod settings {
37916    #[allow(unused_imports)]
37917    use super::*;
37918
37919    /// Specifies when the instance is activated.
37920    ///
37921    /// # Working with unknown values
37922    ///
37923    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
37924    /// additional enum variants at any time. Adding new variants is not considered
37925    /// a breaking change. Applications should write their code in anticipation of:
37926    ///
37927    /// - New values appearing in future releases of the client library, **and**
37928    /// - New values received dynamically, without application changes.
37929    ///
37930    /// Please consult the [Working with enums] section in the user guide for some
37931    /// guidelines.
37932    ///
37933    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
37934    #[derive(Clone, Debug, PartialEq)]
37935    #[non_exhaustive]
37936    pub enum SqlActivationPolicy {
37937        /// Unknown activation plan.
37938        Unspecified,
37939        /// The instance is always up and running.
37940        Always,
37941        /// The instance never starts.
37942        Never,
37943        /// The instance starts upon receiving requests.
37944        #[deprecated]
37945        OnDemand,
37946        /// If set, the enum was initialized with an unknown value.
37947        ///
37948        /// Applications can examine the value using [SqlActivationPolicy::value] or
37949        /// [SqlActivationPolicy::name].
37950        UnknownValue(sql_activation_policy::UnknownValue),
37951    }
37952
37953    #[doc(hidden)]
37954    pub mod sql_activation_policy {
37955        #[allow(unused_imports)]
37956        use super::*;
37957        #[derive(Clone, Debug, PartialEq)]
37958        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
37959    }
37960
37961    impl SqlActivationPolicy {
37962        /// Gets the enum value.
37963        ///
37964        /// Returns `None` if the enum contains an unknown value deserialized from
37965        /// the string representation of enums.
37966        pub fn value(&self) -> std::option::Option<i32> {
37967            match self {
37968                Self::Unspecified => std::option::Option::Some(0),
37969                Self::Always => std::option::Option::Some(1),
37970                Self::Never => std::option::Option::Some(2),
37971                Self::OnDemand => std::option::Option::Some(3),
37972                Self::UnknownValue(u) => u.0.value(),
37973            }
37974        }
37975
37976        /// Gets the enum value as a string.
37977        ///
37978        /// Returns `None` if the enum contains an unknown value deserialized from
37979        /// the integer representation of enums.
37980        pub fn name(&self) -> std::option::Option<&str> {
37981            match self {
37982                Self::Unspecified => std::option::Option::Some("SQL_ACTIVATION_POLICY_UNSPECIFIED"),
37983                Self::Always => std::option::Option::Some("ALWAYS"),
37984                Self::Never => std::option::Option::Some("NEVER"),
37985                Self::OnDemand => std::option::Option::Some("ON_DEMAND"),
37986                Self::UnknownValue(u) => u.0.name(),
37987            }
37988        }
37989    }
37990
37991    impl std::default::Default for SqlActivationPolicy {
37992        fn default() -> Self {
37993            use std::convert::From;
37994            Self::from(0)
37995        }
37996    }
37997
37998    impl std::fmt::Display for SqlActivationPolicy {
37999        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
38000            wkt::internal::display_enum(f, self.name(), self.value())
38001        }
38002    }
38003
38004    impl std::convert::From<i32> for SqlActivationPolicy {
38005        fn from(value: i32) -> Self {
38006            match value {
38007                0 => Self::Unspecified,
38008                1 => Self::Always,
38009                2 => Self::Never,
38010                3 => Self::OnDemand,
38011                _ => Self::UnknownValue(sql_activation_policy::UnknownValue(
38012                    wkt::internal::UnknownEnumValue::Integer(value),
38013                )),
38014            }
38015        }
38016    }
38017
38018    impl std::convert::From<&str> for SqlActivationPolicy {
38019        fn from(value: &str) -> Self {
38020            use std::string::ToString;
38021            match value {
38022                "SQL_ACTIVATION_POLICY_UNSPECIFIED" => Self::Unspecified,
38023                "ALWAYS" => Self::Always,
38024                "NEVER" => Self::Never,
38025                "ON_DEMAND" => Self::OnDemand,
38026                _ => Self::UnknownValue(sql_activation_policy::UnknownValue(
38027                    wkt::internal::UnknownEnumValue::String(value.to_string()),
38028                )),
38029            }
38030        }
38031    }
38032
38033    impl serde::ser::Serialize for SqlActivationPolicy {
38034        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
38035        where
38036            S: serde::Serializer,
38037        {
38038            match self {
38039                Self::Unspecified => serializer.serialize_i32(0),
38040                Self::Always => serializer.serialize_i32(1),
38041                Self::Never => serializer.serialize_i32(2),
38042                Self::OnDemand => serializer.serialize_i32(3),
38043                Self::UnknownValue(u) => u.0.serialize(serializer),
38044            }
38045        }
38046    }
38047
38048    impl<'de> serde::de::Deserialize<'de> for SqlActivationPolicy {
38049        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
38050        where
38051            D: serde::Deserializer<'de>,
38052        {
38053            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlActivationPolicy>::new(
38054                ".google.cloud.sql.v1.Settings.SqlActivationPolicy",
38055            ))
38056        }
38057    }
38058
38059    /// The edition of the instance, can be ENTERPRISE or ENTERPRISE_PLUS.
38060    ///
38061    /// # Working with unknown values
38062    ///
38063    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
38064    /// additional enum variants at any time. Adding new variants is not considered
38065    /// a breaking change. Applications should write their code in anticipation of:
38066    ///
38067    /// - New values appearing in future releases of the client library, **and**
38068    /// - New values received dynamically, without application changes.
38069    ///
38070    /// Please consult the [Working with enums] section in the user guide for some
38071    /// guidelines.
38072    ///
38073    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
38074    #[derive(Clone, Debug, PartialEq)]
38075    #[non_exhaustive]
38076    pub enum Edition {
38077        /// The instance did not specify the edition.
38078        Unspecified,
38079        /// The instance is an enterprise edition.
38080        Enterprise,
38081        /// The instance is an Enterprise Plus edition.
38082        EnterprisePlus,
38083        /// If set, the enum was initialized with an unknown value.
38084        ///
38085        /// Applications can examine the value using [Edition::value] or
38086        /// [Edition::name].
38087        UnknownValue(edition::UnknownValue),
38088    }
38089
38090    #[doc(hidden)]
38091    pub mod edition {
38092        #[allow(unused_imports)]
38093        use super::*;
38094        #[derive(Clone, Debug, PartialEq)]
38095        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
38096    }
38097
38098    impl Edition {
38099        /// Gets the enum value.
38100        ///
38101        /// Returns `None` if the enum contains an unknown value deserialized from
38102        /// the string representation of enums.
38103        pub fn value(&self) -> std::option::Option<i32> {
38104            match self {
38105                Self::Unspecified => std::option::Option::Some(0),
38106                Self::Enterprise => std::option::Option::Some(2),
38107                Self::EnterprisePlus => std::option::Option::Some(3),
38108                Self::UnknownValue(u) => u.0.value(),
38109            }
38110        }
38111
38112        /// Gets the enum value as a string.
38113        ///
38114        /// Returns `None` if the enum contains an unknown value deserialized from
38115        /// the integer representation of enums.
38116        pub fn name(&self) -> std::option::Option<&str> {
38117            match self {
38118                Self::Unspecified => std::option::Option::Some("EDITION_UNSPECIFIED"),
38119                Self::Enterprise => std::option::Option::Some("ENTERPRISE"),
38120                Self::EnterprisePlus => std::option::Option::Some("ENTERPRISE_PLUS"),
38121                Self::UnknownValue(u) => u.0.name(),
38122            }
38123        }
38124    }
38125
38126    impl std::default::Default for Edition {
38127        fn default() -> Self {
38128            use std::convert::From;
38129            Self::from(0)
38130        }
38131    }
38132
38133    impl std::fmt::Display for Edition {
38134        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
38135            wkt::internal::display_enum(f, self.name(), self.value())
38136        }
38137    }
38138
38139    impl std::convert::From<i32> for Edition {
38140        fn from(value: i32) -> Self {
38141            match value {
38142                0 => Self::Unspecified,
38143                2 => Self::Enterprise,
38144                3 => Self::EnterprisePlus,
38145                _ => Self::UnknownValue(edition::UnknownValue(
38146                    wkt::internal::UnknownEnumValue::Integer(value),
38147                )),
38148            }
38149        }
38150    }
38151
38152    impl std::convert::From<&str> for Edition {
38153        fn from(value: &str) -> Self {
38154            use std::string::ToString;
38155            match value {
38156                "EDITION_UNSPECIFIED" => Self::Unspecified,
38157                "ENTERPRISE" => Self::Enterprise,
38158                "ENTERPRISE_PLUS" => Self::EnterprisePlus,
38159                _ => Self::UnknownValue(edition::UnknownValue(
38160                    wkt::internal::UnknownEnumValue::String(value.to_string()),
38161                )),
38162            }
38163        }
38164    }
38165
38166    impl serde::ser::Serialize for Edition {
38167        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
38168        where
38169            S: serde::Serializer,
38170        {
38171            match self {
38172                Self::Unspecified => serializer.serialize_i32(0),
38173                Self::Enterprise => serializer.serialize_i32(2),
38174                Self::EnterprisePlus => serializer.serialize_i32(3),
38175                Self::UnknownValue(u) => u.0.serialize(serializer),
38176            }
38177        }
38178    }
38179
38180    impl<'de> serde::de::Deserialize<'de> for Edition {
38181        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
38182        where
38183            D: serde::Deserializer<'de>,
38184        {
38185            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Edition>::new(
38186                ".google.cloud.sql.v1.Settings.Edition",
38187            ))
38188        }
38189    }
38190
38191    /// The options for enforcing Cloud SQL connectors in the instance.
38192    ///
38193    /// # Working with unknown values
38194    ///
38195    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
38196    /// additional enum variants at any time. Adding new variants is not considered
38197    /// a breaking change. Applications should write their code in anticipation of:
38198    ///
38199    /// - New values appearing in future releases of the client library, **and**
38200    /// - New values received dynamically, without application changes.
38201    ///
38202    /// Please consult the [Working with enums] section in the user guide for some
38203    /// guidelines.
38204    ///
38205    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
38206    #[derive(Clone, Debug, PartialEq)]
38207    #[non_exhaustive]
38208    pub enum ConnectorEnforcement {
38209        /// The requirement for Cloud SQL connectors is unknown.
38210        Unspecified,
38211        /// Do not require Cloud SQL connectors.
38212        NotRequired,
38213        /// Require all connections to use Cloud SQL connectors, including the
38214        /// Cloud SQL Auth Proxy and Cloud SQL Java, Python, and Go connectors.
38215        /// Note: This disables all existing authorized networks.
38216        Required,
38217        /// If set, the enum was initialized with an unknown value.
38218        ///
38219        /// Applications can examine the value using [ConnectorEnforcement::value] or
38220        /// [ConnectorEnforcement::name].
38221        UnknownValue(connector_enforcement::UnknownValue),
38222    }
38223
38224    #[doc(hidden)]
38225    pub mod connector_enforcement {
38226        #[allow(unused_imports)]
38227        use super::*;
38228        #[derive(Clone, Debug, PartialEq)]
38229        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
38230    }
38231
38232    impl ConnectorEnforcement {
38233        /// Gets the enum value.
38234        ///
38235        /// Returns `None` if the enum contains an unknown value deserialized from
38236        /// the string representation of enums.
38237        pub fn value(&self) -> std::option::Option<i32> {
38238            match self {
38239                Self::Unspecified => std::option::Option::Some(0),
38240                Self::NotRequired => std::option::Option::Some(1),
38241                Self::Required => std::option::Option::Some(2),
38242                Self::UnknownValue(u) => u.0.value(),
38243            }
38244        }
38245
38246        /// Gets the enum value as a string.
38247        ///
38248        /// Returns `None` if the enum contains an unknown value deserialized from
38249        /// the integer representation of enums.
38250        pub fn name(&self) -> std::option::Option<&str> {
38251            match self {
38252                Self::Unspecified => std::option::Option::Some("CONNECTOR_ENFORCEMENT_UNSPECIFIED"),
38253                Self::NotRequired => std::option::Option::Some("NOT_REQUIRED"),
38254                Self::Required => std::option::Option::Some("REQUIRED"),
38255                Self::UnknownValue(u) => u.0.name(),
38256            }
38257        }
38258    }
38259
38260    impl std::default::Default for ConnectorEnforcement {
38261        fn default() -> Self {
38262            use std::convert::From;
38263            Self::from(0)
38264        }
38265    }
38266
38267    impl std::fmt::Display for ConnectorEnforcement {
38268        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
38269            wkt::internal::display_enum(f, self.name(), self.value())
38270        }
38271    }
38272
38273    impl std::convert::From<i32> for ConnectorEnforcement {
38274        fn from(value: i32) -> Self {
38275            match value {
38276                0 => Self::Unspecified,
38277                1 => Self::NotRequired,
38278                2 => Self::Required,
38279                _ => Self::UnknownValue(connector_enforcement::UnknownValue(
38280                    wkt::internal::UnknownEnumValue::Integer(value),
38281                )),
38282            }
38283        }
38284    }
38285
38286    impl std::convert::From<&str> for ConnectorEnforcement {
38287        fn from(value: &str) -> Self {
38288            use std::string::ToString;
38289            match value {
38290                "CONNECTOR_ENFORCEMENT_UNSPECIFIED" => Self::Unspecified,
38291                "NOT_REQUIRED" => Self::NotRequired,
38292                "REQUIRED" => Self::Required,
38293                _ => Self::UnknownValue(connector_enforcement::UnknownValue(
38294                    wkt::internal::UnknownEnumValue::String(value.to_string()),
38295                )),
38296            }
38297        }
38298    }
38299
38300    impl serde::ser::Serialize for ConnectorEnforcement {
38301        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
38302        where
38303            S: serde::Serializer,
38304        {
38305            match self {
38306                Self::Unspecified => serializer.serialize_i32(0),
38307                Self::NotRequired => serializer.serialize_i32(1),
38308                Self::Required => serializer.serialize_i32(2),
38309                Self::UnknownValue(u) => u.0.serialize(serializer),
38310            }
38311        }
38312    }
38313
38314    impl<'de> serde::de::Deserialize<'de> for ConnectorEnforcement {
38315        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
38316        where
38317            D: serde::Deserializer<'de>,
38318        {
38319            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ConnectorEnforcement>::new(
38320                ".google.cloud.sql.v1.Settings.ConnectorEnforcement",
38321            ))
38322        }
38323    }
38324}
38325
38326/// Specifies options for controlling advanced machine features.
38327#[derive(Clone, Default, PartialEq)]
38328#[non_exhaustive]
38329pub struct AdvancedMachineFeatures {
38330    /// The number of threads per physical core.
38331    pub threads_per_core: i32,
38332
38333    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
38334}
38335
38336impl AdvancedMachineFeatures {
38337    pub fn new() -> Self {
38338        std::default::Default::default()
38339    }
38340
38341    /// Sets the value of [threads_per_core][crate::model::AdvancedMachineFeatures::threads_per_core].
38342    pub fn set_threads_per_core<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
38343        self.threads_per_core = v.into();
38344        self
38345    }
38346}
38347
38348impl wkt::message::Message for AdvancedMachineFeatures {
38349    fn typename() -> &'static str {
38350        "type.googleapis.com/google.cloud.sql.v1.AdvancedMachineFeatures"
38351    }
38352}
38353
38354#[doc(hidden)]
38355impl<'de> serde::de::Deserialize<'de> for AdvancedMachineFeatures {
38356    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
38357    where
38358        D: serde::Deserializer<'de>,
38359    {
38360        #[allow(non_camel_case_types)]
38361        #[doc(hidden)]
38362        #[derive(PartialEq, Eq, Hash)]
38363        enum __FieldTag {
38364            __threads_per_core,
38365            Unknown(std::string::String),
38366        }
38367        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
38368            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
38369            where
38370                D: serde::Deserializer<'de>,
38371            {
38372                struct Visitor;
38373                impl<'de> serde::de::Visitor<'de> for Visitor {
38374                    type Value = __FieldTag;
38375                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
38376                        formatter.write_str("a field name for AdvancedMachineFeatures")
38377                    }
38378                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
38379                    where
38380                        E: serde::de::Error,
38381                    {
38382                        use std::result::Result::Ok;
38383                        use std::string::ToString;
38384                        match value {
38385                            "threadsPerCore" => Ok(__FieldTag::__threads_per_core),
38386                            "threads_per_core" => Ok(__FieldTag::__threads_per_core),
38387                            _ => Ok(__FieldTag::Unknown(value.to_string())),
38388                        }
38389                    }
38390                }
38391                deserializer.deserialize_identifier(Visitor)
38392            }
38393        }
38394        struct Visitor;
38395        impl<'de> serde::de::Visitor<'de> for Visitor {
38396            type Value = AdvancedMachineFeatures;
38397            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
38398                formatter.write_str("struct AdvancedMachineFeatures")
38399            }
38400            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
38401            where
38402                A: serde::de::MapAccess<'de>,
38403            {
38404                #[allow(unused_imports)]
38405                use serde::de::Error;
38406                use std::option::Option::Some;
38407                let mut fields = std::collections::HashSet::new();
38408                let mut result = Self::Value::new();
38409                while let Some(tag) = map.next_key::<__FieldTag>()? {
38410                    #[allow(clippy::match_single_binding)]
38411                    match tag {
38412                        __FieldTag::__threads_per_core => {
38413                            if !fields.insert(__FieldTag::__threads_per_core) {
38414                                return std::result::Result::Err(A::Error::duplicate_field(
38415                                    "multiple values for threads_per_core",
38416                                ));
38417                            }
38418                            struct __With(std::option::Option<i32>);
38419                            impl<'de> serde::de::Deserialize<'de> for __With {
38420                                fn deserialize<D>(
38421                                    deserializer: D,
38422                                ) -> std::result::Result<Self, D::Error>
38423                                where
38424                                    D: serde::de::Deserializer<'de>,
38425                                {
38426                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
38427                                }
38428                            }
38429                            result.threads_per_core =
38430                                map.next_value::<__With>()?.0.unwrap_or_default();
38431                        }
38432                        __FieldTag::Unknown(key) => {
38433                            let value = map.next_value::<serde_json::Value>()?;
38434                            result._unknown_fields.insert(key, value);
38435                        }
38436                    }
38437                }
38438                std::result::Result::Ok(result)
38439            }
38440        }
38441        deserializer.deserialize_any(Visitor)
38442    }
38443}
38444
38445#[doc(hidden)]
38446impl serde::ser::Serialize for AdvancedMachineFeatures {
38447    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
38448    where
38449        S: serde::ser::Serializer,
38450    {
38451        use serde::ser::SerializeMap;
38452        #[allow(unused_imports)]
38453        use std::option::Option::Some;
38454        let mut state = serializer.serialize_map(std::option::Option::None)?;
38455        if !wkt::internal::is_default(&self.threads_per_core) {
38456            struct __With<'a>(&'a i32);
38457            impl<'a> serde::ser::Serialize for __With<'a> {
38458                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
38459                where
38460                    S: serde::ser::Serializer,
38461                {
38462                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
38463                }
38464            }
38465            state.serialize_entry("threadsPerCore", &__With(&self.threads_per_core))?;
38466        }
38467        if !self._unknown_fields.is_empty() {
38468            for (key, value) in self._unknown_fields.iter() {
38469                state.serialize_entry(key, &value)?;
38470            }
38471        }
38472        state.end()
38473    }
38474}
38475
38476impl std::fmt::Debug for AdvancedMachineFeatures {
38477    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
38478        let mut debug_struct = f.debug_struct("AdvancedMachineFeatures");
38479        debug_struct.field("threads_per_core", &self.threads_per_core);
38480        if !self._unknown_fields.is_empty() {
38481            debug_struct.field("_unknown_fields", &self._unknown_fields);
38482        }
38483        debug_struct.finish()
38484    }
38485}
38486
38487/// SslCerts Resource
38488#[derive(Clone, Default, PartialEq)]
38489#[non_exhaustive]
38490pub struct SslCert {
38491    /// This is always `sql#sslCert`.
38492    pub kind: std::string::String,
38493
38494    /// Serial number, as extracted from the certificate.
38495    pub cert_serial_number: std::string::String,
38496
38497    /// PEM representation.
38498    pub cert: std::string::String,
38499
38500    /// The time when the certificate was created in [RFC
38501    /// 3339](https://tools.ietf.org/html/rfc3339) format, for example
38502    /// `2012-11-15T16:19:00.094Z`
38503    pub create_time: std::option::Option<wkt::Timestamp>,
38504
38505    /// User supplied name.  Constrained to [a-zA-Z.-_ ]+.
38506    pub common_name: std::string::String,
38507
38508    /// The time when the certificate expires in [RFC
38509    /// 3339](https://tools.ietf.org/html/rfc3339) format, for example
38510    /// `2012-11-15T16:19:00.094Z`.
38511    pub expiration_time: std::option::Option<wkt::Timestamp>,
38512
38513    /// Sha1 Fingerprint.
38514    pub sha1_fingerprint: std::string::String,
38515
38516    /// Name of the database instance.
38517    pub instance: std::string::String,
38518
38519    /// The URI of this resource.
38520    pub self_link: std::string::String,
38521
38522    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
38523}
38524
38525impl SslCert {
38526    pub fn new() -> Self {
38527        std::default::Default::default()
38528    }
38529
38530    /// Sets the value of [kind][crate::model::SslCert::kind].
38531    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
38532        self.kind = v.into();
38533        self
38534    }
38535
38536    /// Sets the value of [cert_serial_number][crate::model::SslCert::cert_serial_number].
38537    pub fn set_cert_serial_number<T: std::convert::Into<std::string::String>>(
38538        mut self,
38539        v: T,
38540    ) -> Self {
38541        self.cert_serial_number = v.into();
38542        self
38543    }
38544
38545    /// Sets the value of [cert][crate::model::SslCert::cert].
38546    pub fn set_cert<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
38547        self.cert = v.into();
38548        self
38549    }
38550
38551    /// Sets the value of [create_time][crate::model::SslCert::create_time].
38552    pub fn set_create_time<T>(mut self, v: T) -> Self
38553    where
38554        T: std::convert::Into<wkt::Timestamp>,
38555    {
38556        self.create_time = std::option::Option::Some(v.into());
38557        self
38558    }
38559
38560    /// Sets or clears the value of [create_time][crate::model::SslCert::create_time].
38561    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
38562    where
38563        T: std::convert::Into<wkt::Timestamp>,
38564    {
38565        self.create_time = v.map(|x| x.into());
38566        self
38567    }
38568
38569    /// Sets the value of [common_name][crate::model::SslCert::common_name].
38570    pub fn set_common_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
38571        self.common_name = v.into();
38572        self
38573    }
38574
38575    /// Sets the value of [expiration_time][crate::model::SslCert::expiration_time].
38576    pub fn set_expiration_time<T>(mut self, v: T) -> Self
38577    where
38578        T: std::convert::Into<wkt::Timestamp>,
38579    {
38580        self.expiration_time = std::option::Option::Some(v.into());
38581        self
38582    }
38583
38584    /// Sets or clears the value of [expiration_time][crate::model::SslCert::expiration_time].
38585    pub fn set_or_clear_expiration_time<T>(mut self, v: std::option::Option<T>) -> Self
38586    where
38587        T: std::convert::Into<wkt::Timestamp>,
38588    {
38589        self.expiration_time = v.map(|x| x.into());
38590        self
38591    }
38592
38593    /// Sets the value of [sha1_fingerprint][crate::model::SslCert::sha1_fingerprint].
38594    pub fn set_sha1_fingerprint<T: std::convert::Into<std::string::String>>(
38595        mut self,
38596        v: T,
38597    ) -> Self {
38598        self.sha1_fingerprint = v.into();
38599        self
38600    }
38601
38602    /// Sets the value of [instance][crate::model::SslCert::instance].
38603    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
38604        self.instance = v.into();
38605        self
38606    }
38607
38608    /// Sets the value of [self_link][crate::model::SslCert::self_link].
38609    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
38610        self.self_link = v.into();
38611        self
38612    }
38613}
38614
38615impl wkt::message::Message for SslCert {
38616    fn typename() -> &'static str {
38617        "type.googleapis.com/google.cloud.sql.v1.SslCert"
38618    }
38619}
38620
38621#[doc(hidden)]
38622impl<'de> serde::de::Deserialize<'de> for SslCert {
38623    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
38624    where
38625        D: serde::Deserializer<'de>,
38626    {
38627        #[allow(non_camel_case_types)]
38628        #[doc(hidden)]
38629        #[derive(PartialEq, Eq, Hash)]
38630        enum __FieldTag {
38631            __kind,
38632            __cert_serial_number,
38633            __cert,
38634            __create_time,
38635            __common_name,
38636            __expiration_time,
38637            __sha1_fingerprint,
38638            __instance,
38639            __self_link,
38640            Unknown(std::string::String),
38641        }
38642        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
38643            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
38644            where
38645                D: serde::Deserializer<'de>,
38646            {
38647                struct Visitor;
38648                impl<'de> serde::de::Visitor<'de> for Visitor {
38649                    type Value = __FieldTag;
38650                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
38651                        formatter.write_str("a field name for SslCert")
38652                    }
38653                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
38654                    where
38655                        E: serde::de::Error,
38656                    {
38657                        use std::result::Result::Ok;
38658                        use std::string::ToString;
38659                        match value {
38660                            "kind" => Ok(__FieldTag::__kind),
38661                            "certSerialNumber" => Ok(__FieldTag::__cert_serial_number),
38662                            "cert_serial_number" => Ok(__FieldTag::__cert_serial_number),
38663                            "cert" => Ok(__FieldTag::__cert),
38664                            "createTime" => Ok(__FieldTag::__create_time),
38665                            "create_time" => Ok(__FieldTag::__create_time),
38666                            "commonName" => Ok(__FieldTag::__common_name),
38667                            "common_name" => Ok(__FieldTag::__common_name),
38668                            "expirationTime" => Ok(__FieldTag::__expiration_time),
38669                            "expiration_time" => Ok(__FieldTag::__expiration_time),
38670                            "sha1Fingerprint" => Ok(__FieldTag::__sha1_fingerprint),
38671                            "sha1_fingerprint" => Ok(__FieldTag::__sha1_fingerprint),
38672                            "instance" => Ok(__FieldTag::__instance),
38673                            "selfLink" => Ok(__FieldTag::__self_link),
38674                            "self_link" => Ok(__FieldTag::__self_link),
38675                            _ => Ok(__FieldTag::Unknown(value.to_string())),
38676                        }
38677                    }
38678                }
38679                deserializer.deserialize_identifier(Visitor)
38680            }
38681        }
38682        struct Visitor;
38683        impl<'de> serde::de::Visitor<'de> for Visitor {
38684            type Value = SslCert;
38685            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
38686                formatter.write_str("struct SslCert")
38687            }
38688            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
38689            where
38690                A: serde::de::MapAccess<'de>,
38691            {
38692                #[allow(unused_imports)]
38693                use serde::de::Error;
38694                use std::option::Option::Some;
38695                let mut fields = std::collections::HashSet::new();
38696                let mut result = Self::Value::new();
38697                while let Some(tag) = map.next_key::<__FieldTag>()? {
38698                    #[allow(clippy::match_single_binding)]
38699                    match tag {
38700                        __FieldTag::__kind => {
38701                            if !fields.insert(__FieldTag::__kind) {
38702                                return std::result::Result::Err(A::Error::duplicate_field(
38703                                    "multiple values for kind",
38704                                ));
38705                            }
38706                            result.kind = map
38707                                .next_value::<std::option::Option<std::string::String>>()?
38708                                .unwrap_or_default();
38709                        }
38710                        __FieldTag::__cert_serial_number => {
38711                            if !fields.insert(__FieldTag::__cert_serial_number) {
38712                                return std::result::Result::Err(A::Error::duplicate_field(
38713                                    "multiple values for cert_serial_number",
38714                                ));
38715                            }
38716                            result.cert_serial_number = map
38717                                .next_value::<std::option::Option<std::string::String>>()?
38718                                .unwrap_or_default();
38719                        }
38720                        __FieldTag::__cert => {
38721                            if !fields.insert(__FieldTag::__cert) {
38722                                return std::result::Result::Err(A::Error::duplicate_field(
38723                                    "multiple values for cert",
38724                                ));
38725                            }
38726                            result.cert = map
38727                                .next_value::<std::option::Option<std::string::String>>()?
38728                                .unwrap_or_default();
38729                        }
38730                        __FieldTag::__create_time => {
38731                            if !fields.insert(__FieldTag::__create_time) {
38732                                return std::result::Result::Err(A::Error::duplicate_field(
38733                                    "multiple values for create_time",
38734                                ));
38735                            }
38736                            result.create_time =
38737                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
38738                        }
38739                        __FieldTag::__common_name => {
38740                            if !fields.insert(__FieldTag::__common_name) {
38741                                return std::result::Result::Err(A::Error::duplicate_field(
38742                                    "multiple values for common_name",
38743                                ));
38744                            }
38745                            result.common_name = map
38746                                .next_value::<std::option::Option<std::string::String>>()?
38747                                .unwrap_or_default();
38748                        }
38749                        __FieldTag::__expiration_time => {
38750                            if !fields.insert(__FieldTag::__expiration_time) {
38751                                return std::result::Result::Err(A::Error::duplicate_field(
38752                                    "multiple values for expiration_time",
38753                                ));
38754                            }
38755                            result.expiration_time =
38756                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
38757                        }
38758                        __FieldTag::__sha1_fingerprint => {
38759                            if !fields.insert(__FieldTag::__sha1_fingerprint) {
38760                                return std::result::Result::Err(A::Error::duplicate_field(
38761                                    "multiple values for sha1_fingerprint",
38762                                ));
38763                            }
38764                            result.sha1_fingerprint = map
38765                                .next_value::<std::option::Option<std::string::String>>()?
38766                                .unwrap_or_default();
38767                        }
38768                        __FieldTag::__instance => {
38769                            if !fields.insert(__FieldTag::__instance) {
38770                                return std::result::Result::Err(A::Error::duplicate_field(
38771                                    "multiple values for instance",
38772                                ));
38773                            }
38774                            result.instance = map
38775                                .next_value::<std::option::Option<std::string::String>>()?
38776                                .unwrap_or_default();
38777                        }
38778                        __FieldTag::__self_link => {
38779                            if !fields.insert(__FieldTag::__self_link) {
38780                                return std::result::Result::Err(A::Error::duplicate_field(
38781                                    "multiple values for self_link",
38782                                ));
38783                            }
38784                            result.self_link = map
38785                                .next_value::<std::option::Option<std::string::String>>()?
38786                                .unwrap_or_default();
38787                        }
38788                        __FieldTag::Unknown(key) => {
38789                            let value = map.next_value::<serde_json::Value>()?;
38790                            result._unknown_fields.insert(key, value);
38791                        }
38792                    }
38793                }
38794                std::result::Result::Ok(result)
38795            }
38796        }
38797        deserializer.deserialize_any(Visitor)
38798    }
38799}
38800
38801#[doc(hidden)]
38802impl serde::ser::Serialize for SslCert {
38803    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
38804    where
38805        S: serde::ser::Serializer,
38806    {
38807        use serde::ser::SerializeMap;
38808        #[allow(unused_imports)]
38809        use std::option::Option::Some;
38810        let mut state = serializer.serialize_map(std::option::Option::None)?;
38811        if !self.kind.is_empty() {
38812            state.serialize_entry("kind", &self.kind)?;
38813        }
38814        if !self.cert_serial_number.is_empty() {
38815            state.serialize_entry("certSerialNumber", &self.cert_serial_number)?;
38816        }
38817        if !self.cert.is_empty() {
38818            state.serialize_entry("cert", &self.cert)?;
38819        }
38820        if self.create_time.is_some() {
38821            state.serialize_entry("createTime", &self.create_time)?;
38822        }
38823        if !self.common_name.is_empty() {
38824            state.serialize_entry("commonName", &self.common_name)?;
38825        }
38826        if self.expiration_time.is_some() {
38827            state.serialize_entry("expirationTime", &self.expiration_time)?;
38828        }
38829        if !self.sha1_fingerprint.is_empty() {
38830            state.serialize_entry("sha1Fingerprint", &self.sha1_fingerprint)?;
38831        }
38832        if !self.instance.is_empty() {
38833            state.serialize_entry("instance", &self.instance)?;
38834        }
38835        if !self.self_link.is_empty() {
38836            state.serialize_entry("selfLink", &self.self_link)?;
38837        }
38838        if !self._unknown_fields.is_empty() {
38839            for (key, value) in self._unknown_fields.iter() {
38840                state.serialize_entry(key, &value)?;
38841            }
38842        }
38843        state.end()
38844    }
38845}
38846
38847impl std::fmt::Debug for SslCert {
38848    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
38849        let mut debug_struct = f.debug_struct("SslCert");
38850        debug_struct.field("kind", &self.kind);
38851        debug_struct.field("cert_serial_number", &self.cert_serial_number);
38852        debug_struct.field("cert", &self.cert);
38853        debug_struct.field("create_time", &self.create_time);
38854        debug_struct.field("common_name", &self.common_name);
38855        debug_struct.field("expiration_time", &self.expiration_time);
38856        debug_struct.field("sha1_fingerprint", &self.sha1_fingerprint);
38857        debug_struct.field("instance", &self.instance);
38858        debug_struct.field("self_link", &self.self_link);
38859        if !self._unknown_fields.is_empty() {
38860            debug_struct.field("_unknown_fields", &self._unknown_fields);
38861        }
38862        debug_struct.finish()
38863    }
38864}
38865
38866/// SslCertDetail.
38867#[derive(Clone, Default, PartialEq)]
38868#[non_exhaustive]
38869pub struct SslCertDetail {
38870    /// The public information about the cert.
38871    pub cert_info: std::option::Option<crate::model::SslCert>,
38872
38873    /// The private key for the client cert, in pem format.  Keep private in order
38874    /// to protect your security.
38875    pub cert_private_key: std::string::String,
38876
38877    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
38878}
38879
38880impl SslCertDetail {
38881    pub fn new() -> Self {
38882        std::default::Default::default()
38883    }
38884
38885    /// Sets the value of [cert_info][crate::model::SslCertDetail::cert_info].
38886    pub fn set_cert_info<T>(mut self, v: T) -> Self
38887    where
38888        T: std::convert::Into<crate::model::SslCert>,
38889    {
38890        self.cert_info = std::option::Option::Some(v.into());
38891        self
38892    }
38893
38894    /// Sets or clears the value of [cert_info][crate::model::SslCertDetail::cert_info].
38895    pub fn set_or_clear_cert_info<T>(mut self, v: std::option::Option<T>) -> Self
38896    where
38897        T: std::convert::Into<crate::model::SslCert>,
38898    {
38899        self.cert_info = v.map(|x| x.into());
38900        self
38901    }
38902
38903    /// Sets the value of [cert_private_key][crate::model::SslCertDetail::cert_private_key].
38904    pub fn set_cert_private_key<T: std::convert::Into<std::string::String>>(
38905        mut self,
38906        v: T,
38907    ) -> Self {
38908        self.cert_private_key = v.into();
38909        self
38910    }
38911}
38912
38913impl wkt::message::Message for SslCertDetail {
38914    fn typename() -> &'static str {
38915        "type.googleapis.com/google.cloud.sql.v1.SslCertDetail"
38916    }
38917}
38918
38919#[doc(hidden)]
38920impl<'de> serde::de::Deserialize<'de> for SslCertDetail {
38921    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
38922    where
38923        D: serde::Deserializer<'de>,
38924    {
38925        #[allow(non_camel_case_types)]
38926        #[doc(hidden)]
38927        #[derive(PartialEq, Eq, Hash)]
38928        enum __FieldTag {
38929            __cert_info,
38930            __cert_private_key,
38931            Unknown(std::string::String),
38932        }
38933        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
38934            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
38935            where
38936                D: serde::Deserializer<'de>,
38937            {
38938                struct Visitor;
38939                impl<'de> serde::de::Visitor<'de> for Visitor {
38940                    type Value = __FieldTag;
38941                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
38942                        formatter.write_str("a field name for SslCertDetail")
38943                    }
38944                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
38945                    where
38946                        E: serde::de::Error,
38947                    {
38948                        use std::result::Result::Ok;
38949                        use std::string::ToString;
38950                        match value {
38951                            "certInfo" => Ok(__FieldTag::__cert_info),
38952                            "cert_info" => Ok(__FieldTag::__cert_info),
38953                            "certPrivateKey" => Ok(__FieldTag::__cert_private_key),
38954                            "cert_private_key" => Ok(__FieldTag::__cert_private_key),
38955                            _ => Ok(__FieldTag::Unknown(value.to_string())),
38956                        }
38957                    }
38958                }
38959                deserializer.deserialize_identifier(Visitor)
38960            }
38961        }
38962        struct Visitor;
38963        impl<'de> serde::de::Visitor<'de> for Visitor {
38964            type Value = SslCertDetail;
38965            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
38966                formatter.write_str("struct SslCertDetail")
38967            }
38968            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
38969            where
38970                A: serde::de::MapAccess<'de>,
38971            {
38972                #[allow(unused_imports)]
38973                use serde::de::Error;
38974                use std::option::Option::Some;
38975                let mut fields = std::collections::HashSet::new();
38976                let mut result = Self::Value::new();
38977                while let Some(tag) = map.next_key::<__FieldTag>()? {
38978                    #[allow(clippy::match_single_binding)]
38979                    match tag {
38980                        __FieldTag::__cert_info => {
38981                            if !fields.insert(__FieldTag::__cert_info) {
38982                                return std::result::Result::Err(A::Error::duplicate_field(
38983                                    "multiple values for cert_info",
38984                                ));
38985                            }
38986                            result.cert_info =
38987                                map.next_value::<std::option::Option<crate::model::SslCert>>()?;
38988                        }
38989                        __FieldTag::__cert_private_key => {
38990                            if !fields.insert(__FieldTag::__cert_private_key) {
38991                                return std::result::Result::Err(A::Error::duplicate_field(
38992                                    "multiple values for cert_private_key",
38993                                ));
38994                            }
38995                            result.cert_private_key = map
38996                                .next_value::<std::option::Option<std::string::String>>()?
38997                                .unwrap_or_default();
38998                        }
38999                        __FieldTag::Unknown(key) => {
39000                            let value = map.next_value::<serde_json::Value>()?;
39001                            result._unknown_fields.insert(key, value);
39002                        }
39003                    }
39004                }
39005                std::result::Result::Ok(result)
39006            }
39007        }
39008        deserializer.deserialize_any(Visitor)
39009    }
39010}
39011
39012#[doc(hidden)]
39013impl serde::ser::Serialize for SslCertDetail {
39014    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
39015    where
39016        S: serde::ser::Serializer,
39017    {
39018        use serde::ser::SerializeMap;
39019        #[allow(unused_imports)]
39020        use std::option::Option::Some;
39021        let mut state = serializer.serialize_map(std::option::Option::None)?;
39022        if self.cert_info.is_some() {
39023            state.serialize_entry("certInfo", &self.cert_info)?;
39024        }
39025        if !self.cert_private_key.is_empty() {
39026            state.serialize_entry("certPrivateKey", &self.cert_private_key)?;
39027        }
39028        if !self._unknown_fields.is_empty() {
39029            for (key, value) in self._unknown_fields.iter() {
39030                state.serialize_entry(key, &value)?;
39031            }
39032        }
39033        state.end()
39034    }
39035}
39036
39037impl std::fmt::Debug for SslCertDetail {
39038    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
39039        let mut debug_struct = f.debug_struct("SslCertDetail");
39040        debug_struct.field("cert_info", &self.cert_info);
39041        debug_struct.field("cert_private_key", &self.cert_private_key);
39042        if !self._unknown_fields.is_empty() {
39043            debug_struct.field("_unknown_fields", &self._unknown_fields);
39044        }
39045        debug_struct.finish()
39046    }
39047}
39048
39049/// Active Directory configuration, relevant only for Cloud SQL for SQL Server.
39050#[derive(Clone, Default, PartialEq)]
39051#[non_exhaustive]
39052pub struct SqlActiveDirectoryConfig {
39053    /// This is always sql#activeDirectoryConfig.
39054    pub kind: std::string::String,
39055
39056    /// The name of the domain (e.g., mydomain.com).
39057    pub domain: std::string::String,
39058
39059    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
39060}
39061
39062impl SqlActiveDirectoryConfig {
39063    pub fn new() -> Self {
39064        std::default::Default::default()
39065    }
39066
39067    /// Sets the value of [kind][crate::model::SqlActiveDirectoryConfig::kind].
39068    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
39069        self.kind = v.into();
39070        self
39071    }
39072
39073    /// Sets the value of [domain][crate::model::SqlActiveDirectoryConfig::domain].
39074    pub fn set_domain<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
39075        self.domain = v.into();
39076        self
39077    }
39078}
39079
39080impl wkt::message::Message for SqlActiveDirectoryConfig {
39081    fn typename() -> &'static str {
39082        "type.googleapis.com/google.cloud.sql.v1.SqlActiveDirectoryConfig"
39083    }
39084}
39085
39086#[doc(hidden)]
39087impl<'de> serde::de::Deserialize<'de> for SqlActiveDirectoryConfig {
39088    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
39089    where
39090        D: serde::Deserializer<'de>,
39091    {
39092        #[allow(non_camel_case_types)]
39093        #[doc(hidden)]
39094        #[derive(PartialEq, Eq, Hash)]
39095        enum __FieldTag {
39096            __kind,
39097            __domain,
39098            Unknown(std::string::String),
39099        }
39100        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
39101            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
39102            where
39103                D: serde::Deserializer<'de>,
39104            {
39105                struct Visitor;
39106                impl<'de> serde::de::Visitor<'de> for Visitor {
39107                    type Value = __FieldTag;
39108                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
39109                        formatter.write_str("a field name for SqlActiveDirectoryConfig")
39110                    }
39111                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
39112                    where
39113                        E: serde::de::Error,
39114                    {
39115                        use std::result::Result::Ok;
39116                        use std::string::ToString;
39117                        match value {
39118                            "kind" => Ok(__FieldTag::__kind),
39119                            "domain" => Ok(__FieldTag::__domain),
39120                            _ => Ok(__FieldTag::Unknown(value.to_string())),
39121                        }
39122                    }
39123                }
39124                deserializer.deserialize_identifier(Visitor)
39125            }
39126        }
39127        struct Visitor;
39128        impl<'de> serde::de::Visitor<'de> for Visitor {
39129            type Value = SqlActiveDirectoryConfig;
39130            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
39131                formatter.write_str("struct SqlActiveDirectoryConfig")
39132            }
39133            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
39134            where
39135                A: serde::de::MapAccess<'de>,
39136            {
39137                #[allow(unused_imports)]
39138                use serde::de::Error;
39139                use std::option::Option::Some;
39140                let mut fields = std::collections::HashSet::new();
39141                let mut result = Self::Value::new();
39142                while let Some(tag) = map.next_key::<__FieldTag>()? {
39143                    #[allow(clippy::match_single_binding)]
39144                    match tag {
39145                        __FieldTag::__kind => {
39146                            if !fields.insert(__FieldTag::__kind) {
39147                                return std::result::Result::Err(A::Error::duplicate_field(
39148                                    "multiple values for kind",
39149                                ));
39150                            }
39151                            result.kind = map
39152                                .next_value::<std::option::Option<std::string::String>>()?
39153                                .unwrap_or_default();
39154                        }
39155                        __FieldTag::__domain => {
39156                            if !fields.insert(__FieldTag::__domain) {
39157                                return std::result::Result::Err(A::Error::duplicate_field(
39158                                    "multiple values for domain",
39159                                ));
39160                            }
39161                            result.domain = map
39162                                .next_value::<std::option::Option<std::string::String>>()?
39163                                .unwrap_or_default();
39164                        }
39165                        __FieldTag::Unknown(key) => {
39166                            let value = map.next_value::<serde_json::Value>()?;
39167                            result._unknown_fields.insert(key, value);
39168                        }
39169                    }
39170                }
39171                std::result::Result::Ok(result)
39172            }
39173        }
39174        deserializer.deserialize_any(Visitor)
39175    }
39176}
39177
39178#[doc(hidden)]
39179impl serde::ser::Serialize for SqlActiveDirectoryConfig {
39180    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
39181    where
39182        S: serde::ser::Serializer,
39183    {
39184        use serde::ser::SerializeMap;
39185        #[allow(unused_imports)]
39186        use std::option::Option::Some;
39187        let mut state = serializer.serialize_map(std::option::Option::None)?;
39188        if !self.kind.is_empty() {
39189            state.serialize_entry("kind", &self.kind)?;
39190        }
39191        if !self.domain.is_empty() {
39192            state.serialize_entry("domain", &self.domain)?;
39193        }
39194        if !self._unknown_fields.is_empty() {
39195            for (key, value) in self._unknown_fields.iter() {
39196                state.serialize_entry(key, &value)?;
39197            }
39198        }
39199        state.end()
39200    }
39201}
39202
39203impl std::fmt::Debug for SqlActiveDirectoryConfig {
39204    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
39205        let mut debug_struct = f.debug_struct("SqlActiveDirectoryConfig");
39206        debug_struct.field("kind", &self.kind);
39207        debug_struct.field("domain", &self.domain);
39208        if !self._unknown_fields.is_empty() {
39209            debug_struct.field("_unknown_fields", &self._unknown_fields);
39210        }
39211        debug_struct.finish()
39212    }
39213}
39214
39215/// SQL Server specific audit configuration.
39216#[derive(Clone, Default, PartialEq)]
39217#[non_exhaustive]
39218pub struct SqlServerAuditConfig {
39219    /// This is always sql#sqlServerAuditConfig
39220    pub kind: std::string::String,
39221
39222    /// The name of the destination bucket (e.g., gs://mybucket).
39223    pub bucket: std::string::String,
39224
39225    /// How long to keep generated audit files.
39226    pub retention_interval: std::option::Option<wkt::Duration>,
39227
39228    /// How often to upload generated audit files.
39229    pub upload_interval: std::option::Option<wkt::Duration>,
39230
39231    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
39232}
39233
39234impl SqlServerAuditConfig {
39235    pub fn new() -> Self {
39236        std::default::Default::default()
39237    }
39238
39239    /// Sets the value of [kind][crate::model::SqlServerAuditConfig::kind].
39240    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
39241        self.kind = v.into();
39242        self
39243    }
39244
39245    /// Sets the value of [bucket][crate::model::SqlServerAuditConfig::bucket].
39246    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
39247        self.bucket = v.into();
39248        self
39249    }
39250
39251    /// Sets the value of [retention_interval][crate::model::SqlServerAuditConfig::retention_interval].
39252    pub fn set_retention_interval<T>(mut self, v: T) -> Self
39253    where
39254        T: std::convert::Into<wkt::Duration>,
39255    {
39256        self.retention_interval = std::option::Option::Some(v.into());
39257        self
39258    }
39259
39260    /// Sets or clears the value of [retention_interval][crate::model::SqlServerAuditConfig::retention_interval].
39261    pub fn set_or_clear_retention_interval<T>(mut self, v: std::option::Option<T>) -> Self
39262    where
39263        T: std::convert::Into<wkt::Duration>,
39264    {
39265        self.retention_interval = v.map(|x| x.into());
39266        self
39267    }
39268
39269    /// Sets the value of [upload_interval][crate::model::SqlServerAuditConfig::upload_interval].
39270    pub fn set_upload_interval<T>(mut self, v: T) -> Self
39271    where
39272        T: std::convert::Into<wkt::Duration>,
39273    {
39274        self.upload_interval = std::option::Option::Some(v.into());
39275        self
39276    }
39277
39278    /// Sets or clears the value of [upload_interval][crate::model::SqlServerAuditConfig::upload_interval].
39279    pub fn set_or_clear_upload_interval<T>(mut self, v: std::option::Option<T>) -> Self
39280    where
39281        T: std::convert::Into<wkt::Duration>,
39282    {
39283        self.upload_interval = v.map(|x| x.into());
39284        self
39285    }
39286}
39287
39288impl wkt::message::Message for SqlServerAuditConfig {
39289    fn typename() -> &'static str {
39290        "type.googleapis.com/google.cloud.sql.v1.SqlServerAuditConfig"
39291    }
39292}
39293
39294#[doc(hidden)]
39295impl<'de> serde::de::Deserialize<'de> for SqlServerAuditConfig {
39296    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
39297    where
39298        D: serde::Deserializer<'de>,
39299    {
39300        #[allow(non_camel_case_types)]
39301        #[doc(hidden)]
39302        #[derive(PartialEq, Eq, Hash)]
39303        enum __FieldTag {
39304            __kind,
39305            __bucket,
39306            __retention_interval,
39307            __upload_interval,
39308            Unknown(std::string::String),
39309        }
39310        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
39311            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
39312            where
39313                D: serde::Deserializer<'de>,
39314            {
39315                struct Visitor;
39316                impl<'de> serde::de::Visitor<'de> for Visitor {
39317                    type Value = __FieldTag;
39318                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
39319                        formatter.write_str("a field name for SqlServerAuditConfig")
39320                    }
39321                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
39322                    where
39323                        E: serde::de::Error,
39324                    {
39325                        use std::result::Result::Ok;
39326                        use std::string::ToString;
39327                        match value {
39328                            "kind" => Ok(__FieldTag::__kind),
39329                            "bucket" => Ok(__FieldTag::__bucket),
39330                            "retentionInterval" => Ok(__FieldTag::__retention_interval),
39331                            "retention_interval" => Ok(__FieldTag::__retention_interval),
39332                            "uploadInterval" => Ok(__FieldTag::__upload_interval),
39333                            "upload_interval" => Ok(__FieldTag::__upload_interval),
39334                            _ => Ok(__FieldTag::Unknown(value.to_string())),
39335                        }
39336                    }
39337                }
39338                deserializer.deserialize_identifier(Visitor)
39339            }
39340        }
39341        struct Visitor;
39342        impl<'de> serde::de::Visitor<'de> for Visitor {
39343            type Value = SqlServerAuditConfig;
39344            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
39345                formatter.write_str("struct SqlServerAuditConfig")
39346            }
39347            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
39348            where
39349                A: serde::de::MapAccess<'de>,
39350            {
39351                #[allow(unused_imports)]
39352                use serde::de::Error;
39353                use std::option::Option::Some;
39354                let mut fields = std::collections::HashSet::new();
39355                let mut result = Self::Value::new();
39356                while let Some(tag) = map.next_key::<__FieldTag>()? {
39357                    #[allow(clippy::match_single_binding)]
39358                    match tag {
39359                        __FieldTag::__kind => {
39360                            if !fields.insert(__FieldTag::__kind) {
39361                                return std::result::Result::Err(A::Error::duplicate_field(
39362                                    "multiple values for kind",
39363                                ));
39364                            }
39365                            result.kind = map
39366                                .next_value::<std::option::Option<std::string::String>>()?
39367                                .unwrap_or_default();
39368                        }
39369                        __FieldTag::__bucket => {
39370                            if !fields.insert(__FieldTag::__bucket) {
39371                                return std::result::Result::Err(A::Error::duplicate_field(
39372                                    "multiple values for bucket",
39373                                ));
39374                            }
39375                            result.bucket = map
39376                                .next_value::<std::option::Option<std::string::String>>()?
39377                                .unwrap_or_default();
39378                        }
39379                        __FieldTag::__retention_interval => {
39380                            if !fields.insert(__FieldTag::__retention_interval) {
39381                                return std::result::Result::Err(A::Error::duplicate_field(
39382                                    "multiple values for retention_interval",
39383                                ));
39384                            }
39385                            result.retention_interval =
39386                                map.next_value::<std::option::Option<wkt::Duration>>()?;
39387                        }
39388                        __FieldTag::__upload_interval => {
39389                            if !fields.insert(__FieldTag::__upload_interval) {
39390                                return std::result::Result::Err(A::Error::duplicate_field(
39391                                    "multiple values for upload_interval",
39392                                ));
39393                            }
39394                            result.upload_interval =
39395                                map.next_value::<std::option::Option<wkt::Duration>>()?;
39396                        }
39397                        __FieldTag::Unknown(key) => {
39398                            let value = map.next_value::<serde_json::Value>()?;
39399                            result._unknown_fields.insert(key, value);
39400                        }
39401                    }
39402                }
39403                std::result::Result::Ok(result)
39404            }
39405        }
39406        deserializer.deserialize_any(Visitor)
39407    }
39408}
39409
39410#[doc(hidden)]
39411impl serde::ser::Serialize for SqlServerAuditConfig {
39412    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
39413    where
39414        S: serde::ser::Serializer,
39415    {
39416        use serde::ser::SerializeMap;
39417        #[allow(unused_imports)]
39418        use std::option::Option::Some;
39419        let mut state = serializer.serialize_map(std::option::Option::None)?;
39420        if !self.kind.is_empty() {
39421            state.serialize_entry("kind", &self.kind)?;
39422        }
39423        if !self.bucket.is_empty() {
39424            state.serialize_entry("bucket", &self.bucket)?;
39425        }
39426        if self.retention_interval.is_some() {
39427            state.serialize_entry("retentionInterval", &self.retention_interval)?;
39428        }
39429        if self.upload_interval.is_some() {
39430            state.serialize_entry("uploadInterval", &self.upload_interval)?;
39431        }
39432        if !self._unknown_fields.is_empty() {
39433            for (key, value) in self._unknown_fields.iter() {
39434                state.serialize_entry(key, &value)?;
39435            }
39436        }
39437        state.end()
39438    }
39439}
39440
39441impl std::fmt::Debug for SqlServerAuditConfig {
39442    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
39443        let mut debug_struct = f.debug_struct("SqlServerAuditConfig");
39444        debug_struct.field("kind", &self.kind);
39445        debug_struct.field("bucket", &self.bucket);
39446        debug_struct.field("retention_interval", &self.retention_interval);
39447        debug_struct.field("upload_interval", &self.upload_interval);
39448        if !self._unknown_fields.is_empty() {
39449            debug_struct.field("_unknown_fields", &self._unknown_fields);
39450        }
39451        debug_struct.finish()
39452    }
39453}
39454
39455/// Acquire SSRS lease context.
39456#[derive(Clone, Default, PartialEq)]
39457#[non_exhaustive]
39458pub struct AcquireSsrsLeaseContext {
39459    /// The username to be used as the setup login to connect to the database
39460    /// server for SSRS setup.
39461    pub setup_login: std::option::Option<std::string::String>,
39462
39463    /// The username to be used as the service login to connect to the report
39464    /// database for SSRS setup.
39465    pub service_login: std::option::Option<std::string::String>,
39466
39467    /// The report database to be used for SSRS setup.
39468    pub report_database: std::option::Option<std::string::String>,
39469
39470    /// Lease duration needed for SSRS setup.
39471    pub duration: std::option::Option<wkt::Duration>,
39472
39473    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
39474}
39475
39476impl AcquireSsrsLeaseContext {
39477    pub fn new() -> Self {
39478        std::default::Default::default()
39479    }
39480
39481    /// Sets the value of [setup_login][crate::model::AcquireSsrsLeaseContext::setup_login].
39482    pub fn set_setup_login<T>(mut self, v: T) -> Self
39483    where
39484        T: std::convert::Into<std::string::String>,
39485    {
39486        self.setup_login = std::option::Option::Some(v.into());
39487        self
39488    }
39489
39490    /// Sets or clears the value of [setup_login][crate::model::AcquireSsrsLeaseContext::setup_login].
39491    pub fn set_or_clear_setup_login<T>(mut self, v: std::option::Option<T>) -> Self
39492    where
39493        T: std::convert::Into<std::string::String>,
39494    {
39495        self.setup_login = v.map(|x| x.into());
39496        self
39497    }
39498
39499    /// Sets the value of [service_login][crate::model::AcquireSsrsLeaseContext::service_login].
39500    pub fn set_service_login<T>(mut self, v: T) -> Self
39501    where
39502        T: std::convert::Into<std::string::String>,
39503    {
39504        self.service_login = std::option::Option::Some(v.into());
39505        self
39506    }
39507
39508    /// Sets or clears the value of [service_login][crate::model::AcquireSsrsLeaseContext::service_login].
39509    pub fn set_or_clear_service_login<T>(mut self, v: std::option::Option<T>) -> Self
39510    where
39511        T: std::convert::Into<std::string::String>,
39512    {
39513        self.service_login = v.map(|x| x.into());
39514        self
39515    }
39516
39517    /// Sets the value of [report_database][crate::model::AcquireSsrsLeaseContext::report_database].
39518    pub fn set_report_database<T>(mut self, v: T) -> Self
39519    where
39520        T: std::convert::Into<std::string::String>,
39521    {
39522        self.report_database = std::option::Option::Some(v.into());
39523        self
39524    }
39525
39526    /// Sets or clears the value of [report_database][crate::model::AcquireSsrsLeaseContext::report_database].
39527    pub fn set_or_clear_report_database<T>(mut self, v: std::option::Option<T>) -> Self
39528    where
39529        T: std::convert::Into<std::string::String>,
39530    {
39531        self.report_database = v.map(|x| x.into());
39532        self
39533    }
39534
39535    /// Sets the value of [duration][crate::model::AcquireSsrsLeaseContext::duration].
39536    pub fn set_duration<T>(mut self, v: T) -> Self
39537    where
39538        T: std::convert::Into<wkt::Duration>,
39539    {
39540        self.duration = std::option::Option::Some(v.into());
39541        self
39542    }
39543
39544    /// Sets or clears the value of [duration][crate::model::AcquireSsrsLeaseContext::duration].
39545    pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
39546    where
39547        T: std::convert::Into<wkt::Duration>,
39548    {
39549        self.duration = v.map(|x| x.into());
39550        self
39551    }
39552}
39553
39554impl wkt::message::Message for AcquireSsrsLeaseContext {
39555    fn typename() -> &'static str {
39556        "type.googleapis.com/google.cloud.sql.v1.AcquireSsrsLeaseContext"
39557    }
39558}
39559
39560#[doc(hidden)]
39561impl<'de> serde::de::Deserialize<'de> for AcquireSsrsLeaseContext {
39562    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
39563    where
39564        D: serde::Deserializer<'de>,
39565    {
39566        #[allow(non_camel_case_types)]
39567        #[doc(hidden)]
39568        #[derive(PartialEq, Eq, Hash)]
39569        enum __FieldTag {
39570            __setup_login,
39571            __service_login,
39572            __report_database,
39573            __duration,
39574            Unknown(std::string::String),
39575        }
39576        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
39577            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
39578            where
39579                D: serde::Deserializer<'de>,
39580            {
39581                struct Visitor;
39582                impl<'de> serde::de::Visitor<'de> for Visitor {
39583                    type Value = __FieldTag;
39584                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
39585                        formatter.write_str("a field name for AcquireSsrsLeaseContext")
39586                    }
39587                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
39588                    where
39589                        E: serde::de::Error,
39590                    {
39591                        use std::result::Result::Ok;
39592                        use std::string::ToString;
39593                        match value {
39594                            "setupLogin" => Ok(__FieldTag::__setup_login),
39595                            "setup_login" => Ok(__FieldTag::__setup_login),
39596                            "serviceLogin" => Ok(__FieldTag::__service_login),
39597                            "service_login" => Ok(__FieldTag::__service_login),
39598                            "reportDatabase" => Ok(__FieldTag::__report_database),
39599                            "report_database" => Ok(__FieldTag::__report_database),
39600                            "duration" => Ok(__FieldTag::__duration),
39601                            _ => Ok(__FieldTag::Unknown(value.to_string())),
39602                        }
39603                    }
39604                }
39605                deserializer.deserialize_identifier(Visitor)
39606            }
39607        }
39608        struct Visitor;
39609        impl<'de> serde::de::Visitor<'de> for Visitor {
39610            type Value = AcquireSsrsLeaseContext;
39611            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
39612                formatter.write_str("struct AcquireSsrsLeaseContext")
39613            }
39614            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
39615            where
39616                A: serde::de::MapAccess<'de>,
39617            {
39618                #[allow(unused_imports)]
39619                use serde::de::Error;
39620                use std::option::Option::Some;
39621                let mut fields = std::collections::HashSet::new();
39622                let mut result = Self::Value::new();
39623                while let Some(tag) = map.next_key::<__FieldTag>()? {
39624                    #[allow(clippy::match_single_binding)]
39625                    match tag {
39626                        __FieldTag::__setup_login => {
39627                            if !fields.insert(__FieldTag::__setup_login) {
39628                                return std::result::Result::Err(A::Error::duplicate_field(
39629                                    "multiple values for setup_login",
39630                                ));
39631                            }
39632                            result.setup_login =
39633                                map.next_value::<std::option::Option<std::string::String>>()?;
39634                        }
39635                        __FieldTag::__service_login => {
39636                            if !fields.insert(__FieldTag::__service_login) {
39637                                return std::result::Result::Err(A::Error::duplicate_field(
39638                                    "multiple values for service_login",
39639                                ));
39640                            }
39641                            result.service_login =
39642                                map.next_value::<std::option::Option<std::string::String>>()?;
39643                        }
39644                        __FieldTag::__report_database => {
39645                            if !fields.insert(__FieldTag::__report_database) {
39646                                return std::result::Result::Err(A::Error::duplicate_field(
39647                                    "multiple values for report_database",
39648                                ));
39649                            }
39650                            result.report_database =
39651                                map.next_value::<std::option::Option<std::string::String>>()?;
39652                        }
39653                        __FieldTag::__duration => {
39654                            if !fields.insert(__FieldTag::__duration) {
39655                                return std::result::Result::Err(A::Error::duplicate_field(
39656                                    "multiple values for duration",
39657                                ));
39658                            }
39659                            result.duration =
39660                                map.next_value::<std::option::Option<wkt::Duration>>()?;
39661                        }
39662                        __FieldTag::Unknown(key) => {
39663                            let value = map.next_value::<serde_json::Value>()?;
39664                            result._unknown_fields.insert(key, value);
39665                        }
39666                    }
39667                }
39668                std::result::Result::Ok(result)
39669            }
39670        }
39671        deserializer.deserialize_any(Visitor)
39672    }
39673}
39674
39675#[doc(hidden)]
39676impl serde::ser::Serialize for AcquireSsrsLeaseContext {
39677    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
39678    where
39679        S: serde::ser::Serializer,
39680    {
39681        use serde::ser::SerializeMap;
39682        #[allow(unused_imports)]
39683        use std::option::Option::Some;
39684        let mut state = serializer.serialize_map(std::option::Option::None)?;
39685        if self.setup_login.is_some() {
39686            state.serialize_entry("setupLogin", &self.setup_login)?;
39687        }
39688        if self.service_login.is_some() {
39689            state.serialize_entry("serviceLogin", &self.service_login)?;
39690        }
39691        if self.report_database.is_some() {
39692            state.serialize_entry("reportDatabase", &self.report_database)?;
39693        }
39694        if self.duration.is_some() {
39695            state.serialize_entry("duration", &self.duration)?;
39696        }
39697        if !self._unknown_fields.is_empty() {
39698            for (key, value) in self._unknown_fields.iter() {
39699                state.serialize_entry(key, &value)?;
39700            }
39701        }
39702        state.end()
39703    }
39704}
39705
39706impl std::fmt::Debug for AcquireSsrsLeaseContext {
39707    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
39708        let mut debug_struct = f.debug_struct("AcquireSsrsLeaseContext");
39709        debug_struct.field("setup_login", &self.setup_login);
39710        debug_struct.field("service_login", &self.service_login);
39711        debug_struct.field("report_database", &self.report_database);
39712        debug_struct.field("duration", &self.duration);
39713        if !self._unknown_fields.is_empty() {
39714            debug_struct.field("_unknown_fields", &self._unknown_fields);
39715        }
39716        debug_struct.finish()
39717    }
39718}
39719
39720#[derive(Clone, Default, PartialEq)]
39721#[non_exhaustive]
39722pub struct SqlSslCertsDeleteRequest {
39723    /// Cloud SQL instance ID. This does not include the project ID.
39724    pub instance: std::string::String,
39725
39726    /// Project ID of the project that contains the instance.
39727    pub project: std::string::String,
39728
39729    /// Sha1 FingerPrint.
39730    pub sha1_fingerprint: std::string::String,
39731
39732    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
39733}
39734
39735impl SqlSslCertsDeleteRequest {
39736    pub fn new() -> Self {
39737        std::default::Default::default()
39738    }
39739
39740    /// Sets the value of [instance][crate::model::SqlSslCertsDeleteRequest::instance].
39741    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
39742        self.instance = v.into();
39743        self
39744    }
39745
39746    /// Sets the value of [project][crate::model::SqlSslCertsDeleteRequest::project].
39747    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
39748        self.project = v.into();
39749        self
39750    }
39751
39752    /// Sets the value of [sha1_fingerprint][crate::model::SqlSslCertsDeleteRequest::sha1_fingerprint].
39753    pub fn set_sha1_fingerprint<T: std::convert::Into<std::string::String>>(
39754        mut self,
39755        v: T,
39756    ) -> Self {
39757        self.sha1_fingerprint = v.into();
39758        self
39759    }
39760}
39761
39762impl wkt::message::Message for SqlSslCertsDeleteRequest {
39763    fn typename() -> &'static str {
39764        "type.googleapis.com/google.cloud.sql.v1.SqlSslCertsDeleteRequest"
39765    }
39766}
39767
39768#[doc(hidden)]
39769impl<'de> serde::de::Deserialize<'de> for SqlSslCertsDeleteRequest {
39770    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
39771    where
39772        D: serde::Deserializer<'de>,
39773    {
39774        #[allow(non_camel_case_types)]
39775        #[doc(hidden)]
39776        #[derive(PartialEq, Eq, Hash)]
39777        enum __FieldTag {
39778            __instance,
39779            __project,
39780            __sha1_fingerprint,
39781            Unknown(std::string::String),
39782        }
39783        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
39784            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
39785            where
39786                D: serde::Deserializer<'de>,
39787            {
39788                struct Visitor;
39789                impl<'de> serde::de::Visitor<'de> for Visitor {
39790                    type Value = __FieldTag;
39791                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
39792                        formatter.write_str("a field name for SqlSslCertsDeleteRequest")
39793                    }
39794                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
39795                    where
39796                        E: serde::de::Error,
39797                    {
39798                        use std::result::Result::Ok;
39799                        use std::string::ToString;
39800                        match value {
39801                            "instance" => Ok(__FieldTag::__instance),
39802                            "project" => Ok(__FieldTag::__project),
39803                            "sha1Fingerprint" => Ok(__FieldTag::__sha1_fingerprint),
39804                            "sha1_fingerprint" => Ok(__FieldTag::__sha1_fingerprint),
39805                            _ => Ok(__FieldTag::Unknown(value.to_string())),
39806                        }
39807                    }
39808                }
39809                deserializer.deserialize_identifier(Visitor)
39810            }
39811        }
39812        struct Visitor;
39813        impl<'de> serde::de::Visitor<'de> for Visitor {
39814            type Value = SqlSslCertsDeleteRequest;
39815            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
39816                formatter.write_str("struct SqlSslCertsDeleteRequest")
39817            }
39818            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
39819            where
39820                A: serde::de::MapAccess<'de>,
39821            {
39822                #[allow(unused_imports)]
39823                use serde::de::Error;
39824                use std::option::Option::Some;
39825                let mut fields = std::collections::HashSet::new();
39826                let mut result = Self::Value::new();
39827                while let Some(tag) = map.next_key::<__FieldTag>()? {
39828                    #[allow(clippy::match_single_binding)]
39829                    match tag {
39830                        __FieldTag::__instance => {
39831                            if !fields.insert(__FieldTag::__instance) {
39832                                return std::result::Result::Err(A::Error::duplicate_field(
39833                                    "multiple values for instance",
39834                                ));
39835                            }
39836                            result.instance = map
39837                                .next_value::<std::option::Option<std::string::String>>()?
39838                                .unwrap_or_default();
39839                        }
39840                        __FieldTag::__project => {
39841                            if !fields.insert(__FieldTag::__project) {
39842                                return std::result::Result::Err(A::Error::duplicate_field(
39843                                    "multiple values for project",
39844                                ));
39845                            }
39846                            result.project = map
39847                                .next_value::<std::option::Option<std::string::String>>()?
39848                                .unwrap_or_default();
39849                        }
39850                        __FieldTag::__sha1_fingerprint => {
39851                            if !fields.insert(__FieldTag::__sha1_fingerprint) {
39852                                return std::result::Result::Err(A::Error::duplicate_field(
39853                                    "multiple values for sha1_fingerprint",
39854                                ));
39855                            }
39856                            result.sha1_fingerprint = map
39857                                .next_value::<std::option::Option<std::string::String>>()?
39858                                .unwrap_or_default();
39859                        }
39860                        __FieldTag::Unknown(key) => {
39861                            let value = map.next_value::<serde_json::Value>()?;
39862                            result._unknown_fields.insert(key, value);
39863                        }
39864                    }
39865                }
39866                std::result::Result::Ok(result)
39867            }
39868        }
39869        deserializer.deserialize_any(Visitor)
39870    }
39871}
39872
39873#[doc(hidden)]
39874impl serde::ser::Serialize for SqlSslCertsDeleteRequest {
39875    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
39876    where
39877        S: serde::ser::Serializer,
39878    {
39879        use serde::ser::SerializeMap;
39880        #[allow(unused_imports)]
39881        use std::option::Option::Some;
39882        let mut state = serializer.serialize_map(std::option::Option::None)?;
39883        if !self.instance.is_empty() {
39884            state.serialize_entry("instance", &self.instance)?;
39885        }
39886        if !self.project.is_empty() {
39887            state.serialize_entry("project", &self.project)?;
39888        }
39889        if !self.sha1_fingerprint.is_empty() {
39890            state.serialize_entry("sha1Fingerprint", &self.sha1_fingerprint)?;
39891        }
39892        if !self._unknown_fields.is_empty() {
39893            for (key, value) in self._unknown_fields.iter() {
39894                state.serialize_entry(key, &value)?;
39895            }
39896        }
39897        state.end()
39898    }
39899}
39900
39901impl std::fmt::Debug for SqlSslCertsDeleteRequest {
39902    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
39903        let mut debug_struct = f.debug_struct("SqlSslCertsDeleteRequest");
39904        debug_struct.field("instance", &self.instance);
39905        debug_struct.field("project", &self.project);
39906        debug_struct.field("sha1_fingerprint", &self.sha1_fingerprint);
39907        if !self._unknown_fields.is_empty() {
39908            debug_struct.field("_unknown_fields", &self._unknown_fields);
39909        }
39910        debug_struct.finish()
39911    }
39912}
39913
39914#[derive(Clone, Default, PartialEq)]
39915#[non_exhaustive]
39916pub struct SqlSslCertsGetRequest {
39917    /// Cloud SQL instance ID. This does not include the project ID.
39918    pub instance: std::string::String,
39919
39920    /// Project ID of the project that contains the instance.
39921    pub project: std::string::String,
39922
39923    /// Sha1 FingerPrint.
39924    pub sha1_fingerprint: std::string::String,
39925
39926    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
39927}
39928
39929impl SqlSslCertsGetRequest {
39930    pub fn new() -> Self {
39931        std::default::Default::default()
39932    }
39933
39934    /// Sets the value of [instance][crate::model::SqlSslCertsGetRequest::instance].
39935    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
39936        self.instance = v.into();
39937        self
39938    }
39939
39940    /// Sets the value of [project][crate::model::SqlSslCertsGetRequest::project].
39941    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
39942        self.project = v.into();
39943        self
39944    }
39945
39946    /// Sets the value of [sha1_fingerprint][crate::model::SqlSslCertsGetRequest::sha1_fingerprint].
39947    pub fn set_sha1_fingerprint<T: std::convert::Into<std::string::String>>(
39948        mut self,
39949        v: T,
39950    ) -> Self {
39951        self.sha1_fingerprint = v.into();
39952        self
39953    }
39954}
39955
39956impl wkt::message::Message for SqlSslCertsGetRequest {
39957    fn typename() -> &'static str {
39958        "type.googleapis.com/google.cloud.sql.v1.SqlSslCertsGetRequest"
39959    }
39960}
39961
39962#[doc(hidden)]
39963impl<'de> serde::de::Deserialize<'de> for SqlSslCertsGetRequest {
39964    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
39965    where
39966        D: serde::Deserializer<'de>,
39967    {
39968        #[allow(non_camel_case_types)]
39969        #[doc(hidden)]
39970        #[derive(PartialEq, Eq, Hash)]
39971        enum __FieldTag {
39972            __instance,
39973            __project,
39974            __sha1_fingerprint,
39975            Unknown(std::string::String),
39976        }
39977        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
39978            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
39979            where
39980                D: serde::Deserializer<'de>,
39981            {
39982                struct Visitor;
39983                impl<'de> serde::de::Visitor<'de> for Visitor {
39984                    type Value = __FieldTag;
39985                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
39986                        formatter.write_str("a field name for SqlSslCertsGetRequest")
39987                    }
39988                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
39989                    where
39990                        E: serde::de::Error,
39991                    {
39992                        use std::result::Result::Ok;
39993                        use std::string::ToString;
39994                        match value {
39995                            "instance" => Ok(__FieldTag::__instance),
39996                            "project" => Ok(__FieldTag::__project),
39997                            "sha1Fingerprint" => Ok(__FieldTag::__sha1_fingerprint),
39998                            "sha1_fingerprint" => Ok(__FieldTag::__sha1_fingerprint),
39999                            _ => Ok(__FieldTag::Unknown(value.to_string())),
40000                        }
40001                    }
40002                }
40003                deserializer.deserialize_identifier(Visitor)
40004            }
40005        }
40006        struct Visitor;
40007        impl<'de> serde::de::Visitor<'de> for Visitor {
40008            type Value = SqlSslCertsGetRequest;
40009            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
40010                formatter.write_str("struct SqlSslCertsGetRequest")
40011            }
40012            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
40013            where
40014                A: serde::de::MapAccess<'de>,
40015            {
40016                #[allow(unused_imports)]
40017                use serde::de::Error;
40018                use std::option::Option::Some;
40019                let mut fields = std::collections::HashSet::new();
40020                let mut result = Self::Value::new();
40021                while let Some(tag) = map.next_key::<__FieldTag>()? {
40022                    #[allow(clippy::match_single_binding)]
40023                    match tag {
40024                        __FieldTag::__instance => {
40025                            if !fields.insert(__FieldTag::__instance) {
40026                                return std::result::Result::Err(A::Error::duplicate_field(
40027                                    "multiple values for instance",
40028                                ));
40029                            }
40030                            result.instance = map
40031                                .next_value::<std::option::Option<std::string::String>>()?
40032                                .unwrap_or_default();
40033                        }
40034                        __FieldTag::__project => {
40035                            if !fields.insert(__FieldTag::__project) {
40036                                return std::result::Result::Err(A::Error::duplicate_field(
40037                                    "multiple values for project",
40038                                ));
40039                            }
40040                            result.project = map
40041                                .next_value::<std::option::Option<std::string::String>>()?
40042                                .unwrap_or_default();
40043                        }
40044                        __FieldTag::__sha1_fingerprint => {
40045                            if !fields.insert(__FieldTag::__sha1_fingerprint) {
40046                                return std::result::Result::Err(A::Error::duplicate_field(
40047                                    "multiple values for sha1_fingerprint",
40048                                ));
40049                            }
40050                            result.sha1_fingerprint = map
40051                                .next_value::<std::option::Option<std::string::String>>()?
40052                                .unwrap_or_default();
40053                        }
40054                        __FieldTag::Unknown(key) => {
40055                            let value = map.next_value::<serde_json::Value>()?;
40056                            result._unknown_fields.insert(key, value);
40057                        }
40058                    }
40059                }
40060                std::result::Result::Ok(result)
40061            }
40062        }
40063        deserializer.deserialize_any(Visitor)
40064    }
40065}
40066
40067#[doc(hidden)]
40068impl serde::ser::Serialize for SqlSslCertsGetRequest {
40069    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
40070    where
40071        S: serde::ser::Serializer,
40072    {
40073        use serde::ser::SerializeMap;
40074        #[allow(unused_imports)]
40075        use std::option::Option::Some;
40076        let mut state = serializer.serialize_map(std::option::Option::None)?;
40077        if !self.instance.is_empty() {
40078            state.serialize_entry("instance", &self.instance)?;
40079        }
40080        if !self.project.is_empty() {
40081            state.serialize_entry("project", &self.project)?;
40082        }
40083        if !self.sha1_fingerprint.is_empty() {
40084            state.serialize_entry("sha1Fingerprint", &self.sha1_fingerprint)?;
40085        }
40086        if !self._unknown_fields.is_empty() {
40087            for (key, value) in self._unknown_fields.iter() {
40088                state.serialize_entry(key, &value)?;
40089            }
40090        }
40091        state.end()
40092    }
40093}
40094
40095impl std::fmt::Debug for SqlSslCertsGetRequest {
40096    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
40097        let mut debug_struct = f.debug_struct("SqlSslCertsGetRequest");
40098        debug_struct.field("instance", &self.instance);
40099        debug_struct.field("project", &self.project);
40100        debug_struct.field("sha1_fingerprint", &self.sha1_fingerprint);
40101        if !self._unknown_fields.is_empty() {
40102            debug_struct.field("_unknown_fields", &self._unknown_fields);
40103        }
40104        debug_struct.finish()
40105    }
40106}
40107
40108#[derive(Clone, Default, PartialEq)]
40109#[non_exhaustive]
40110pub struct SqlSslCertsInsertRequest {
40111    /// Cloud SQL instance ID. This does not include the project ID.
40112    pub instance: std::string::String,
40113
40114    /// Project ID of the project that contains the instance.
40115    pub project: std::string::String,
40116
40117    pub body: std::option::Option<crate::model::SslCertsInsertRequest>,
40118
40119    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
40120}
40121
40122impl SqlSslCertsInsertRequest {
40123    pub fn new() -> Self {
40124        std::default::Default::default()
40125    }
40126
40127    /// Sets the value of [instance][crate::model::SqlSslCertsInsertRequest::instance].
40128    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
40129        self.instance = v.into();
40130        self
40131    }
40132
40133    /// Sets the value of [project][crate::model::SqlSslCertsInsertRequest::project].
40134    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
40135        self.project = v.into();
40136        self
40137    }
40138
40139    /// Sets the value of [body][crate::model::SqlSslCertsInsertRequest::body].
40140    pub fn set_body<T>(mut self, v: T) -> Self
40141    where
40142        T: std::convert::Into<crate::model::SslCertsInsertRequest>,
40143    {
40144        self.body = std::option::Option::Some(v.into());
40145        self
40146    }
40147
40148    /// Sets or clears the value of [body][crate::model::SqlSslCertsInsertRequest::body].
40149    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
40150    where
40151        T: std::convert::Into<crate::model::SslCertsInsertRequest>,
40152    {
40153        self.body = v.map(|x| x.into());
40154        self
40155    }
40156}
40157
40158impl wkt::message::Message for SqlSslCertsInsertRequest {
40159    fn typename() -> &'static str {
40160        "type.googleapis.com/google.cloud.sql.v1.SqlSslCertsInsertRequest"
40161    }
40162}
40163
40164#[doc(hidden)]
40165impl<'de> serde::de::Deserialize<'de> for SqlSslCertsInsertRequest {
40166    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
40167    where
40168        D: serde::Deserializer<'de>,
40169    {
40170        #[allow(non_camel_case_types)]
40171        #[doc(hidden)]
40172        #[derive(PartialEq, Eq, Hash)]
40173        enum __FieldTag {
40174            __instance,
40175            __project,
40176            __body,
40177            Unknown(std::string::String),
40178        }
40179        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
40180            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
40181            where
40182                D: serde::Deserializer<'de>,
40183            {
40184                struct Visitor;
40185                impl<'de> serde::de::Visitor<'de> for Visitor {
40186                    type Value = __FieldTag;
40187                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
40188                        formatter.write_str("a field name for SqlSslCertsInsertRequest")
40189                    }
40190                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
40191                    where
40192                        E: serde::de::Error,
40193                    {
40194                        use std::result::Result::Ok;
40195                        use std::string::ToString;
40196                        match value {
40197                            "instance" => Ok(__FieldTag::__instance),
40198                            "project" => Ok(__FieldTag::__project),
40199                            "body" => Ok(__FieldTag::__body),
40200                            _ => Ok(__FieldTag::Unknown(value.to_string())),
40201                        }
40202                    }
40203                }
40204                deserializer.deserialize_identifier(Visitor)
40205            }
40206        }
40207        struct Visitor;
40208        impl<'de> serde::de::Visitor<'de> for Visitor {
40209            type Value = SqlSslCertsInsertRequest;
40210            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
40211                formatter.write_str("struct SqlSslCertsInsertRequest")
40212            }
40213            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
40214            where
40215                A: serde::de::MapAccess<'de>,
40216            {
40217                #[allow(unused_imports)]
40218                use serde::de::Error;
40219                use std::option::Option::Some;
40220                let mut fields = std::collections::HashSet::new();
40221                let mut result = Self::Value::new();
40222                while let Some(tag) = map.next_key::<__FieldTag>()? {
40223                    #[allow(clippy::match_single_binding)]
40224                    match tag {
40225                        __FieldTag::__instance => {
40226                            if !fields.insert(__FieldTag::__instance) {
40227                                return std::result::Result::Err(A::Error::duplicate_field(
40228                                    "multiple values for instance",
40229                                ));
40230                            }
40231                            result.instance = map
40232                                .next_value::<std::option::Option<std::string::String>>()?
40233                                .unwrap_or_default();
40234                        }
40235                        __FieldTag::__project => {
40236                            if !fields.insert(__FieldTag::__project) {
40237                                return std::result::Result::Err(A::Error::duplicate_field(
40238                                    "multiple values for project",
40239                                ));
40240                            }
40241                            result.project = map
40242                                .next_value::<std::option::Option<std::string::String>>()?
40243                                .unwrap_or_default();
40244                        }
40245                        __FieldTag::__body => {
40246                            if !fields.insert(__FieldTag::__body) {
40247                                return std::result::Result::Err(A::Error::duplicate_field(
40248                                    "multiple values for body",
40249                                ));
40250                            }
40251                            result.body = map.next_value::<std::option::Option<crate::model::SslCertsInsertRequest>>()?
40252                                ;
40253                        }
40254                        __FieldTag::Unknown(key) => {
40255                            let value = map.next_value::<serde_json::Value>()?;
40256                            result._unknown_fields.insert(key, value);
40257                        }
40258                    }
40259                }
40260                std::result::Result::Ok(result)
40261            }
40262        }
40263        deserializer.deserialize_any(Visitor)
40264    }
40265}
40266
40267#[doc(hidden)]
40268impl serde::ser::Serialize for SqlSslCertsInsertRequest {
40269    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
40270    where
40271        S: serde::ser::Serializer,
40272    {
40273        use serde::ser::SerializeMap;
40274        #[allow(unused_imports)]
40275        use std::option::Option::Some;
40276        let mut state = serializer.serialize_map(std::option::Option::None)?;
40277        if !self.instance.is_empty() {
40278            state.serialize_entry("instance", &self.instance)?;
40279        }
40280        if !self.project.is_empty() {
40281            state.serialize_entry("project", &self.project)?;
40282        }
40283        if self.body.is_some() {
40284            state.serialize_entry("body", &self.body)?;
40285        }
40286        if !self._unknown_fields.is_empty() {
40287            for (key, value) in self._unknown_fields.iter() {
40288                state.serialize_entry(key, &value)?;
40289            }
40290        }
40291        state.end()
40292    }
40293}
40294
40295impl std::fmt::Debug for SqlSslCertsInsertRequest {
40296    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
40297        let mut debug_struct = f.debug_struct("SqlSslCertsInsertRequest");
40298        debug_struct.field("instance", &self.instance);
40299        debug_struct.field("project", &self.project);
40300        debug_struct.field("body", &self.body);
40301        if !self._unknown_fields.is_empty() {
40302            debug_struct.field("_unknown_fields", &self._unknown_fields);
40303        }
40304        debug_struct.finish()
40305    }
40306}
40307
40308#[derive(Clone, Default, PartialEq)]
40309#[non_exhaustive]
40310pub struct SqlSslCertsListRequest {
40311    /// Cloud SQL instance ID. This does not include the project ID.
40312    pub instance: std::string::String,
40313
40314    /// Project ID of the project that contains the instance.
40315    pub project: std::string::String,
40316
40317    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
40318}
40319
40320impl SqlSslCertsListRequest {
40321    pub fn new() -> Self {
40322        std::default::Default::default()
40323    }
40324
40325    /// Sets the value of [instance][crate::model::SqlSslCertsListRequest::instance].
40326    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
40327        self.instance = v.into();
40328        self
40329    }
40330
40331    /// Sets the value of [project][crate::model::SqlSslCertsListRequest::project].
40332    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
40333        self.project = v.into();
40334        self
40335    }
40336}
40337
40338impl wkt::message::Message for SqlSslCertsListRequest {
40339    fn typename() -> &'static str {
40340        "type.googleapis.com/google.cloud.sql.v1.SqlSslCertsListRequest"
40341    }
40342}
40343
40344#[doc(hidden)]
40345impl<'de> serde::de::Deserialize<'de> for SqlSslCertsListRequest {
40346    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
40347    where
40348        D: serde::Deserializer<'de>,
40349    {
40350        #[allow(non_camel_case_types)]
40351        #[doc(hidden)]
40352        #[derive(PartialEq, Eq, Hash)]
40353        enum __FieldTag {
40354            __instance,
40355            __project,
40356            Unknown(std::string::String),
40357        }
40358        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
40359            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
40360            where
40361                D: serde::Deserializer<'de>,
40362            {
40363                struct Visitor;
40364                impl<'de> serde::de::Visitor<'de> for Visitor {
40365                    type Value = __FieldTag;
40366                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
40367                        formatter.write_str("a field name for SqlSslCertsListRequest")
40368                    }
40369                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
40370                    where
40371                        E: serde::de::Error,
40372                    {
40373                        use std::result::Result::Ok;
40374                        use std::string::ToString;
40375                        match value {
40376                            "instance" => Ok(__FieldTag::__instance),
40377                            "project" => Ok(__FieldTag::__project),
40378                            _ => Ok(__FieldTag::Unknown(value.to_string())),
40379                        }
40380                    }
40381                }
40382                deserializer.deserialize_identifier(Visitor)
40383            }
40384        }
40385        struct Visitor;
40386        impl<'de> serde::de::Visitor<'de> for Visitor {
40387            type Value = SqlSslCertsListRequest;
40388            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
40389                formatter.write_str("struct SqlSslCertsListRequest")
40390            }
40391            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
40392            where
40393                A: serde::de::MapAccess<'de>,
40394            {
40395                #[allow(unused_imports)]
40396                use serde::de::Error;
40397                use std::option::Option::Some;
40398                let mut fields = std::collections::HashSet::new();
40399                let mut result = Self::Value::new();
40400                while let Some(tag) = map.next_key::<__FieldTag>()? {
40401                    #[allow(clippy::match_single_binding)]
40402                    match tag {
40403                        __FieldTag::__instance => {
40404                            if !fields.insert(__FieldTag::__instance) {
40405                                return std::result::Result::Err(A::Error::duplicate_field(
40406                                    "multiple values for instance",
40407                                ));
40408                            }
40409                            result.instance = map
40410                                .next_value::<std::option::Option<std::string::String>>()?
40411                                .unwrap_or_default();
40412                        }
40413                        __FieldTag::__project => {
40414                            if !fields.insert(__FieldTag::__project) {
40415                                return std::result::Result::Err(A::Error::duplicate_field(
40416                                    "multiple values for project",
40417                                ));
40418                            }
40419                            result.project = map
40420                                .next_value::<std::option::Option<std::string::String>>()?
40421                                .unwrap_or_default();
40422                        }
40423                        __FieldTag::Unknown(key) => {
40424                            let value = map.next_value::<serde_json::Value>()?;
40425                            result._unknown_fields.insert(key, value);
40426                        }
40427                    }
40428                }
40429                std::result::Result::Ok(result)
40430            }
40431        }
40432        deserializer.deserialize_any(Visitor)
40433    }
40434}
40435
40436#[doc(hidden)]
40437impl serde::ser::Serialize for SqlSslCertsListRequest {
40438    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
40439    where
40440        S: serde::ser::Serializer,
40441    {
40442        use serde::ser::SerializeMap;
40443        #[allow(unused_imports)]
40444        use std::option::Option::Some;
40445        let mut state = serializer.serialize_map(std::option::Option::None)?;
40446        if !self.instance.is_empty() {
40447            state.serialize_entry("instance", &self.instance)?;
40448        }
40449        if !self.project.is_empty() {
40450            state.serialize_entry("project", &self.project)?;
40451        }
40452        if !self._unknown_fields.is_empty() {
40453            for (key, value) in self._unknown_fields.iter() {
40454                state.serialize_entry(key, &value)?;
40455            }
40456        }
40457        state.end()
40458    }
40459}
40460
40461impl std::fmt::Debug for SqlSslCertsListRequest {
40462    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
40463        let mut debug_struct = f.debug_struct("SqlSslCertsListRequest");
40464        debug_struct.field("instance", &self.instance);
40465        debug_struct.field("project", &self.project);
40466        if !self._unknown_fields.is_empty() {
40467            debug_struct.field("_unknown_fields", &self._unknown_fields);
40468        }
40469        debug_struct.finish()
40470    }
40471}
40472
40473/// SslCerts insert request.
40474#[derive(Clone, Default, PartialEq)]
40475#[non_exhaustive]
40476pub struct SslCertsInsertRequest {
40477    /// User supplied name.  Must be a distinct name from the other certificates
40478    /// for this instance.
40479    pub common_name: std::string::String,
40480
40481    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
40482}
40483
40484impl SslCertsInsertRequest {
40485    pub fn new() -> Self {
40486        std::default::Default::default()
40487    }
40488
40489    /// Sets the value of [common_name][crate::model::SslCertsInsertRequest::common_name].
40490    pub fn set_common_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
40491        self.common_name = v.into();
40492        self
40493    }
40494}
40495
40496impl wkt::message::Message for SslCertsInsertRequest {
40497    fn typename() -> &'static str {
40498        "type.googleapis.com/google.cloud.sql.v1.SslCertsInsertRequest"
40499    }
40500}
40501
40502#[doc(hidden)]
40503impl<'de> serde::de::Deserialize<'de> for SslCertsInsertRequest {
40504    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
40505    where
40506        D: serde::Deserializer<'de>,
40507    {
40508        #[allow(non_camel_case_types)]
40509        #[doc(hidden)]
40510        #[derive(PartialEq, Eq, Hash)]
40511        enum __FieldTag {
40512            __common_name,
40513            Unknown(std::string::String),
40514        }
40515        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
40516            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
40517            where
40518                D: serde::Deserializer<'de>,
40519            {
40520                struct Visitor;
40521                impl<'de> serde::de::Visitor<'de> for Visitor {
40522                    type Value = __FieldTag;
40523                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
40524                        formatter.write_str("a field name for SslCertsInsertRequest")
40525                    }
40526                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
40527                    where
40528                        E: serde::de::Error,
40529                    {
40530                        use std::result::Result::Ok;
40531                        use std::string::ToString;
40532                        match value {
40533                            "commonName" => Ok(__FieldTag::__common_name),
40534                            "common_name" => Ok(__FieldTag::__common_name),
40535                            _ => Ok(__FieldTag::Unknown(value.to_string())),
40536                        }
40537                    }
40538                }
40539                deserializer.deserialize_identifier(Visitor)
40540            }
40541        }
40542        struct Visitor;
40543        impl<'de> serde::de::Visitor<'de> for Visitor {
40544            type Value = SslCertsInsertRequest;
40545            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
40546                formatter.write_str("struct SslCertsInsertRequest")
40547            }
40548            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
40549            where
40550                A: serde::de::MapAccess<'de>,
40551            {
40552                #[allow(unused_imports)]
40553                use serde::de::Error;
40554                use std::option::Option::Some;
40555                let mut fields = std::collections::HashSet::new();
40556                let mut result = Self::Value::new();
40557                while let Some(tag) = map.next_key::<__FieldTag>()? {
40558                    #[allow(clippy::match_single_binding)]
40559                    match tag {
40560                        __FieldTag::__common_name => {
40561                            if !fields.insert(__FieldTag::__common_name) {
40562                                return std::result::Result::Err(A::Error::duplicate_field(
40563                                    "multiple values for common_name",
40564                                ));
40565                            }
40566                            result.common_name = map
40567                                .next_value::<std::option::Option<std::string::String>>()?
40568                                .unwrap_or_default();
40569                        }
40570                        __FieldTag::Unknown(key) => {
40571                            let value = map.next_value::<serde_json::Value>()?;
40572                            result._unknown_fields.insert(key, value);
40573                        }
40574                    }
40575                }
40576                std::result::Result::Ok(result)
40577            }
40578        }
40579        deserializer.deserialize_any(Visitor)
40580    }
40581}
40582
40583#[doc(hidden)]
40584impl serde::ser::Serialize for SslCertsInsertRequest {
40585    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
40586    where
40587        S: serde::ser::Serializer,
40588    {
40589        use serde::ser::SerializeMap;
40590        #[allow(unused_imports)]
40591        use std::option::Option::Some;
40592        let mut state = serializer.serialize_map(std::option::Option::None)?;
40593        if !self.common_name.is_empty() {
40594            state.serialize_entry("commonName", &self.common_name)?;
40595        }
40596        if !self._unknown_fields.is_empty() {
40597            for (key, value) in self._unknown_fields.iter() {
40598                state.serialize_entry(key, &value)?;
40599            }
40600        }
40601        state.end()
40602    }
40603}
40604
40605impl std::fmt::Debug for SslCertsInsertRequest {
40606    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
40607        let mut debug_struct = f.debug_struct("SslCertsInsertRequest");
40608        debug_struct.field("common_name", &self.common_name);
40609        if !self._unknown_fields.is_empty() {
40610            debug_struct.field("_unknown_fields", &self._unknown_fields);
40611        }
40612        debug_struct.finish()
40613    }
40614}
40615
40616/// SslCert insert response.
40617#[derive(Clone, Default, PartialEq)]
40618#[non_exhaustive]
40619pub struct SslCertsInsertResponse {
40620    /// This is always `sql#sslCertsInsert`.
40621    pub kind: std::string::String,
40622
40623    /// The operation to track the ssl certs insert request.
40624    pub operation: std::option::Option<crate::model::Operation>,
40625
40626    /// The server Certificate Authority's certificate.  If this is missing you can
40627    /// force a new one to be generated by calling resetSslConfig method on
40628    /// instances resource.
40629    pub server_ca_cert: std::option::Option<crate::model::SslCert>,
40630
40631    /// The new client certificate and private key.
40632    pub client_cert: std::option::Option<crate::model::SslCertDetail>,
40633
40634    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
40635}
40636
40637impl SslCertsInsertResponse {
40638    pub fn new() -> Self {
40639        std::default::Default::default()
40640    }
40641
40642    /// Sets the value of [kind][crate::model::SslCertsInsertResponse::kind].
40643    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
40644        self.kind = v.into();
40645        self
40646    }
40647
40648    /// Sets the value of [operation][crate::model::SslCertsInsertResponse::operation].
40649    pub fn set_operation<T>(mut self, v: T) -> Self
40650    where
40651        T: std::convert::Into<crate::model::Operation>,
40652    {
40653        self.operation = std::option::Option::Some(v.into());
40654        self
40655    }
40656
40657    /// Sets or clears the value of [operation][crate::model::SslCertsInsertResponse::operation].
40658    pub fn set_or_clear_operation<T>(mut self, v: std::option::Option<T>) -> Self
40659    where
40660        T: std::convert::Into<crate::model::Operation>,
40661    {
40662        self.operation = v.map(|x| x.into());
40663        self
40664    }
40665
40666    /// Sets the value of [server_ca_cert][crate::model::SslCertsInsertResponse::server_ca_cert].
40667    pub fn set_server_ca_cert<T>(mut self, v: T) -> Self
40668    where
40669        T: std::convert::Into<crate::model::SslCert>,
40670    {
40671        self.server_ca_cert = std::option::Option::Some(v.into());
40672        self
40673    }
40674
40675    /// Sets or clears the value of [server_ca_cert][crate::model::SslCertsInsertResponse::server_ca_cert].
40676    pub fn set_or_clear_server_ca_cert<T>(mut self, v: std::option::Option<T>) -> Self
40677    where
40678        T: std::convert::Into<crate::model::SslCert>,
40679    {
40680        self.server_ca_cert = v.map(|x| x.into());
40681        self
40682    }
40683
40684    /// Sets the value of [client_cert][crate::model::SslCertsInsertResponse::client_cert].
40685    pub fn set_client_cert<T>(mut self, v: T) -> Self
40686    where
40687        T: std::convert::Into<crate::model::SslCertDetail>,
40688    {
40689        self.client_cert = std::option::Option::Some(v.into());
40690        self
40691    }
40692
40693    /// Sets or clears the value of [client_cert][crate::model::SslCertsInsertResponse::client_cert].
40694    pub fn set_or_clear_client_cert<T>(mut self, v: std::option::Option<T>) -> Self
40695    where
40696        T: std::convert::Into<crate::model::SslCertDetail>,
40697    {
40698        self.client_cert = v.map(|x| x.into());
40699        self
40700    }
40701}
40702
40703impl wkt::message::Message for SslCertsInsertResponse {
40704    fn typename() -> &'static str {
40705        "type.googleapis.com/google.cloud.sql.v1.SslCertsInsertResponse"
40706    }
40707}
40708
40709#[doc(hidden)]
40710impl<'de> serde::de::Deserialize<'de> for SslCertsInsertResponse {
40711    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
40712    where
40713        D: serde::Deserializer<'de>,
40714    {
40715        #[allow(non_camel_case_types)]
40716        #[doc(hidden)]
40717        #[derive(PartialEq, Eq, Hash)]
40718        enum __FieldTag {
40719            __kind,
40720            __operation,
40721            __server_ca_cert,
40722            __client_cert,
40723            Unknown(std::string::String),
40724        }
40725        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
40726            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
40727            where
40728                D: serde::Deserializer<'de>,
40729            {
40730                struct Visitor;
40731                impl<'de> serde::de::Visitor<'de> for Visitor {
40732                    type Value = __FieldTag;
40733                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
40734                        formatter.write_str("a field name for SslCertsInsertResponse")
40735                    }
40736                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
40737                    where
40738                        E: serde::de::Error,
40739                    {
40740                        use std::result::Result::Ok;
40741                        use std::string::ToString;
40742                        match value {
40743                            "kind" => Ok(__FieldTag::__kind),
40744                            "operation" => Ok(__FieldTag::__operation),
40745                            "serverCaCert" => Ok(__FieldTag::__server_ca_cert),
40746                            "server_ca_cert" => Ok(__FieldTag::__server_ca_cert),
40747                            "clientCert" => Ok(__FieldTag::__client_cert),
40748                            "client_cert" => Ok(__FieldTag::__client_cert),
40749                            _ => Ok(__FieldTag::Unknown(value.to_string())),
40750                        }
40751                    }
40752                }
40753                deserializer.deserialize_identifier(Visitor)
40754            }
40755        }
40756        struct Visitor;
40757        impl<'de> serde::de::Visitor<'de> for Visitor {
40758            type Value = SslCertsInsertResponse;
40759            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
40760                formatter.write_str("struct SslCertsInsertResponse")
40761            }
40762            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
40763            where
40764                A: serde::de::MapAccess<'de>,
40765            {
40766                #[allow(unused_imports)]
40767                use serde::de::Error;
40768                use std::option::Option::Some;
40769                let mut fields = std::collections::HashSet::new();
40770                let mut result = Self::Value::new();
40771                while let Some(tag) = map.next_key::<__FieldTag>()? {
40772                    #[allow(clippy::match_single_binding)]
40773                    match tag {
40774                        __FieldTag::__kind => {
40775                            if !fields.insert(__FieldTag::__kind) {
40776                                return std::result::Result::Err(A::Error::duplicate_field(
40777                                    "multiple values for kind",
40778                                ));
40779                            }
40780                            result.kind = map
40781                                .next_value::<std::option::Option<std::string::String>>()?
40782                                .unwrap_or_default();
40783                        }
40784                        __FieldTag::__operation => {
40785                            if !fields.insert(__FieldTag::__operation) {
40786                                return std::result::Result::Err(A::Error::duplicate_field(
40787                                    "multiple values for operation",
40788                                ));
40789                            }
40790                            result.operation =
40791                                map.next_value::<std::option::Option<crate::model::Operation>>()?;
40792                        }
40793                        __FieldTag::__server_ca_cert => {
40794                            if !fields.insert(__FieldTag::__server_ca_cert) {
40795                                return std::result::Result::Err(A::Error::duplicate_field(
40796                                    "multiple values for server_ca_cert",
40797                                ));
40798                            }
40799                            result.server_ca_cert =
40800                                map.next_value::<std::option::Option<crate::model::SslCert>>()?;
40801                        }
40802                        __FieldTag::__client_cert => {
40803                            if !fields.insert(__FieldTag::__client_cert) {
40804                                return std::result::Result::Err(A::Error::duplicate_field(
40805                                    "multiple values for client_cert",
40806                                ));
40807                            }
40808                            result.client_cert = map
40809                                .next_value::<std::option::Option<crate::model::SslCertDetail>>()?;
40810                        }
40811                        __FieldTag::Unknown(key) => {
40812                            let value = map.next_value::<serde_json::Value>()?;
40813                            result._unknown_fields.insert(key, value);
40814                        }
40815                    }
40816                }
40817                std::result::Result::Ok(result)
40818            }
40819        }
40820        deserializer.deserialize_any(Visitor)
40821    }
40822}
40823
40824#[doc(hidden)]
40825impl serde::ser::Serialize for SslCertsInsertResponse {
40826    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
40827    where
40828        S: serde::ser::Serializer,
40829    {
40830        use serde::ser::SerializeMap;
40831        #[allow(unused_imports)]
40832        use std::option::Option::Some;
40833        let mut state = serializer.serialize_map(std::option::Option::None)?;
40834        if !self.kind.is_empty() {
40835            state.serialize_entry("kind", &self.kind)?;
40836        }
40837        if self.operation.is_some() {
40838            state.serialize_entry("operation", &self.operation)?;
40839        }
40840        if self.server_ca_cert.is_some() {
40841            state.serialize_entry("serverCaCert", &self.server_ca_cert)?;
40842        }
40843        if self.client_cert.is_some() {
40844            state.serialize_entry("clientCert", &self.client_cert)?;
40845        }
40846        if !self._unknown_fields.is_empty() {
40847            for (key, value) in self._unknown_fields.iter() {
40848                state.serialize_entry(key, &value)?;
40849            }
40850        }
40851        state.end()
40852    }
40853}
40854
40855impl std::fmt::Debug for SslCertsInsertResponse {
40856    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
40857        let mut debug_struct = f.debug_struct("SslCertsInsertResponse");
40858        debug_struct.field("kind", &self.kind);
40859        debug_struct.field("operation", &self.operation);
40860        debug_struct.field("server_ca_cert", &self.server_ca_cert);
40861        debug_struct.field("client_cert", &self.client_cert);
40862        if !self._unknown_fields.is_empty() {
40863            debug_struct.field("_unknown_fields", &self._unknown_fields);
40864        }
40865        debug_struct.finish()
40866    }
40867}
40868
40869/// SslCerts list response.
40870#[derive(Clone, Default, PartialEq)]
40871#[non_exhaustive]
40872pub struct SslCertsListResponse {
40873    /// This is always `sql#sslCertsList`.
40874    pub kind: std::string::String,
40875
40876    /// List of client certificates for the instance.
40877    pub items: std::vec::Vec<crate::model::SslCert>,
40878
40879    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
40880}
40881
40882impl SslCertsListResponse {
40883    pub fn new() -> Self {
40884        std::default::Default::default()
40885    }
40886
40887    /// Sets the value of [kind][crate::model::SslCertsListResponse::kind].
40888    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
40889        self.kind = v.into();
40890        self
40891    }
40892
40893    /// Sets the value of [items][crate::model::SslCertsListResponse::items].
40894    pub fn set_items<T, V>(mut self, v: T) -> Self
40895    where
40896        T: std::iter::IntoIterator<Item = V>,
40897        V: std::convert::Into<crate::model::SslCert>,
40898    {
40899        use std::iter::Iterator;
40900        self.items = v.into_iter().map(|i| i.into()).collect();
40901        self
40902    }
40903}
40904
40905impl wkt::message::Message for SslCertsListResponse {
40906    fn typename() -> &'static str {
40907        "type.googleapis.com/google.cloud.sql.v1.SslCertsListResponse"
40908    }
40909}
40910
40911#[doc(hidden)]
40912impl<'de> serde::de::Deserialize<'de> for SslCertsListResponse {
40913    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
40914    where
40915        D: serde::Deserializer<'de>,
40916    {
40917        #[allow(non_camel_case_types)]
40918        #[doc(hidden)]
40919        #[derive(PartialEq, Eq, Hash)]
40920        enum __FieldTag {
40921            __kind,
40922            __items,
40923            Unknown(std::string::String),
40924        }
40925        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
40926            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
40927            where
40928                D: serde::Deserializer<'de>,
40929            {
40930                struct Visitor;
40931                impl<'de> serde::de::Visitor<'de> for Visitor {
40932                    type Value = __FieldTag;
40933                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
40934                        formatter.write_str("a field name for SslCertsListResponse")
40935                    }
40936                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
40937                    where
40938                        E: serde::de::Error,
40939                    {
40940                        use std::result::Result::Ok;
40941                        use std::string::ToString;
40942                        match value {
40943                            "kind" => Ok(__FieldTag::__kind),
40944                            "items" => Ok(__FieldTag::__items),
40945                            _ => Ok(__FieldTag::Unknown(value.to_string())),
40946                        }
40947                    }
40948                }
40949                deserializer.deserialize_identifier(Visitor)
40950            }
40951        }
40952        struct Visitor;
40953        impl<'de> serde::de::Visitor<'de> for Visitor {
40954            type Value = SslCertsListResponse;
40955            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
40956                formatter.write_str("struct SslCertsListResponse")
40957            }
40958            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
40959            where
40960                A: serde::de::MapAccess<'de>,
40961            {
40962                #[allow(unused_imports)]
40963                use serde::de::Error;
40964                use std::option::Option::Some;
40965                let mut fields = std::collections::HashSet::new();
40966                let mut result = Self::Value::new();
40967                while let Some(tag) = map.next_key::<__FieldTag>()? {
40968                    #[allow(clippy::match_single_binding)]
40969                    match tag {
40970                        __FieldTag::__kind => {
40971                            if !fields.insert(__FieldTag::__kind) {
40972                                return std::result::Result::Err(A::Error::duplicate_field(
40973                                    "multiple values for kind",
40974                                ));
40975                            }
40976                            result.kind = map
40977                                .next_value::<std::option::Option<std::string::String>>()?
40978                                .unwrap_or_default();
40979                        }
40980                        __FieldTag::__items => {
40981                            if !fields.insert(__FieldTag::__items) {
40982                                return std::result::Result::Err(A::Error::duplicate_field(
40983                                    "multiple values for items",
40984                                ));
40985                            }
40986                            result.items = map.next_value::<std::option::Option<std::vec::Vec<crate::model::SslCert>>>()?.unwrap_or_default();
40987                        }
40988                        __FieldTag::Unknown(key) => {
40989                            let value = map.next_value::<serde_json::Value>()?;
40990                            result._unknown_fields.insert(key, value);
40991                        }
40992                    }
40993                }
40994                std::result::Result::Ok(result)
40995            }
40996        }
40997        deserializer.deserialize_any(Visitor)
40998    }
40999}
41000
41001#[doc(hidden)]
41002impl serde::ser::Serialize for SslCertsListResponse {
41003    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
41004    where
41005        S: serde::ser::Serializer,
41006    {
41007        use serde::ser::SerializeMap;
41008        #[allow(unused_imports)]
41009        use std::option::Option::Some;
41010        let mut state = serializer.serialize_map(std::option::Option::None)?;
41011        if !self.kind.is_empty() {
41012            state.serialize_entry("kind", &self.kind)?;
41013        }
41014        if !self.items.is_empty() {
41015            state.serialize_entry("items", &self.items)?;
41016        }
41017        if !self._unknown_fields.is_empty() {
41018            for (key, value) in self._unknown_fields.iter() {
41019                state.serialize_entry(key, &value)?;
41020            }
41021        }
41022        state.end()
41023    }
41024}
41025
41026impl std::fmt::Debug for SslCertsListResponse {
41027    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
41028        let mut debug_struct = f.debug_struct("SslCertsListResponse");
41029        debug_struct.field("kind", &self.kind);
41030        debug_struct.field("items", &self.items);
41031        if !self._unknown_fields.is_empty() {
41032            debug_struct.field("_unknown_fields", &self._unknown_fields);
41033        }
41034        debug_struct.finish()
41035    }
41036}
41037
41038/// Tiers list request.
41039#[derive(Clone, Default, PartialEq)]
41040#[non_exhaustive]
41041pub struct SqlTiersListRequest {
41042    /// Project ID of the project for which to list tiers.
41043    pub project: std::string::String,
41044
41045    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
41046}
41047
41048impl SqlTiersListRequest {
41049    pub fn new() -> Self {
41050        std::default::Default::default()
41051    }
41052
41053    /// Sets the value of [project][crate::model::SqlTiersListRequest::project].
41054    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
41055        self.project = v.into();
41056        self
41057    }
41058}
41059
41060impl wkt::message::Message for SqlTiersListRequest {
41061    fn typename() -> &'static str {
41062        "type.googleapis.com/google.cloud.sql.v1.SqlTiersListRequest"
41063    }
41064}
41065
41066#[doc(hidden)]
41067impl<'de> serde::de::Deserialize<'de> for SqlTiersListRequest {
41068    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
41069    where
41070        D: serde::Deserializer<'de>,
41071    {
41072        #[allow(non_camel_case_types)]
41073        #[doc(hidden)]
41074        #[derive(PartialEq, Eq, Hash)]
41075        enum __FieldTag {
41076            __project,
41077            Unknown(std::string::String),
41078        }
41079        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
41080            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
41081            where
41082                D: serde::Deserializer<'de>,
41083            {
41084                struct Visitor;
41085                impl<'de> serde::de::Visitor<'de> for Visitor {
41086                    type Value = __FieldTag;
41087                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
41088                        formatter.write_str("a field name for SqlTiersListRequest")
41089                    }
41090                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
41091                    where
41092                        E: serde::de::Error,
41093                    {
41094                        use std::result::Result::Ok;
41095                        use std::string::ToString;
41096                        match value {
41097                            "project" => Ok(__FieldTag::__project),
41098                            _ => Ok(__FieldTag::Unknown(value.to_string())),
41099                        }
41100                    }
41101                }
41102                deserializer.deserialize_identifier(Visitor)
41103            }
41104        }
41105        struct Visitor;
41106        impl<'de> serde::de::Visitor<'de> for Visitor {
41107            type Value = SqlTiersListRequest;
41108            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
41109                formatter.write_str("struct SqlTiersListRequest")
41110            }
41111            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
41112            where
41113                A: serde::de::MapAccess<'de>,
41114            {
41115                #[allow(unused_imports)]
41116                use serde::de::Error;
41117                use std::option::Option::Some;
41118                let mut fields = std::collections::HashSet::new();
41119                let mut result = Self::Value::new();
41120                while let Some(tag) = map.next_key::<__FieldTag>()? {
41121                    #[allow(clippy::match_single_binding)]
41122                    match tag {
41123                        __FieldTag::__project => {
41124                            if !fields.insert(__FieldTag::__project) {
41125                                return std::result::Result::Err(A::Error::duplicate_field(
41126                                    "multiple values for project",
41127                                ));
41128                            }
41129                            result.project = map
41130                                .next_value::<std::option::Option<std::string::String>>()?
41131                                .unwrap_or_default();
41132                        }
41133                        __FieldTag::Unknown(key) => {
41134                            let value = map.next_value::<serde_json::Value>()?;
41135                            result._unknown_fields.insert(key, value);
41136                        }
41137                    }
41138                }
41139                std::result::Result::Ok(result)
41140            }
41141        }
41142        deserializer.deserialize_any(Visitor)
41143    }
41144}
41145
41146#[doc(hidden)]
41147impl serde::ser::Serialize for SqlTiersListRequest {
41148    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
41149    where
41150        S: serde::ser::Serializer,
41151    {
41152        use serde::ser::SerializeMap;
41153        #[allow(unused_imports)]
41154        use std::option::Option::Some;
41155        let mut state = serializer.serialize_map(std::option::Option::None)?;
41156        if !self.project.is_empty() {
41157            state.serialize_entry("project", &self.project)?;
41158        }
41159        if !self._unknown_fields.is_empty() {
41160            for (key, value) in self._unknown_fields.iter() {
41161                state.serialize_entry(key, &value)?;
41162            }
41163        }
41164        state.end()
41165    }
41166}
41167
41168impl std::fmt::Debug for SqlTiersListRequest {
41169    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
41170        let mut debug_struct = f.debug_struct("SqlTiersListRequest");
41171        debug_struct.field("project", &self.project);
41172        if !self._unknown_fields.is_empty() {
41173            debug_struct.field("_unknown_fields", &self._unknown_fields);
41174        }
41175        debug_struct.finish()
41176    }
41177}
41178
41179/// Tiers list response.
41180#[derive(Clone, Default, PartialEq)]
41181#[non_exhaustive]
41182pub struct TiersListResponse {
41183    /// This is always `sql#tiersList`.
41184    pub kind: std::string::String,
41185
41186    /// List of tiers.
41187    pub items: std::vec::Vec<crate::model::Tier>,
41188
41189    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
41190}
41191
41192impl TiersListResponse {
41193    pub fn new() -> Self {
41194        std::default::Default::default()
41195    }
41196
41197    /// Sets the value of [kind][crate::model::TiersListResponse::kind].
41198    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
41199        self.kind = v.into();
41200        self
41201    }
41202
41203    /// Sets the value of [items][crate::model::TiersListResponse::items].
41204    pub fn set_items<T, V>(mut self, v: T) -> Self
41205    where
41206        T: std::iter::IntoIterator<Item = V>,
41207        V: std::convert::Into<crate::model::Tier>,
41208    {
41209        use std::iter::Iterator;
41210        self.items = v.into_iter().map(|i| i.into()).collect();
41211        self
41212    }
41213}
41214
41215impl wkt::message::Message for TiersListResponse {
41216    fn typename() -> &'static str {
41217        "type.googleapis.com/google.cloud.sql.v1.TiersListResponse"
41218    }
41219}
41220
41221#[doc(hidden)]
41222impl<'de> serde::de::Deserialize<'de> for TiersListResponse {
41223    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
41224    where
41225        D: serde::Deserializer<'de>,
41226    {
41227        #[allow(non_camel_case_types)]
41228        #[doc(hidden)]
41229        #[derive(PartialEq, Eq, Hash)]
41230        enum __FieldTag {
41231            __kind,
41232            __items,
41233            Unknown(std::string::String),
41234        }
41235        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
41236            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
41237            where
41238                D: serde::Deserializer<'de>,
41239            {
41240                struct Visitor;
41241                impl<'de> serde::de::Visitor<'de> for Visitor {
41242                    type Value = __FieldTag;
41243                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
41244                        formatter.write_str("a field name for TiersListResponse")
41245                    }
41246                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
41247                    where
41248                        E: serde::de::Error,
41249                    {
41250                        use std::result::Result::Ok;
41251                        use std::string::ToString;
41252                        match value {
41253                            "kind" => Ok(__FieldTag::__kind),
41254                            "items" => Ok(__FieldTag::__items),
41255                            _ => Ok(__FieldTag::Unknown(value.to_string())),
41256                        }
41257                    }
41258                }
41259                deserializer.deserialize_identifier(Visitor)
41260            }
41261        }
41262        struct Visitor;
41263        impl<'de> serde::de::Visitor<'de> for Visitor {
41264            type Value = TiersListResponse;
41265            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
41266                formatter.write_str("struct TiersListResponse")
41267            }
41268            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
41269            where
41270                A: serde::de::MapAccess<'de>,
41271            {
41272                #[allow(unused_imports)]
41273                use serde::de::Error;
41274                use std::option::Option::Some;
41275                let mut fields = std::collections::HashSet::new();
41276                let mut result = Self::Value::new();
41277                while let Some(tag) = map.next_key::<__FieldTag>()? {
41278                    #[allow(clippy::match_single_binding)]
41279                    match tag {
41280                        __FieldTag::__kind => {
41281                            if !fields.insert(__FieldTag::__kind) {
41282                                return std::result::Result::Err(A::Error::duplicate_field(
41283                                    "multiple values for kind",
41284                                ));
41285                            }
41286                            result.kind = map
41287                                .next_value::<std::option::Option<std::string::String>>()?
41288                                .unwrap_or_default();
41289                        }
41290                        __FieldTag::__items => {
41291                            if !fields.insert(__FieldTag::__items) {
41292                                return std::result::Result::Err(A::Error::duplicate_field(
41293                                    "multiple values for items",
41294                                ));
41295                            }
41296                            result.items = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Tier>>>()?.unwrap_or_default();
41297                        }
41298                        __FieldTag::Unknown(key) => {
41299                            let value = map.next_value::<serde_json::Value>()?;
41300                            result._unknown_fields.insert(key, value);
41301                        }
41302                    }
41303                }
41304                std::result::Result::Ok(result)
41305            }
41306        }
41307        deserializer.deserialize_any(Visitor)
41308    }
41309}
41310
41311#[doc(hidden)]
41312impl serde::ser::Serialize for TiersListResponse {
41313    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
41314    where
41315        S: serde::ser::Serializer,
41316    {
41317        use serde::ser::SerializeMap;
41318        #[allow(unused_imports)]
41319        use std::option::Option::Some;
41320        let mut state = serializer.serialize_map(std::option::Option::None)?;
41321        if !self.kind.is_empty() {
41322            state.serialize_entry("kind", &self.kind)?;
41323        }
41324        if !self.items.is_empty() {
41325            state.serialize_entry("items", &self.items)?;
41326        }
41327        if !self._unknown_fields.is_empty() {
41328            for (key, value) in self._unknown_fields.iter() {
41329                state.serialize_entry(key, &value)?;
41330            }
41331        }
41332        state.end()
41333    }
41334}
41335
41336impl std::fmt::Debug for TiersListResponse {
41337    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
41338        let mut debug_struct = f.debug_struct("TiersListResponse");
41339        debug_struct.field("kind", &self.kind);
41340        debug_struct.field("items", &self.items);
41341        if !self._unknown_fields.is_empty() {
41342            debug_struct.field("_unknown_fields", &self._unknown_fields);
41343        }
41344        debug_struct.finish()
41345    }
41346}
41347
41348/// A Google Cloud SQL service tier resource.
41349#[derive(Clone, Default, PartialEq)]
41350#[non_exhaustive]
41351pub struct Tier {
41352    /// An identifier for the machine type, for example, `db-custom-1-3840`. For
41353    /// related information, see [Pricing](/sql/pricing).
41354    pub tier: std::string::String,
41355
41356    /// The maximum RAM usage of this tier in bytes.
41357    pub ram: i64,
41358
41359    /// This is always `sql#tier`.
41360    pub kind: std::string::String,
41361
41362    /// The maximum disk size of this tier in bytes.
41363    pub disk_quota: i64,
41364
41365    /// The applicable regions for this tier.
41366    pub region: std::vec::Vec<std::string::String>,
41367
41368    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
41369}
41370
41371impl Tier {
41372    pub fn new() -> Self {
41373        std::default::Default::default()
41374    }
41375
41376    /// Sets the value of [tier][crate::model::Tier::tier].
41377    pub fn set_tier<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
41378        self.tier = v.into();
41379        self
41380    }
41381
41382    /// Sets the value of [ram][crate::model::Tier::ram].
41383    pub fn set_ram<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
41384        self.ram = v.into();
41385        self
41386    }
41387
41388    /// Sets the value of [kind][crate::model::Tier::kind].
41389    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
41390        self.kind = v.into();
41391        self
41392    }
41393
41394    /// Sets the value of [disk_quota][crate::model::Tier::disk_quota].
41395    pub fn set_disk_quota<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
41396        self.disk_quota = v.into();
41397        self
41398    }
41399
41400    /// Sets the value of [region][crate::model::Tier::region].
41401    pub fn set_region<T, V>(mut self, v: T) -> Self
41402    where
41403        T: std::iter::IntoIterator<Item = V>,
41404        V: std::convert::Into<std::string::String>,
41405    {
41406        use std::iter::Iterator;
41407        self.region = v.into_iter().map(|i| i.into()).collect();
41408        self
41409    }
41410}
41411
41412impl wkt::message::Message for Tier {
41413    fn typename() -> &'static str {
41414        "type.googleapis.com/google.cloud.sql.v1.Tier"
41415    }
41416}
41417
41418#[doc(hidden)]
41419impl<'de> serde::de::Deserialize<'de> for Tier {
41420    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
41421    where
41422        D: serde::Deserializer<'de>,
41423    {
41424        #[allow(non_camel_case_types)]
41425        #[doc(hidden)]
41426        #[derive(PartialEq, Eq, Hash)]
41427        enum __FieldTag {
41428            __tier,
41429            __ram,
41430            __kind,
41431            __disk_quota,
41432            __region,
41433            Unknown(std::string::String),
41434        }
41435        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
41436            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
41437            where
41438                D: serde::Deserializer<'de>,
41439            {
41440                struct Visitor;
41441                impl<'de> serde::de::Visitor<'de> for Visitor {
41442                    type Value = __FieldTag;
41443                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
41444                        formatter.write_str("a field name for Tier")
41445                    }
41446                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
41447                    where
41448                        E: serde::de::Error,
41449                    {
41450                        use std::result::Result::Ok;
41451                        use std::string::ToString;
41452                        match value {
41453                            "tier" => Ok(__FieldTag::__tier),
41454                            "RAM" => Ok(__FieldTag::__ram),
41455                            "kind" => Ok(__FieldTag::__kind),
41456                            "DiskQuota" => Ok(__FieldTag::__disk_quota),
41457                            "Disk_Quota" => Ok(__FieldTag::__disk_quota),
41458                            "region" => Ok(__FieldTag::__region),
41459                            _ => Ok(__FieldTag::Unknown(value.to_string())),
41460                        }
41461                    }
41462                }
41463                deserializer.deserialize_identifier(Visitor)
41464            }
41465        }
41466        struct Visitor;
41467        impl<'de> serde::de::Visitor<'de> for Visitor {
41468            type Value = Tier;
41469            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
41470                formatter.write_str("struct Tier")
41471            }
41472            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
41473            where
41474                A: serde::de::MapAccess<'de>,
41475            {
41476                #[allow(unused_imports)]
41477                use serde::de::Error;
41478                use std::option::Option::Some;
41479                let mut fields = std::collections::HashSet::new();
41480                let mut result = Self::Value::new();
41481                while let Some(tag) = map.next_key::<__FieldTag>()? {
41482                    #[allow(clippy::match_single_binding)]
41483                    match tag {
41484                        __FieldTag::__tier => {
41485                            if !fields.insert(__FieldTag::__tier) {
41486                                return std::result::Result::Err(A::Error::duplicate_field(
41487                                    "multiple values for tier",
41488                                ));
41489                            }
41490                            result.tier = map
41491                                .next_value::<std::option::Option<std::string::String>>()?
41492                                .unwrap_or_default();
41493                        }
41494                        __FieldTag::__ram => {
41495                            if !fields.insert(__FieldTag::__ram) {
41496                                return std::result::Result::Err(A::Error::duplicate_field(
41497                                    "multiple values for ram",
41498                                ));
41499                            }
41500                            struct __With(std::option::Option<i64>);
41501                            impl<'de> serde::de::Deserialize<'de> for __With {
41502                                fn deserialize<D>(
41503                                    deserializer: D,
41504                                ) -> std::result::Result<Self, D::Error>
41505                                where
41506                                    D: serde::de::Deserializer<'de>,
41507                                {
41508                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
41509                                }
41510                            }
41511                            result.ram = map.next_value::<__With>()?.0.unwrap_or_default();
41512                        }
41513                        __FieldTag::__kind => {
41514                            if !fields.insert(__FieldTag::__kind) {
41515                                return std::result::Result::Err(A::Error::duplicate_field(
41516                                    "multiple values for kind",
41517                                ));
41518                            }
41519                            result.kind = map
41520                                .next_value::<std::option::Option<std::string::String>>()?
41521                                .unwrap_or_default();
41522                        }
41523                        __FieldTag::__disk_quota => {
41524                            if !fields.insert(__FieldTag::__disk_quota) {
41525                                return std::result::Result::Err(A::Error::duplicate_field(
41526                                    "multiple values for disk_quota",
41527                                ));
41528                            }
41529                            struct __With(std::option::Option<i64>);
41530                            impl<'de> serde::de::Deserialize<'de> for __With {
41531                                fn deserialize<D>(
41532                                    deserializer: D,
41533                                ) -> std::result::Result<Self, D::Error>
41534                                where
41535                                    D: serde::de::Deserializer<'de>,
41536                                {
41537                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
41538                                }
41539                            }
41540                            result.disk_quota = map.next_value::<__With>()?.0.unwrap_or_default();
41541                        }
41542                        __FieldTag::__region => {
41543                            if !fields.insert(__FieldTag::__region) {
41544                                return std::result::Result::Err(A::Error::duplicate_field(
41545                                    "multiple values for region",
41546                                ));
41547                            }
41548                            result.region = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
41549                        }
41550                        __FieldTag::Unknown(key) => {
41551                            let value = map.next_value::<serde_json::Value>()?;
41552                            result._unknown_fields.insert(key, value);
41553                        }
41554                    }
41555                }
41556                std::result::Result::Ok(result)
41557            }
41558        }
41559        deserializer.deserialize_any(Visitor)
41560    }
41561}
41562
41563#[doc(hidden)]
41564impl serde::ser::Serialize for Tier {
41565    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
41566    where
41567        S: serde::ser::Serializer,
41568    {
41569        use serde::ser::SerializeMap;
41570        #[allow(unused_imports)]
41571        use std::option::Option::Some;
41572        let mut state = serializer.serialize_map(std::option::Option::None)?;
41573        if !self.tier.is_empty() {
41574            state.serialize_entry("tier", &self.tier)?;
41575        }
41576        if !wkt::internal::is_default(&self.ram) {
41577            struct __With<'a>(&'a i64);
41578            impl<'a> serde::ser::Serialize for __With<'a> {
41579                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
41580                where
41581                    S: serde::ser::Serializer,
41582                {
41583                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
41584                }
41585            }
41586            state.serialize_entry("RAM", &__With(&self.ram))?;
41587        }
41588        if !self.kind.is_empty() {
41589            state.serialize_entry("kind", &self.kind)?;
41590        }
41591        if !wkt::internal::is_default(&self.disk_quota) {
41592            struct __With<'a>(&'a i64);
41593            impl<'a> serde::ser::Serialize for __With<'a> {
41594                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
41595                where
41596                    S: serde::ser::Serializer,
41597                {
41598                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
41599                }
41600            }
41601            state.serialize_entry("DiskQuota", &__With(&self.disk_quota))?;
41602        }
41603        if !self.region.is_empty() {
41604            state.serialize_entry("region", &self.region)?;
41605        }
41606        if !self._unknown_fields.is_empty() {
41607            for (key, value) in self._unknown_fields.iter() {
41608                state.serialize_entry(key, &value)?;
41609            }
41610        }
41611        state.end()
41612    }
41613}
41614
41615impl std::fmt::Debug for Tier {
41616    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
41617        let mut debug_struct = f.debug_struct("Tier");
41618        debug_struct.field("tier", &self.tier);
41619        debug_struct.field("ram", &self.ram);
41620        debug_struct.field("kind", &self.kind);
41621        debug_struct.field("disk_quota", &self.disk_quota);
41622        debug_struct.field("region", &self.region);
41623        if !self._unknown_fields.is_empty() {
41624            debug_struct.field("_unknown_fields", &self._unknown_fields);
41625        }
41626        debug_struct.finish()
41627    }
41628}
41629
41630#[derive(Clone, Default, PartialEq)]
41631#[non_exhaustive]
41632pub struct SqlUsersDeleteRequest {
41633    /// Host of the user in the instance.
41634    pub host: std::string::String,
41635
41636    /// Database instance ID. This does not include the project ID.
41637    pub instance: std::string::String,
41638
41639    /// Name of the user in the instance.
41640    pub name: std::string::String,
41641
41642    /// Project ID of the project that contains the instance.
41643    pub project: std::string::String,
41644
41645    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
41646}
41647
41648impl SqlUsersDeleteRequest {
41649    pub fn new() -> Self {
41650        std::default::Default::default()
41651    }
41652
41653    /// Sets the value of [host][crate::model::SqlUsersDeleteRequest::host].
41654    pub fn set_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
41655        self.host = v.into();
41656        self
41657    }
41658
41659    /// Sets the value of [instance][crate::model::SqlUsersDeleteRequest::instance].
41660    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
41661        self.instance = v.into();
41662        self
41663    }
41664
41665    /// Sets the value of [name][crate::model::SqlUsersDeleteRequest::name].
41666    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
41667        self.name = v.into();
41668        self
41669    }
41670
41671    /// Sets the value of [project][crate::model::SqlUsersDeleteRequest::project].
41672    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
41673        self.project = v.into();
41674        self
41675    }
41676}
41677
41678impl wkt::message::Message for SqlUsersDeleteRequest {
41679    fn typename() -> &'static str {
41680        "type.googleapis.com/google.cloud.sql.v1.SqlUsersDeleteRequest"
41681    }
41682}
41683
41684#[doc(hidden)]
41685impl<'de> serde::de::Deserialize<'de> for SqlUsersDeleteRequest {
41686    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
41687    where
41688        D: serde::Deserializer<'de>,
41689    {
41690        #[allow(non_camel_case_types)]
41691        #[doc(hidden)]
41692        #[derive(PartialEq, Eq, Hash)]
41693        enum __FieldTag {
41694            __host,
41695            __instance,
41696            __name,
41697            __project,
41698            Unknown(std::string::String),
41699        }
41700        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
41701            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
41702            where
41703                D: serde::Deserializer<'de>,
41704            {
41705                struct Visitor;
41706                impl<'de> serde::de::Visitor<'de> for Visitor {
41707                    type Value = __FieldTag;
41708                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
41709                        formatter.write_str("a field name for SqlUsersDeleteRequest")
41710                    }
41711                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
41712                    where
41713                        E: serde::de::Error,
41714                    {
41715                        use std::result::Result::Ok;
41716                        use std::string::ToString;
41717                        match value {
41718                            "host" => Ok(__FieldTag::__host),
41719                            "instance" => Ok(__FieldTag::__instance),
41720                            "name" => Ok(__FieldTag::__name),
41721                            "project" => Ok(__FieldTag::__project),
41722                            _ => Ok(__FieldTag::Unknown(value.to_string())),
41723                        }
41724                    }
41725                }
41726                deserializer.deserialize_identifier(Visitor)
41727            }
41728        }
41729        struct Visitor;
41730        impl<'de> serde::de::Visitor<'de> for Visitor {
41731            type Value = SqlUsersDeleteRequest;
41732            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
41733                formatter.write_str("struct SqlUsersDeleteRequest")
41734            }
41735            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
41736            where
41737                A: serde::de::MapAccess<'de>,
41738            {
41739                #[allow(unused_imports)]
41740                use serde::de::Error;
41741                use std::option::Option::Some;
41742                let mut fields = std::collections::HashSet::new();
41743                let mut result = Self::Value::new();
41744                while let Some(tag) = map.next_key::<__FieldTag>()? {
41745                    #[allow(clippy::match_single_binding)]
41746                    match tag {
41747                        __FieldTag::__host => {
41748                            if !fields.insert(__FieldTag::__host) {
41749                                return std::result::Result::Err(A::Error::duplicate_field(
41750                                    "multiple values for host",
41751                                ));
41752                            }
41753                            result.host = map
41754                                .next_value::<std::option::Option<std::string::String>>()?
41755                                .unwrap_or_default();
41756                        }
41757                        __FieldTag::__instance => {
41758                            if !fields.insert(__FieldTag::__instance) {
41759                                return std::result::Result::Err(A::Error::duplicate_field(
41760                                    "multiple values for instance",
41761                                ));
41762                            }
41763                            result.instance = map
41764                                .next_value::<std::option::Option<std::string::String>>()?
41765                                .unwrap_or_default();
41766                        }
41767                        __FieldTag::__name => {
41768                            if !fields.insert(__FieldTag::__name) {
41769                                return std::result::Result::Err(A::Error::duplicate_field(
41770                                    "multiple values for name",
41771                                ));
41772                            }
41773                            result.name = map
41774                                .next_value::<std::option::Option<std::string::String>>()?
41775                                .unwrap_or_default();
41776                        }
41777                        __FieldTag::__project => {
41778                            if !fields.insert(__FieldTag::__project) {
41779                                return std::result::Result::Err(A::Error::duplicate_field(
41780                                    "multiple values for project",
41781                                ));
41782                            }
41783                            result.project = map
41784                                .next_value::<std::option::Option<std::string::String>>()?
41785                                .unwrap_or_default();
41786                        }
41787                        __FieldTag::Unknown(key) => {
41788                            let value = map.next_value::<serde_json::Value>()?;
41789                            result._unknown_fields.insert(key, value);
41790                        }
41791                    }
41792                }
41793                std::result::Result::Ok(result)
41794            }
41795        }
41796        deserializer.deserialize_any(Visitor)
41797    }
41798}
41799
41800#[doc(hidden)]
41801impl serde::ser::Serialize for SqlUsersDeleteRequest {
41802    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
41803    where
41804        S: serde::ser::Serializer,
41805    {
41806        use serde::ser::SerializeMap;
41807        #[allow(unused_imports)]
41808        use std::option::Option::Some;
41809        let mut state = serializer.serialize_map(std::option::Option::None)?;
41810        if !self.host.is_empty() {
41811            state.serialize_entry("host", &self.host)?;
41812        }
41813        if !self.instance.is_empty() {
41814            state.serialize_entry("instance", &self.instance)?;
41815        }
41816        if !self.name.is_empty() {
41817            state.serialize_entry("name", &self.name)?;
41818        }
41819        if !self.project.is_empty() {
41820            state.serialize_entry("project", &self.project)?;
41821        }
41822        if !self._unknown_fields.is_empty() {
41823            for (key, value) in self._unknown_fields.iter() {
41824                state.serialize_entry(key, &value)?;
41825            }
41826        }
41827        state.end()
41828    }
41829}
41830
41831impl std::fmt::Debug for SqlUsersDeleteRequest {
41832    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
41833        let mut debug_struct = f.debug_struct("SqlUsersDeleteRequest");
41834        debug_struct.field("host", &self.host);
41835        debug_struct.field("instance", &self.instance);
41836        debug_struct.field("name", &self.name);
41837        debug_struct.field("project", &self.project);
41838        if !self._unknown_fields.is_empty() {
41839            debug_struct.field("_unknown_fields", &self._unknown_fields);
41840        }
41841        debug_struct.finish()
41842    }
41843}
41844
41845/// Request message for Users Get RPC
41846#[derive(Clone, Default, PartialEq)]
41847#[non_exhaustive]
41848pub struct SqlUsersGetRequest {
41849    /// Database instance ID. This does not include the project ID.
41850    pub instance: std::string::String,
41851
41852    /// User of the instance.
41853    pub name: std::string::String,
41854
41855    /// Project ID of the project that contains the instance.
41856    pub project: std::string::String,
41857
41858    /// Host of a user of the instance.
41859    pub host: std::string::String,
41860
41861    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
41862}
41863
41864impl SqlUsersGetRequest {
41865    pub fn new() -> Self {
41866        std::default::Default::default()
41867    }
41868
41869    /// Sets the value of [instance][crate::model::SqlUsersGetRequest::instance].
41870    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
41871        self.instance = v.into();
41872        self
41873    }
41874
41875    /// Sets the value of [name][crate::model::SqlUsersGetRequest::name].
41876    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
41877        self.name = v.into();
41878        self
41879    }
41880
41881    /// Sets the value of [project][crate::model::SqlUsersGetRequest::project].
41882    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
41883        self.project = v.into();
41884        self
41885    }
41886
41887    /// Sets the value of [host][crate::model::SqlUsersGetRequest::host].
41888    pub fn set_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
41889        self.host = v.into();
41890        self
41891    }
41892}
41893
41894impl wkt::message::Message for SqlUsersGetRequest {
41895    fn typename() -> &'static str {
41896        "type.googleapis.com/google.cloud.sql.v1.SqlUsersGetRequest"
41897    }
41898}
41899
41900#[doc(hidden)]
41901impl<'de> serde::de::Deserialize<'de> for SqlUsersGetRequest {
41902    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
41903    where
41904        D: serde::Deserializer<'de>,
41905    {
41906        #[allow(non_camel_case_types)]
41907        #[doc(hidden)]
41908        #[derive(PartialEq, Eq, Hash)]
41909        enum __FieldTag {
41910            __instance,
41911            __name,
41912            __project,
41913            __host,
41914            Unknown(std::string::String),
41915        }
41916        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
41917            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
41918            where
41919                D: serde::Deserializer<'de>,
41920            {
41921                struct Visitor;
41922                impl<'de> serde::de::Visitor<'de> for Visitor {
41923                    type Value = __FieldTag;
41924                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
41925                        formatter.write_str("a field name for SqlUsersGetRequest")
41926                    }
41927                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
41928                    where
41929                        E: serde::de::Error,
41930                    {
41931                        use std::result::Result::Ok;
41932                        use std::string::ToString;
41933                        match value {
41934                            "instance" => Ok(__FieldTag::__instance),
41935                            "name" => Ok(__FieldTag::__name),
41936                            "project" => Ok(__FieldTag::__project),
41937                            "host" => Ok(__FieldTag::__host),
41938                            _ => Ok(__FieldTag::Unknown(value.to_string())),
41939                        }
41940                    }
41941                }
41942                deserializer.deserialize_identifier(Visitor)
41943            }
41944        }
41945        struct Visitor;
41946        impl<'de> serde::de::Visitor<'de> for Visitor {
41947            type Value = SqlUsersGetRequest;
41948            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
41949                formatter.write_str("struct SqlUsersGetRequest")
41950            }
41951            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
41952            where
41953                A: serde::de::MapAccess<'de>,
41954            {
41955                #[allow(unused_imports)]
41956                use serde::de::Error;
41957                use std::option::Option::Some;
41958                let mut fields = std::collections::HashSet::new();
41959                let mut result = Self::Value::new();
41960                while let Some(tag) = map.next_key::<__FieldTag>()? {
41961                    #[allow(clippy::match_single_binding)]
41962                    match tag {
41963                        __FieldTag::__instance => {
41964                            if !fields.insert(__FieldTag::__instance) {
41965                                return std::result::Result::Err(A::Error::duplicate_field(
41966                                    "multiple values for instance",
41967                                ));
41968                            }
41969                            result.instance = map
41970                                .next_value::<std::option::Option<std::string::String>>()?
41971                                .unwrap_or_default();
41972                        }
41973                        __FieldTag::__name => {
41974                            if !fields.insert(__FieldTag::__name) {
41975                                return std::result::Result::Err(A::Error::duplicate_field(
41976                                    "multiple values for name",
41977                                ));
41978                            }
41979                            result.name = map
41980                                .next_value::<std::option::Option<std::string::String>>()?
41981                                .unwrap_or_default();
41982                        }
41983                        __FieldTag::__project => {
41984                            if !fields.insert(__FieldTag::__project) {
41985                                return std::result::Result::Err(A::Error::duplicate_field(
41986                                    "multiple values for project",
41987                                ));
41988                            }
41989                            result.project = map
41990                                .next_value::<std::option::Option<std::string::String>>()?
41991                                .unwrap_or_default();
41992                        }
41993                        __FieldTag::__host => {
41994                            if !fields.insert(__FieldTag::__host) {
41995                                return std::result::Result::Err(A::Error::duplicate_field(
41996                                    "multiple values for host",
41997                                ));
41998                            }
41999                            result.host = map
42000                                .next_value::<std::option::Option<std::string::String>>()?
42001                                .unwrap_or_default();
42002                        }
42003                        __FieldTag::Unknown(key) => {
42004                            let value = map.next_value::<serde_json::Value>()?;
42005                            result._unknown_fields.insert(key, value);
42006                        }
42007                    }
42008                }
42009                std::result::Result::Ok(result)
42010            }
42011        }
42012        deserializer.deserialize_any(Visitor)
42013    }
42014}
42015
42016#[doc(hidden)]
42017impl serde::ser::Serialize for SqlUsersGetRequest {
42018    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
42019    where
42020        S: serde::ser::Serializer,
42021    {
42022        use serde::ser::SerializeMap;
42023        #[allow(unused_imports)]
42024        use std::option::Option::Some;
42025        let mut state = serializer.serialize_map(std::option::Option::None)?;
42026        if !self.instance.is_empty() {
42027            state.serialize_entry("instance", &self.instance)?;
42028        }
42029        if !self.name.is_empty() {
42030            state.serialize_entry("name", &self.name)?;
42031        }
42032        if !self.project.is_empty() {
42033            state.serialize_entry("project", &self.project)?;
42034        }
42035        if !self.host.is_empty() {
42036            state.serialize_entry("host", &self.host)?;
42037        }
42038        if !self._unknown_fields.is_empty() {
42039            for (key, value) in self._unknown_fields.iter() {
42040                state.serialize_entry(key, &value)?;
42041            }
42042        }
42043        state.end()
42044    }
42045}
42046
42047impl std::fmt::Debug for SqlUsersGetRequest {
42048    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
42049        let mut debug_struct = f.debug_struct("SqlUsersGetRequest");
42050        debug_struct.field("instance", &self.instance);
42051        debug_struct.field("name", &self.name);
42052        debug_struct.field("project", &self.project);
42053        debug_struct.field("host", &self.host);
42054        if !self._unknown_fields.is_empty() {
42055            debug_struct.field("_unknown_fields", &self._unknown_fields);
42056        }
42057        debug_struct.finish()
42058    }
42059}
42060
42061#[derive(Clone, Default, PartialEq)]
42062#[non_exhaustive]
42063pub struct SqlUsersInsertRequest {
42064    /// Database instance ID. This does not include the project ID.
42065    pub instance: std::string::String,
42066
42067    /// Project ID of the project that contains the instance.
42068    pub project: std::string::String,
42069
42070    pub body: std::option::Option<crate::model::User>,
42071
42072    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
42073}
42074
42075impl SqlUsersInsertRequest {
42076    pub fn new() -> Self {
42077        std::default::Default::default()
42078    }
42079
42080    /// Sets the value of [instance][crate::model::SqlUsersInsertRequest::instance].
42081    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
42082        self.instance = v.into();
42083        self
42084    }
42085
42086    /// Sets the value of [project][crate::model::SqlUsersInsertRequest::project].
42087    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
42088        self.project = v.into();
42089        self
42090    }
42091
42092    /// Sets the value of [body][crate::model::SqlUsersInsertRequest::body].
42093    pub fn set_body<T>(mut self, v: T) -> Self
42094    where
42095        T: std::convert::Into<crate::model::User>,
42096    {
42097        self.body = std::option::Option::Some(v.into());
42098        self
42099    }
42100
42101    /// Sets or clears the value of [body][crate::model::SqlUsersInsertRequest::body].
42102    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
42103    where
42104        T: std::convert::Into<crate::model::User>,
42105    {
42106        self.body = v.map(|x| x.into());
42107        self
42108    }
42109}
42110
42111impl wkt::message::Message for SqlUsersInsertRequest {
42112    fn typename() -> &'static str {
42113        "type.googleapis.com/google.cloud.sql.v1.SqlUsersInsertRequest"
42114    }
42115}
42116
42117#[doc(hidden)]
42118impl<'de> serde::de::Deserialize<'de> for SqlUsersInsertRequest {
42119    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
42120    where
42121        D: serde::Deserializer<'de>,
42122    {
42123        #[allow(non_camel_case_types)]
42124        #[doc(hidden)]
42125        #[derive(PartialEq, Eq, Hash)]
42126        enum __FieldTag {
42127            __instance,
42128            __project,
42129            __body,
42130            Unknown(std::string::String),
42131        }
42132        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
42133            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
42134            where
42135                D: serde::Deserializer<'de>,
42136            {
42137                struct Visitor;
42138                impl<'de> serde::de::Visitor<'de> for Visitor {
42139                    type Value = __FieldTag;
42140                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
42141                        formatter.write_str("a field name for SqlUsersInsertRequest")
42142                    }
42143                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
42144                    where
42145                        E: serde::de::Error,
42146                    {
42147                        use std::result::Result::Ok;
42148                        use std::string::ToString;
42149                        match value {
42150                            "instance" => Ok(__FieldTag::__instance),
42151                            "project" => Ok(__FieldTag::__project),
42152                            "body" => Ok(__FieldTag::__body),
42153                            _ => Ok(__FieldTag::Unknown(value.to_string())),
42154                        }
42155                    }
42156                }
42157                deserializer.deserialize_identifier(Visitor)
42158            }
42159        }
42160        struct Visitor;
42161        impl<'de> serde::de::Visitor<'de> for Visitor {
42162            type Value = SqlUsersInsertRequest;
42163            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
42164                formatter.write_str("struct SqlUsersInsertRequest")
42165            }
42166            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
42167            where
42168                A: serde::de::MapAccess<'de>,
42169            {
42170                #[allow(unused_imports)]
42171                use serde::de::Error;
42172                use std::option::Option::Some;
42173                let mut fields = std::collections::HashSet::new();
42174                let mut result = Self::Value::new();
42175                while let Some(tag) = map.next_key::<__FieldTag>()? {
42176                    #[allow(clippy::match_single_binding)]
42177                    match tag {
42178                        __FieldTag::__instance => {
42179                            if !fields.insert(__FieldTag::__instance) {
42180                                return std::result::Result::Err(A::Error::duplicate_field(
42181                                    "multiple values for instance",
42182                                ));
42183                            }
42184                            result.instance = map
42185                                .next_value::<std::option::Option<std::string::String>>()?
42186                                .unwrap_or_default();
42187                        }
42188                        __FieldTag::__project => {
42189                            if !fields.insert(__FieldTag::__project) {
42190                                return std::result::Result::Err(A::Error::duplicate_field(
42191                                    "multiple values for project",
42192                                ));
42193                            }
42194                            result.project = map
42195                                .next_value::<std::option::Option<std::string::String>>()?
42196                                .unwrap_or_default();
42197                        }
42198                        __FieldTag::__body => {
42199                            if !fields.insert(__FieldTag::__body) {
42200                                return std::result::Result::Err(A::Error::duplicate_field(
42201                                    "multiple values for body",
42202                                ));
42203                            }
42204                            result.body =
42205                                map.next_value::<std::option::Option<crate::model::User>>()?;
42206                        }
42207                        __FieldTag::Unknown(key) => {
42208                            let value = map.next_value::<serde_json::Value>()?;
42209                            result._unknown_fields.insert(key, value);
42210                        }
42211                    }
42212                }
42213                std::result::Result::Ok(result)
42214            }
42215        }
42216        deserializer.deserialize_any(Visitor)
42217    }
42218}
42219
42220#[doc(hidden)]
42221impl serde::ser::Serialize for SqlUsersInsertRequest {
42222    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
42223    where
42224        S: serde::ser::Serializer,
42225    {
42226        use serde::ser::SerializeMap;
42227        #[allow(unused_imports)]
42228        use std::option::Option::Some;
42229        let mut state = serializer.serialize_map(std::option::Option::None)?;
42230        if !self.instance.is_empty() {
42231            state.serialize_entry("instance", &self.instance)?;
42232        }
42233        if !self.project.is_empty() {
42234            state.serialize_entry("project", &self.project)?;
42235        }
42236        if self.body.is_some() {
42237            state.serialize_entry("body", &self.body)?;
42238        }
42239        if !self._unknown_fields.is_empty() {
42240            for (key, value) in self._unknown_fields.iter() {
42241                state.serialize_entry(key, &value)?;
42242            }
42243        }
42244        state.end()
42245    }
42246}
42247
42248impl std::fmt::Debug for SqlUsersInsertRequest {
42249    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
42250        let mut debug_struct = f.debug_struct("SqlUsersInsertRequest");
42251        debug_struct.field("instance", &self.instance);
42252        debug_struct.field("project", &self.project);
42253        debug_struct.field("body", &self.body);
42254        if !self._unknown_fields.is_empty() {
42255            debug_struct.field("_unknown_fields", &self._unknown_fields);
42256        }
42257        debug_struct.finish()
42258    }
42259}
42260
42261#[derive(Clone, Default, PartialEq)]
42262#[non_exhaustive]
42263pub struct SqlUsersListRequest {
42264    /// Database instance ID. This does not include the project ID.
42265    pub instance: std::string::String,
42266
42267    /// Project ID of the project that contains the instance.
42268    pub project: std::string::String,
42269
42270    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
42271}
42272
42273impl SqlUsersListRequest {
42274    pub fn new() -> Self {
42275        std::default::Default::default()
42276    }
42277
42278    /// Sets the value of [instance][crate::model::SqlUsersListRequest::instance].
42279    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
42280        self.instance = v.into();
42281        self
42282    }
42283
42284    /// Sets the value of [project][crate::model::SqlUsersListRequest::project].
42285    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
42286        self.project = v.into();
42287        self
42288    }
42289}
42290
42291impl wkt::message::Message for SqlUsersListRequest {
42292    fn typename() -> &'static str {
42293        "type.googleapis.com/google.cloud.sql.v1.SqlUsersListRequest"
42294    }
42295}
42296
42297#[doc(hidden)]
42298impl<'de> serde::de::Deserialize<'de> for SqlUsersListRequest {
42299    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
42300    where
42301        D: serde::Deserializer<'de>,
42302    {
42303        #[allow(non_camel_case_types)]
42304        #[doc(hidden)]
42305        #[derive(PartialEq, Eq, Hash)]
42306        enum __FieldTag {
42307            __instance,
42308            __project,
42309            Unknown(std::string::String),
42310        }
42311        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
42312            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
42313            where
42314                D: serde::Deserializer<'de>,
42315            {
42316                struct Visitor;
42317                impl<'de> serde::de::Visitor<'de> for Visitor {
42318                    type Value = __FieldTag;
42319                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
42320                        formatter.write_str("a field name for SqlUsersListRequest")
42321                    }
42322                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
42323                    where
42324                        E: serde::de::Error,
42325                    {
42326                        use std::result::Result::Ok;
42327                        use std::string::ToString;
42328                        match value {
42329                            "instance" => Ok(__FieldTag::__instance),
42330                            "project" => Ok(__FieldTag::__project),
42331                            _ => Ok(__FieldTag::Unknown(value.to_string())),
42332                        }
42333                    }
42334                }
42335                deserializer.deserialize_identifier(Visitor)
42336            }
42337        }
42338        struct Visitor;
42339        impl<'de> serde::de::Visitor<'de> for Visitor {
42340            type Value = SqlUsersListRequest;
42341            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
42342                formatter.write_str("struct SqlUsersListRequest")
42343            }
42344            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
42345            where
42346                A: serde::de::MapAccess<'de>,
42347            {
42348                #[allow(unused_imports)]
42349                use serde::de::Error;
42350                use std::option::Option::Some;
42351                let mut fields = std::collections::HashSet::new();
42352                let mut result = Self::Value::new();
42353                while let Some(tag) = map.next_key::<__FieldTag>()? {
42354                    #[allow(clippy::match_single_binding)]
42355                    match tag {
42356                        __FieldTag::__instance => {
42357                            if !fields.insert(__FieldTag::__instance) {
42358                                return std::result::Result::Err(A::Error::duplicate_field(
42359                                    "multiple values for instance",
42360                                ));
42361                            }
42362                            result.instance = map
42363                                .next_value::<std::option::Option<std::string::String>>()?
42364                                .unwrap_or_default();
42365                        }
42366                        __FieldTag::__project => {
42367                            if !fields.insert(__FieldTag::__project) {
42368                                return std::result::Result::Err(A::Error::duplicate_field(
42369                                    "multiple values for project",
42370                                ));
42371                            }
42372                            result.project = map
42373                                .next_value::<std::option::Option<std::string::String>>()?
42374                                .unwrap_or_default();
42375                        }
42376                        __FieldTag::Unknown(key) => {
42377                            let value = map.next_value::<serde_json::Value>()?;
42378                            result._unknown_fields.insert(key, value);
42379                        }
42380                    }
42381                }
42382                std::result::Result::Ok(result)
42383            }
42384        }
42385        deserializer.deserialize_any(Visitor)
42386    }
42387}
42388
42389#[doc(hidden)]
42390impl serde::ser::Serialize for SqlUsersListRequest {
42391    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
42392    where
42393        S: serde::ser::Serializer,
42394    {
42395        use serde::ser::SerializeMap;
42396        #[allow(unused_imports)]
42397        use std::option::Option::Some;
42398        let mut state = serializer.serialize_map(std::option::Option::None)?;
42399        if !self.instance.is_empty() {
42400            state.serialize_entry("instance", &self.instance)?;
42401        }
42402        if !self.project.is_empty() {
42403            state.serialize_entry("project", &self.project)?;
42404        }
42405        if !self._unknown_fields.is_empty() {
42406            for (key, value) in self._unknown_fields.iter() {
42407                state.serialize_entry(key, &value)?;
42408            }
42409        }
42410        state.end()
42411    }
42412}
42413
42414impl std::fmt::Debug for SqlUsersListRequest {
42415    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
42416        let mut debug_struct = f.debug_struct("SqlUsersListRequest");
42417        debug_struct.field("instance", &self.instance);
42418        debug_struct.field("project", &self.project);
42419        if !self._unknown_fields.is_empty() {
42420            debug_struct.field("_unknown_fields", &self._unknown_fields);
42421        }
42422        debug_struct.finish()
42423    }
42424}
42425
42426#[derive(Clone, Default, PartialEq)]
42427#[non_exhaustive]
42428pub struct SqlUsersUpdateRequest {
42429    /// Optional. Host of the user in the instance.
42430    pub host: std::string::String,
42431
42432    /// Database instance ID. This does not include the project ID.
42433    pub instance: std::string::String,
42434
42435    /// Name of the user in the instance.
42436    pub name: std::string::String,
42437
42438    /// Project ID of the project that contains the instance.
42439    pub project: std::string::String,
42440
42441    pub body: std::option::Option<crate::model::User>,
42442
42443    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
42444}
42445
42446impl SqlUsersUpdateRequest {
42447    pub fn new() -> Self {
42448        std::default::Default::default()
42449    }
42450
42451    /// Sets the value of [host][crate::model::SqlUsersUpdateRequest::host].
42452    pub fn set_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
42453        self.host = v.into();
42454        self
42455    }
42456
42457    /// Sets the value of [instance][crate::model::SqlUsersUpdateRequest::instance].
42458    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
42459        self.instance = v.into();
42460        self
42461    }
42462
42463    /// Sets the value of [name][crate::model::SqlUsersUpdateRequest::name].
42464    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
42465        self.name = v.into();
42466        self
42467    }
42468
42469    /// Sets the value of [project][crate::model::SqlUsersUpdateRequest::project].
42470    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
42471        self.project = v.into();
42472        self
42473    }
42474
42475    /// Sets the value of [body][crate::model::SqlUsersUpdateRequest::body].
42476    pub fn set_body<T>(mut self, v: T) -> Self
42477    where
42478        T: std::convert::Into<crate::model::User>,
42479    {
42480        self.body = std::option::Option::Some(v.into());
42481        self
42482    }
42483
42484    /// Sets or clears the value of [body][crate::model::SqlUsersUpdateRequest::body].
42485    pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
42486    where
42487        T: std::convert::Into<crate::model::User>,
42488    {
42489        self.body = v.map(|x| x.into());
42490        self
42491    }
42492}
42493
42494impl wkt::message::Message for SqlUsersUpdateRequest {
42495    fn typename() -> &'static str {
42496        "type.googleapis.com/google.cloud.sql.v1.SqlUsersUpdateRequest"
42497    }
42498}
42499
42500#[doc(hidden)]
42501impl<'de> serde::de::Deserialize<'de> for SqlUsersUpdateRequest {
42502    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
42503    where
42504        D: serde::Deserializer<'de>,
42505    {
42506        #[allow(non_camel_case_types)]
42507        #[doc(hidden)]
42508        #[derive(PartialEq, Eq, Hash)]
42509        enum __FieldTag {
42510            __host,
42511            __instance,
42512            __name,
42513            __project,
42514            __body,
42515            Unknown(std::string::String),
42516        }
42517        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
42518            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
42519            where
42520                D: serde::Deserializer<'de>,
42521            {
42522                struct Visitor;
42523                impl<'de> serde::de::Visitor<'de> for Visitor {
42524                    type Value = __FieldTag;
42525                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
42526                        formatter.write_str("a field name for SqlUsersUpdateRequest")
42527                    }
42528                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
42529                    where
42530                        E: serde::de::Error,
42531                    {
42532                        use std::result::Result::Ok;
42533                        use std::string::ToString;
42534                        match value {
42535                            "host" => Ok(__FieldTag::__host),
42536                            "instance" => Ok(__FieldTag::__instance),
42537                            "name" => Ok(__FieldTag::__name),
42538                            "project" => Ok(__FieldTag::__project),
42539                            "body" => Ok(__FieldTag::__body),
42540                            _ => Ok(__FieldTag::Unknown(value.to_string())),
42541                        }
42542                    }
42543                }
42544                deserializer.deserialize_identifier(Visitor)
42545            }
42546        }
42547        struct Visitor;
42548        impl<'de> serde::de::Visitor<'de> for Visitor {
42549            type Value = SqlUsersUpdateRequest;
42550            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
42551                formatter.write_str("struct SqlUsersUpdateRequest")
42552            }
42553            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
42554            where
42555                A: serde::de::MapAccess<'de>,
42556            {
42557                #[allow(unused_imports)]
42558                use serde::de::Error;
42559                use std::option::Option::Some;
42560                let mut fields = std::collections::HashSet::new();
42561                let mut result = Self::Value::new();
42562                while let Some(tag) = map.next_key::<__FieldTag>()? {
42563                    #[allow(clippy::match_single_binding)]
42564                    match tag {
42565                        __FieldTag::__host => {
42566                            if !fields.insert(__FieldTag::__host) {
42567                                return std::result::Result::Err(A::Error::duplicate_field(
42568                                    "multiple values for host",
42569                                ));
42570                            }
42571                            result.host = map
42572                                .next_value::<std::option::Option<std::string::String>>()?
42573                                .unwrap_or_default();
42574                        }
42575                        __FieldTag::__instance => {
42576                            if !fields.insert(__FieldTag::__instance) {
42577                                return std::result::Result::Err(A::Error::duplicate_field(
42578                                    "multiple values for instance",
42579                                ));
42580                            }
42581                            result.instance = map
42582                                .next_value::<std::option::Option<std::string::String>>()?
42583                                .unwrap_or_default();
42584                        }
42585                        __FieldTag::__name => {
42586                            if !fields.insert(__FieldTag::__name) {
42587                                return std::result::Result::Err(A::Error::duplicate_field(
42588                                    "multiple values for name",
42589                                ));
42590                            }
42591                            result.name = map
42592                                .next_value::<std::option::Option<std::string::String>>()?
42593                                .unwrap_or_default();
42594                        }
42595                        __FieldTag::__project => {
42596                            if !fields.insert(__FieldTag::__project) {
42597                                return std::result::Result::Err(A::Error::duplicate_field(
42598                                    "multiple values for project",
42599                                ));
42600                            }
42601                            result.project = map
42602                                .next_value::<std::option::Option<std::string::String>>()?
42603                                .unwrap_or_default();
42604                        }
42605                        __FieldTag::__body => {
42606                            if !fields.insert(__FieldTag::__body) {
42607                                return std::result::Result::Err(A::Error::duplicate_field(
42608                                    "multiple values for body",
42609                                ));
42610                            }
42611                            result.body =
42612                                map.next_value::<std::option::Option<crate::model::User>>()?;
42613                        }
42614                        __FieldTag::Unknown(key) => {
42615                            let value = map.next_value::<serde_json::Value>()?;
42616                            result._unknown_fields.insert(key, value);
42617                        }
42618                    }
42619                }
42620                std::result::Result::Ok(result)
42621            }
42622        }
42623        deserializer.deserialize_any(Visitor)
42624    }
42625}
42626
42627#[doc(hidden)]
42628impl serde::ser::Serialize for SqlUsersUpdateRequest {
42629    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
42630    where
42631        S: serde::ser::Serializer,
42632    {
42633        use serde::ser::SerializeMap;
42634        #[allow(unused_imports)]
42635        use std::option::Option::Some;
42636        let mut state = serializer.serialize_map(std::option::Option::None)?;
42637        if !self.host.is_empty() {
42638            state.serialize_entry("host", &self.host)?;
42639        }
42640        if !self.instance.is_empty() {
42641            state.serialize_entry("instance", &self.instance)?;
42642        }
42643        if !self.name.is_empty() {
42644            state.serialize_entry("name", &self.name)?;
42645        }
42646        if !self.project.is_empty() {
42647            state.serialize_entry("project", &self.project)?;
42648        }
42649        if self.body.is_some() {
42650            state.serialize_entry("body", &self.body)?;
42651        }
42652        if !self._unknown_fields.is_empty() {
42653            for (key, value) in self._unknown_fields.iter() {
42654                state.serialize_entry(key, &value)?;
42655            }
42656        }
42657        state.end()
42658    }
42659}
42660
42661impl std::fmt::Debug for SqlUsersUpdateRequest {
42662    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
42663        let mut debug_struct = f.debug_struct("SqlUsersUpdateRequest");
42664        debug_struct.field("host", &self.host);
42665        debug_struct.field("instance", &self.instance);
42666        debug_struct.field("name", &self.name);
42667        debug_struct.field("project", &self.project);
42668        debug_struct.field("body", &self.body);
42669        if !self._unknown_fields.is_empty() {
42670            debug_struct.field("_unknown_fields", &self._unknown_fields);
42671        }
42672        debug_struct.finish()
42673    }
42674}
42675
42676/// User level password validation policy.
42677#[derive(Clone, Default, PartialEq)]
42678#[non_exhaustive]
42679pub struct UserPasswordValidationPolicy {
42680    /// Number of failed login attempts allowed before user get locked.
42681    pub allowed_failed_attempts: i32,
42682
42683    /// Expiration duration after password is updated.
42684    pub password_expiration_duration: std::option::Option<wkt::Duration>,
42685
42686    /// If true, failed login attempts check will be enabled.
42687    pub enable_failed_attempts_check: bool,
42688
42689    /// Output only. Read-only password status.
42690    pub status: std::option::Option<crate::model::PasswordStatus>,
42691
42692    /// If true, the user must specify the current password before changing the
42693    /// password. This flag is supported only for MySQL.
42694    pub enable_password_verification: bool,
42695
42696    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
42697}
42698
42699impl UserPasswordValidationPolicy {
42700    pub fn new() -> Self {
42701        std::default::Default::default()
42702    }
42703
42704    /// Sets the value of [allowed_failed_attempts][crate::model::UserPasswordValidationPolicy::allowed_failed_attempts].
42705    pub fn set_allowed_failed_attempts<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
42706        self.allowed_failed_attempts = v.into();
42707        self
42708    }
42709
42710    /// Sets the value of [password_expiration_duration][crate::model::UserPasswordValidationPolicy::password_expiration_duration].
42711    pub fn set_password_expiration_duration<T>(mut self, v: T) -> Self
42712    where
42713        T: std::convert::Into<wkt::Duration>,
42714    {
42715        self.password_expiration_duration = std::option::Option::Some(v.into());
42716        self
42717    }
42718
42719    /// Sets or clears the value of [password_expiration_duration][crate::model::UserPasswordValidationPolicy::password_expiration_duration].
42720    pub fn set_or_clear_password_expiration_duration<T>(mut self, v: std::option::Option<T>) -> Self
42721    where
42722        T: std::convert::Into<wkt::Duration>,
42723    {
42724        self.password_expiration_duration = v.map(|x| x.into());
42725        self
42726    }
42727
42728    /// Sets the value of [enable_failed_attempts_check][crate::model::UserPasswordValidationPolicy::enable_failed_attempts_check].
42729    pub fn set_enable_failed_attempts_check<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
42730        self.enable_failed_attempts_check = v.into();
42731        self
42732    }
42733
42734    /// Sets the value of [status][crate::model::UserPasswordValidationPolicy::status].
42735    pub fn set_status<T>(mut self, v: T) -> Self
42736    where
42737        T: std::convert::Into<crate::model::PasswordStatus>,
42738    {
42739        self.status = std::option::Option::Some(v.into());
42740        self
42741    }
42742
42743    /// Sets or clears the value of [status][crate::model::UserPasswordValidationPolicy::status].
42744    pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
42745    where
42746        T: std::convert::Into<crate::model::PasswordStatus>,
42747    {
42748        self.status = v.map(|x| x.into());
42749        self
42750    }
42751
42752    /// Sets the value of [enable_password_verification][crate::model::UserPasswordValidationPolicy::enable_password_verification].
42753    pub fn set_enable_password_verification<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
42754        self.enable_password_verification = v.into();
42755        self
42756    }
42757}
42758
42759impl wkt::message::Message for UserPasswordValidationPolicy {
42760    fn typename() -> &'static str {
42761        "type.googleapis.com/google.cloud.sql.v1.UserPasswordValidationPolicy"
42762    }
42763}
42764
42765#[doc(hidden)]
42766impl<'de> serde::de::Deserialize<'de> for UserPasswordValidationPolicy {
42767    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
42768    where
42769        D: serde::Deserializer<'de>,
42770    {
42771        #[allow(non_camel_case_types)]
42772        #[doc(hidden)]
42773        #[derive(PartialEq, Eq, Hash)]
42774        enum __FieldTag {
42775            __allowed_failed_attempts,
42776            __password_expiration_duration,
42777            __enable_failed_attempts_check,
42778            __status,
42779            __enable_password_verification,
42780            Unknown(std::string::String),
42781        }
42782        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
42783            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
42784            where
42785                D: serde::Deserializer<'de>,
42786            {
42787                struct Visitor;
42788                impl<'de> serde::de::Visitor<'de> for Visitor {
42789                    type Value = __FieldTag;
42790                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
42791                        formatter.write_str("a field name for UserPasswordValidationPolicy")
42792                    }
42793                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
42794                    where
42795                        E: serde::de::Error,
42796                    {
42797                        use std::result::Result::Ok;
42798                        use std::string::ToString;
42799                        match value {
42800                            "allowedFailedAttempts" => Ok(__FieldTag::__allowed_failed_attempts),
42801                            "allowed_failed_attempts" => Ok(__FieldTag::__allowed_failed_attempts),
42802                            "passwordExpirationDuration" => {
42803                                Ok(__FieldTag::__password_expiration_duration)
42804                            }
42805                            "password_expiration_duration" => {
42806                                Ok(__FieldTag::__password_expiration_duration)
42807                            }
42808                            "enableFailedAttemptsCheck" => {
42809                                Ok(__FieldTag::__enable_failed_attempts_check)
42810                            }
42811                            "enable_failed_attempts_check" => {
42812                                Ok(__FieldTag::__enable_failed_attempts_check)
42813                            }
42814                            "status" => Ok(__FieldTag::__status),
42815                            "enablePasswordVerification" => {
42816                                Ok(__FieldTag::__enable_password_verification)
42817                            }
42818                            "enable_password_verification" => {
42819                                Ok(__FieldTag::__enable_password_verification)
42820                            }
42821                            _ => Ok(__FieldTag::Unknown(value.to_string())),
42822                        }
42823                    }
42824                }
42825                deserializer.deserialize_identifier(Visitor)
42826            }
42827        }
42828        struct Visitor;
42829        impl<'de> serde::de::Visitor<'de> for Visitor {
42830            type Value = UserPasswordValidationPolicy;
42831            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
42832                formatter.write_str("struct UserPasswordValidationPolicy")
42833            }
42834            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
42835            where
42836                A: serde::de::MapAccess<'de>,
42837            {
42838                #[allow(unused_imports)]
42839                use serde::de::Error;
42840                use std::option::Option::Some;
42841                let mut fields = std::collections::HashSet::new();
42842                let mut result = Self::Value::new();
42843                while let Some(tag) = map.next_key::<__FieldTag>()? {
42844                    #[allow(clippy::match_single_binding)]
42845                    match tag {
42846                        __FieldTag::__allowed_failed_attempts => {
42847                            if !fields.insert(__FieldTag::__allowed_failed_attempts) {
42848                                return std::result::Result::Err(A::Error::duplicate_field(
42849                                    "multiple values for allowed_failed_attempts",
42850                                ));
42851                            }
42852                            struct __With(std::option::Option<i32>);
42853                            impl<'de> serde::de::Deserialize<'de> for __With {
42854                                fn deserialize<D>(
42855                                    deserializer: D,
42856                                ) -> std::result::Result<Self, D::Error>
42857                                where
42858                                    D: serde::de::Deserializer<'de>,
42859                                {
42860                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
42861                                }
42862                            }
42863                            result.allowed_failed_attempts =
42864                                map.next_value::<__With>()?.0.unwrap_or_default();
42865                        }
42866                        __FieldTag::__password_expiration_duration => {
42867                            if !fields.insert(__FieldTag::__password_expiration_duration) {
42868                                return std::result::Result::Err(A::Error::duplicate_field(
42869                                    "multiple values for password_expiration_duration",
42870                                ));
42871                            }
42872                            result.password_expiration_duration =
42873                                map.next_value::<std::option::Option<wkt::Duration>>()?;
42874                        }
42875                        __FieldTag::__enable_failed_attempts_check => {
42876                            if !fields.insert(__FieldTag::__enable_failed_attempts_check) {
42877                                return std::result::Result::Err(A::Error::duplicate_field(
42878                                    "multiple values for enable_failed_attempts_check",
42879                                ));
42880                            }
42881                            result.enable_failed_attempts_check = map
42882                                .next_value::<std::option::Option<bool>>()?
42883                                .unwrap_or_default();
42884                        }
42885                        __FieldTag::__status => {
42886                            if !fields.insert(__FieldTag::__status) {
42887                                return std::result::Result::Err(A::Error::duplicate_field(
42888                                    "multiple values for status",
42889                                ));
42890                            }
42891                            result.status = map
42892                                .next_value::<std::option::Option<crate::model::PasswordStatus>>(
42893                                )?;
42894                        }
42895                        __FieldTag::__enable_password_verification => {
42896                            if !fields.insert(__FieldTag::__enable_password_verification) {
42897                                return std::result::Result::Err(A::Error::duplicate_field(
42898                                    "multiple values for enable_password_verification",
42899                                ));
42900                            }
42901                            result.enable_password_verification = map
42902                                .next_value::<std::option::Option<bool>>()?
42903                                .unwrap_or_default();
42904                        }
42905                        __FieldTag::Unknown(key) => {
42906                            let value = map.next_value::<serde_json::Value>()?;
42907                            result._unknown_fields.insert(key, value);
42908                        }
42909                    }
42910                }
42911                std::result::Result::Ok(result)
42912            }
42913        }
42914        deserializer.deserialize_any(Visitor)
42915    }
42916}
42917
42918#[doc(hidden)]
42919impl serde::ser::Serialize for UserPasswordValidationPolicy {
42920    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
42921    where
42922        S: serde::ser::Serializer,
42923    {
42924        use serde::ser::SerializeMap;
42925        #[allow(unused_imports)]
42926        use std::option::Option::Some;
42927        let mut state = serializer.serialize_map(std::option::Option::None)?;
42928        if !wkt::internal::is_default(&self.allowed_failed_attempts) {
42929            struct __With<'a>(&'a i32);
42930            impl<'a> serde::ser::Serialize for __With<'a> {
42931                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
42932                where
42933                    S: serde::ser::Serializer,
42934                {
42935                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
42936                }
42937            }
42938            state.serialize_entry(
42939                "allowedFailedAttempts",
42940                &__With(&self.allowed_failed_attempts),
42941            )?;
42942        }
42943        if self.password_expiration_duration.is_some() {
42944            state.serialize_entry(
42945                "passwordExpirationDuration",
42946                &self.password_expiration_duration,
42947            )?;
42948        }
42949        if !wkt::internal::is_default(&self.enable_failed_attempts_check) {
42950            state.serialize_entry(
42951                "enableFailedAttemptsCheck",
42952                &self.enable_failed_attempts_check,
42953            )?;
42954        }
42955        if self.status.is_some() {
42956            state.serialize_entry("status", &self.status)?;
42957        }
42958        if !wkt::internal::is_default(&self.enable_password_verification) {
42959            state.serialize_entry(
42960                "enablePasswordVerification",
42961                &self.enable_password_verification,
42962            )?;
42963        }
42964        if !self._unknown_fields.is_empty() {
42965            for (key, value) in self._unknown_fields.iter() {
42966                state.serialize_entry(key, &value)?;
42967            }
42968        }
42969        state.end()
42970    }
42971}
42972
42973impl std::fmt::Debug for UserPasswordValidationPolicy {
42974    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
42975        let mut debug_struct = f.debug_struct("UserPasswordValidationPolicy");
42976        debug_struct.field("allowed_failed_attempts", &self.allowed_failed_attempts);
42977        debug_struct.field(
42978            "password_expiration_duration",
42979            &self.password_expiration_duration,
42980        );
42981        debug_struct.field(
42982            "enable_failed_attempts_check",
42983            &self.enable_failed_attempts_check,
42984        );
42985        debug_struct.field("status", &self.status);
42986        debug_struct.field(
42987            "enable_password_verification",
42988            &self.enable_password_verification,
42989        );
42990        if !self._unknown_fields.is_empty() {
42991            debug_struct.field("_unknown_fields", &self._unknown_fields);
42992        }
42993        debug_struct.finish()
42994    }
42995}
42996
42997/// Read-only password status.
42998#[derive(Clone, Default, PartialEq)]
42999#[non_exhaustive]
43000pub struct PasswordStatus {
43001    /// If true, user does not have login privileges.
43002    pub locked: bool,
43003
43004    /// The expiration time of the current password.
43005    pub password_expiration_time: std::option::Option<wkt::Timestamp>,
43006
43007    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
43008}
43009
43010impl PasswordStatus {
43011    pub fn new() -> Self {
43012        std::default::Default::default()
43013    }
43014
43015    /// Sets the value of [locked][crate::model::PasswordStatus::locked].
43016    pub fn set_locked<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
43017        self.locked = v.into();
43018        self
43019    }
43020
43021    /// Sets the value of [password_expiration_time][crate::model::PasswordStatus::password_expiration_time].
43022    pub fn set_password_expiration_time<T>(mut self, v: T) -> Self
43023    where
43024        T: std::convert::Into<wkt::Timestamp>,
43025    {
43026        self.password_expiration_time = std::option::Option::Some(v.into());
43027        self
43028    }
43029
43030    /// Sets or clears the value of [password_expiration_time][crate::model::PasswordStatus::password_expiration_time].
43031    pub fn set_or_clear_password_expiration_time<T>(mut self, v: std::option::Option<T>) -> Self
43032    where
43033        T: std::convert::Into<wkt::Timestamp>,
43034    {
43035        self.password_expiration_time = v.map(|x| x.into());
43036        self
43037    }
43038}
43039
43040impl wkt::message::Message for PasswordStatus {
43041    fn typename() -> &'static str {
43042        "type.googleapis.com/google.cloud.sql.v1.PasswordStatus"
43043    }
43044}
43045
43046#[doc(hidden)]
43047impl<'de> serde::de::Deserialize<'de> for PasswordStatus {
43048    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
43049    where
43050        D: serde::Deserializer<'de>,
43051    {
43052        #[allow(non_camel_case_types)]
43053        #[doc(hidden)]
43054        #[derive(PartialEq, Eq, Hash)]
43055        enum __FieldTag {
43056            __locked,
43057            __password_expiration_time,
43058            Unknown(std::string::String),
43059        }
43060        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
43061            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
43062            where
43063                D: serde::Deserializer<'de>,
43064            {
43065                struct Visitor;
43066                impl<'de> serde::de::Visitor<'de> for Visitor {
43067                    type Value = __FieldTag;
43068                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
43069                        formatter.write_str("a field name for PasswordStatus")
43070                    }
43071                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
43072                    where
43073                        E: serde::de::Error,
43074                    {
43075                        use std::result::Result::Ok;
43076                        use std::string::ToString;
43077                        match value {
43078                            "locked" => Ok(__FieldTag::__locked),
43079                            "passwordExpirationTime" => Ok(__FieldTag::__password_expiration_time),
43080                            "password_expiration_time" => {
43081                                Ok(__FieldTag::__password_expiration_time)
43082                            }
43083                            _ => Ok(__FieldTag::Unknown(value.to_string())),
43084                        }
43085                    }
43086                }
43087                deserializer.deserialize_identifier(Visitor)
43088            }
43089        }
43090        struct Visitor;
43091        impl<'de> serde::de::Visitor<'de> for Visitor {
43092            type Value = PasswordStatus;
43093            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
43094                formatter.write_str("struct PasswordStatus")
43095            }
43096            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
43097            where
43098                A: serde::de::MapAccess<'de>,
43099            {
43100                #[allow(unused_imports)]
43101                use serde::de::Error;
43102                use std::option::Option::Some;
43103                let mut fields = std::collections::HashSet::new();
43104                let mut result = Self::Value::new();
43105                while let Some(tag) = map.next_key::<__FieldTag>()? {
43106                    #[allow(clippy::match_single_binding)]
43107                    match tag {
43108                        __FieldTag::__locked => {
43109                            if !fields.insert(__FieldTag::__locked) {
43110                                return std::result::Result::Err(A::Error::duplicate_field(
43111                                    "multiple values for locked",
43112                                ));
43113                            }
43114                            result.locked = map
43115                                .next_value::<std::option::Option<bool>>()?
43116                                .unwrap_or_default();
43117                        }
43118                        __FieldTag::__password_expiration_time => {
43119                            if !fields.insert(__FieldTag::__password_expiration_time) {
43120                                return std::result::Result::Err(A::Error::duplicate_field(
43121                                    "multiple values for password_expiration_time",
43122                                ));
43123                            }
43124                            result.password_expiration_time =
43125                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
43126                        }
43127                        __FieldTag::Unknown(key) => {
43128                            let value = map.next_value::<serde_json::Value>()?;
43129                            result._unknown_fields.insert(key, value);
43130                        }
43131                    }
43132                }
43133                std::result::Result::Ok(result)
43134            }
43135        }
43136        deserializer.deserialize_any(Visitor)
43137    }
43138}
43139
43140#[doc(hidden)]
43141impl serde::ser::Serialize for PasswordStatus {
43142    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
43143    where
43144        S: serde::ser::Serializer,
43145    {
43146        use serde::ser::SerializeMap;
43147        #[allow(unused_imports)]
43148        use std::option::Option::Some;
43149        let mut state = serializer.serialize_map(std::option::Option::None)?;
43150        if !wkt::internal::is_default(&self.locked) {
43151            state.serialize_entry("locked", &self.locked)?;
43152        }
43153        if self.password_expiration_time.is_some() {
43154            state.serialize_entry("passwordExpirationTime", &self.password_expiration_time)?;
43155        }
43156        if !self._unknown_fields.is_empty() {
43157            for (key, value) in self._unknown_fields.iter() {
43158                state.serialize_entry(key, &value)?;
43159            }
43160        }
43161        state.end()
43162    }
43163}
43164
43165impl std::fmt::Debug for PasswordStatus {
43166    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
43167        let mut debug_struct = f.debug_struct("PasswordStatus");
43168        debug_struct.field("locked", &self.locked);
43169        debug_struct.field("password_expiration_time", &self.password_expiration_time);
43170        if !self._unknown_fields.is_empty() {
43171            debug_struct.field("_unknown_fields", &self._unknown_fields);
43172        }
43173        debug_struct.finish()
43174    }
43175}
43176
43177/// A Cloud SQL user resource.
43178#[derive(Clone, Default, PartialEq)]
43179#[non_exhaustive]
43180pub struct User {
43181    /// This is always `sql#user`.
43182    pub kind: std::string::String,
43183
43184    /// The password for the user.
43185    pub password: std::string::String,
43186
43187    /// This field is deprecated and will be removed from a future version of the
43188    /// API.
43189    pub etag: std::string::String,
43190
43191    /// The name of the user in the Cloud SQL instance. Can be omitted for
43192    /// `update` because it is already specified in the URL.
43193    pub name: std::string::String,
43194
43195    /// Optional. The host from which the user can connect. For `insert`
43196    /// operations, host defaults to an empty string. For `update`
43197    /// operations, host is specified as part of the request URL. The host name
43198    /// cannot be updated after insertion.  For a MySQL instance, it's required;
43199    /// for a PostgreSQL or SQL Server instance, it's optional.
43200    pub host: std::string::String,
43201
43202    /// The name of the Cloud SQL instance. This does not include the project ID.
43203    /// Can be omitted for `update` because it is already specified on the
43204    /// URL.
43205    pub instance: std::string::String,
43206
43207    /// The project ID of the project containing the Cloud SQL database. The Google
43208    /// apps domain is prefixed if applicable. Can be omitted for `update` because
43209    /// it is already specified on the URL.
43210    pub project: std::string::String,
43211
43212    /// The user type. It determines the method to authenticate the user during
43213    /// login. The default is the database's built-in user type.
43214    pub r#type: crate::model::user::SqlUserType,
43215
43216    /// User level password validation policy.
43217    pub password_policy: std::option::Option<crate::model::UserPasswordValidationPolicy>,
43218
43219    /// Dual password status for the user.
43220    pub dual_password_type: std::option::Option<crate::model::user::DualPasswordType>,
43221
43222    /// User details for specific database type
43223    pub user_details: std::option::Option<crate::model::user::UserDetails>,
43224
43225    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
43226}
43227
43228impl User {
43229    pub fn new() -> Self {
43230        std::default::Default::default()
43231    }
43232
43233    /// Sets the value of [kind][crate::model::User::kind].
43234    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
43235        self.kind = v.into();
43236        self
43237    }
43238
43239    /// Sets the value of [password][crate::model::User::password].
43240    pub fn set_password<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
43241        self.password = v.into();
43242        self
43243    }
43244
43245    /// Sets the value of [etag][crate::model::User::etag].
43246    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
43247        self.etag = v.into();
43248        self
43249    }
43250
43251    /// Sets the value of [name][crate::model::User::name].
43252    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
43253        self.name = v.into();
43254        self
43255    }
43256
43257    /// Sets the value of [host][crate::model::User::host].
43258    pub fn set_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
43259        self.host = v.into();
43260        self
43261    }
43262
43263    /// Sets the value of [instance][crate::model::User::instance].
43264    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
43265        self.instance = v.into();
43266        self
43267    }
43268
43269    /// Sets the value of [project][crate::model::User::project].
43270    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
43271        self.project = v.into();
43272        self
43273    }
43274
43275    /// Sets the value of [r#type][crate::model::User::type].
43276    pub fn set_type<T: std::convert::Into<crate::model::user::SqlUserType>>(
43277        mut self,
43278        v: T,
43279    ) -> Self {
43280        self.r#type = v.into();
43281        self
43282    }
43283
43284    /// Sets the value of [password_policy][crate::model::User::password_policy].
43285    pub fn set_password_policy<T>(mut self, v: T) -> Self
43286    where
43287        T: std::convert::Into<crate::model::UserPasswordValidationPolicy>,
43288    {
43289        self.password_policy = std::option::Option::Some(v.into());
43290        self
43291    }
43292
43293    /// Sets or clears the value of [password_policy][crate::model::User::password_policy].
43294    pub fn set_or_clear_password_policy<T>(mut self, v: std::option::Option<T>) -> Self
43295    where
43296        T: std::convert::Into<crate::model::UserPasswordValidationPolicy>,
43297    {
43298        self.password_policy = v.map(|x| x.into());
43299        self
43300    }
43301
43302    /// Sets the value of [dual_password_type][crate::model::User::dual_password_type].
43303    pub fn set_dual_password_type<T>(mut self, v: T) -> Self
43304    where
43305        T: std::convert::Into<crate::model::user::DualPasswordType>,
43306    {
43307        self.dual_password_type = std::option::Option::Some(v.into());
43308        self
43309    }
43310
43311    /// Sets or clears the value of [dual_password_type][crate::model::User::dual_password_type].
43312    pub fn set_or_clear_dual_password_type<T>(mut self, v: std::option::Option<T>) -> Self
43313    where
43314        T: std::convert::Into<crate::model::user::DualPasswordType>,
43315    {
43316        self.dual_password_type = v.map(|x| x.into());
43317        self
43318    }
43319
43320    /// Sets the value of [user_details][crate::model::User::user_details].
43321    ///
43322    /// Note that all the setters affecting `user_details` are mutually
43323    /// exclusive.
43324    pub fn set_user_details<
43325        T: std::convert::Into<std::option::Option<crate::model::user::UserDetails>>,
43326    >(
43327        mut self,
43328        v: T,
43329    ) -> Self {
43330        self.user_details = v.into();
43331        self
43332    }
43333
43334    /// The value of [user_details][crate::model::User::user_details]
43335    /// if it holds a `SqlserverUserDetails`, `None` if the field is not set or
43336    /// holds a different branch.
43337    pub fn sqlserver_user_details(
43338        &self,
43339    ) -> std::option::Option<&std::boxed::Box<crate::model::SqlServerUserDetails>> {
43340        #[allow(unreachable_patterns)]
43341        self.user_details.as_ref().and_then(|v| match v {
43342            crate::model::user::UserDetails::SqlserverUserDetails(v) => {
43343                std::option::Option::Some(v)
43344            }
43345            _ => std::option::Option::None,
43346        })
43347    }
43348
43349    /// Sets the value of [user_details][crate::model::User::user_details]
43350    /// to hold a `SqlserverUserDetails`.
43351    ///
43352    /// Note that all the setters affecting `user_details` are
43353    /// mutually exclusive.
43354    pub fn set_sqlserver_user_details<
43355        T: std::convert::Into<std::boxed::Box<crate::model::SqlServerUserDetails>>,
43356    >(
43357        mut self,
43358        v: T,
43359    ) -> Self {
43360        self.user_details = std::option::Option::Some(
43361            crate::model::user::UserDetails::SqlserverUserDetails(v.into()),
43362        );
43363        self
43364    }
43365}
43366
43367impl wkt::message::Message for User {
43368    fn typename() -> &'static str {
43369        "type.googleapis.com/google.cloud.sql.v1.User"
43370    }
43371}
43372
43373#[doc(hidden)]
43374impl<'de> serde::de::Deserialize<'de> for User {
43375    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
43376    where
43377        D: serde::Deserializer<'de>,
43378    {
43379        #[allow(non_camel_case_types)]
43380        #[doc(hidden)]
43381        #[derive(PartialEq, Eq, Hash)]
43382        enum __FieldTag {
43383            __kind,
43384            __password,
43385            __etag,
43386            __name,
43387            __host,
43388            __instance,
43389            __project,
43390            __type,
43391            __sqlserver_user_details,
43392            __password_policy,
43393            __dual_password_type,
43394            Unknown(std::string::String),
43395        }
43396        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
43397            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
43398            where
43399                D: serde::Deserializer<'de>,
43400            {
43401                struct Visitor;
43402                impl<'de> serde::de::Visitor<'de> for Visitor {
43403                    type Value = __FieldTag;
43404                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
43405                        formatter.write_str("a field name for User")
43406                    }
43407                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
43408                    where
43409                        E: serde::de::Error,
43410                    {
43411                        use std::result::Result::Ok;
43412                        use std::string::ToString;
43413                        match value {
43414                            "kind" => Ok(__FieldTag::__kind),
43415                            "password" => Ok(__FieldTag::__password),
43416                            "etag" => Ok(__FieldTag::__etag),
43417                            "name" => Ok(__FieldTag::__name),
43418                            "host" => Ok(__FieldTag::__host),
43419                            "instance" => Ok(__FieldTag::__instance),
43420                            "project" => Ok(__FieldTag::__project),
43421                            "type" => Ok(__FieldTag::__type),
43422                            "sqlserverUserDetails" => Ok(__FieldTag::__sqlserver_user_details),
43423                            "sqlserver_user_details" => Ok(__FieldTag::__sqlserver_user_details),
43424                            "passwordPolicy" => Ok(__FieldTag::__password_policy),
43425                            "password_policy" => Ok(__FieldTag::__password_policy),
43426                            "dualPasswordType" => Ok(__FieldTag::__dual_password_type),
43427                            "dual_password_type" => Ok(__FieldTag::__dual_password_type),
43428                            _ => Ok(__FieldTag::Unknown(value.to_string())),
43429                        }
43430                    }
43431                }
43432                deserializer.deserialize_identifier(Visitor)
43433            }
43434        }
43435        struct Visitor;
43436        impl<'de> serde::de::Visitor<'de> for Visitor {
43437            type Value = User;
43438            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
43439                formatter.write_str("struct User")
43440            }
43441            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
43442            where
43443                A: serde::de::MapAccess<'de>,
43444            {
43445                #[allow(unused_imports)]
43446                use serde::de::Error;
43447                use std::option::Option::Some;
43448                let mut fields = std::collections::HashSet::new();
43449                let mut result = Self::Value::new();
43450                while let Some(tag) = map.next_key::<__FieldTag>()? {
43451                    #[allow(clippy::match_single_binding)]
43452                    match tag {
43453                        __FieldTag::__kind => {
43454                            if !fields.insert(__FieldTag::__kind) {
43455                                return std::result::Result::Err(A::Error::duplicate_field(
43456                                    "multiple values for kind",
43457                                ));
43458                            }
43459                            result.kind = map
43460                                .next_value::<std::option::Option<std::string::String>>()?
43461                                .unwrap_or_default();
43462                        }
43463                        __FieldTag::__password => {
43464                            if !fields.insert(__FieldTag::__password) {
43465                                return std::result::Result::Err(A::Error::duplicate_field(
43466                                    "multiple values for password",
43467                                ));
43468                            }
43469                            result.password = map
43470                                .next_value::<std::option::Option<std::string::String>>()?
43471                                .unwrap_or_default();
43472                        }
43473                        __FieldTag::__etag => {
43474                            if !fields.insert(__FieldTag::__etag) {
43475                                return std::result::Result::Err(A::Error::duplicate_field(
43476                                    "multiple values for etag",
43477                                ));
43478                            }
43479                            result.etag = map
43480                                .next_value::<std::option::Option<std::string::String>>()?
43481                                .unwrap_or_default();
43482                        }
43483                        __FieldTag::__name => {
43484                            if !fields.insert(__FieldTag::__name) {
43485                                return std::result::Result::Err(A::Error::duplicate_field(
43486                                    "multiple values for name",
43487                                ));
43488                            }
43489                            result.name = map
43490                                .next_value::<std::option::Option<std::string::String>>()?
43491                                .unwrap_or_default();
43492                        }
43493                        __FieldTag::__host => {
43494                            if !fields.insert(__FieldTag::__host) {
43495                                return std::result::Result::Err(A::Error::duplicate_field(
43496                                    "multiple values for host",
43497                                ));
43498                            }
43499                            result.host = map
43500                                .next_value::<std::option::Option<std::string::String>>()?
43501                                .unwrap_or_default();
43502                        }
43503                        __FieldTag::__instance => {
43504                            if !fields.insert(__FieldTag::__instance) {
43505                                return std::result::Result::Err(A::Error::duplicate_field(
43506                                    "multiple values for instance",
43507                                ));
43508                            }
43509                            result.instance = map
43510                                .next_value::<std::option::Option<std::string::String>>()?
43511                                .unwrap_or_default();
43512                        }
43513                        __FieldTag::__project => {
43514                            if !fields.insert(__FieldTag::__project) {
43515                                return std::result::Result::Err(A::Error::duplicate_field(
43516                                    "multiple values for project",
43517                                ));
43518                            }
43519                            result.project = map
43520                                .next_value::<std::option::Option<std::string::String>>()?
43521                                .unwrap_or_default();
43522                        }
43523                        __FieldTag::__type => {
43524                            if !fields.insert(__FieldTag::__type) {
43525                                return std::result::Result::Err(A::Error::duplicate_field(
43526                                    "multiple values for type",
43527                                ));
43528                            }
43529                            result.r#type = map
43530                                .next_value::<std::option::Option<crate::model::user::SqlUserType>>(
43531                                )?
43532                                .unwrap_or_default();
43533                        }
43534                        __FieldTag::__sqlserver_user_details => {
43535                            if !fields.insert(__FieldTag::__sqlserver_user_details) {
43536                                return std::result::Result::Err(A::Error::duplicate_field(
43537                                    "multiple values for sqlserver_user_details",
43538                                ));
43539                            }
43540                            if result.user_details.is_some() {
43541                                return std::result::Result::Err(A::Error::duplicate_field(
43542                                    "multiple values for `user_details`, a oneof with full ID .google.cloud.sql.v1.User.sqlserver_user_details, latest field was sqlserverUserDetails",
43543                                ));
43544                            }
43545                            result.user_details = std::option::Option::Some(
43546                                crate::model::user::UserDetails::SqlserverUserDetails(
43547                                    map.next_value::<std::option::Option<
43548                                        std::boxed::Box<crate::model::SqlServerUserDetails>,
43549                                    >>()?
43550                                    .unwrap_or_default(),
43551                                ),
43552                            );
43553                        }
43554                        __FieldTag::__password_policy => {
43555                            if !fields.insert(__FieldTag::__password_policy) {
43556                                return std::result::Result::Err(A::Error::duplicate_field(
43557                                    "multiple values for password_policy",
43558                                ));
43559                            }
43560                            result.password_policy = map.next_value::<std::option::Option<crate::model::UserPasswordValidationPolicy>>()?
43561                                ;
43562                        }
43563                        __FieldTag::__dual_password_type => {
43564                            if !fields.insert(__FieldTag::__dual_password_type) {
43565                                return std::result::Result::Err(A::Error::duplicate_field(
43566                                    "multiple values for dual_password_type",
43567                                ));
43568                            }
43569                            result.dual_password_type = map.next_value::<std::option::Option<crate::model::user::DualPasswordType>>()?
43570                                ;
43571                        }
43572                        __FieldTag::Unknown(key) => {
43573                            let value = map.next_value::<serde_json::Value>()?;
43574                            result._unknown_fields.insert(key, value);
43575                        }
43576                    }
43577                }
43578                std::result::Result::Ok(result)
43579            }
43580        }
43581        deserializer.deserialize_any(Visitor)
43582    }
43583}
43584
43585#[doc(hidden)]
43586impl serde::ser::Serialize for User {
43587    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
43588    where
43589        S: serde::ser::Serializer,
43590    {
43591        use serde::ser::SerializeMap;
43592        #[allow(unused_imports)]
43593        use std::option::Option::Some;
43594        let mut state = serializer.serialize_map(std::option::Option::None)?;
43595        if !self.kind.is_empty() {
43596            state.serialize_entry("kind", &self.kind)?;
43597        }
43598        if !self.password.is_empty() {
43599            state.serialize_entry("password", &self.password)?;
43600        }
43601        if !self.etag.is_empty() {
43602            state.serialize_entry("etag", &self.etag)?;
43603        }
43604        if !self.name.is_empty() {
43605            state.serialize_entry("name", &self.name)?;
43606        }
43607        if !self.host.is_empty() {
43608            state.serialize_entry("host", &self.host)?;
43609        }
43610        if !self.instance.is_empty() {
43611            state.serialize_entry("instance", &self.instance)?;
43612        }
43613        if !self.project.is_empty() {
43614            state.serialize_entry("project", &self.project)?;
43615        }
43616        if !wkt::internal::is_default(&self.r#type) {
43617            state.serialize_entry("type", &self.r#type)?;
43618        }
43619        if let Some(value) = self.sqlserver_user_details() {
43620            state.serialize_entry("sqlserverUserDetails", value)?;
43621        }
43622        if self.password_policy.is_some() {
43623            state.serialize_entry("passwordPolicy", &self.password_policy)?;
43624        }
43625        if self.dual_password_type.is_some() {
43626            state.serialize_entry("dualPasswordType", &self.dual_password_type)?;
43627        }
43628        if !self._unknown_fields.is_empty() {
43629            for (key, value) in self._unknown_fields.iter() {
43630                state.serialize_entry(key, &value)?;
43631            }
43632        }
43633        state.end()
43634    }
43635}
43636
43637impl std::fmt::Debug for User {
43638    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
43639        let mut debug_struct = f.debug_struct("User");
43640        debug_struct.field("kind", &self.kind);
43641        debug_struct.field("password", &self.password);
43642        debug_struct.field("etag", &self.etag);
43643        debug_struct.field("name", &self.name);
43644        debug_struct.field("host", &self.host);
43645        debug_struct.field("instance", &self.instance);
43646        debug_struct.field("project", &self.project);
43647        debug_struct.field("r#type", &self.r#type);
43648        debug_struct.field("password_policy", &self.password_policy);
43649        debug_struct.field("dual_password_type", &self.dual_password_type);
43650        debug_struct.field("user_details", &self.user_details);
43651        if !self._unknown_fields.is_empty() {
43652            debug_struct.field("_unknown_fields", &self._unknown_fields);
43653        }
43654        debug_struct.finish()
43655    }
43656}
43657
43658/// Defines additional types related to [User].
43659pub mod user {
43660    #[allow(unused_imports)]
43661    use super::*;
43662
43663    /// The user type.
43664    ///
43665    /// # Working with unknown values
43666    ///
43667    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
43668    /// additional enum variants at any time. Adding new variants is not considered
43669    /// a breaking change. Applications should write their code in anticipation of:
43670    ///
43671    /// - New values appearing in future releases of the client library, **and**
43672    /// - New values received dynamically, without application changes.
43673    ///
43674    /// Please consult the [Working with enums] section in the user guide for some
43675    /// guidelines.
43676    ///
43677    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
43678    #[derive(Clone, Debug, PartialEq)]
43679    #[non_exhaustive]
43680    pub enum SqlUserType {
43681        /// The database's built-in user type.
43682        BuiltIn,
43683        /// Cloud IAM user.
43684        CloudIamUser,
43685        /// Cloud IAM service account.
43686        CloudIamServiceAccount,
43687        /// Cloud IAM group non-login user.
43688        CloudIamGroup,
43689        /// Cloud IAM group login user.
43690        CloudIamGroupUser,
43691        /// Cloud IAM group login service account.
43692        CloudIamGroupServiceAccount,
43693        /// If set, the enum was initialized with an unknown value.
43694        ///
43695        /// Applications can examine the value using [SqlUserType::value] or
43696        /// [SqlUserType::name].
43697        UnknownValue(sql_user_type::UnknownValue),
43698    }
43699
43700    #[doc(hidden)]
43701    pub mod sql_user_type {
43702        #[allow(unused_imports)]
43703        use super::*;
43704        #[derive(Clone, Debug, PartialEq)]
43705        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
43706    }
43707
43708    impl SqlUserType {
43709        /// Gets the enum value.
43710        ///
43711        /// Returns `None` if the enum contains an unknown value deserialized from
43712        /// the string representation of enums.
43713        pub fn value(&self) -> std::option::Option<i32> {
43714            match self {
43715                Self::BuiltIn => std::option::Option::Some(0),
43716                Self::CloudIamUser => std::option::Option::Some(1),
43717                Self::CloudIamServiceAccount => std::option::Option::Some(2),
43718                Self::CloudIamGroup => std::option::Option::Some(3),
43719                Self::CloudIamGroupUser => std::option::Option::Some(4),
43720                Self::CloudIamGroupServiceAccount => std::option::Option::Some(5),
43721                Self::UnknownValue(u) => u.0.value(),
43722            }
43723        }
43724
43725        /// Gets the enum value as a string.
43726        ///
43727        /// Returns `None` if the enum contains an unknown value deserialized from
43728        /// the integer representation of enums.
43729        pub fn name(&self) -> std::option::Option<&str> {
43730            match self {
43731                Self::BuiltIn => std::option::Option::Some("BUILT_IN"),
43732                Self::CloudIamUser => std::option::Option::Some("CLOUD_IAM_USER"),
43733                Self::CloudIamServiceAccount => {
43734                    std::option::Option::Some("CLOUD_IAM_SERVICE_ACCOUNT")
43735                }
43736                Self::CloudIamGroup => std::option::Option::Some("CLOUD_IAM_GROUP"),
43737                Self::CloudIamGroupUser => std::option::Option::Some("CLOUD_IAM_GROUP_USER"),
43738                Self::CloudIamGroupServiceAccount => {
43739                    std::option::Option::Some("CLOUD_IAM_GROUP_SERVICE_ACCOUNT")
43740                }
43741                Self::UnknownValue(u) => u.0.name(),
43742            }
43743        }
43744    }
43745
43746    impl std::default::Default for SqlUserType {
43747        fn default() -> Self {
43748            use std::convert::From;
43749            Self::from(0)
43750        }
43751    }
43752
43753    impl std::fmt::Display for SqlUserType {
43754        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
43755            wkt::internal::display_enum(f, self.name(), self.value())
43756        }
43757    }
43758
43759    impl std::convert::From<i32> for SqlUserType {
43760        fn from(value: i32) -> Self {
43761            match value {
43762                0 => Self::BuiltIn,
43763                1 => Self::CloudIamUser,
43764                2 => Self::CloudIamServiceAccount,
43765                3 => Self::CloudIamGroup,
43766                4 => Self::CloudIamGroupUser,
43767                5 => Self::CloudIamGroupServiceAccount,
43768                _ => Self::UnknownValue(sql_user_type::UnknownValue(
43769                    wkt::internal::UnknownEnumValue::Integer(value),
43770                )),
43771            }
43772        }
43773    }
43774
43775    impl std::convert::From<&str> for SqlUserType {
43776        fn from(value: &str) -> Self {
43777            use std::string::ToString;
43778            match value {
43779                "BUILT_IN" => Self::BuiltIn,
43780                "CLOUD_IAM_USER" => Self::CloudIamUser,
43781                "CLOUD_IAM_SERVICE_ACCOUNT" => Self::CloudIamServiceAccount,
43782                "CLOUD_IAM_GROUP" => Self::CloudIamGroup,
43783                "CLOUD_IAM_GROUP_USER" => Self::CloudIamGroupUser,
43784                "CLOUD_IAM_GROUP_SERVICE_ACCOUNT" => Self::CloudIamGroupServiceAccount,
43785                _ => Self::UnknownValue(sql_user_type::UnknownValue(
43786                    wkt::internal::UnknownEnumValue::String(value.to_string()),
43787                )),
43788            }
43789        }
43790    }
43791
43792    impl serde::ser::Serialize for SqlUserType {
43793        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
43794        where
43795            S: serde::Serializer,
43796        {
43797            match self {
43798                Self::BuiltIn => serializer.serialize_i32(0),
43799                Self::CloudIamUser => serializer.serialize_i32(1),
43800                Self::CloudIamServiceAccount => serializer.serialize_i32(2),
43801                Self::CloudIamGroup => serializer.serialize_i32(3),
43802                Self::CloudIamGroupUser => serializer.serialize_i32(4),
43803                Self::CloudIamGroupServiceAccount => serializer.serialize_i32(5),
43804                Self::UnknownValue(u) => u.0.serialize(serializer),
43805            }
43806        }
43807    }
43808
43809    impl<'de> serde::de::Deserialize<'de> for SqlUserType {
43810        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
43811        where
43812            D: serde::Deserializer<'de>,
43813        {
43814            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlUserType>::new(
43815                ".google.cloud.sql.v1.User.SqlUserType",
43816            ))
43817        }
43818    }
43819
43820    /// The type of retained password.
43821    ///
43822    /// # Working with unknown values
43823    ///
43824    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
43825    /// additional enum variants at any time. Adding new variants is not considered
43826    /// a breaking change. Applications should write their code in anticipation of:
43827    ///
43828    /// - New values appearing in future releases of the client library, **and**
43829    /// - New values received dynamically, without application changes.
43830    ///
43831    /// Please consult the [Working with enums] section in the user guide for some
43832    /// guidelines.
43833    ///
43834    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
43835    #[derive(Clone, Debug, PartialEq)]
43836    #[non_exhaustive]
43837    pub enum DualPasswordType {
43838        /// The default value.
43839        Unspecified,
43840        /// Do not update the user's dual password status.
43841        NoModifyDualPassword,
43842        /// No dual password usable for connecting using this user.
43843        NoDualPassword,
43844        /// Dual password usable for connecting using this user.
43845        DualPassword,
43846        /// If set, the enum was initialized with an unknown value.
43847        ///
43848        /// Applications can examine the value using [DualPasswordType::value] or
43849        /// [DualPasswordType::name].
43850        UnknownValue(dual_password_type::UnknownValue),
43851    }
43852
43853    #[doc(hidden)]
43854    pub mod dual_password_type {
43855        #[allow(unused_imports)]
43856        use super::*;
43857        #[derive(Clone, Debug, PartialEq)]
43858        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
43859    }
43860
43861    impl DualPasswordType {
43862        /// Gets the enum value.
43863        ///
43864        /// Returns `None` if the enum contains an unknown value deserialized from
43865        /// the string representation of enums.
43866        pub fn value(&self) -> std::option::Option<i32> {
43867            match self {
43868                Self::Unspecified => std::option::Option::Some(0),
43869                Self::NoModifyDualPassword => std::option::Option::Some(1),
43870                Self::NoDualPassword => std::option::Option::Some(2),
43871                Self::DualPassword => std::option::Option::Some(3),
43872                Self::UnknownValue(u) => u.0.value(),
43873            }
43874        }
43875
43876        /// Gets the enum value as a string.
43877        ///
43878        /// Returns `None` if the enum contains an unknown value deserialized from
43879        /// the integer representation of enums.
43880        pub fn name(&self) -> std::option::Option<&str> {
43881            match self {
43882                Self::Unspecified => std::option::Option::Some("DUAL_PASSWORD_TYPE_UNSPECIFIED"),
43883                Self::NoModifyDualPassword => std::option::Option::Some("NO_MODIFY_DUAL_PASSWORD"),
43884                Self::NoDualPassword => std::option::Option::Some("NO_DUAL_PASSWORD"),
43885                Self::DualPassword => std::option::Option::Some("DUAL_PASSWORD"),
43886                Self::UnknownValue(u) => u.0.name(),
43887            }
43888        }
43889    }
43890
43891    impl std::default::Default for DualPasswordType {
43892        fn default() -> Self {
43893            use std::convert::From;
43894            Self::from(0)
43895        }
43896    }
43897
43898    impl std::fmt::Display for DualPasswordType {
43899        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
43900            wkt::internal::display_enum(f, self.name(), self.value())
43901        }
43902    }
43903
43904    impl std::convert::From<i32> for DualPasswordType {
43905        fn from(value: i32) -> Self {
43906            match value {
43907                0 => Self::Unspecified,
43908                1 => Self::NoModifyDualPassword,
43909                2 => Self::NoDualPassword,
43910                3 => Self::DualPassword,
43911                _ => Self::UnknownValue(dual_password_type::UnknownValue(
43912                    wkt::internal::UnknownEnumValue::Integer(value),
43913                )),
43914            }
43915        }
43916    }
43917
43918    impl std::convert::From<&str> for DualPasswordType {
43919        fn from(value: &str) -> Self {
43920            use std::string::ToString;
43921            match value {
43922                "DUAL_PASSWORD_TYPE_UNSPECIFIED" => Self::Unspecified,
43923                "NO_MODIFY_DUAL_PASSWORD" => Self::NoModifyDualPassword,
43924                "NO_DUAL_PASSWORD" => Self::NoDualPassword,
43925                "DUAL_PASSWORD" => Self::DualPassword,
43926                _ => Self::UnknownValue(dual_password_type::UnknownValue(
43927                    wkt::internal::UnknownEnumValue::String(value.to_string()),
43928                )),
43929            }
43930        }
43931    }
43932
43933    impl serde::ser::Serialize for DualPasswordType {
43934        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
43935        where
43936            S: serde::Serializer,
43937        {
43938            match self {
43939                Self::Unspecified => serializer.serialize_i32(0),
43940                Self::NoModifyDualPassword => serializer.serialize_i32(1),
43941                Self::NoDualPassword => serializer.serialize_i32(2),
43942                Self::DualPassword => serializer.serialize_i32(3),
43943                Self::UnknownValue(u) => u.0.serialize(serializer),
43944            }
43945        }
43946    }
43947
43948    impl<'de> serde::de::Deserialize<'de> for DualPasswordType {
43949        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
43950        where
43951            D: serde::Deserializer<'de>,
43952        {
43953            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DualPasswordType>::new(
43954                ".google.cloud.sql.v1.User.DualPasswordType",
43955            ))
43956        }
43957    }
43958
43959    /// User details for specific database type
43960    #[derive(Clone, Debug, PartialEq)]
43961    #[non_exhaustive]
43962    pub enum UserDetails {
43963        SqlserverUserDetails(std::boxed::Box<crate::model::SqlServerUserDetails>),
43964    }
43965}
43966
43967/// Represents a Sql Server user on the Cloud SQL instance.
43968#[derive(Clone, Default, PartialEq)]
43969#[non_exhaustive]
43970pub struct SqlServerUserDetails {
43971    /// If the user has been disabled
43972    pub disabled: bool,
43973
43974    /// The server roles for this user
43975    pub server_roles: std::vec::Vec<std::string::String>,
43976
43977    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
43978}
43979
43980impl SqlServerUserDetails {
43981    pub fn new() -> Self {
43982        std::default::Default::default()
43983    }
43984
43985    /// Sets the value of [disabled][crate::model::SqlServerUserDetails::disabled].
43986    pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
43987        self.disabled = v.into();
43988        self
43989    }
43990
43991    /// Sets the value of [server_roles][crate::model::SqlServerUserDetails::server_roles].
43992    pub fn set_server_roles<T, V>(mut self, v: T) -> Self
43993    where
43994        T: std::iter::IntoIterator<Item = V>,
43995        V: std::convert::Into<std::string::String>,
43996    {
43997        use std::iter::Iterator;
43998        self.server_roles = v.into_iter().map(|i| i.into()).collect();
43999        self
44000    }
44001}
44002
44003impl wkt::message::Message for SqlServerUserDetails {
44004    fn typename() -> &'static str {
44005        "type.googleapis.com/google.cloud.sql.v1.SqlServerUserDetails"
44006    }
44007}
44008
44009#[doc(hidden)]
44010impl<'de> serde::de::Deserialize<'de> for SqlServerUserDetails {
44011    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
44012    where
44013        D: serde::Deserializer<'de>,
44014    {
44015        #[allow(non_camel_case_types)]
44016        #[doc(hidden)]
44017        #[derive(PartialEq, Eq, Hash)]
44018        enum __FieldTag {
44019            __disabled,
44020            __server_roles,
44021            Unknown(std::string::String),
44022        }
44023        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
44024            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
44025            where
44026                D: serde::Deserializer<'de>,
44027            {
44028                struct Visitor;
44029                impl<'de> serde::de::Visitor<'de> for Visitor {
44030                    type Value = __FieldTag;
44031                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
44032                        formatter.write_str("a field name for SqlServerUserDetails")
44033                    }
44034                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
44035                    where
44036                        E: serde::de::Error,
44037                    {
44038                        use std::result::Result::Ok;
44039                        use std::string::ToString;
44040                        match value {
44041                            "disabled" => Ok(__FieldTag::__disabled),
44042                            "serverRoles" => Ok(__FieldTag::__server_roles),
44043                            "server_roles" => Ok(__FieldTag::__server_roles),
44044                            _ => Ok(__FieldTag::Unknown(value.to_string())),
44045                        }
44046                    }
44047                }
44048                deserializer.deserialize_identifier(Visitor)
44049            }
44050        }
44051        struct Visitor;
44052        impl<'de> serde::de::Visitor<'de> for Visitor {
44053            type Value = SqlServerUserDetails;
44054            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
44055                formatter.write_str("struct SqlServerUserDetails")
44056            }
44057            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
44058            where
44059                A: serde::de::MapAccess<'de>,
44060            {
44061                #[allow(unused_imports)]
44062                use serde::de::Error;
44063                use std::option::Option::Some;
44064                let mut fields = std::collections::HashSet::new();
44065                let mut result = Self::Value::new();
44066                while let Some(tag) = map.next_key::<__FieldTag>()? {
44067                    #[allow(clippy::match_single_binding)]
44068                    match tag {
44069                        __FieldTag::__disabled => {
44070                            if !fields.insert(__FieldTag::__disabled) {
44071                                return std::result::Result::Err(A::Error::duplicate_field(
44072                                    "multiple values for disabled",
44073                                ));
44074                            }
44075                            result.disabled = map
44076                                .next_value::<std::option::Option<bool>>()?
44077                                .unwrap_or_default();
44078                        }
44079                        __FieldTag::__server_roles => {
44080                            if !fields.insert(__FieldTag::__server_roles) {
44081                                return std::result::Result::Err(A::Error::duplicate_field(
44082                                    "multiple values for server_roles",
44083                                ));
44084                            }
44085                            result.server_roles = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
44086                        }
44087                        __FieldTag::Unknown(key) => {
44088                            let value = map.next_value::<serde_json::Value>()?;
44089                            result._unknown_fields.insert(key, value);
44090                        }
44091                    }
44092                }
44093                std::result::Result::Ok(result)
44094            }
44095        }
44096        deserializer.deserialize_any(Visitor)
44097    }
44098}
44099
44100#[doc(hidden)]
44101impl serde::ser::Serialize for SqlServerUserDetails {
44102    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
44103    where
44104        S: serde::ser::Serializer,
44105    {
44106        use serde::ser::SerializeMap;
44107        #[allow(unused_imports)]
44108        use std::option::Option::Some;
44109        let mut state = serializer.serialize_map(std::option::Option::None)?;
44110        if !wkt::internal::is_default(&self.disabled) {
44111            state.serialize_entry("disabled", &self.disabled)?;
44112        }
44113        if !self.server_roles.is_empty() {
44114            state.serialize_entry("serverRoles", &self.server_roles)?;
44115        }
44116        if !self._unknown_fields.is_empty() {
44117            for (key, value) in self._unknown_fields.iter() {
44118                state.serialize_entry(key, &value)?;
44119            }
44120        }
44121        state.end()
44122    }
44123}
44124
44125impl std::fmt::Debug for SqlServerUserDetails {
44126    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
44127        let mut debug_struct = f.debug_struct("SqlServerUserDetails");
44128        debug_struct.field("disabled", &self.disabled);
44129        debug_struct.field("server_roles", &self.server_roles);
44130        if !self._unknown_fields.is_empty() {
44131            debug_struct.field("_unknown_fields", &self._unknown_fields);
44132        }
44133        debug_struct.finish()
44134    }
44135}
44136
44137/// User list response.
44138#[derive(Clone, Default, PartialEq)]
44139#[non_exhaustive]
44140pub struct UsersListResponse {
44141    /// This is always `sql#usersList`.
44142    pub kind: std::string::String,
44143
44144    /// List of user resources in the instance.
44145    pub items: std::vec::Vec<crate::model::User>,
44146
44147    /// Unused.
44148    #[deprecated]
44149    pub next_page_token: std::string::String,
44150
44151    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
44152}
44153
44154impl UsersListResponse {
44155    pub fn new() -> Self {
44156        std::default::Default::default()
44157    }
44158
44159    /// Sets the value of [kind][crate::model::UsersListResponse::kind].
44160    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
44161        self.kind = v.into();
44162        self
44163    }
44164
44165    /// Sets the value of [items][crate::model::UsersListResponse::items].
44166    pub fn set_items<T, V>(mut self, v: T) -> Self
44167    where
44168        T: std::iter::IntoIterator<Item = V>,
44169        V: std::convert::Into<crate::model::User>,
44170    {
44171        use std::iter::Iterator;
44172        self.items = v.into_iter().map(|i| i.into()).collect();
44173        self
44174    }
44175
44176    /// Sets the value of [next_page_token][crate::model::UsersListResponse::next_page_token].
44177    #[deprecated]
44178    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
44179        self.next_page_token = v.into();
44180        self
44181    }
44182}
44183
44184impl wkt::message::Message for UsersListResponse {
44185    fn typename() -> &'static str {
44186        "type.googleapis.com/google.cloud.sql.v1.UsersListResponse"
44187    }
44188}
44189
44190#[doc(hidden)]
44191impl<'de> serde::de::Deserialize<'de> for UsersListResponse {
44192    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
44193    where
44194        D: serde::Deserializer<'de>,
44195    {
44196        #[allow(non_camel_case_types)]
44197        #[doc(hidden)]
44198        #[derive(PartialEq, Eq, Hash)]
44199        enum __FieldTag {
44200            __kind,
44201            __items,
44202            __next_page_token,
44203            Unknown(std::string::String),
44204        }
44205        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
44206            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
44207            where
44208                D: serde::Deserializer<'de>,
44209            {
44210                struct Visitor;
44211                impl<'de> serde::de::Visitor<'de> for Visitor {
44212                    type Value = __FieldTag;
44213                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
44214                        formatter.write_str("a field name for UsersListResponse")
44215                    }
44216                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
44217                    where
44218                        E: serde::de::Error,
44219                    {
44220                        use std::result::Result::Ok;
44221                        use std::string::ToString;
44222                        match value {
44223                            "kind" => Ok(__FieldTag::__kind),
44224                            "items" => Ok(__FieldTag::__items),
44225                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
44226                            "next_page_token" => Ok(__FieldTag::__next_page_token),
44227                            _ => Ok(__FieldTag::Unknown(value.to_string())),
44228                        }
44229                    }
44230                }
44231                deserializer.deserialize_identifier(Visitor)
44232            }
44233        }
44234        struct Visitor;
44235        impl<'de> serde::de::Visitor<'de> for Visitor {
44236            type Value = UsersListResponse;
44237            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
44238                formatter.write_str("struct UsersListResponse")
44239            }
44240            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
44241            where
44242                A: serde::de::MapAccess<'de>,
44243            {
44244                #[allow(unused_imports)]
44245                use serde::de::Error;
44246                use std::option::Option::Some;
44247                let mut fields = std::collections::HashSet::new();
44248                let mut result = Self::Value::new();
44249                while let Some(tag) = map.next_key::<__FieldTag>()? {
44250                    #[allow(clippy::match_single_binding)]
44251                    match tag {
44252                        __FieldTag::__kind => {
44253                            if !fields.insert(__FieldTag::__kind) {
44254                                return std::result::Result::Err(A::Error::duplicate_field(
44255                                    "multiple values for kind",
44256                                ));
44257                            }
44258                            result.kind = map
44259                                .next_value::<std::option::Option<std::string::String>>()?
44260                                .unwrap_or_default();
44261                        }
44262                        __FieldTag::__items => {
44263                            if !fields.insert(__FieldTag::__items) {
44264                                return std::result::Result::Err(A::Error::duplicate_field(
44265                                    "multiple values for items",
44266                                ));
44267                            }
44268                            result.items = map.next_value::<std::option::Option<std::vec::Vec<crate::model::User>>>()?.unwrap_or_default();
44269                        }
44270                        __FieldTag::__next_page_token => {
44271                            if !fields.insert(__FieldTag::__next_page_token) {
44272                                return std::result::Result::Err(A::Error::duplicate_field(
44273                                    "multiple values for next_page_token",
44274                                ));
44275                            }
44276                            result.next_page_token = map
44277                                .next_value::<std::option::Option<std::string::String>>()?
44278                                .unwrap_or_default();
44279                        }
44280                        __FieldTag::Unknown(key) => {
44281                            let value = map.next_value::<serde_json::Value>()?;
44282                            result._unknown_fields.insert(key, value);
44283                        }
44284                    }
44285                }
44286                std::result::Result::Ok(result)
44287            }
44288        }
44289        deserializer.deserialize_any(Visitor)
44290    }
44291}
44292
44293#[doc(hidden)]
44294impl serde::ser::Serialize for UsersListResponse {
44295    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
44296    where
44297        S: serde::ser::Serializer,
44298    {
44299        use serde::ser::SerializeMap;
44300        #[allow(unused_imports)]
44301        use std::option::Option::Some;
44302        let mut state = serializer.serialize_map(std::option::Option::None)?;
44303        if !self.kind.is_empty() {
44304            state.serialize_entry("kind", &self.kind)?;
44305        }
44306        if !self.items.is_empty() {
44307            state.serialize_entry("items", &self.items)?;
44308        }
44309        if !self.next_page_token.is_empty() {
44310            state.serialize_entry("nextPageToken", &self.next_page_token)?;
44311        }
44312        if !self._unknown_fields.is_empty() {
44313            for (key, value) in self._unknown_fields.iter() {
44314                state.serialize_entry(key, &value)?;
44315            }
44316        }
44317        state.end()
44318    }
44319}
44320
44321impl std::fmt::Debug for UsersListResponse {
44322    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
44323        let mut debug_struct = f.debug_struct("UsersListResponse");
44324        debug_struct.field("kind", &self.kind);
44325        debug_struct.field("items", &self.items);
44326        debug_struct.field("next_page_token", &self.next_page_token);
44327        if !self._unknown_fields.is_empty() {
44328            debug_struct.field("_unknown_fields", &self._unknown_fields);
44329        }
44330        debug_struct.finish()
44331    }
44332}
44333
44334/// The status of a backup run.
44335///
44336/// # Working with unknown values
44337///
44338/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
44339/// additional enum variants at any time. Adding new variants is not considered
44340/// a breaking change. Applications should write their code in anticipation of:
44341///
44342/// - New values appearing in future releases of the client library, **and**
44343/// - New values received dynamically, without application changes.
44344///
44345/// Please consult the [Working with enums] section in the user guide for some
44346/// guidelines.
44347///
44348/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
44349#[derive(Clone, Debug, PartialEq)]
44350#[non_exhaustive]
44351pub enum SqlBackupRunStatus {
44352    /// The status of the run is unknown.
44353    Unspecified,
44354    /// The backup operation was enqueued.
44355    Enqueued,
44356    /// The backup is overdue across a given backup window. Indicates a
44357    /// problem. Example: Long-running operation in progress during
44358    /// the whole window.
44359    Overdue,
44360    /// The backup is in progress.
44361    Running,
44362    /// The backup failed.
44363    Failed,
44364    /// The backup was successful.
44365    Successful,
44366    /// The backup was skipped (without problems) for a given backup
44367    /// window. Example: Instance was idle.
44368    Skipped,
44369    /// The backup is about to be deleted.
44370    DeletionPending,
44371    /// The backup deletion failed.
44372    DeletionFailed,
44373    /// The backup has been deleted.
44374    Deleted,
44375    /// If set, the enum was initialized with an unknown value.
44376    ///
44377    /// Applications can examine the value using [SqlBackupRunStatus::value] or
44378    /// [SqlBackupRunStatus::name].
44379    UnknownValue(sql_backup_run_status::UnknownValue),
44380}
44381
44382#[doc(hidden)]
44383pub mod sql_backup_run_status {
44384    #[allow(unused_imports)]
44385    use super::*;
44386    #[derive(Clone, Debug, PartialEq)]
44387    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
44388}
44389
44390impl SqlBackupRunStatus {
44391    /// Gets the enum value.
44392    ///
44393    /// Returns `None` if the enum contains an unknown value deserialized from
44394    /// the string representation of enums.
44395    pub fn value(&self) -> std::option::Option<i32> {
44396        match self {
44397            Self::Unspecified => std::option::Option::Some(0),
44398            Self::Enqueued => std::option::Option::Some(1),
44399            Self::Overdue => std::option::Option::Some(2),
44400            Self::Running => std::option::Option::Some(3),
44401            Self::Failed => std::option::Option::Some(4),
44402            Self::Successful => std::option::Option::Some(5),
44403            Self::Skipped => std::option::Option::Some(6),
44404            Self::DeletionPending => std::option::Option::Some(7),
44405            Self::DeletionFailed => std::option::Option::Some(8),
44406            Self::Deleted => std::option::Option::Some(9),
44407            Self::UnknownValue(u) => u.0.value(),
44408        }
44409    }
44410
44411    /// Gets the enum value as a string.
44412    ///
44413    /// Returns `None` if the enum contains an unknown value deserialized from
44414    /// the integer representation of enums.
44415    pub fn name(&self) -> std::option::Option<&str> {
44416        match self {
44417            Self::Unspecified => std::option::Option::Some("SQL_BACKUP_RUN_STATUS_UNSPECIFIED"),
44418            Self::Enqueued => std::option::Option::Some("ENQUEUED"),
44419            Self::Overdue => std::option::Option::Some("OVERDUE"),
44420            Self::Running => std::option::Option::Some("RUNNING"),
44421            Self::Failed => std::option::Option::Some("FAILED"),
44422            Self::Successful => std::option::Option::Some("SUCCESSFUL"),
44423            Self::Skipped => std::option::Option::Some("SKIPPED"),
44424            Self::DeletionPending => std::option::Option::Some("DELETION_PENDING"),
44425            Self::DeletionFailed => std::option::Option::Some("DELETION_FAILED"),
44426            Self::Deleted => std::option::Option::Some("DELETED"),
44427            Self::UnknownValue(u) => u.0.name(),
44428        }
44429    }
44430}
44431
44432impl std::default::Default for SqlBackupRunStatus {
44433    fn default() -> Self {
44434        use std::convert::From;
44435        Self::from(0)
44436    }
44437}
44438
44439impl std::fmt::Display for SqlBackupRunStatus {
44440    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
44441        wkt::internal::display_enum(f, self.name(), self.value())
44442    }
44443}
44444
44445impl std::convert::From<i32> for SqlBackupRunStatus {
44446    fn from(value: i32) -> Self {
44447        match value {
44448            0 => Self::Unspecified,
44449            1 => Self::Enqueued,
44450            2 => Self::Overdue,
44451            3 => Self::Running,
44452            4 => Self::Failed,
44453            5 => Self::Successful,
44454            6 => Self::Skipped,
44455            7 => Self::DeletionPending,
44456            8 => Self::DeletionFailed,
44457            9 => Self::Deleted,
44458            _ => Self::UnknownValue(sql_backup_run_status::UnknownValue(
44459                wkt::internal::UnknownEnumValue::Integer(value),
44460            )),
44461        }
44462    }
44463}
44464
44465impl std::convert::From<&str> for SqlBackupRunStatus {
44466    fn from(value: &str) -> Self {
44467        use std::string::ToString;
44468        match value {
44469            "SQL_BACKUP_RUN_STATUS_UNSPECIFIED" => Self::Unspecified,
44470            "ENQUEUED" => Self::Enqueued,
44471            "OVERDUE" => Self::Overdue,
44472            "RUNNING" => Self::Running,
44473            "FAILED" => Self::Failed,
44474            "SUCCESSFUL" => Self::Successful,
44475            "SKIPPED" => Self::Skipped,
44476            "DELETION_PENDING" => Self::DeletionPending,
44477            "DELETION_FAILED" => Self::DeletionFailed,
44478            "DELETED" => Self::Deleted,
44479            _ => Self::UnknownValue(sql_backup_run_status::UnknownValue(
44480                wkt::internal::UnknownEnumValue::String(value.to_string()),
44481            )),
44482        }
44483    }
44484}
44485
44486impl serde::ser::Serialize for SqlBackupRunStatus {
44487    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
44488    where
44489        S: serde::Serializer,
44490    {
44491        match self {
44492            Self::Unspecified => serializer.serialize_i32(0),
44493            Self::Enqueued => serializer.serialize_i32(1),
44494            Self::Overdue => serializer.serialize_i32(2),
44495            Self::Running => serializer.serialize_i32(3),
44496            Self::Failed => serializer.serialize_i32(4),
44497            Self::Successful => serializer.serialize_i32(5),
44498            Self::Skipped => serializer.serialize_i32(6),
44499            Self::DeletionPending => serializer.serialize_i32(7),
44500            Self::DeletionFailed => serializer.serialize_i32(8),
44501            Self::Deleted => serializer.serialize_i32(9),
44502            Self::UnknownValue(u) => u.0.serialize(serializer),
44503        }
44504    }
44505}
44506
44507impl<'de> serde::de::Deserialize<'de> for SqlBackupRunStatus {
44508    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
44509    where
44510        D: serde::Deserializer<'de>,
44511    {
44512        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlBackupRunStatus>::new(
44513            ".google.cloud.sql.v1.SqlBackupRunStatus",
44514        ))
44515    }
44516}
44517
44518/// Defines the supported backup kinds.
44519///
44520/// # Working with unknown values
44521///
44522/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
44523/// additional enum variants at any time. Adding new variants is not considered
44524/// a breaking change. Applications should write their code in anticipation of:
44525///
44526/// - New values appearing in future releases of the client library, **and**
44527/// - New values received dynamically, without application changes.
44528///
44529/// Please consult the [Working with enums] section in the user guide for some
44530/// guidelines.
44531///
44532/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
44533#[derive(Clone, Debug, PartialEq)]
44534#[non_exhaustive]
44535pub enum SqlBackupKind {
44536    /// This is an unknown BackupKind.
44537    Unspecified,
44538    /// The snapshot based backups
44539    Snapshot,
44540    /// Physical backups
44541    Physical,
44542    /// If set, the enum was initialized with an unknown value.
44543    ///
44544    /// Applications can examine the value using [SqlBackupKind::value] or
44545    /// [SqlBackupKind::name].
44546    UnknownValue(sql_backup_kind::UnknownValue),
44547}
44548
44549#[doc(hidden)]
44550pub mod sql_backup_kind {
44551    #[allow(unused_imports)]
44552    use super::*;
44553    #[derive(Clone, Debug, PartialEq)]
44554    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
44555}
44556
44557impl SqlBackupKind {
44558    /// Gets the enum value.
44559    ///
44560    /// Returns `None` if the enum contains an unknown value deserialized from
44561    /// the string representation of enums.
44562    pub fn value(&self) -> std::option::Option<i32> {
44563        match self {
44564            Self::Unspecified => std::option::Option::Some(0),
44565            Self::Snapshot => std::option::Option::Some(1),
44566            Self::Physical => std::option::Option::Some(2),
44567            Self::UnknownValue(u) => u.0.value(),
44568        }
44569    }
44570
44571    /// Gets the enum value as a string.
44572    ///
44573    /// Returns `None` if the enum contains an unknown value deserialized from
44574    /// the integer representation of enums.
44575    pub fn name(&self) -> std::option::Option<&str> {
44576        match self {
44577            Self::Unspecified => std::option::Option::Some("SQL_BACKUP_KIND_UNSPECIFIED"),
44578            Self::Snapshot => std::option::Option::Some("SNAPSHOT"),
44579            Self::Physical => std::option::Option::Some("PHYSICAL"),
44580            Self::UnknownValue(u) => u.0.name(),
44581        }
44582    }
44583}
44584
44585impl std::default::Default for SqlBackupKind {
44586    fn default() -> Self {
44587        use std::convert::From;
44588        Self::from(0)
44589    }
44590}
44591
44592impl std::fmt::Display for SqlBackupKind {
44593    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
44594        wkt::internal::display_enum(f, self.name(), self.value())
44595    }
44596}
44597
44598impl std::convert::From<i32> for SqlBackupKind {
44599    fn from(value: i32) -> Self {
44600        match value {
44601            0 => Self::Unspecified,
44602            1 => Self::Snapshot,
44603            2 => Self::Physical,
44604            _ => Self::UnknownValue(sql_backup_kind::UnknownValue(
44605                wkt::internal::UnknownEnumValue::Integer(value),
44606            )),
44607        }
44608    }
44609}
44610
44611impl std::convert::From<&str> for SqlBackupKind {
44612    fn from(value: &str) -> Self {
44613        use std::string::ToString;
44614        match value {
44615            "SQL_BACKUP_KIND_UNSPECIFIED" => Self::Unspecified,
44616            "SNAPSHOT" => Self::Snapshot,
44617            "PHYSICAL" => Self::Physical,
44618            _ => Self::UnknownValue(sql_backup_kind::UnknownValue(
44619                wkt::internal::UnknownEnumValue::String(value.to_string()),
44620            )),
44621        }
44622    }
44623}
44624
44625impl serde::ser::Serialize for SqlBackupKind {
44626    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
44627    where
44628        S: serde::Serializer,
44629    {
44630        match self {
44631            Self::Unspecified => serializer.serialize_i32(0),
44632            Self::Snapshot => serializer.serialize_i32(1),
44633            Self::Physical => serializer.serialize_i32(2),
44634            Self::UnknownValue(u) => u.0.serialize(serializer),
44635        }
44636    }
44637}
44638
44639impl<'de> serde::de::Deserialize<'de> for SqlBackupKind {
44640    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
44641    where
44642        D: serde::Deserializer<'de>,
44643    {
44644        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlBackupKind>::new(
44645            ".google.cloud.sql.v1.SqlBackupKind",
44646        ))
44647    }
44648}
44649
44650/// Type of backup (i.e. automated, on demand, etc).
44651///
44652/// # Working with unknown values
44653///
44654/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
44655/// additional enum variants at any time. Adding new variants is not considered
44656/// a breaking change. Applications should write their code in anticipation of:
44657///
44658/// - New values appearing in future releases of the client library, **and**
44659/// - New values received dynamically, without application changes.
44660///
44661/// Please consult the [Working with enums] section in the user guide for some
44662/// guidelines.
44663///
44664/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
44665#[derive(Clone, Debug, PartialEq)]
44666#[non_exhaustive]
44667pub enum SqlBackupRunType {
44668    /// This is an unknown BackupRun type.
44669    Unspecified,
44670    /// The backup schedule automatically triggers a backup.
44671    Automated,
44672    /// The user manually triggers a backup.
44673    OnDemand,
44674    /// If set, the enum was initialized with an unknown value.
44675    ///
44676    /// Applications can examine the value using [SqlBackupRunType::value] or
44677    /// [SqlBackupRunType::name].
44678    UnknownValue(sql_backup_run_type::UnknownValue),
44679}
44680
44681#[doc(hidden)]
44682pub mod sql_backup_run_type {
44683    #[allow(unused_imports)]
44684    use super::*;
44685    #[derive(Clone, Debug, PartialEq)]
44686    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
44687}
44688
44689impl SqlBackupRunType {
44690    /// Gets the enum value.
44691    ///
44692    /// Returns `None` if the enum contains an unknown value deserialized from
44693    /// the string representation of enums.
44694    pub fn value(&self) -> std::option::Option<i32> {
44695        match self {
44696            Self::Unspecified => std::option::Option::Some(0),
44697            Self::Automated => std::option::Option::Some(1),
44698            Self::OnDemand => std::option::Option::Some(2),
44699            Self::UnknownValue(u) => u.0.value(),
44700        }
44701    }
44702
44703    /// Gets the enum value as a string.
44704    ///
44705    /// Returns `None` if the enum contains an unknown value deserialized from
44706    /// the integer representation of enums.
44707    pub fn name(&self) -> std::option::Option<&str> {
44708        match self {
44709            Self::Unspecified => std::option::Option::Some("SQL_BACKUP_RUN_TYPE_UNSPECIFIED"),
44710            Self::Automated => std::option::Option::Some("AUTOMATED"),
44711            Self::OnDemand => std::option::Option::Some("ON_DEMAND"),
44712            Self::UnknownValue(u) => u.0.name(),
44713        }
44714    }
44715}
44716
44717impl std::default::Default for SqlBackupRunType {
44718    fn default() -> Self {
44719        use std::convert::From;
44720        Self::from(0)
44721    }
44722}
44723
44724impl std::fmt::Display for SqlBackupRunType {
44725    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
44726        wkt::internal::display_enum(f, self.name(), self.value())
44727    }
44728}
44729
44730impl std::convert::From<i32> for SqlBackupRunType {
44731    fn from(value: i32) -> Self {
44732        match value {
44733            0 => Self::Unspecified,
44734            1 => Self::Automated,
44735            2 => Self::OnDemand,
44736            _ => Self::UnknownValue(sql_backup_run_type::UnknownValue(
44737                wkt::internal::UnknownEnumValue::Integer(value),
44738            )),
44739        }
44740    }
44741}
44742
44743impl std::convert::From<&str> for SqlBackupRunType {
44744    fn from(value: &str) -> Self {
44745        use std::string::ToString;
44746        match value {
44747            "SQL_BACKUP_RUN_TYPE_UNSPECIFIED" => Self::Unspecified,
44748            "AUTOMATED" => Self::Automated,
44749            "ON_DEMAND" => Self::OnDemand,
44750            _ => Self::UnknownValue(sql_backup_run_type::UnknownValue(
44751                wkt::internal::UnknownEnumValue::String(value.to_string()),
44752            )),
44753        }
44754    }
44755}
44756
44757impl serde::ser::Serialize for SqlBackupRunType {
44758    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
44759    where
44760        S: serde::Serializer,
44761    {
44762        match self {
44763            Self::Unspecified => serializer.serialize_i32(0),
44764            Self::Automated => serializer.serialize_i32(1),
44765            Self::OnDemand => serializer.serialize_i32(2),
44766            Self::UnknownValue(u) => u.0.serialize(serializer),
44767        }
44768    }
44769}
44770
44771impl<'de> serde::de::Deserialize<'de> for SqlBackupRunType {
44772    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
44773    where
44774        D: serde::Deserializer<'de>,
44775    {
44776        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlBackupRunType>::new(
44777            ".google.cloud.sql.v1.SqlBackupRunType",
44778        ))
44779    }
44780}
44781
44782///
44783/// # Working with unknown values
44784///
44785/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
44786/// additional enum variants at any time. Adding new variants is not considered
44787/// a breaking change. Applications should write their code in anticipation of:
44788///
44789/// - New values appearing in future releases of the client library, **and**
44790/// - New values received dynamically, without application changes.
44791///
44792/// Please consult the [Working with enums] section in the user guide for some
44793/// guidelines.
44794///
44795/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
44796#[derive(Clone, Debug, PartialEq)]
44797#[non_exhaustive]
44798pub enum SqlFlagType {
44799    /// This is an unknown flag type.
44800    Unspecified,
44801    /// Boolean type flag.
44802    Boolean,
44803    /// String type flag.
44804    String,
44805    /// Integer type flag.
44806    Integer,
44807    /// Flag type used for a server startup option.
44808    None,
44809    /// Type introduced specially for MySQL TimeZone offset. Accept a string value
44810    /// with the format [-12:59, 13:00].
44811    MysqlTimezoneOffset,
44812    /// Float type flag.
44813    Float,
44814    /// Comma-separated list of the strings in a SqlFlagType enum.
44815    RepeatedString,
44816    /// If set, the enum was initialized with an unknown value.
44817    ///
44818    /// Applications can examine the value using [SqlFlagType::value] or
44819    /// [SqlFlagType::name].
44820    UnknownValue(sql_flag_type::UnknownValue),
44821}
44822
44823#[doc(hidden)]
44824pub mod sql_flag_type {
44825    #[allow(unused_imports)]
44826    use super::*;
44827    #[derive(Clone, Debug, PartialEq)]
44828    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
44829}
44830
44831impl SqlFlagType {
44832    /// Gets the enum value.
44833    ///
44834    /// Returns `None` if the enum contains an unknown value deserialized from
44835    /// the string representation of enums.
44836    pub fn value(&self) -> std::option::Option<i32> {
44837        match self {
44838            Self::Unspecified => std::option::Option::Some(0),
44839            Self::Boolean => std::option::Option::Some(1),
44840            Self::String => std::option::Option::Some(2),
44841            Self::Integer => std::option::Option::Some(3),
44842            Self::None => std::option::Option::Some(4),
44843            Self::MysqlTimezoneOffset => std::option::Option::Some(5),
44844            Self::Float => std::option::Option::Some(6),
44845            Self::RepeatedString => std::option::Option::Some(7),
44846            Self::UnknownValue(u) => u.0.value(),
44847        }
44848    }
44849
44850    /// Gets the enum value as a string.
44851    ///
44852    /// Returns `None` if the enum contains an unknown value deserialized from
44853    /// the integer representation of enums.
44854    pub fn name(&self) -> std::option::Option<&str> {
44855        match self {
44856            Self::Unspecified => std::option::Option::Some("SQL_FLAG_TYPE_UNSPECIFIED"),
44857            Self::Boolean => std::option::Option::Some("BOOLEAN"),
44858            Self::String => std::option::Option::Some("STRING"),
44859            Self::Integer => std::option::Option::Some("INTEGER"),
44860            Self::None => std::option::Option::Some("NONE"),
44861            Self::MysqlTimezoneOffset => std::option::Option::Some("MYSQL_TIMEZONE_OFFSET"),
44862            Self::Float => std::option::Option::Some("FLOAT"),
44863            Self::RepeatedString => std::option::Option::Some("REPEATED_STRING"),
44864            Self::UnknownValue(u) => u.0.name(),
44865        }
44866    }
44867}
44868
44869impl std::default::Default for SqlFlagType {
44870    fn default() -> Self {
44871        use std::convert::From;
44872        Self::from(0)
44873    }
44874}
44875
44876impl std::fmt::Display for SqlFlagType {
44877    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
44878        wkt::internal::display_enum(f, self.name(), self.value())
44879    }
44880}
44881
44882impl std::convert::From<i32> for SqlFlagType {
44883    fn from(value: i32) -> Self {
44884        match value {
44885            0 => Self::Unspecified,
44886            1 => Self::Boolean,
44887            2 => Self::String,
44888            3 => Self::Integer,
44889            4 => Self::None,
44890            5 => Self::MysqlTimezoneOffset,
44891            6 => Self::Float,
44892            7 => Self::RepeatedString,
44893            _ => Self::UnknownValue(sql_flag_type::UnknownValue(
44894                wkt::internal::UnknownEnumValue::Integer(value),
44895            )),
44896        }
44897    }
44898}
44899
44900impl std::convert::From<&str> for SqlFlagType {
44901    fn from(value: &str) -> Self {
44902        use std::string::ToString;
44903        match value {
44904            "SQL_FLAG_TYPE_UNSPECIFIED" => Self::Unspecified,
44905            "BOOLEAN" => Self::Boolean,
44906            "STRING" => Self::String,
44907            "INTEGER" => Self::Integer,
44908            "NONE" => Self::None,
44909            "MYSQL_TIMEZONE_OFFSET" => Self::MysqlTimezoneOffset,
44910            "FLOAT" => Self::Float,
44911            "REPEATED_STRING" => Self::RepeatedString,
44912            _ => Self::UnknownValue(sql_flag_type::UnknownValue(
44913                wkt::internal::UnknownEnumValue::String(value.to_string()),
44914            )),
44915        }
44916    }
44917}
44918
44919impl serde::ser::Serialize for SqlFlagType {
44920    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
44921    where
44922        S: serde::Serializer,
44923    {
44924        match self {
44925            Self::Unspecified => serializer.serialize_i32(0),
44926            Self::Boolean => serializer.serialize_i32(1),
44927            Self::String => serializer.serialize_i32(2),
44928            Self::Integer => serializer.serialize_i32(3),
44929            Self::None => serializer.serialize_i32(4),
44930            Self::MysqlTimezoneOffset => serializer.serialize_i32(5),
44931            Self::Float => serializer.serialize_i32(6),
44932            Self::RepeatedString => serializer.serialize_i32(7),
44933            Self::UnknownValue(u) => u.0.serialize(serializer),
44934        }
44935    }
44936}
44937
44938impl<'de> serde::de::Deserialize<'de> for SqlFlagType {
44939    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
44940    where
44941        D: serde::Deserializer<'de>,
44942    {
44943        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlFlagType>::new(
44944            ".google.cloud.sql.v1.SqlFlagType",
44945        ))
44946    }
44947}
44948
44949/// External Sync parallel level.
44950///
44951/// # Working with unknown values
44952///
44953/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
44954/// additional enum variants at any time. Adding new variants is not considered
44955/// a breaking change. Applications should write their code in anticipation of:
44956///
44957/// - New values appearing in future releases of the client library, **and**
44958/// - New values received dynamically, without application changes.
44959///
44960/// Please consult the [Working with enums] section in the user guide for some
44961/// guidelines.
44962///
44963/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
44964#[derive(Clone, Debug, PartialEq)]
44965#[non_exhaustive]
44966pub enum ExternalSyncParallelLevel {
44967    /// Unknown sync parallel level. Will be defaulted to OPTIMAL.
44968    Unspecified,
44969    /// Minimal parallel level.
44970    Min,
44971    /// Optimal parallel level.
44972    Optimal,
44973    /// Maximum parallel level.
44974    Max,
44975    /// If set, the enum was initialized with an unknown value.
44976    ///
44977    /// Applications can examine the value using [ExternalSyncParallelLevel::value] or
44978    /// [ExternalSyncParallelLevel::name].
44979    UnknownValue(external_sync_parallel_level::UnknownValue),
44980}
44981
44982#[doc(hidden)]
44983pub mod external_sync_parallel_level {
44984    #[allow(unused_imports)]
44985    use super::*;
44986    #[derive(Clone, Debug, PartialEq)]
44987    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
44988}
44989
44990impl ExternalSyncParallelLevel {
44991    /// Gets the enum value.
44992    ///
44993    /// Returns `None` if the enum contains an unknown value deserialized from
44994    /// the string representation of enums.
44995    pub fn value(&self) -> std::option::Option<i32> {
44996        match self {
44997            Self::Unspecified => std::option::Option::Some(0),
44998            Self::Min => std::option::Option::Some(1),
44999            Self::Optimal => std::option::Option::Some(2),
45000            Self::Max => std::option::Option::Some(3),
45001            Self::UnknownValue(u) => u.0.value(),
45002        }
45003    }
45004
45005    /// Gets the enum value as a string.
45006    ///
45007    /// Returns `None` if the enum contains an unknown value deserialized from
45008    /// the integer representation of enums.
45009    pub fn name(&self) -> std::option::Option<&str> {
45010        match self {
45011            Self::Unspecified => {
45012                std::option::Option::Some("EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED")
45013            }
45014            Self::Min => std::option::Option::Some("MIN"),
45015            Self::Optimal => std::option::Option::Some("OPTIMAL"),
45016            Self::Max => std::option::Option::Some("MAX"),
45017            Self::UnknownValue(u) => u.0.name(),
45018        }
45019    }
45020}
45021
45022impl std::default::Default for ExternalSyncParallelLevel {
45023    fn default() -> Self {
45024        use std::convert::From;
45025        Self::from(0)
45026    }
45027}
45028
45029impl std::fmt::Display for ExternalSyncParallelLevel {
45030    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
45031        wkt::internal::display_enum(f, self.name(), self.value())
45032    }
45033}
45034
45035impl std::convert::From<i32> for ExternalSyncParallelLevel {
45036    fn from(value: i32) -> Self {
45037        match value {
45038            0 => Self::Unspecified,
45039            1 => Self::Min,
45040            2 => Self::Optimal,
45041            3 => Self::Max,
45042            _ => Self::UnknownValue(external_sync_parallel_level::UnknownValue(
45043                wkt::internal::UnknownEnumValue::Integer(value),
45044            )),
45045        }
45046    }
45047}
45048
45049impl std::convert::From<&str> for ExternalSyncParallelLevel {
45050    fn from(value: &str) -> Self {
45051        use std::string::ToString;
45052        match value {
45053            "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED" => Self::Unspecified,
45054            "MIN" => Self::Min,
45055            "OPTIMAL" => Self::Optimal,
45056            "MAX" => Self::Max,
45057            _ => Self::UnknownValue(external_sync_parallel_level::UnknownValue(
45058                wkt::internal::UnknownEnumValue::String(value.to_string()),
45059            )),
45060        }
45061    }
45062}
45063
45064impl serde::ser::Serialize for ExternalSyncParallelLevel {
45065    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
45066    where
45067        S: serde::Serializer,
45068    {
45069        match self {
45070            Self::Unspecified => serializer.serialize_i32(0),
45071            Self::Min => serializer.serialize_i32(1),
45072            Self::Optimal => serializer.serialize_i32(2),
45073            Self::Max => serializer.serialize_i32(3),
45074            Self::UnknownValue(u) => u.0.serialize(serializer),
45075        }
45076    }
45077}
45078
45079impl<'de> serde::de::Deserialize<'de> for ExternalSyncParallelLevel {
45080    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
45081    where
45082        D: serde::Deserializer<'de>,
45083    {
45084        deserializer.deserialize_any(
45085            wkt::internal::EnumVisitor::<ExternalSyncParallelLevel>::new(
45086                ".google.cloud.sql.v1.ExternalSyncParallelLevel",
45087            ),
45088        )
45089    }
45090}
45091
45092///
45093/// # Working with unknown values
45094///
45095/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
45096/// additional enum variants at any time. Adding new variants is not considered
45097/// a breaking change. Applications should write their code in anticipation of:
45098///
45099/// - New values appearing in future releases of the client library, **and**
45100/// - New values received dynamically, without application changes.
45101///
45102/// Please consult the [Working with enums] section in the user guide for some
45103/// guidelines.
45104///
45105/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
45106#[derive(Clone, Debug, PartialEq)]
45107#[non_exhaustive]
45108pub enum SqlInstanceType {
45109    /// This is an unknown Cloud SQL instance type.
45110    Unspecified,
45111    /// A regular Cloud SQL instance that is not replicating from a primary
45112    /// instance.
45113    CloudSqlInstance,
45114    /// An instance running on the customer's premises that is not managed by
45115    /// Cloud SQL.
45116    OnPremisesInstance,
45117    /// A Cloud SQL instance acting as a read-replica.
45118    ReadReplicaInstance,
45119    /// If set, the enum was initialized with an unknown value.
45120    ///
45121    /// Applications can examine the value using [SqlInstanceType::value] or
45122    /// [SqlInstanceType::name].
45123    UnknownValue(sql_instance_type::UnknownValue),
45124}
45125
45126#[doc(hidden)]
45127pub mod sql_instance_type {
45128    #[allow(unused_imports)]
45129    use super::*;
45130    #[derive(Clone, Debug, PartialEq)]
45131    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
45132}
45133
45134impl SqlInstanceType {
45135    /// Gets the enum value.
45136    ///
45137    /// Returns `None` if the enum contains an unknown value deserialized from
45138    /// the string representation of enums.
45139    pub fn value(&self) -> std::option::Option<i32> {
45140        match self {
45141            Self::Unspecified => std::option::Option::Some(0),
45142            Self::CloudSqlInstance => std::option::Option::Some(1),
45143            Self::OnPremisesInstance => std::option::Option::Some(2),
45144            Self::ReadReplicaInstance => std::option::Option::Some(3),
45145            Self::UnknownValue(u) => u.0.value(),
45146        }
45147    }
45148
45149    /// Gets the enum value as a string.
45150    ///
45151    /// Returns `None` if the enum contains an unknown value deserialized from
45152    /// the integer representation of enums.
45153    pub fn name(&self) -> std::option::Option<&str> {
45154        match self {
45155            Self::Unspecified => std::option::Option::Some("SQL_INSTANCE_TYPE_UNSPECIFIED"),
45156            Self::CloudSqlInstance => std::option::Option::Some("CLOUD_SQL_INSTANCE"),
45157            Self::OnPremisesInstance => std::option::Option::Some("ON_PREMISES_INSTANCE"),
45158            Self::ReadReplicaInstance => std::option::Option::Some("READ_REPLICA_INSTANCE"),
45159            Self::UnknownValue(u) => u.0.name(),
45160        }
45161    }
45162}
45163
45164impl std::default::Default for SqlInstanceType {
45165    fn default() -> Self {
45166        use std::convert::From;
45167        Self::from(0)
45168    }
45169}
45170
45171impl std::fmt::Display for SqlInstanceType {
45172    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
45173        wkt::internal::display_enum(f, self.name(), self.value())
45174    }
45175}
45176
45177impl std::convert::From<i32> for SqlInstanceType {
45178    fn from(value: i32) -> Self {
45179        match value {
45180            0 => Self::Unspecified,
45181            1 => Self::CloudSqlInstance,
45182            2 => Self::OnPremisesInstance,
45183            3 => Self::ReadReplicaInstance,
45184            _ => Self::UnknownValue(sql_instance_type::UnknownValue(
45185                wkt::internal::UnknownEnumValue::Integer(value),
45186            )),
45187        }
45188    }
45189}
45190
45191impl std::convert::From<&str> for SqlInstanceType {
45192    fn from(value: &str) -> Self {
45193        use std::string::ToString;
45194        match value {
45195            "SQL_INSTANCE_TYPE_UNSPECIFIED" => Self::Unspecified,
45196            "CLOUD_SQL_INSTANCE" => Self::CloudSqlInstance,
45197            "ON_PREMISES_INSTANCE" => Self::OnPremisesInstance,
45198            "READ_REPLICA_INSTANCE" => Self::ReadReplicaInstance,
45199            _ => Self::UnknownValue(sql_instance_type::UnknownValue(
45200                wkt::internal::UnknownEnumValue::String(value.to_string()),
45201            )),
45202        }
45203    }
45204}
45205
45206impl serde::ser::Serialize for SqlInstanceType {
45207    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
45208    where
45209        S: serde::Serializer,
45210    {
45211        match self {
45212            Self::Unspecified => serializer.serialize_i32(0),
45213            Self::CloudSqlInstance => serializer.serialize_i32(1),
45214            Self::OnPremisesInstance => serializer.serialize_i32(2),
45215            Self::ReadReplicaInstance => serializer.serialize_i32(3),
45216            Self::UnknownValue(u) => u.0.serialize(serializer),
45217        }
45218    }
45219}
45220
45221impl<'de> serde::de::Deserialize<'de> for SqlInstanceType {
45222    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
45223    where
45224        D: serde::Deserializer<'de>,
45225    {
45226        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlInstanceType>::new(
45227            ".google.cloud.sql.v1.SqlInstanceType",
45228        ))
45229    }
45230}
45231
45232/// The suspension reason of the database instance if the state is SUSPENDED.
45233///
45234/// # Working with unknown values
45235///
45236/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
45237/// additional enum variants at any time. Adding new variants is not considered
45238/// a breaking change. Applications should write their code in anticipation of:
45239///
45240/// - New values appearing in future releases of the client library, **and**
45241/// - New values received dynamically, without application changes.
45242///
45243/// Please consult the [Working with enums] section in the user guide for some
45244/// guidelines.
45245///
45246/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
45247#[derive(Clone, Debug, PartialEq)]
45248#[non_exhaustive]
45249pub enum SqlSuspensionReason {
45250    /// This is an unknown suspension reason.
45251    Unspecified,
45252    /// The instance is suspended due to billing issues (for example:, GCP account
45253    /// issue)
45254    BillingIssue,
45255    /// The instance is suspended due to illegal content (for example:, child
45256    /// pornography, copyrighted material, etc.).
45257    LegalIssue,
45258    /// The instance is causing operational issues (for example:, causing the
45259    /// database to crash).
45260    OperationalIssue,
45261    /// The KMS key used by the instance is either revoked or denied access to
45262    KmsKeyIssue,
45263    /// If set, the enum was initialized with an unknown value.
45264    ///
45265    /// Applications can examine the value using [SqlSuspensionReason::value] or
45266    /// [SqlSuspensionReason::name].
45267    UnknownValue(sql_suspension_reason::UnknownValue),
45268}
45269
45270#[doc(hidden)]
45271pub mod sql_suspension_reason {
45272    #[allow(unused_imports)]
45273    use super::*;
45274    #[derive(Clone, Debug, PartialEq)]
45275    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
45276}
45277
45278impl SqlSuspensionReason {
45279    /// Gets the enum value.
45280    ///
45281    /// Returns `None` if the enum contains an unknown value deserialized from
45282    /// the string representation of enums.
45283    pub fn value(&self) -> std::option::Option<i32> {
45284        match self {
45285            Self::Unspecified => std::option::Option::Some(0),
45286            Self::BillingIssue => std::option::Option::Some(2),
45287            Self::LegalIssue => std::option::Option::Some(3),
45288            Self::OperationalIssue => std::option::Option::Some(4),
45289            Self::KmsKeyIssue => std::option::Option::Some(5),
45290            Self::UnknownValue(u) => u.0.value(),
45291        }
45292    }
45293
45294    /// Gets the enum value as a string.
45295    ///
45296    /// Returns `None` if the enum contains an unknown value deserialized from
45297    /// the integer representation of enums.
45298    pub fn name(&self) -> std::option::Option<&str> {
45299        match self {
45300            Self::Unspecified => std::option::Option::Some("SQL_SUSPENSION_REASON_UNSPECIFIED"),
45301            Self::BillingIssue => std::option::Option::Some("BILLING_ISSUE"),
45302            Self::LegalIssue => std::option::Option::Some("LEGAL_ISSUE"),
45303            Self::OperationalIssue => std::option::Option::Some("OPERATIONAL_ISSUE"),
45304            Self::KmsKeyIssue => std::option::Option::Some("KMS_KEY_ISSUE"),
45305            Self::UnknownValue(u) => u.0.name(),
45306        }
45307    }
45308}
45309
45310impl std::default::Default for SqlSuspensionReason {
45311    fn default() -> Self {
45312        use std::convert::From;
45313        Self::from(0)
45314    }
45315}
45316
45317impl std::fmt::Display for SqlSuspensionReason {
45318    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
45319        wkt::internal::display_enum(f, self.name(), self.value())
45320    }
45321}
45322
45323impl std::convert::From<i32> for SqlSuspensionReason {
45324    fn from(value: i32) -> Self {
45325        match value {
45326            0 => Self::Unspecified,
45327            2 => Self::BillingIssue,
45328            3 => Self::LegalIssue,
45329            4 => Self::OperationalIssue,
45330            5 => Self::KmsKeyIssue,
45331            _ => Self::UnknownValue(sql_suspension_reason::UnknownValue(
45332                wkt::internal::UnknownEnumValue::Integer(value),
45333            )),
45334        }
45335    }
45336}
45337
45338impl std::convert::From<&str> for SqlSuspensionReason {
45339    fn from(value: &str) -> Self {
45340        use std::string::ToString;
45341        match value {
45342            "SQL_SUSPENSION_REASON_UNSPECIFIED" => Self::Unspecified,
45343            "BILLING_ISSUE" => Self::BillingIssue,
45344            "LEGAL_ISSUE" => Self::LegalIssue,
45345            "OPERATIONAL_ISSUE" => Self::OperationalIssue,
45346            "KMS_KEY_ISSUE" => Self::KmsKeyIssue,
45347            _ => Self::UnknownValue(sql_suspension_reason::UnknownValue(
45348                wkt::internal::UnknownEnumValue::String(value.to_string()),
45349            )),
45350        }
45351    }
45352}
45353
45354impl serde::ser::Serialize for SqlSuspensionReason {
45355    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
45356    where
45357        S: serde::Serializer,
45358    {
45359        match self {
45360            Self::Unspecified => serializer.serialize_i32(0),
45361            Self::BillingIssue => serializer.serialize_i32(2),
45362            Self::LegalIssue => serializer.serialize_i32(3),
45363            Self::OperationalIssue => serializer.serialize_i32(4),
45364            Self::KmsKeyIssue => serializer.serialize_i32(5),
45365            Self::UnknownValue(u) => u.0.serialize(serializer),
45366        }
45367    }
45368}
45369
45370impl<'de> serde::de::Deserialize<'de> for SqlSuspensionReason {
45371    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
45372    where
45373        D: serde::Deserializer<'de>,
45374    {
45375        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlSuspensionReason>::new(
45376            ".google.cloud.sql.v1.SqlSuspensionReason",
45377        ))
45378    }
45379}
45380
45381///
45382/// # Working with unknown values
45383///
45384/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
45385/// additional enum variants at any time. Adding new variants is not considered
45386/// a breaking change. Applications should write their code in anticipation of:
45387///
45388/// - New values appearing in future releases of the client library, **and**
45389/// - New values received dynamically, without application changes.
45390///
45391/// Please consult the [Working with enums] section in the user guide for some
45392/// guidelines.
45393///
45394/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
45395#[derive(Clone, Debug, PartialEq)]
45396#[non_exhaustive]
45397pub enum SqlFileType {
45398    /// Unknown file type.
45399    Unspecified,
45400    /// File containing SQL statements.
45401    Sql,
45402    /// File in CSV format.
45403    Csv,
45404    Bak,
45405    /// If set, the enum was initialized with an unknown value.
45406    ///
45407    /// Applications can examine the value using [SqlFileType::value] or
45408    /// [SqlFileType::name].
45409    UnknownValue(sql_file_type::UnknownValue),
45410}
45411
45412#[doc(hidden)]
45413pub mod sql_file_type {
45414    #[allow(unused_imports)]
45415    use super::*;
45416    #[derive(Clone, Debug, PartialEq)]
45417    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
45418}
45419
45420impl SqlFileType {
45421    /// Gets the enum value.
45422    ///
45423    /// Returns `None` if the enum contains an unknown value deserialized from
45424    /// the string representation of enums.
45425    pub fn value(&self) -> std::option::Option<i32> {
45426        match self {
45427            Self::Unspecified => std::option::Option::Some(0),
45428            Self::Sql => std::option::Option::Some(1),
45429            Self::Csv => std::option::Option::Some(2),
45430            Self::Bak => std::option::Option::Some(4),
45431            Self::UnknownValue(u) => u.0.value(),
45432        }
45433    }
45434
45435    /// Gets the enum value as a string.
45436    ///
45437    /// Returns `None` if the enum contains an unknown value deserialized from
45438    /// the integer representation of enums.
45439    pub fn name(&self) -> std::option::Option<&str> {
45440        match self {
45441            Self::Unspecified => std::option::Option::Some("SQL_FILE_TYPE_UNSPECIFIED"),
45442            Self::Sql => std::option::Option::Some("SQL"),
45443            Self::Csv => std::option::Option::Some("CSV"),
45444            Self::Bak => std::option::Option::Some("BAK"),
45445            Self::UnknownValue(u) => u.0.name(),
45446        }
45447    }
45448}
45449
45450impl std::default::Default for SqlFileType {
45451    fn default() -> Self {
45452        use std::convert::From;
45453        Self::from(0)
45454    }
45455}
45456
45457impl std::fmt::Display for SqlFileType {
45458    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
45459        wkt::internal::display_enum(f, self.name(), self.value())
45460    }
45461}
45462
45463impl std::convert::From<i32> for SqlFileType {
45464    fn from(value: i32) -> Self {
45465        match value {
45466            0 => Self::Unspecified,
45467            1 => Self::Sql,
45468            2 => Self::Csv,
45469            4 => Self::Bak,
45470            _ => Self::UnknownValue(sql_file_type::UnknownValue(
45471                wkt::internal::UnknownEnumValue::Integer(value),
45472            )),
45473        }
45474    }
45475}
45476
45477impl std::convert::From<&str> for SqlFileType {
45478    fn from(value: &str) -> Self {
45479        use std::string::ToString;
45480        match value {
45481            "SQL_FILE_TYPE_UNSPECIFIED" => Self::Unspecified,
45482            "SQL" => Self::Sql,
45483            "CSV" => Self::Csv,
45484            "BAK" => Self::Bak,
45485            _ => Self::UnknownValue(sql_file_type::UnknownValue(
45486                wkt::internal::UnknownEnumValue::String(value.to_string()),
45487            )),
45488        }
45489    }
45490}
45491
45492impl serde::ser::Serialize for SqlFileType {
45493    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
45494    where
45495        S: serde::Serializer,
45496    {
45497        match self {
45498            Self::Unspecified => serializer.serialize_i32(0),
45499            Self::Sql => serializer.serialize_i32(1),
45500            Self::Csv => serializer.serialize_i32(2),
45501            Self::Bak => serializer.serialize_i32(4),
45502            Self::UnknownValue(u) => u.0.serialize(serializer),
45503        }
45504    }
45505}
45506
45507impl<'de> serde::de::Deserialize<'de> for SqlFileType {
45508    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
45509    where
45510        D: serde::Deserializer<'de>,
45511    {
45512        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlFileType>::new(
45513            ".google.cloud.sql.v1.SqlFileType",
45514        ))
45515    }
45516}
45517
45518///
45519/// # Working with unknown values
45520///
45521/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
45522/// additional enum variants at any time. Adding new variants is not considered
45523/// a breaking change. Applications should write their code in anticipation of:
45524///
45525/// - New values appearing in future releases of the client library, **and**
45526/// - New values received dynamically, without application changes.
45527///
45528/// Please consult the [Working with enums] section in the user guide for some
45529/// guidelines.
45530///
45531/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
45532#[derive(Clone, Debug, PartialEq)]
45533#[non_exhaustive]
45534pub enum BakType {
45535    /// Default type.
45536    Unspecified,
45537    /// Full backup.
45538    Full,
45539    /// Differential backup.
45540    Diff,
45541    /// Transaction Log backup
45542    Tlog,
45543    /// If set, the enum was initialized with an unknown value.
45544    ///
45545    /// Applications can examine the value using [BakType::value] or
45546    /// [BakType::name].
45547    UnknownValue(bak_type::UnknownValue),
45548}
45549
45550#[doc(hidden)]
45551pub mod bak_type {
45552    #[allow(unused_imports)]
45553    use super::*;
45554    #[derive(Clone, Debug, PartialEq)]
45555    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
45556}
45557
45558impl BakType {
45559    /// Gets the enum value.
45560    ///
45561    /// Returns `None` if the enum contains an unknown value deserialized from
45562    /// the string representation of enums.
45563    pub fn value(&self) -> std::option::Option<i32> {
45564        match self {
45565            Self::Unspecified => std::option::Option::Some(0),
45566            Self::Full => std::option::Option::Some(1),
45567            Self::Diff => std::option::Option::Some(2),
45568            Self::Tlog => std::option::Option::Some(3),
45569            Self::UnknownValue(u) => u.0.value(),
45570        }
45571    }
45572
45573    /// Gets the enum value as a string.
45574    ///
45575    /// Returns `None` if the enum contains an unknown value deserialized from
45576    /// the integer representation of enums.
45577    pub fn name(&self) -> std::option::Option<&str> {
45578        match self {
45579            Self::Unspecified => std::option::Option::Some("BAK_TYPE_UNSPECIFIED"),
45580            Self::Full => std::option::Option::Some("FULL"),
45581            Self::Diff => std::option::Option::Some("DIFF"),
45582            Self::Tlog => std::option::Option::Some("TLOG"),
45583            Self::UnknownValue(u) => u.0.name(),
45584        }
45585    }
45586}
45587
45588impl std::default::Default for BakType {
45589    fn default() -> Self {
45590        use std::convert::From;
45591        Self::from(0)
45592    }
45593}
45594
45595impl std::fmt::Display for BakType {
45596    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
45597        wkt::internal::display_enum(f, self.name(), self.value())
45598    }
45599}
45600
45601impl std::convert::From<i32> for BakType {
45602    fn from(value: i32) -> Self {
45603        match value {
45604            0 => Self::Unspecified,
45605            1 => Self::Full,
45606            2 => Self::Diff,
45607            3 => Self::Tlog,
45608            _ => Self::UnknownValue(bak_type::UnknownValue(
45609                wkt::internal::UnknownEnumValue::Integer(value),
45610            )),
45611        }
45612    }
45613}
45614
45615impl std::convert::From<&str> for BakType {
45616    fn from(value: &str) -> Self {
45617        use std::string::ToString;
45618        match value {
45619            "BAK_TYPE_UNSPECIFIED" => Self::Unspecified,
45620            "FULL" => Self::Full,
45621            "DIFF" => Self::Diff,
45622            "TLOG" => Self::Tlog,
45623            _ => Self::UnknownValue(bak_type::UnknownValue(
45624                wkt::internal::UnknownEnumValue::String(value.to_string()),
45625            )),
45626        }
45627    }
45628}
45629
45630impl serde::ser::Serialize for BakType {
45631    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
45632    where
45633        S: serde::Serializer,
45634    {
45635        match self {
45636            Self::Unspecified => serializer.serialize_i32(0),
45637            Self::Full => serializer.serialize_i32(1),
45638            Self::Diff => serializer.serialize_i32(2),
45639            Self::Tlog => serializer.serialize_i32(3),
45640            Self::UnknownValue(u) => u.0.serialize(serializer),
45641        }
45642    }
45643}
45644
45645impl<'de> serde::de::Deserialize<'de> for BakType {
45646    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
45647    where
45648        D: serde::Deserializer<'de>,
45649    {
45650        deserializer.deserialize_any(wkt::internal::EnumVisitor::<BakType>::new(
45651            ".google.cloud.sql.v1.BakType",
45652        ))
45653    }
45654}
45655
45656///
45657/// # Working with unknown values
45658///
45659/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
45660/// additional enum variants at any time. Adding new variants is not considered
45661/// a breaking change. Applications should write their code in anticipation of:
45662///
45663/// - New values appearing in future releases of the client library, **and**
45664/// - New values received dynamically, without application changes.
45665///
45666/// Please consult the [Working with enums] section in the user guide for some
45667/// guidelines.
45668///
45669/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
45670#[derive(Clone, Debug, PartialEq)]
45671#[non_exhaustive]
45672pub enum SqlBackendType {
45673    /// This is an unknown backend type for instance.
45674    Unspecified,
45675    /// V1 speckle instance.
45676    #[deprecated]
45677    FirstGen,
45678    /// V2 speckle instance.
45679    SecondGen,
45680    /// On premises instance.
45681    External,
45682    /// If set, the enum was initialized with an unknown value.
45683    ///
45684    /// Applications can examine the value using [SqlBackendType::value] or
45685    /// [SqlBackendType::name].
45686    UnknownValue(sql_backend_type::UnknownValue),
45687}
45688
45689#[doc(hidden)]
45690pub mod sql_backend_type {
45691    #[allow(unused_imports)]
45692    use super::*;
45693    #[derive(Clone, Debug, PartialEq)]
45694    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
45695}
45696
45697impl SqlBackendType {
45698    /// Gets the enum value.
45699    ///
45700    /// Returns `None` if the enum contains an unknown value deserialized from
45701    /// the string representation of enums.
45702    pub fn value(&self) -> std::option::Option<i32> {
45703        match self {
45704            Self::Unspecified => std::option::Option::Some(0),
45705            Self::FirstGen => std::option::Option::Some(1),
45706            Self::SecondGen => std::option::Option::Some(2),
45707            Self::External => std::option::Option::Some(3),
45708            Self::UnknownValue(u) => u.0.value(),
45709        }
45710    }
45711
45712    /// Gets the enum value as a string.
45713    ///
45714    /// Returns `None` if the enum contains an unknown value deserialized from
45715    /// the integer representation of enums.
45716    pub fn name(&self) -> std::option::Option<&str> {
45717        match self {
45718            Self::Unspecified => std::option::Option::Some("SQL_BACKEND_TYPE_UNSPECIFIED"),
45719            Self::FirstGen => std::option::Option::Some("FIRST_GEN"),
45720            Self::SecondGen => std::option::Option::Some("SECOND_GEN"),
45721            Self::External => std::option::Option::Some("EXTERNAL"),
45722            Self::UnknownValue(u) => u.0.name(),
45723        }
45724    }
45725}
45726
45727impl std::default::Default for SqlBackendType {
45728    fn default() -> Self {
45729        use std::convert::From;
45730        Self::from(0)
45731    }
45732}
45733
45734impl std::fmt::Display for SqlBackendType {
45735    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
45736        wkt::internal::display_enum(f, self.name(), self.value())
45737    }
45738}
45739
45740impl std::convert::From<i32> for SqlBackendType {
45741    fn from(value: i32) -> Self {
45742        match value {
45743            0 => Self::Unspecified,
45744            1 => Self::FirstGen,
45745            2 => Self::SecondGen,
45746            3 => Self::External,
45747            _ => Self::UnknownValue(sql_backend_type::UnknownValue(
45748                wkt::internal::UnknownEnumValue::Integer(value),
45749            )),
45750        }
45751    }
45752}
45753
45754impl std::convert::From<&str> for SqlBackendType {
45755    fn from(value: &str) -> Self {
45756        use std::string::ToString;
45757        match value {
45758            "SQL_BACKEND_TYPE_UNSPECIFIED" => Self::Unspecified,
45759            "FIRST_GEN" => Self::FirstGen,
45760            "SECOND_GEN" => Self::SecondGen,
45761            "EXTERNAL" => Self::External,
45762            _ => Self::UnknownValue(sql_backend_type::UnknownValue(
45763                wkt::internal::UnknownEnumValue::String(value.to_string()),
45764            )),
45765        }
45766    }
45767}
45768
45769impl serde::ser::Serialize for SqlBackendType {
45770    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
45771    where
45772        S: serde::Serializer,
45773    {
45774        match self {
45775            Self::Unspecified => serializer.serialize_i32(0),
45776            Self::FirstGen => serializer.serialize_i32(1),
45777            Self::SecondGen => serializer.serialize_i32(2),
45778            Self::External => serializer.serialize_i32(3),
45779            Self::UnknownValue(u) => u.0.serialize(serializer),
45780        }
45781    }
45782}
45783
45784impl<'de> serde::de::Deserialize<'de> for SqlBackendType {
45785    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
45786    where
45787        D: serde::Deserializer<'de>,
45788    {
45789        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlBackendType>::new(
45790            ".google.cloud.sql.v1.SqlBackendType",
45791        ))
45792    }
45793}
45794
45795///
45796/// # Working with unknown values
45797///
45798/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
45799/// additional enum variants at any time. Adding new variants is not considered
45800/// a breaking change. Applications should write their code in anticipation of:
45801///
45802/// - New values appearing in future releases of the client library, **and**
45803/// - New values received dynamically, without application changes.
45804///
45805/// Please consult the [Working with enums] section in the user guide for some
45806/// guidelines.
45807///
45808/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
45809#[derive(Clone, Debug, PartialEq)]
45810#[non_exhaustive]
45811pub enum SqlIpAddressType {
45812    /// This is an unknown IP address type.
45813    Unspecified,
45814    /// IP address the customer is supposed to connect to. Usually this is the
45815    /// load balancer's IP address
45816    Primary,
45817    /// Source IP address of the connection a read replica establishes to its
45818    /// external primary instance. This IP address can be allowlisted by the
45819    /// customer in case it has a firewall that filters incoming connection to its
45820    /// on premises primary instance.
45821    Outgoing,
45822    /// Private IP used when using private IPs and network peering.
45823    Private,
45824    /// V1 IP of a migrated instance. We want the user to
45825    /// decommission this IP as soon as the migration is complete.
45826    /// Note: V1 instances with V1 ip addresses will be counted as PRIMARY.
45827    Migrated1StGen,
45828    /// If set, the enum was initialized with an unknown value.
45829    ///
45830    /// Applications can examine the value using [SqlIpAddressType::value] or
45831    /// [SqlIpAddressType::name].
45832    UnknownValue(sql_ip_address_type::UnknownValue),
45833}
45834
45835#[doc(hidden)]
45836pub mod sql_ip_address_type {
45837    #[allow(unused_imports)]
45838    use super::*;
45839    #[derive(Clone, Debug, PartialEq)]
45840    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
45841}
45842
45843impl SqlIpAddressType {
45844    /// Gets the enum value.
45845    ///
45846    /// Returns `None` if the enum contains an unknown value deserialized from
45847    /// the string representation of enums.
45848    pub fn value(&self) -> std::option::Option<i32> {
45849        match self {
45850            Self::Unspecified => std::option::Option::Some(0),
45851            Self::Primary => std::option::Option::Some(1),
45852            Self::Outgoing => std::option::Option::Some(2),
45853            Self::Private => std::option::Option::Some(3),
45854            Self::Migrated1StGen => std::option::Option::Some(4),
45855            Self::UnknownValue(u) => u.0.value(),
45856        }
45857    }
45858
45859    /// Gets the enum value as a string.
45860    ///
45861    /// Returns `None` if the enum contains an unknown value deserialized from
45862    /// the integer representation of enums.
45863    pub fn name(&self) -> std::option::Option<&str> {
45864        match self {
45865            Self::Unspecified => std::option::Option::Some("SQL_IP_ADDRESS_TYPE_UNSPECIFIED"),
45866            Self::Primary => std::option::Option::Some("PRIMARY"),
45867            Self::Outgoing => std::option::Option::Some("OUTGOING"),
45868            Self::Private => std::option::Option::Some("PRIVATE"),
45869            Self::Migrated1StGen => std::option::Option::Some("MIGRATED_1ST_GEN"),
45870            Self::UnknownValue(u) => u.0.name(),
45871        }
45872    }
45873}
45874
45875impl std::default::Default for SqlIpAddressType {
45876    fn default() -> Self {
45877        use std::convert::From;
45878        Self::from(0)
45879    }
45880}
45881
45882impl std::fmt::Display for SqlIpAddressType {
45883    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
45884        wkt::internal::display_enum(f, self.name(), self.value())
45885    }
45886}
45887
45888impl std::convert::From<i32> for SqlIpAddressType {
45889    fn from(value: i32) -> Self {
45890        match value {
45891            0 => Self::Unspecified,
45892            1 => Self::Primary,
45893            2 => Self::Outgoing,
45894            3 => Self::Private,
45895            4 => Self::Migrated1StGen,
45896            _ => Self::UnknownValue(sql_ip_address_type::UnknownValue(
45897                wkt::internal::UnknownEnumValue::Integer(value),
45898            )),
45899        }
45900    }
45901}
45902
45903impl std::convert::From<&str> for SqlIpAddressType {
45904    fn from(value: &str) -> Self {
45905        use std::string::ToString;
45906        match value {
45907            "SQL_IP_ADDRESS_TYPE_UNSPECIFIED" => Self::Unspecified,
45908            "PRIMARY" => Self::Primary,
45909            "OUTGOING" => Self::Outgoing,
45910            "PRIVATE" => Self::Private,
45911            "MIGRATED_1ST_GEN" => Self::Migrated1StGen,
45912            _ => Self::UnknownValue(sql_ip_address_type::UnknownValue(
45913                wkt::internal::UnknownEnumValue::String(value.to_string()),
45914            )),
45915        }
45916    }
45917}
45918
45919impl serde::ser::Serialize for SqlIpAddressType {
45920    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
45921    where
45922        S: serde::Serializer,
45923    {
45924        match self {
45925            Self::Unspecified => serializer.serialize_i32(0),
45926            Self::Primary => serializer.serialize_i32(1),
45927            Self::Outgoing => serializer.serialize_i32(2),
45928            Self::Private => serializer.serialize_i32(3),
45929            Self::Migrated1StGen => serializer.serialize_i32(4),
45930            Self::UnknownValue(u) => u.0.serialize(serializer),
45931        }
45932    }
45933}
45934
45935impl<'de> serde::de::Deserialize<'de> for SqlIpAddressType {
45936    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
45937    where
45938        D: serde::Deserializer<'de>,
45939    {
45940        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlIpAddressType>::new(
45941            ".google.cloud.sql.v1.SqlIpAddressType",
45942        ))
45943    }
45944}
45945
45946/// The database engine type and version.
45947///
45948/// # Working with unknown values
45949///
45950/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
45951/// additional enum variants at any time. Adding new variants is not considered
45952/// a breaking change. Applications should write their code in anticipation of:
45953///
45954/// - New values appearing in future releases of the client library, **and**
45955/// - New values received dynamically, without application changes.
45956///
45957/// Please consult the [Working with enums] section in the user guide for some
45958/// guidelines.
45959///
45960/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
45961#[derive(Clone, Debug, PartialEq)]
45962#[non_exhaustive]
45963pub enum SqlDatabaseVersion {
45964    /// This is an unknown database version.
45965    Unspecified,
45966    /// The database version is MySQL 5.1.
45967    #[deprecated]
45968    Mysql51,
45969    /// The database version is MySQL 5.5.
45970    #[deprecated]
45971    Mysql55,
45972    /// The database version is MySQL 5.6.
45973    Mysql56,
45974    /// The database version is MySQL 5.7.
45975    Mysql57,
45976    /// The database version is SQL Server 2017 Standard.
45977    Sqlserver2017Standard,
45978    /// The database version is SQL Server 2017 Enterprise.
45979    Sqlserver2017Enterprise,
45980    /// The database version is SQL Server 2017 Express.
45981    Sqlserver2017Express,
45982    /// The database version is SQL Server 2017 Web.
45983    Sqlserver2017Web,
45984    /// The database version is PostgreSQL 9.6.
45985    Postgres96,
45986    /// The database version is PostgreSQL 10.
45987    Postgres10,
45988    /// The database version is PostgreSQL 11.
45989    Postgres11,
45990    /// The database version is PostgreSQL 12.
45991    Postgres12,
45992    /// The database version is PostgreSQL 13.
45993    Postgres13,
45994    /// The database version is PostgreSQL 14.
45995    Postgres14,
45996    /// The database version is PostgreSQL 15.
45997    Postgres15,
45998    /// The database version is PostgreSQL 16.
45999    Postgres16,
46000    /// The database version is MySQL 8.
46001    Mysql80,
46002    /// The database major version is MySQL 8.0 and the minor version is 18.
46003    Mysql8018,
46004    /// The database major version is MySQL 8.0 and the minor version is 26.
46005    Mysql8026,
46006    /// The database major version is MySQL 8.0 and the minor version is 27.
46007    Mysql8027,
46008    /// The database major version is MySQL 8.0 and the minor version is 28.
46009    Mysql8028,
46010    /// The database major version is MySQL 8.0 and the minor version is 29.
46011    #[deprecated]
46012    Mysql8029,
46013    /// The database major version is MySQL 8.0 and the minor version is 30.
46014    Mysql8030,
46015    /// The database major version is MySQL 8.0 and the minor version is 31.
46016    Mysql8031,
46017    /// The database major version is MySQL 8.0 and the minor version is 32.
46018    Mysql8032,
46019    /// The database major version is MySQL 8.0 and the minor version is 33.
46020    Mysql8033,
46021    /// The database major version is MySQL 8.0 and the minor version is 34.
46022    Mysql8034,
46023    /// The database major version is MySQL 8.0 and the minor version is 35.
46024    Mysql8035,
46025    /// The database major version is MySQL 8.0 and the minor version is 36.
46026    Mysql8036,
46027    /// The database major version is MySQL 8.0 and the minor version is 37.
46028    Mysql8037,
46029    /// The database major version is MySQL 8.0 and the minor version is 38.
46030    Mysql8038,
46031    /// The database major version is MySQL 8.0 and the minor version is 39.
46032    Mysql8039,
46033    /// The database major version is MySQL 8.0 and the minor version is 40.
46034    Mysql8040,
46035    /// The database version is MySQL 8.4.
46036    Mysql84,
46037    /// The database version is MySQL 8.4 and the patch version is 0.
46038    Mysql840,
46039    /// The database version is SQL Server 2019 Standard.
46040    Sqlserver2019Standard,
46041    /// The database version is SQL Server 2019 Enterprise.
46042    Sqlserver2019Enterprise,
46043    /// The database version is SQL Server 2019 Express.
46044    Sqlserver2019Express,
46045    /// The database version is SQL Server 2019 Web.
46046    Sqlserver2019Web,
46047    /// The database version is SQL Server 2022 Standard.
46048    Sqlserver2022Standard,
46049    /// The database version is SQL Server 2022 Enterprise.
46050    Sqlserver2022Enterprise,
46051    /// The database version is SQL Server 2022 Express.
46052    Sqlserver2022Express,
46053    /// The database version is SQL Server 2022 Web.
46054    Sqlserver2022Web,
46055    /// If set, the enum was initialized with an unknown value.
46056    ///
46057    /// Applications can examine the value using [SqlDatabaseVersion::value] or
46058    /// [SqlDatabaseVersion::name].
46059    UnknownValue(sql_database_version::UnknownValue),
46060}
46061
46062#[doc(hidden)]
46063pub mod sql_database_version {
46064    #[allow(unused_imports)]
46065    use super::*;
46066    #[derive(Clone, Debug, PartialEq)]
46067    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
46068}
46069
46070impl SqlDatabaseVersion {
46071    /// Gets the enum value.
46072    ///
46073    /// Returns `None` if the enum contains an unknown value deserialized from
46074    /// the string representation of enums.
46075    pub fn value(&self) -> std::option::Option<i32> {
46076        match self {
46077            Self::Unspecified => std::option::Option::Some(0),
46078            Self::Mysql51 => std::option::Option::Some(2),
46079            Self::Mysql55 => std::option::Option::Some(3),
46080            Self::Mysql56 => std::option::Option::Some(5),
46081            Self::Mysql57 => std::option::Option::Some(6),
46082            Self::Sqlserver2017Standard => std::option::Option::Some(11),
46083            Self::Sqlserver2017Enterprise => std::option::Option::Some(14),
46084            Self::Sqlserver2017Express => std::option::Option::Some(15),
46085            Self::Sqlserver2017Web => std::option::Option::Some(16),
46086            Self::Postgres96 => std::option::Option::Some(9),
46087            Self::Postgres10 => std::option::Option::Some(18),
46088            Self::Postgres11 => std::option::Option::Some(10),
46089            Self::Postgres12 => std::option::Option::Some(19),
46090            Self::Postgres13 => std::option::Option::Some(23),
46091            Self::Postgres14 => std::option::Option::Some(110),
46092            Self::Postgres15 => std::option::Option::Some(172),
46093            Self::Postgres16 => std::option::Option::Some(272),
46094            Self::Mysql80 => std::option::Option::Some(20),
46095            Self::Mysql8018 => std::option::Option::Some(41),
46096            Self::Mysql8026 => std::option::Option::Some(85),
46097            Self::Mysql8027 => std::option::Option::Some(111),
46098            Self::Mysql8028 => std::option::Option::Some(132),
46099            Self::Mysql8029 => std::option::Option::Some(148),
46100            Self::Mysql8030 => std::option::Option::Some(174),
46101            Self::Mysql8031 => std::option::Option::Some(197),
46102            Self::Mysql8032 => std::option::Option::Some(213),
46103            Self::Mysql8033 => std::option::Option::Some(238),
46104            Self::Mysql8034 => std::option::Option::Some(239),
46105            Self::Mysql8035 => std::option::Option::Some(240),
46106            Self::Mysql8036 => std::option::Option::Some(241),
46107            Self::Mysql8037 => std::option::Option::Some(355),
46108            Self::Mysql8038 => std::option::Option::Some(356),
46109            Self::Mysql8039 => std::option::Option::Some(357),
46110            Self::Mysql8040 => std::option::Option::Some(358),
46111            Self::Mysql84 => std::option::Option::Some(398),
46112            Self::Mysql840 => std::option::Option::Some(399),
46113            Self::Sqlserver2019Standard => std::option::Option::Some(26),
46114            Self::Sqlserver2019Enterprise => std::option::Option::Some(27),
46115            Self::Sqlserver2019Express => std::option::Option::Some(28),
46116            Self::Sqlserver2019Web => std::option::Option::Some(29),
46117            Self::Sqlserver2022Standard => std::option::Option::Some(199),
46118            Self::Sqlserver2022Enterprise => std::option::Option::Some(200),
46119            Self::Sqlserver2022Express => std::option::Option::Some(201),
46120            Self::Sqlserver2022Web => std::option::Option::Some(202),
46121            Self::UnknownValue(u) => u.0.value(),
46122        }
46123    }
46124
46125    /// Gets the enum value as a string.
46126    ///
46127    /// Returns `None` if the enum contains an unknown value deserialized from
46128    /// the integer representation of enums.
46129    pub fn name(&self) -> std::option::Option<&str> {
46130        match self {
46131            Self::Unspecified => std::option::Option::Some("SQL_DATABASE_VERSION_UNSPECIFIED"),
46132            Self::Mysql51 => std::option::Option::Some("MYSQL_5_1"),
46133            Self::Mysql55 => std::option::Option::Some("MYSQL_5_5"),
46134            Self::Mysql56 => std::option::Option::Some("MYSQL_5_6"),
46135            Self::Mysql57 => std::option::Option::Some("MYSQL_5_7"),
46136            Self::Sqlserver2017Standard => std::option::Option::Some("SQLSERVER_2017_STANDARD"),
46137            Self::Sqlserver2017Enterprise => std::option::Option::Some("SQLSERVER_2017_ENTERPRISE"),
46138            Self::Sqlserver2017Express => std::option::Option::Some("SQLSERVER_2017_EXPRESS"),
46139            Self::Sqlserver2017Web => std::option::Option::Some("SQLSERVER_2017_WEB"),
46140            Self::Postgres96 => std::option::Option::Some("POSTGRES_9_6"),
46141            Self::Postgres10 => std::option::Option::Some("POSTGRES_10"),
46142            Self::Postgres11 => std::option::Option::Some("POSTGRES_11"),
46143            Self::Postgres12 => std::option::Option::Some("POSTGRES_12"),
46144            Self::Postgres13 => std::option::Option::Some("POSTGRES_13"),
46145            Self::Postgres14 => std::option::Option::Some("POSTGRES_14"),
46146            Self::Postgres15 => std::option::Option::Some("POSTGRES_15"),
46147            Self::Postgres16 => std::option::Option::Some("POSTGRES_16"),
46148            Self::Mysql80 => std::option::Option::Some("MYSQL_8_0"),
46149            Self::Mysql8018 => std::option::Option::Some("MYSQL_8_0_18"),
46150            Self::Mysql8026 => std::option::Option::Some("MYSQL_8_0_26"),
46151            Self::Mysql8027 => std::option::Option::Some("MYSQL_8_0_27"),
46152            Self::Mysql8028 => std::option::Option::Some("MYSQL_8_0_28"),
46153            Self::Mysql8029 => std::option::Option::Some("MYSQL_8_0_29"),
46154            Self::Mysql8030 => std::option::Option::Some("MYSQL_8_0_30"),
46155            Self::Mysql8031 => std::option::Option::Some("MYSQL_8_0_31"),
46156            Self::Mysql8032 => std::option::Option::Some("MYSQL_8_0_32"),
46157            Self::Mysql8033 => std::option::Option::Some("MYSQL_8_0_33"),
46158            Self::Mysql8034 => std::option::Option::Some("MYSQL_8_0_34"),
46159            Self::Mysql8035 => std::option::Option::Some("MYSQL_8_0_35"),
46160            Self::Mysql8036 => std::option::Option::Some("MYSQL_8_0_36"),
46161            Self::Mysql8037 => std::option::Option::Some("MYSQL_8_0_37"),
46162            Self::Mysql8038 => std::option::Option::Some("MYSQL_8_0_38"),
46163            Self::Mysql8039 => std::option::Option::Some("MYSQL_8_0_39"),
46164            Self::Mysql8040 => std::option::Option::Some("MYSQL_8_0_40"),
46165            Self::Mysql84 => std::option::Option::Some("MYSQL_8_4"),
46166            Self::Mysql840 => std::option::Option::Some("MYSQL_8_4_0"),
46167            Self::Sqlserver2019Standard => std::option::Option::Some("SQLSERVER_2019_STANDARD"),
46168            Self::Sqlserver2019Enterprise => std::option::Option::Some("SQLSERVER_2019_ENTERPRISE"),
46169            Self::Sqlserver2019Express => std::option::Option::Some("SQLSERVER_2019_EXPRESS"),
46170            Self::Sqlserver2019Web => std::option::Option::Some("SQLSERVER_2019_WEB"),
46171            Self::Sqlserver2022Standard => std::option::Option::Some("SQLSERVER_2022_STANDARD"),
46172            Self::Sqlserver2022Enterprise => std::option::Option::Some("SQLSERVER_2022_ENTERPRISE"),
46173            Self::Sqlserver2022Express => std::option::Option::Some("SQLSERVER_2022_EXPRESS"),
46174            Self::Sqlserver2022Web => std::option::Option::Some("SQLSERVER_2022_WEB"),
46175            Self::UnknownValue(u) => u.0.name(),
46176        }
46177    }
46178}
46179
46180impl std::default::Default for SqlDatabaseVersion {
46181    fn default() -> Self {
46182        use std::convert::From;
46183        Self::from(0)
46184    }
46185}
46186
46187impl std::fmt::Display for SqlDatabaseVersion {
46188    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
46189        wkt::internal::display_enum(f, self.name(), self.value())
46190    }
46191}
46192
46193impl std::convert::From<i32> for SqlDatabaseVersion {
46194    fn from(value: i32) -> Self {
46195        match value {
46196            0 => Self::Unspecified,
46197            2 => Self::Mysql51,
46198            3 => Self::Mysql55,
46199            5 => Self::Mysql56,
46200            6 => Self::Mysql57,
46201            9 => Self::Postgres96,
46202            10 => Self::Postgres11,
46203            11 => Self::Sqlserver2017Standard,
46204            14 => Self::Sqlserver2017Enterprise,
46205            15 => Self::Sqlserver2017Express,
46206            16 => Self::Sqlserver2017Web,
46207            18 => Self::Postgres10,
46208            19 => Self::Postgres12,
46209            20 => Self::Mysql80,
46210            23 => Self::Postgres13,
46211            26 => Self::Sqlserver2019Standard,
46212            27 => Self::Sqlserver2019Enterprise,
46213            28 => Self::Sqlserver2019Express,
46214            29 => Self::Sqlserver2019Web,
46215            41 => Self::Mysql8018,
46216            85 => Self::Mysql8026,
46217            110 => Self::Postgres14,
46218            111 => Self::Mysql8027,
46219            132 => Self::Mysql8028,
46220            148 => Self::Mysql8029,
46221            172 => Self::Postgres15,
46222            174 => Self::Mysql8030,
46223            197 => Self::Mysql8031,
46224            199 => Self::Sqlserver2022Standard,
46225            200 => Self::Sqlserver2022Enterprise,
46226            201 => Self::Sqlserver2022Express,
46227            202 => Self::Sqlserver2022Web,
46228            213 => Self::Mysql8032,
46229            238 => Self::Mysql8033,
46230            239 => Self::Mysql8034,
46231            240 => Self::Mysql8035,
46232            241 => Self::Mysql8036,
46233            272 => Self::Postgres16,
46234            355 => Self::Mysql8037,
46235            356 => Self::Mysql8038,
46236            357 => Self::Mysql8039,
46237            358 => Self::Mysql8040,
46238            398 => Self::Mysql84,
46239            399 => Self::Mysql840,
46240            _ => Self::UnknownValue(sql_database_version::UnknownValue(
46241                wkt::internal::UnknownEnumValue::Integer(value),
46242            )),
46243        }
46244    }
46245}
46246
46247impl std::convert::From<&str> for SqlDatabaseVersion {
46248    fn from(value: &str) -> Self {
46249        use std::string::ToString;
46250        match value {
46251            "SQL_DATABASE_VERSION_UNSPECIFIED" => Self::Unspecified,
46252            "MYSQL_5_1" => Self::Mysql51,
46253            "MYSQL_5_5" => Self::Mysql55,
46254            "MYSQL_5_6" => Self::Mysql56,
46255            "MYSQL_5_7" => Self::Mysql57,
46256            "SQLSERVER_2017_STANDARD" => Self::Sqlserver2017Standard,
46257            "SQLSERVER_2017_ENTERPRISE" => Self::Sqlserver2017Enterprise,
46258            "SQLSERVER_2017_EXPRESS" => Self::Sqlserver2017Express,
46259            "SQLSERVER_2017_WEB" => Self::Sqlserver2017Web,
46260            "POSTGRES_9_6" => Self::Postgres96,
46261            "POSTGRES_10" => Self::Postgres10,
46262            "POSTGRES_11" => Self::Postgres11,
46263            "POSTGRES_12" => Self::Postgres12,
46264            "POSTGRES_13" => Self::Postgres13,
46265            "POSTGRES_14" => Self::Postgres14,
46266            "POSTGRES_15" => Self::Postgres15,
46267            "POSTGRES_16" => Self::Postgres16,
46268            "MYSQL_8_0" => Self::Mysql80,
46269            "MYSQL_8_0_18" => Self::Mysql8018,
46270            "MYSQL_8_0_26" => Self::Mysql8026,
46271            "MYSQL_8_0_27" => Self::Mysql8027,
46272            "MYSQL_8_0_28" => Self::Mysql8028,
46273            "MYSQL_8_0_29" => Self::Mysql8029,
46274            "MYSQL_8_0_30" => Self::Mysql8030,
46275            "MYSQL_8_0_31" => Self::Mysql8031,
46276            "MYSQL_8_0_32" => Self::Mysql8032,
46277            "MYSQL_8_0_33" => Self::Mysql8033,
46278            "MYSQL_8_0_34" => Self::Mysql8034,
46279            "MYSQL_8_0_35" => Self::Mysql8035,
46280            "MYSQL_8_0_36" => Self::Mysql8036,
46281            "MYSQL_8_0_37" => Self::Mysql8037,
46282            "MYSQL_8_0_38" => Self::Mysql8038,
46283            "MYSQL_8_0_39" => Self::Mysql8039,
46284            "MYSQL_8_0_40" => Self::Mysql8040,
46285            "MYSQL_8_4" => Self::Mysql84,
46286            "MYSQL_8_4_0" => Self::Mysql840,
46287            "SQLSERVER_2019_STANDARD" => Self::Sqlserver2019Standard,
46288            "SQLSERVER_2019_ENTERPRISE" => Self::Sqlserver2019Enterprise,
46289            "SQLSERVER_2019_EXPRESS" => Self::Sqlserver2019Express,
46290            "SQLSERVER_2019_WEB" => Self::Sqlserver2019Web,
46291            "SQLSERVER_2022_STANDARD" => Self::Sqlserver2022Standard,
46292            "SQLSERVER_2022_ENTERPRISE" => Self::Sqlserver2022Enterprise,
46293            "SQLSERVER_2022_EXPRESS" => Self::Sqlserver2022Express,
46294            "SQLSERVER_2022_WEB" => Self::Sqlserver2022Web,
46295            _ => Self::UnknownValue(sql_database_version::UnknownValue(
46296                wkt::internal::UnknownEnumValue::String(value.to_string()),
46297            )),
46298        }
46299    }
46300}
46301
46302impl serde::ser::Serialize for SqlDatabaseVersion {
46303    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
46304    where
46305        S: serde::Serializer,
46306    {
46307        match self {
46308            Self::Unspecified => serializer.serialize_i32(0),
46309            Self::Mysql51 => serializer.serialize_i32(2),
46310            Self::Mysql55 => serializer.serialize_i32(3),
46311            Self::Mysql56 => serializer.serialize_i32(5),
46312            Self::Mysql57 => serializer.serialize_i32(6),
46313            Self::Sqlserver2017Standard => serializer.serialize_i32(11),
46314            Self::Sqlserver2017Enterprise => serializer.serialize_i32(14),
46315            Self::Sqlserver2017Express => serializer.serialize_i32(15),
46316            Self::Sqlserver2017Web => serializer.serialize_i32(16),
46317            Self::Postgres96 => serializer.serialize_i32(9),
46318            Self::Postgres10 => serializer.serialize_i32(18),
46319            Self::Postgres11 => serializer.serialize_i32(10),
46320            Self::Postgres12 => serializer.serialize_i32(19),
46321            Self::Postgres13 => serializer.serialize_i32(23),
46322            Self::Postgres14 => serializer.serialize_i32(110),
46323            Self::Postgres15 => serializer.serialize_i32(172),
46324            Self::Postgres16 => serializer.serialize_i32(272),
46325            Self::Mysql80 => serializer.serialize_i32(20),
46326            Self::Mysql8018 => serializer.serialize_i32(41),
46327            Self::Mysql8026 => serializer.serialize_i32(85),
46328            Self::Mysql8027 => serializer.serialize_i32(111),
46329            Self::Mysql8028 => serializer.serialize_i32(132),
46330            Self::Mysql8029 => serializer.serialize_i32(148),
46331            Self::Mysql8030 => serializer.serialize_i32(174),
46332            Self::Mysql8031 => serializer.serialize_i32(197),
46333            Self::Mysql8032 => serializer.serialize_i32(213),
46334            Self::Mysql8033 => serializer.serialize_i32(238),
46335            Self::Mysql8034 => serializer.serialize_i32(239),
46336            Self::Mysql8035 => serializer.serialize_i32(240),
46337            Self::Mysql8036 => serializer.serialize_i32(241),
46338            Self::Mysql8037 => serializer.serialize_i32(355),
46339            Self::Mysql8038 => serializer.serialize_i32(356),
46340            Self::Mysql8039 => serializer.serialize_i32(357),
46341            Self::Mysql8040 => serializer.serialize_i32(358),
46342            Self::Mysql84 => serializer.serialize_i32(398),
46343            Self::Mysql840 => serializer.serialize_i32(399),
46344            Self::Sqlserver2019Standard => serializer.serialize_i32(26),
46345            Self::Sqlserver2019Enterprise => serializer.serialize_i32(27),
46346            Self::Sqlserver2019Express => serializer.serialize_i32(28),
46347            Self::Sqlserver2019Web => serializer.serialize_i32(29),
46348            Self::Sqlserver2022Standard => serializer.serialize_i32(199),
46349            Self::Sqlserver2022Enterprise => serializer.serialize_i32(200),
46350            Self::Sqlserver2022Express => serializer.serialize_i32(201),
46351            Self::Sqlserver2022Web => serializer.serialize_i32(202),
46352            Self::UnknownValue(u) => u.0.serialize(serializer),
46353        }
46354    }
46355}
46356
46357impl<'de> serde::de::Deserialize<'de> for SqlDatabaseVersion {
46358    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
46359    where
46360        D: serde::Deserializer<'de>,
46361    {
46362        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlDatabaseVersion>::new(
46363            ".google.cloud.sql.v1.SqlDatabaseVersion",
46364        ))
46365    }
46366}
46367
46368/// The pricing plan for this instance.
46369///
46370/// # Working with unknown values
46371///
46372/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
46373/// additional enum variants at any time. Adding new variants is not considered
46374/// a breaking change. Applications should write their code in anticipation of:
46375///
46376/// - New values appearing in future releases of the client library, **and**
46377/// - New values received dynamically, without application changes.
46378///
46379/// Please consult the [Working with enums] section in the user guide for some
46380/// guidelines.
46381///
46382/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
46383#[derive(Clone, Debug, PartialEq)]
46384#[non_exhaustive]
46385pub enum SqlPricingPlan {
46386    /// This is an unknown pricing plan for this instance.
46387    Unspecified,
46388    /// The instance is billed at a monthly flat rate.
46389    Package,
46390    /// The instance is billed per usage.
46391    PerUse,
46392    /// If set, the enum was initialized with an unknown value.
46393    ///
46394    /// Applications can examine the value using [SqlPricingPlan::value] or
46395    /// [SqlPricingPlan::name].
46396    UnknownValue(sql_pricing_plan::UnknownValue),
46397}
46398
46399#[doc(hidden)]
46400pub mod sql_pricing_plan {
46401    #[allow(unused_imports)]
46402    use super::*;
46403    #[derive(Clone, Debug, PartialEq)]
46404    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
46405}
46406
46407impl SqlPricingPlan {
46408    /// Gets the enum value.
46409    ///
46410    /// Returns `None` if the enum contains an unknown value deserialized from
46411    /// the string representation of enums.
46412    pub fn value(&self) -> std::option::Option<i32> {
46413        match self {
46414            Self::Unspecified => std::option::Option::Some(0),
46415            Self::Package => std::option::Option::Some(1),
46416            Self::PerUse => std::option::Option::Some(2),
46417            Self::UnknownValue(u) => u.0.value(),
46418        }
46419    }
46420
46421    /// Gets the enum value as a string.
46422    ///
46423    /// Returns `None` if the enum contains an unknown value deserialized from
46424    /// the integer representation of enums.
46425    pub fn name(&self) -> std::option::Option<&str> {
46426        match self {
46427            Self::Unspecified => std::option::Option::Some("SQL_PRICING_PLAN_UNSPECIFIED"),
46428            Self::Package => std::option::Option::Some("PACKAGE"),
46429            Self::PerUse => std::option::Option::Some("PER_USE"),
46430            Self::UnknownValue(u) => u.0.name(),
46431        }
46432    }
46433}
46434
46435impl std::default::Default for SqlPricingPlan {
46436    fn default() -> Self {
46437        use std::convert::From;
46438        Self::from(0)
46439    }
46440}
46441
46442impl std::fmt::Display for SqlPricingPlan {
46443    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
46444        wkt::internal::display_enum(f, self.name(), self.value())
46445    }
46446}
46447
46448impl std::convert::From<i32> for SqlPricingPlan {
46449    fn from(value: i32) -> Self {
46450        match value {
46451            0 => Self::Unspecified,
46452            1 => Self::Package,
46453            2 => Self::PerUse,
46454            _ => Self::UnknownValue(sql_pricing_plan::UnknownValue(
46455                wkt::internal::UnknownEnumValue::Integer(value),
46456            )),
46457        }
46458    }
46459}
46460
46461impl std::convert::From<&str> for SqlPricingPlan {
46462    fn from(value: &str) -> Self {
46463        use std::string::ToString;
46464        match value {
46465            "SQL_PRICING_PLAN_UNSPECIFIED" => Self::Unspecified,
46466            "PACKAGE" => Self::Package,
46467            "PER_USE" => Self::PerUse,
46468            _ => Self::UnknownValue(sql_pricing_plan::UnknownValue(
46469                wkt::internal::UnknownEnumValue::String(value.to_string()),
46470            )),
46471        }
46472    }
46473}
46474
46475impl serde::ser::Serialize for SqlPricingPlan {
46476    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
46477    where
46478        S: serde::Serializer,
46479    {
46480        match self {
46481            Self::Unspecified => serializer.serialize_i32(0),
46482            Self::Package => serializer.serialize_i32(1),
46483            Self::PerUse => serializer.serialize_i32(2),
46484            Self::UnknownValue(u) => u.0.serialize(serializer),
46485        }
46486    }
46487}
46488
46489impl<'de> serde::de::Deserialize<'de> for SqlPricingPlan {
46490    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
46491    where
46492        D: serde::Deserializer<'de>,
46493    {
46494        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlPricingPlan>::new(
46495            ".google.cloud.sql.v1.SqlPricingPlan",
46496        ))
46497    }
46498}
46499
46500///
46501/// # Working with unknown values
46502///
46503/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
46504/// additional enum variants at any time. Adding new variants is not considered
46505/// a breaking change. Applications should write their code in anticipation of:
46506///
46507/// - New values appearing in future releases of the client library, **and**
46508/// - New values received dynamically, without application changes.
46509///
46510/// Please consult the [Working with enums] section in the user guide for some
46511/// guidelines.
46512///
46513/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
46514#[derive(Clone, Debug, PartialEq)]
46515#[non_exhaustive]
46516pub enum SqlReplicationType {
46517    /// This is an unknown replication type for a Cloud SQL instance.
46518    Unspecified,
46519    /// The synchronous replication mode for First Generation instances. It is the
46520    /// default value.
46521    Synchronous,
46522    /// The asynchronous replication mode for First Generation instances. It
46523    /// provides a slight performance gain, but if an outage occurs while this
46524    /// option is set to asynchronous, you can lose up to a few seconds of updates
46525    /// to your data.
46526    Asynchronous,
46527    /// If set, the enum was initialized with an unknown value.
46528    ///
46529    /// Applications can examine the value using [SqlReplicationType::value] or
46530    /// [SqlReplicationType::name].
46531    UnknownValue(sql_replication_type::UnknownValue),
46532}
46533
46534#[doc(hidden)]
46535pub mod sql_replication_type {
46536    #[allow(unused_imports)]
46537    use super::*;
46538    #[derive(Clone, Debug, PartialEq)]
46539    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
46540}
46541
46542impl SqlReplicationType {
46543    /// Gets the enum value.
46544    ///
46545    /// Returns `None` if the enum contains an unknown value deserialized from
46546    /// the string representation of enums.
46547    pub fn value(&self) -> std::option::Option<i32> {
46548        match self {
46549            Self::Unspecified => std::option::Option::Some(0),
46550            Self::Synchronous => std::option::Option::Some(1),
46551            Self::Asynchronous => std::option::Option::Some(2),
46552            Self::UnknownValue(u) => u.0.value(),
46553        }
46554    }
46555
46556    /// Gets the enum value as a string.
46557    ///
46558    /// Returns `None` if the enum contains an unknown value deserialized from
46559    /// the integer representation of enums.
46560    pub fn name(&self) -> std::option::Option<&str> {
46561        match self {
46562            Self::Unspecified => std::option::Option::Some("SQL_REPLICATION_TYPE_UNSPECIFIED"),
46563            Self::Synchronous => std::option::Option::Some("SYNCHRONOUS"),
46564            Self::Asynchronous => std::option::Option::Some("ASYNCHRONOUS"),
46565            Self::UnknownValue(u) => u.0.name(),
46566        }
46567    }
46568}
46569
46570impl std::default::Default for SqlReplicationType {
46571    fn default() -> Self {
46572        use std::convert::From;
46573        Self::from(0)
46574    }
46575}
46576
46577impl std::fmt::Display for SqlReplicationType {
46578    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
46579        wkt::internal::display_enum(f, self.name(), self.value())
46580    }
46581}
46582
46583impl std::convert::From<i32> for SqlReplicationType {
46584    fn from(value: i32) -> Self {
46585        match value {
46586            0 => Self::Unspecified,
46587            1 => Self::Synchronous,
46588            2 => Self::Asynchronous,
46589            _ => Self::UnknownValue(sql_replication_type::UnknownValue(
46590                wkt::internal::UnknownEnumValue::Integer(value),
46591            )),
46592        }
46593    }
46594}
46595
46596impl std::convert::From<&str> for SqlReplicationType {
46597    fn from(value: &str) -> Self {
46598        use std::string::ToString;
46599        match value {
46600            "SQL_REPLICATION_TYPE_UNSPECIFIED" => Self::Unspecified,
46601            "SYNCHRONOUS" => Self::Synchronous,
46602            "ASYNCHRONOUS" => Self::Asynchronous,
46603            _ => Self::UnknownValue(sql_replication_type::UnknownValue(
46604                wkt::internal::UnknownEnumValue::String(value.to_string()),
46605            )),
46606        }
46607    }
46608}
46609
46610impl serde::ser::Serialize for SqlReplicationType {
46611    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
46612    where
46613        S: serde::Serializer,
46614    {
46615        match self {
46616            Self::Unspecified => serializer.serialize_i32(0),
46617            Self::Synchronous => serializer.serialize_i32(1),
46618            Self::Asynchronous => serializer.serialize_i32(2),
46619            Self::UnknownValue(u) => u.0.serialize(serializer),
46620        }
46621    }
46622}
46623
46624impl<'de> serde::de::Deserialize<'de> for SqlReplicationType {
46625    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
46626    where
46627        D: serde::Deserializer<'de>,
46628    {
46629        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlReplicationType>::new(
46630            ".google.cloud.sql.v1.SqlReplicationType",
46631        ))
46632    }
46633}
46634
46635/// The type of disk that is used for a v2 instance to use.
46636///
46637/// # Working with unknown values
46638///
46639/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
46640/// additional enum variants at any time. Adding new variants is not considered
46641/// a breaking change. Applications should write their code in anticipation of:
46642///
46643/// - New values appearing in future releases of the client library, **and**
46644/// - New values received dynamically, without application changes.
46645///
46646/// Please consult the [Working with enums] section in the user guide for some
46647/// guidelines.
46648///
46649/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
46650#[derive(Clone, Debug, PartialEq)]
46651#[non_exhaustive]
46652pub enum SqlDataDiskType {
46653    /// This is an unknown data disk type.
46654    Unspecified,
46655    /// An SSD data disk.
46656    PdSsd,
46657    /// An HDD data disk.
46658    PdHdd,
46659    /// This field is deprecated and will be removed from a future version of the
46660    /// API.
46661    #[deprecated]
46662    ObsoleteLocalSsd,
46663    /// If set, the enum was initialized with an unknown value.
46664    ///
46665    /// Applications can examine the value using [SqlDataDiskType::value] or
46666    /// [SqlDataDiskType::name].
46667    UnknownValue(sql_data_disk_type::UnknownValue),
46668}
46669
46670#[doc(hidden)]
46671pub mod sql_data_disk_type {
46672    #[allow(unused_imports)]
46673    use super::*;
46674    #[derive(Clone, Debug, PartialEq)]
46675    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
46676}
46677
46678impl SqlDataDiskType {
46679    /// Gets the enum value.
46680    ///
46681    /// Returns `None` if the enum contains an unknown value deserialized from
46682    /// the string representation of enums.
46683    pub fn value(&self) -> std::option::Option<i32> {
46684        match self {
46685            Self::Unspecified => std::option::Option::Some(0),
46686            Self::PdSsd => std::option::Option::Some(1),
46687            Self::PdHdd => std::option::Option::Some(2),
46688            Self::ObsoleteLocalSsd => std::option::Option::Some(3),
46689            Self::UnknownValue(u) => u.0.value(),
46690        }
46691    }
46692
46693    /// Gets the enum value as a string.
46694    ///
46695    /// Returns `None` if the enum contains an unknown value deserialized from
46696    /// the integer representation of enums.
46697    pub fn name(&self) -> std::option::Option<&str> {
46698        match self {
46699            Self::Unspecified => std::option::Option::Some("SQL_DATA_DISK_TYPE_UNSPECIFIED"),
46700            Self::PdSsd => std::option::Option::Some("PD_SSD"),
46701            Self::PdHdd => std::option::Option::Some("PD_HDD"),
46702            Self::ObsoleteLocalSsd => std::option::Option::Some("OBSOLETE_LOCAL_SSD"),
46703            Self::UnknownValue(u) => u.0.name(),
46704        }
46705    }
46706}
46707
46708impl std::default::Default for SqlDataDiskType {
46709    fn default() -> Self {
46710        use std::convert::From;
46711        Self::from(0)
46712    }
46713}
46714
46715impl std::fmt::Display for SqlDataDiskType {
46716    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
46717        wkt::internal::display_enum(f, self.name(), self.value())
46718    }
46719}
46720
46721impl std::convert::From<i32> for SqlDataDiskType {
46722    fn from(value: i32) -> Self {
46723        match value {
46724            0 => Self::Unspecified,
46725            1 => Self::PdSsd,
46726            2 => Self::PdHdd,
46727            3 => Self::ObsoleteLocalSsd,
46728            _ => Self::UnknownValue(sql_data_disk_type::UnknownValue(
46729                wkt::internal::UnknownEnumValue::Integer(value),
46730            )),
46731        }
46732    }
46733}
46734
46735impl std::convert::From<&str> for SqlDataDiskType {
46736    fn from(value: &str) -> Self {
46737        use std::string::ToString;
46738        match value {
46739            "SQL_DATA_DISK_TYPE_UNSPECIFIED" => Self::Unspecified,
46740            "PD_SSD" => Self::PdSsd,
46741            "PD_HDD" => Self::PdHdd,
46742            "OBSOLETE_LOCAL_SSD" => Self::ObsoleteLocalSsd,
46743            _ => Self::UnknownValue(sql_data_disk_type::UnknownValue(
46744                wkt::internal::UnknownEnumValue::String(value.to_string()),
46745            )),
46746        }
46747    }
46748}
46749
46750impl serde::ser::Serialize for SqlDataDiskType {
46751    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
46752    where
46753        S: serde::Serializer,
46754    {
46755        match self {
46756            Self::Unspecified => serializer.serialize_i32(0),
46757            Self::PdSsd => serializer.serialize_i32(1),
46758            Self::PdHdd => serializer.serialize_i32(2),
46759            Self::ObsoleteLocalSsd => serializer.serialize_i32(3),
46760            Self::UnknownValue(u) => u.0.serialize(serializer),
46761        }
46762    }
46763}
46764
46765impl<'de> serde::de::Deserialize<'de> for SqlDataDiskType {
46766    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
46767    where
46768        D: serde::Deserializer<'de>,
46769    {
46770        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlDataDiskType>::new(
46771            ".google.cloud.sql.v1.SqlDataDiskType",
46772        ))
46773    }
46774}
46775
46776/// The availability type of the given Cloud SQL instance.
46777///
46778/// # Working with unknown values
46779///
46780/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
46781/// additional enum variants at any time. Adding new variants is not considered
46782/// a breaking change. Applications should write their code in anticipation of:
46783///
46784/// - New values appearing in future releases of the client library, **and**
46785/// - New values received dynamically, without application changes.
46786///
46787/// Please consult the [Working with enums] section in the user guide for some
46788/// guidelines.
46789///
46790/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
46791#[derive(Clone, Debug, PartialEq)]
46792#[non_exhaustive]
46793pub enum SqlAvailabilityType {
46794    /// This is an unknown Availability type.
46795    Unspecified,
46796    /// Zonal available instance.
46797    Zonal,
46798    /// Regional available instance.
46799    Regional,
46800    /// If set, the enum was initialized with an unknown value.
46801    ///
46802    /// Applications can examine the value using [SqlAvailabilityType::value] or
46803    /// [SqlAvailabilityType::name].
46804    UnknownValue(sql_availability_type::UnknownValue),
46805}
46806
46807#[doc(hidden)]
46808pub mod sql_availability_type {
46809    #[allow(unused_imports)]
46810    use super::*;
46811    #[derive(Clone, Debug, PartialEq)]
46812    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
46813}
46814
46815impl SqlAvailabilityType {
46816    /// Gets the enum value.
46817    ///
46818    /// Returns `None` if the enum contains an unknown value deserialized from
46819    /// the string representation of enums.
46820    pub fn value(&self) -> std::option::Option<i32> {
46821        match self {
46822            Self::Unspecified => std::option::Option::Some(0),
46823            Self::Zonal => std::option::Option::Some(1),
46824            Self::Regional => std::option::Option::Some(2),
46825            Self::UnknownValue(u) => u.0.value(),
46826        }
46827    }
46828
46829    /// Gets the enum value as a string.
46830    ///
46831    /// Returns `None` if the enum contains an unknown value deserialized from
46832    /// the integer representation of enums.
46833    pub fn name(&self) -> std::option::Option<&str> {
46834        match self {
46835            Self::Unspecified => std::option::Option::Some("SQL_AVAILABILITY_TYPE_UNSPECIFIED"),
46836            Self::Zonal => std::option::Option::Some("ZONAL"),
46837            Self::Regional => std::option::Option::Some("REGIONAL"),
46838            Self::UnknownValue(u) => u.0.name(),
46839        }
46840    }
46841}
46842
46843impl std::default::Default for SqlAvailabilityType {
46844    fn default() -> Self {
46845        use std::convert::From;
46846        Self::from(0)
46847    }
46848}
46849
46850impl std::fmt::Display for SqlAvailabilityType {
46851    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
46852        wkt::internal::display_enum(f, self.name(), self.value())
46853    }
46854}
46855
46856impl std::convert::From<i32> for SqlAvailabilityType {
46857    fn from(value: i32) -> Self {
46858        match value {
46859            0 => Self::Unspecified,
46860            1 => Self::Zonal,
46861            2 => Self::Regional,
46862            _ => Self::UnknownValue(sql_availability_type::UnknownValue(
46863                wkt::internal::UnknownEnumValue::Integer(value),
46864            )),
46865        }
46866    }
46867}
46868
46869impl std::convert::From<&str> for SqlAvailabilityType {
46870    fn from(value: &str) -> Self {
46871        use std::string::ToString;
46872        match value {
46873            "SQL_AVAILABILITY_TYPE_UNSPECIFIED" => Self::Unspecified,
46874            "ZONAL" => Self::Zonal,
46875            "REGIONAL" => Self::Regional,
46876            _ => Self::UnknownValue(sql_availability_type::UnknownValue(
46877                wkt::internal::UnknownEnumValue::String(value.to_string()),
46878            )),
46879        }
46880    }
46881}
46882
46883impl serde::ser::Serialize for SqlAvailabilityType {
46884    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
46885    where
46886        S: serde::Serializer,
46887    {
46888        match self {
46889            Self::Unspecified => serializer.serialize_i32(0),
46890            Self::Zonal => serializer.serialize_i32(1),
46891            Self::Regional => serializer.serialize_i32(2),
46892            Self::UnknownValue(u) => u.0.serialize(serializer),
46893        }
46894    }
46895}
46896
46897impl<'de> serde::de::Deserialize<'de> for SqlAvailabilityType {
46898    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
46899    where
46900        D: serde::Deserializer<'de>,
46901    {
46902        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlAvailabilityType>::new(
46903            ".google.cloud.sql.v1.SqlAvailabilityType",
46904        ))
46905    }
46906}
46907
46908///
46909/// # Working with unknown values
46910///
46911/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
46912/// additional enum variants at any time. Adding new variants is not considered
46913/// a breaking change. Applications should write their code in anticipation of:
46914///
46915/// - New values appearing in future releases of the client library, **and**
46916/// - New values received dynamically, without application changes.
46917///
46918/// Please consult the [Working with enums] section in the user guide for some
46919/// guidelines.
46920///
46921/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
46922#[derive(Clone, Debug, PartialEq)]
46923#[non_exhaustive]
46924pub enum SqlUpdateTrack {
46925    /// This is an unknown maintenance timing preference.
46926    Unspecified,
46927    /// For an instance with a scheduled maintenance window, this maintenance
46928    /// timing indicates that the maintenance update is scheduled 7 to 14 days
46929    /// after the notification is sent out. Also referred to as `Week 1` (Console)
46930    /// and `preview` (gcloud CLI).
46931    Canary,
46932    /// For an instance with a scheduled maintenance window, this maintenance
46933    /// timing indicates that the maintenance update is scheduled 15 to 21 days
46934    /// after the notification is sent out. Also referred to as `Week 2` (Console)
46935    /// and `production` (gcloud CLI).
46936    Stable,
46937    /// For instance with a scheduled maintenance window, this maintenance
46938    /// timing indicates that the maintenance update is scheduled 35 to 42 days
46939    /// after the notification is sent out.
46940    Week5,
46941    /// If set, the enum was initialized with an unknown value.
46942    ///
46943    /// Applications can examine the value using [SqlUpdateTrack::value] or
46944    /// [SqlUpdateTrack::name].
46945    UnknownValue(sql_update_track::UnknownValue),
46946}
46947
46948#[doc(hidden)]
46949pub mod sql_update_track {
46950    #[allow(unused_imports)]
46951    use super::*;
46952    #[derive(Clone, Debug, PartialEq)]
46953    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
46954}
46955
46956impl SqlUpdateTrack {
46957    /// Gets the enum value.
46958    ///
46959    /// Returns `None` if the enum contains an unknown value deserialized from
46960    /// the string representation of enums.
46961    pub fn value(&self) -> std::option::Option<i32> {
46962        match self {
46963            Self::Unspecified => std::option::Option::Some(0),
46964            Self::Canary => std::option::Option::Some(1),
46965            Self::Stable => std::option::Option::Some(2),
46966            Self::Week5 => std::option::Option::Some(3),
46967            Self::UnknownValue(u) => u.0.value(),
46968        }
46969    }
46970
46971    /// Gets the enum value as a string.
46972    ///
46973    /// Returns `None` if the enum contains an unknown value deserialized from
46974    /// the integer representation of enums.
46975    pub fn name(&self) -> std::option::Option<&str> {
46976        match self {
46977            Self::Unspecified => std::option::Option::Some("SQL_UPDATE_TRACK_UNSPECIFIED"),
46978            Self::Canary => std::option::Option::Some("canary"),
46979            Self::Stable => std::option::Option::Some("stable"),
46980            Self::Week5 => std::option::Option::Some("week5"),
46981            Self::UnknownValue(u) => u.0.name(),
46982        }
46983    }
46984}
46985
46986impl std::default::Default for SqlUpdateTrack {
46987    fn default() -> Self {
46988        use std::convert::From;
46989        Self::from(0)
46990    }
46991}
46992
46993impl std::fmt::Display for SqlUpdateTrack {
46994    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
46995        wkt::internal::display_enum(f, self.name(), self.value())
46996    }
46997}
46998
46999impl std::convert::From<i32> for SqlUpdateTrack {
47000    fn from(value: i32) -> Self {
47001        match value {
47002            0 => Self::Unspecified,
47003            1 => Self::Canary,
47004            2 => Self::Stable,
47005            3 => Self::Week5,
47006            _ => Self::UnknownValue(sql_update_track::UnknownValue(
47007                wkt::internal::UnknownEnumValue::Integer(value),
47008            )),
47009        }
47010    }
47011}
47012
47013impl std::convert::From<&str> for SqlUpdateTrack {
47014    fn from(value: &str) -> Self {
47015        use std::string::ToString;
47016        match value {
47017            "SQL_UPDATE_TRACK_UNSPECIFIED" => Self::Unspecified,
47018            "canary" => Self::Canary,
47019            "stable" => Self::Stable,
47020            "week5" => Self::Week5,
47021            _ => Self::UnknownValue(sql_update_track::UnknownValue(
47022                wkt::internal::UnknownEnumValue::String(value.to_string()),
47023            )),
47024        }
47025    }
47026}
47027
47028impl serde::ser::Serialize for SqlUpdateTrack {
47029    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
47030    where
47031        S: serde::Serializer,
47032    {
47033        match self {
47034            Self::Unspecified => serializer.serialize_i32(0),
47035            Self::Canary => serializer.serialize_i32(1),
47036            Self::Stable => serializer.serialize_i32(2),
47037            Self::Week5 => serializer.serialize_i32(3),
47038            Self::UnknownValue(u) => u.0.serialize(serializer),
47039        }
47040    }
47041}
47042
47043impl<'de> serde::de::Deserialize<'de> for SqlUpdateTrack {
47044    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
47045    where
47046        D: serde::Deserializer<'de>,
47047    {
47048        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SqlUpdateTrack>::new(
47049            ".google.cloud.sql.v1.SqlUpdateTrack",
47050        ))
47051    }
47052}