google_cloud_spanner_admin_database_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 iam_v1;
25extern crate lazy_static;
26extern crate longrunning;
27extern crate lro;
28extern crate reqwest;
29extern crate rpc;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37/// A backup of a Cloud Spanner database.
38#[derive(Clone, Default, PartialEq)]
39#[non_exhaustive]
40pub struct Backup {
41    /// Required for the
42    /// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
43    /// operation. Name of the database from which this backup was created. This
44    /// needs to be in the same instance as the backup. Values are of the form
45    /// `projects/<project>/instances/<instance>/databases/<database>`.
46    ///
47    /// [google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]: crate::client::DatabaseAdmin::create_backup
48    pub database: std::string::String,
49
50    /// The backup will contain an externally consistent copy of the database at
51    /// the timestamp specified by `version_time`. If `version_time` is not
52    /// specified, the system will set `version_time` to the `create_time` of the
53    /// backup.
54    pub version_time: std::option::Option<wkt::Timestamp>,
55
56    /// Required for the
57    /// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
58    /// operation. The expiration time of the backup, with microseconds
59    /// granularity that must be at least 6 hours and at most 366 days
60    /// from the time the CreateBackup request is processed. Once the `expire_time`
61    /// has passed, the backup is eligible to be automatically deleted by Cloud
62    /// Spanner to free the resources used by the backup.
63    ///
64    /// [google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]: crate::client::DatabaseAdmin::create_backup
65    pub expire_time: std::option::Option<wkt::Timestamp>,
66
67    /// Output only for the
68    /// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
69    /// operation. Required for the
70    /// [UpdateBackup][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup]
71    /// operation.
72    ///
73    /// A globally unique identifier for the backup which cannot be
74    /// changed. Values are of the form
75    /// `projects/<project>/instances/<instance>/backups/[a-z][a-z0-9_\-]*[a-z0-9]`
76    /// The final segment of the name must be between 2 and 60 characters
77    /// in length.
78    ///
79    /// The backup is stored in the location(s) specified in the instance
80    /// configuration of the instance containing the backup, identified
81    /// by the prefix of the backup name of the form
82    /// `projects/<project>/instances/<instance>`.
83    ///
84    /// [google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]: crate::client::DatabaseAdmin::create_backup
85    /// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup]: crate::client::DatabaseAdmin::update_backup
86    pub name: std::string::String,
87
88    /// Output only. The time the
89    /// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
90    /// request is received. If the request does not specify `version_time`, the
91    /// `version_time` of the backup will be equivalent to the `create_time`.
92    ///
93    /// [google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]: crate::client::DatabaseAdmin::create_backup
94    pub create_time: std::option::Option<wkt::Timestamp>,
95
96    /// Output only. Size of the backup in bytes.
97    pub size_bytes: i64,
98
99    /// Output only. The number of bytes that will be freed by deleting this
100    /// backup. This value will be zero if, for example, this backup is part of an
101    /// incremental backup chain and younger backups in the chain require that we
102    /// keep its data. For backups not in an incremental backup chain, this is
103    /// always the size of the backup. This value may change if backups on the same
104    /// chain get created, deleted or expired.
105    pub freeable_size_bytes: i64,
106
107    /// Output only. For a backup in an incremental backup chain, this is the
108    /// storage space needed to keep the data that has changed since the previous
109    /// backup. For all other backups, this is always the size of the backup. This
110    /// value may change if backups on the same chain get deleted or expired.
111    ///
112    /// This field can be used to calculate the total storage space used by a set
113    /// of backups. For example, the total space used by all backups of a database
114    /// can be computed by summing up this field.
115    pub exclusive_size_bytes: i64,
116
117    /// Output only. The current state of the backup.
118    pub state: crate::model::backup::State,
119
120    /// Output only. The names of the restored databases that reference the backup.
121    /// The database names are of
122    /// the form `projects/<project>/instances/<instance>/databases/<database>`.
123    /// Referencing databases may exist in different instances. The existence of
124    /// any referencing database prevents the backup from being deleted. When a
125    /// restored database from the backup enters the `READY` state, the reference
126    /// to the backup is removed.
127    pub referencing_databases: std::vec::Vec<std::string::String>,
128
129    /// Output only. The encryption information for the backup.
130    pub encryption_info: std::option::Option<crate::model::EncryptionInfo>,
131
132    /// Output only. The encryption information for the backup, whether it is
133    /// protected by one or more KMS keys. The information includes all Cloud
134    /// KMS key versions used to encrypt the backup. The `encryption_status' field
135    /// inside of each `EncryptionInfo` is not populated. At least one of the key
136    /// versions must be available for the backup to be restored. If a key version
137    /// is revoked in the middle of a restore, the restore behavior is undefined.
138    pub encryption_information: std::vec::Vec<crate::model::EncryptionInfo>,
139
140    /// Output only. The database dialect information for the backup.
141    pub database_dialect: crate::model::DatabaseDialect,
142
143    /// Output only. The names of the destination backups being created by copying
144    /// this source backup. The backup names are of the form
145    /// `projects/<project>/instances/<instance>/backups/<backup>`.
146    /// Referencing backups may exist in different instances. The existence of
147    /// any referencing backup prevents the backup from being deleted. When the
148    /// copy operation is done (either successfully completed or cancelled or the
149    /// destination backup is deleted), the reference to the backup is removed.
150    pub referencing_backups: std::vec::Vec<std::string::String>,
151
152    /// Output only. The max allowed expiration time of the backup, with
153    /// microseconds granularity. A backup's expiration time can be configured in
154    /// multiple APIs: CreateBackup, UpdateBackup, CopyBackup. When updating or
155    /// copying an existing backup, the expiration time specified must be
156    /// less than `Backup.max_expire_time`.
157    pub max_expire_time: std::option::Option<wkt::Timestamp>,
158
159    /// Output only. List of backup schedule URIs that are associated with
160    /// creating this backup. This is only applicable for scheduled backups, and
161    /// is empty for on-demand backups.
162    ///
163    /// To optimize for storage, whenever possible, multiple schedules are
164    /// collapsed together to create one backup. In such cases, this field captures
165    /// the list of all backup schedule URIs that are associated with creating
166    /// this backup. If collapsing is not done, then this field captures the
167    /// single backup schedule URI associated with creating this backup.
168    pub backup_schedules: std::vec::Vec<std::string::String>,
169
170    /// Output only. Populated only for backups in an incremental backup chain.
171    /// Backups share the same chain id if and only if they belong to the same
172    /// incremental backup chain. Use this field to determine which backups are
173    /// part of the same incremental backup chain. The ordering of backups in the
174    /// chain can be determined by ordering the backup `version_time`.
175    pub incremental_backup_chain_id: std::string::String,
176
177    /// Output only. Data deleted at a time older than this is guaranteed not to be
178    /// retained in order to support this backup. For a backup in an incremental
179    /// backup chain, this is the version time of the oldest backup that exists or
180    /// ever existed in the chain. For all other backups, this is the version time
181    /// of the backup. This field can be used to understand what data is being
182    /// retained by the backup system.
183    pub oldest_version_time: std::option::Option<wkt::Timestamp>,
184
185    /// Output only. The instance partition(s) storing the backup.
186    ///
187    /// This is the same as the list of the instance partition(s) that the database
188    /// had footprint in at the backup's `version_time`.
189    pub instance_partitions: std::vec::Vec<crate::model::BackupInstancePartition>,
190
191    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
192}
193
194impl Backup {
195    pub fn new() -> Self {
196        std::default::Default::default()
197    }
198
199    /// Sets the value of [database][crate::model::Backup::database].
200    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
201        self.database = v.into();
202        self
203    }
204
205    /// Sets the value of [version_time][crate::model::Backup::version_time].
206    pub fn set_version_time<T>(mut self, v: T) -> Self
207    where
208        T: std::convert::Into<wkt::Timestamp>,
209    {
210        self.version_time = std::option::Option::Some(v.into());
211        self
212    }
213
214    /// Sets or clears the value of [version_time][crate::model::Backup::version_time].
215    pub fn set_or_clear_version_time<T>(mut self, v: std::option::Option<T>) -> Self
216    where
217        T: std::convert::Into<wkt::Timestamp>,
218    {
219        self.version_time = v.map(|x| x.into());
220        self
221    }
222
223    /// Sets the value of [expire_time][crate::model::Backup::expire_time].
224    pub fn set_expire_time<T>(mut self, v: T) -> Self
225    where
226        T: std::convert::Into<wkt::Timestamp>,
227    {
228        self.expire_time = std::option::Option::Some(v.into());
229        self
230    }
231
232    /// Sets or clears the value of [expire_time][crate::model::Backup::expire_time].
233    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
234    where
235        T: std::convert::Into<wkt::Timestamp>,
236    {
237        self.expire_time = v.map(|x| x.into());
238        self
239    }
240
241    /// Sets the value of [name][crate::model::Backup::name].
242    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
243        self.name = v.into();
244        self
245    }
246
247    /// Sets the value of [create_time][crate::model::Backup::create_time].
248    pub fn set_create_time<T>(mut self, v: T) -> Self
249    where
250        T: std::convert::Into<wkt::Timestamp>,
251    {
252        self.create_time = std::option::Option::Some(v.into());
253        self
254    }
255
256    /// Sets or clears the value of [create_time][crate::model::Backup::create_time].
257    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
258    where
259        T: std::convert::Into<wkt::Timestamp>,
260    {
261        self.create_time = v.map(|x| x.into());
262        self
263    }
264
265    /// Sets the value of [size_bytes][crate::model::Backup::size_bytes].
266    pub fn set_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
267        self.size_bytes = v.into();
268        self
269    }
270
271    /// Sets the value of [freeable_size_bytes][crate::model::Backup::freeable_size_bytes].
272    pub fn set_freeable_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
273        self.freeable_size_bytes = v.into();
274        self
275    }
276
277    /// Sets the value of [exclusive_size_bytes][crate::model::Backup::exclusive_size_bytes].
278    pub fn set_exclusive_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
279        self.exclusive_size_bytes = v.into();
280        self
281    }
282
283    /// Sets the value of [state][crate::model::Backup::state].
284    pub fn set_state<T: std::convert::Into<crate::model::backup::State>>(mut self, v: T) -> Self {
285        self.state = v.into();
286        self
287    }
288
289    /// Sets the value of [referencing_databases][crate::model::Backup::referencing_databases].
290    pub fn set_referencing_databases<T, V>(mut self, v: T) -> Self
291    where
292        T: std::iter::IntoIterator<Item = V>,
293        V: std::convert::Into<std::string::String>,
294    {
295        use std::iter::Iterator;
296        self.referencing_databases = v.into_iter().map(|i| i.into()).collect();
297        self
298    }
299
300    /// Sets the value of [encryption_info][crate::model::Backup::encryption_info].
301    pub fn set_encryption_info<T>(mut self, v: T) -> Self
302    where
303        T: std::convert::Into<crate::model::EncryptionInfo>,
304    {
305        self.encryption_info = std::option::Option::Some(v.into());
306        self
307    }
308
309    /// Sets or clears the value of [encryption_info][crate::model::Backup::encryption_info].
310    pub fn set_or_clear_encryption_info<T>(mut self, v: std::option::Option<T>) -> Self
311    where
312        T: std::convert::Into<crate::model::EncryptionInfo>,
313    {
314        self.encryption_info = v.map(|x| x.into());
315        self
316    }
317
318    /// Sets the value of [encryption_information][crate::model::Backup::encryption_information].
319    pub fn set_encryption_information<T, V>(mut self, v: T) -> Self
320    where
321        T: std::iter::IntoIterator<Item = V>,
322        V: std::convert::Into<crate::model::EncryptionInfo>,
323    {
324        use std::iter::Iterator;
325        self.encryption_information = v.into_iter().map(|i| i.into()).collect();
326        self
327    }
328
329    /// Sets the value of [database_dialect][crate::model::Backup::database_dialect].
330    pub fn set_database_dialect<T: std::convert::Into<crate::model::DatabaseDialect>>(
331        mut self,
332        v: T,
333    ) -> Self {
334        self.database_dialect = v.into();
335        self
336    }
337
338    /// Sets the value of [referencing_backups][crate::model::Backup::referencing_backups].
339    pub fn set_referencing_backups<T, V>(mut self, v: T) -> Self
340    where
341        T: std::iter::IntoIterator<Item = V>,
342        V: std::convert::Into<std::string::String>,
343    {
344        use std::iter::Iterator;
345        self.referencing_backups = v.into_iter().map(|i| i.into()).collect();
346        self
347    }
348
349    /// Sets the value of [max_expire_time][crate::model::Backup::max_expire_time].
350    pub fn set_max_expire_time<T>(mut self, v: T) -> Self
351    where
352        T: std::convert::Into<wkt::Timestamp>,
353    {
354        self.max_expire_time = std::option::Option::Some(v.into());
355        self
356    }
357
358    /// Sets or clears the value of [max_expire_time][crate::model::Backup::max_expire_time].
359    pub fn set_or_clear_max_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
360    where
361        T: std::convert::Into<wkt::Timestamp>,
362    {
363        self.max_expire_time = v.map(|x| x.into());
364        self
365    }
366
367    /// Sets the value of [backup_schedules][crate::model::Backup::backup_schedules].
368    pub fn set_backup_schedules<T, V>(mut self, v: T) -> Self
369    where
370        T: std::iter::IntoIterator<Item = V>,
371        V: std::convert::Into<std::string::String>,
372    {
373        use std::iter::Iterator;
374        self.backup_schedules = v.into_iter().map(|i| i.into()).collect();
375        self
376    }
377
378    /// Sets the value of [incremental_backup_chain_id][crate::model::Backup::incremental_backup_chain_id].
379    pub fn set_incremental_backup_chain_id<T: std::convert::Into<std::string::String>>(
380        mut self,
381        v: T,
382    ) -> Self {
383        self.incremental_backup_chain_id = v.into();
384        self
385    }
386
387    /// Sets the value of [oldest_version_time][crate::model::Backup::oldest_version_time].
388    pub fn set_oldest_version_time<T>(mut self, v: T) -> Self
389    where
390        T: std::convert::Into<wkt::Timestamp>,
391    {
392        self.oldest_version_time = std::option::Option::Some(v.into());
393        self
394    }
395
396    /// Sets or clears the value of [oldest_version_time][crate::model::Backup::oldest_version_time].
397    pub fn set_or_clear_oldest_version_time<T>(mut self, v: std::option::Option<T>) -> Self
398    where
399        T: std::convert::Into<wkt::Timestamp>,
400    {
401        self.oldest_version_time = v.map(|x| x.into());
402        self
403    }
404
405    /// Sets the value of [instance_partitions][crate::model::Backup::instance_partitions].
406    pub fn set_instance_partitions<T, V>(mut self, v: T) -> Self
407    where
408        T: std::iter::IntoIterator<Item = V>,
409        V: std::convert::Into<crate::model::BackupInstancePartition>,
410    {
411        use std::iter::Iterator;
412        self.instance_partitions = v.into_iter().map(|i| i.into()).collect();
413        self
414    }
415}
416
417impl wkt::message::Message for Backup {
418    fn typename() -> &'static str {
419        "type.googleapis.com/google.spanner.admin.database.v1.Backup"
420    }
421}
422
423#[doc(hidden)]
424impl<'de> serde::de::Deserialize<'de> for Backup {
425    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
426    where
427        D: serde::Deserializer<'de>,
428    {
429        #[allow(non_camel_case_types)]
430        #[doc(hidden)]
431        #[derive(PartialEq, Eq, Hash)]
432        enum __FieldTag {
433            __database,
434            __version_time,
435            __expire_time,
436            __name,
437            __create_time,
438            __size_bytes,
439            __freeable_size_bytes,
440            __exclusive_size_bytes,
441            __state,
442            __referencing_databases,
443            __encryption_info,
444            __encryption_information,
445            __database_dialect,
446            __referencing_backups,
447            __max_expire_time,
448            __backup_schedules,
449            __incremental_backup_chain_id,
450            __oldest_version_time,
451            __instance_partitions,
452            Unknown(std::string::String),
453        }
454        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
455            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
456            where
457                D: serde::Deserializer<'de>,
458            {
459                struct Visitor;
460                impl<'de> serde::de::Visitor<'de> for Visitor {
461                    type Value = __FieldTag;
462                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
463                        formatter.write_str("a field name for Backup")
464                    }
465                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
466                    where
467                        E: serde::de::Error,
468                    {
469                        use std::result::Result::Ok;
470                        use std::string::ToString;
471                        match value {
472                            "database" => Ok(__FieldTag::__database),
473                            "versionTime" => Ok(__FieldTag::__version_time),
474                            "version_time" => Ok(__FieldTag::__version_time),
475                            "expireTime" => Ok(__FieldTag::__expire_time),
476                            "expire_time" => Ok(__FieldTag::__expire_time),
477                            "name" => Ok(__FieldTag::__name),
478                            "createTime" => Ok(__FieldTag::__create_time),
479                            "create_time" => Ok(__FieldTag::__create_time),
480                            "sizeBytes" => Ok(__FieldTag::__size_bytes),
481                            "size_bytes" => Ok(__FieldTag::__size_bytes),
482                            "freeableSizeBytes" => Ok(__FieldTag::__freeable_size_bytes),
483                            "freeable_size_bytes" => Ok(__FieldTag::__freeable_size_bytes),
484                            "exclusiveSizeBytes" => Ok(__FieldTag::__exclusive_size_bytes),
485                            "exclusive_size_bytes" => Ok(__FieldTag::__exclusive_size_bytes),
486                            "state" => Ok(__FieldTag::__state),
487                            "referencingDatabases" => Ok(__FieldTag::__referencing_databases),
488                            "referencing_databases" => Ok(__FieldTag::__referencing_databases),
489                            "encryptionInfo" => Ok(__FieldTag::__encryption_info),
490                            "encryption_info" => Ok(__FieldTag::__encryption_info),
491                            "encryptionInformation" => Ok(__FieldTag::__encryption_information),
492                            "encryption_information" => Ok(__FieldTag::__encryption_information),
493                            "databaseDialect" => Ok(__FieldTag::__database_dialect),
494                            "database_dialect" => Ok(__FieldTag::__database_dialect),
495                            "referencingBackups" => Ok(__FieldTag::__referencing_backups),
496                            "referencing_backups" => Ok(__FieldTag::__referencing_backups),
497                            "maxExpireTime" => Ok(__FieldTag::__max_expire_time),
498                            "max_expire_time" => Ok(__FieldTag::__max_expire_time),
499                            "backupSchedules" => Ok(__FieldTag::__backup_schedules),
500                            "backup_schedules" => Ok(__FieldTag::__backup_schedules),
501                            "incrementalBackupChainId" => {
502                                Ok(__FieldTag::__incremental_backup_chain_id)
503                            }
504                            "incremental_backup_chain_id" => {
505                                Ok(__FieldTag::__incremental_backup_chain_id)
506                            }
507                            "oldestVersionTime" => Ok(__FieldTag::__oldest_version_time),
508                            "oldest_version_time" => Ok(__FieldTag::__oldest_version_time),
509                            "instancePartitions" => Ok(__FieldTag::__instance_partitions),
510                            "instance_partitions" => Ok(__FieldTag::__instance_partitions),
511                            _ => Ok(__FieldTag::Unknown(value.to_string())),
512                        }
513                    }
514                }
515                deserializer.deserialize_identifier(Visitor)
516            }
517        }
518        struct Visitor;
519        impl<'de> serde::de::Visitor<'de> for Visitor {
520            type Value = Backup;
521            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
522                formatter.write_str("struct Backup")
523            }
524            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
525            where
526                A: serde::de::MapAccess<'de>,
527            {
528                #[allow(unused_imports)]
529                use serde::de::Error;
530                use std::option::Option::Some;
531                let mut fields = std::collections::HashSet::new();
532                let mut result = Self::Value::new();
533                while let Some(tag) = map.next_key::<__FieldTag>()? {
534                    #[allow(clippy::match_single_binding)]
535                    match tag {
536                        __FieldTag::__database => {
537                            if !fields.insert(__FieldTag::__database) {
538                                return std::result::Result::Err(A::Error::duplicate_field(
539                                    "multiple values for database",
540                                ));
541                            }
542                            result.database = map
543                                .next_value::<std::option::Option<std::string::String>>()?
544                                .unwrap_or_default();
545                        }
546                        __FieldTag::__version_time => {
547                            if !fields.insert(__FieldTag::__version_time) {
548                                return std::result::Result::Err(A::Error::duplicate_field(
549                                    "multiple values for version_time",
550                                ));
551                            }
552                            result.version_time =
553                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
554                        }
555                        __FieldTag::__expire_time => {
556                            if !fields.insert(__FieldTag::__expire_time) {
557                                return std::result::Result::Err(A::Error::duplicate_field(
558                                    "multiple values for expire_time",
559                                ));
560                            }
561                            result.expire_time =
562                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
563                        }
564                        __FieldTag::__name => {
565                            if !fields.insert(__FieldTag::__name) {
566                                return std::result::Result::Err(A::Error::duplicate_field(
567                                    "multiple values for name",
568                                ));
569                            }
570                            result.name = map
571                                .next_value::<std::option::Option<std::string::String>>()?
572                                .unwrap_or_default();
573                        }
574                        __FieldTag::__create_time => {
575                            if !fields.insert(__FieldTag::__create_time) {
576                                return std::result::Result::Err(A::Error::duplicate_field(
577                                    "multiple values for create_time",
578                                ));
579                            }
580                            result.create_time =
581                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
582                        }
583                        __FieldTag::__size_bytes => {
584                            if !fields.insert(__FieldTag::__size_bytes) {
585                                return std::result::Result::Err(A::Error::duplicate_field(
586                                    "multiple values for size_bytes",
587                                ));
588                            }
589                            struct __With(std::option::Option<i64>);
590                            impl<'de> serde::de::Deserialize<'de> for __With {
591                                fn deserialize<D>(
592                                    deserializer: D,
593                                ) -> std::result::Result<Self, D::Error>
594                                where
595                                    D: serde::de::Deserializer<'de>,
596                                {
597                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
598                                }
599                            }
600                            result.size_bytes = map.next_value::<__With>()?.0.unwrap_or_default();
601                        }
602                        __FieldTag::__freeable_size_bytes => {
603                            if !fields.insert(__FieldTag::__freeable_size_bytes) {
604                                return std::result::Result::Err(A::Error::duplicate_field(
605                                    "multiple values for freeable_size_bytes",
606                                ));
607                            }
608                            struct __With(std::option::Option<i64>);
609                            impl<'de> serde::de::Deserialize<'de> for __With {
610                                fn deserialize<D>(
611                                    deserializer: D,
612                                ) -> std::result::Result<Self, D::Error>
613                                where
614                                    D: serde::de::Deserializer<'de>,
615                                {
616                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
617                                }
618                            }
619                            result.freeable_size_bytes =
620                                map.next_value::<__With>()?.0.unwrap_or_default();
621                        }
622                        __FieldTag::__exclusive_size_bytes => {
623                            if !fields.insert(__FieldTag::__exclusive_size_bytes) {
624                                return std::result::Result::Err(A::Error::duplicate_field(
625                                    "multiple values for exclusive_size_bytes",
626                                ));
627                            }
628                            struct __With(std::option::Option<i64>);
629                            impl<'de> serde::de::Deserialize<'de> for __With {
630                                fn deserialize<D>(
631                                    deserializer: D,
632                                ) -> std::result::Result<Self, D::Error>
633                                where
634                                    D: serde::de::Deserializer<'de>,
635                                {
636                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
637                                }
638                            }
639                            result.exclusive_size_bytes =
640                                map.next_value::<__With>()?.0.unwrap_or_default();
641                        }
642                        __FieldTag::__state => {
643                            if !fields.insert(__FieldTag::__state) {
644                                return std::result::Result::Err(A::Error::duplicate_field(
645                                    "multiple values for state",
646                                ));
647                            }
648                            result.state = map
649                                .next_value::<std::option::Option<crate::model::backup::State>>()?
650                                .unwrap_or_default();
651                        }
652                        __FieldTag::__referencing_databases => {
653                            if !fields.insert(__FieldTag::__referencing_databases) {
654                                return std::result::Result::Err(A::Error::duplicate_field(
655                                    "multiple values for referencing_databases",
656                                ));
657                            }
658                            result.referencing_databases = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
659                        }
660                        __FieldTag::__encryption_info => {
661                            if !fields.insert(__FieldTag::__encryption_info) {
662                                return std::result::Result::Err(A::Error::duplicate_field(
663                                    "multiple values for encryption_info",
664                                ));
665                            }
666                            result.encryption_info = map
667                                .next_value::<std::option::Option<crate::model::EncryptionInfo>>(
668                                )?;
669                        }
670                        __FieldTag::__encryption_information => {
671                            if !fields.insert(__FieldTag::__encryption_information) {
672                                return std::result::Result::Err(A::Error::duplicate_field(
673                                    "multiple values for encryption_information",
674                                ));
675                            }
676                            result.encryption_information =
677                                map.next_value::<std::option::Option<
678                                    std::vec::Vec<crate::model::EncryptionInfo>,
679                                >>()?
680                                .unwrap_or_default();
681                        }
682                        __FieldTag::__database_dialect => {
683                            if !fields.insert(__FieldTag::__database_dialect) {
684                                return std::result::Result::Err(A::Error::duplicate_field(
685                                    "multiple values for database_dialect",
686                                ));
687                            }
688                            result.database_dialect = map
689                                .next_value::<std::option::Option<crate::model::DatabaseDialect>>()?
690                                .unwrap_or_default();
691                        }
692                        __FieldTag::__referencing_backups => {
693                            if !fields.insert(__FieldTag::__referencing_backups) {
694                                return std::result::Result::Err(A::Error::duplicate_field(
695                                    "multiple values for referencing_backups",
696                                ));
697                            }
698                            result.referencing_backups = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
699                        }
700                        __FieldTag::__max_expire_time => {
701                            if !fields.insert(__FieldTag::__max_expire_time) {
702                                return std::result::Result::Err(A::Error::duplicate_field(
703                                    "multiple values for max_expire_time",
704                                ));
705                            }
706                            result.max_expire_time =
707                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
708                        }
709                        __FieldTag::__backup_schedules => {
710                            if !fields.insert(__FieldTag::__backup_schedules) {
711                                return std::result::Result::Err(A::Error::duplicate_field(
712                                    "multiple values for backup_schedules",
713                                ));
714                            }
715                            result.backup_schedules = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
716                        }
717                        __FieldTag::__incremental_backup_chain_id => {
718                            if !fields.insert(__FieldTag::__incremental_backup_chain_id) {
719                                return std::result::Result::Err(A::Error::duplicate_field(
720                                    "multiple values for incremental_backup_chain_id",
721                                ));
722                            }
723                            result.incremental_backup_chain_id = map
724                                .next_value::<std::option::Option<std::string::String>>()?
725                                .unwrap_or_default();
726                        }
727                        __FieldTag::__oldest_version_time => {
728                            if !fields.insert(__FieldTag::__oldest_version_time) {
729                                return std::result::Result::Err(A::Error::duplicate_field(
730                                    "multiple values for oldest_version_time",
731                                ));
732                            }
733                            result.oldest_version_time =
734                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
735                        }
736                        __FieldTag::__instance_partitions => {
737                            if !fields.insert(__FieldTag::__instance_partitions) {
738                                return std::result::Result::Err(A::Error::duplicate_field(
739                                    "multiple values for instance_partitions",
740                                ));
741                            }
742                            result.instance_partitions = map
743                                .next_value::<std::option::Option<
744                                    std::vec::Vec<crate::model::BackupInstancePartition>,
745                                >>()?
746                                .unwrap_or_default();
747                        }
748                        __FieldTag::Unknown(key) => {
749                            let value = map.next_value::<serde_json::Value>()?;
750                            result._unknown_fields.insert(key, value);
751                        }
752                    }
753                }
754                std::result::Result::Ok(result)
755            }
756        }
757        deserializer.deserialize_any(Visitor)
758    }
759}
760
761#[doc(hidden)]
762impl serde::ser::Serialize for Backup {
763    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
764    where
765        S: serde::ser::Serializer,
766    {
767        use serde::ser::SerializeMap;
768        #[allow(unused_imports)]
769        use std::option::Option::Some;
770        let mut state = serializer.serialize_map(std::option::Option::None)?;
771        if !self.database.is_empty() {
772            state.serialize_entry("database", &self.database)?;
773        }
774        if self.version_time.is_some() {
775            state.serialize_entry("versionTime", &self.version_time)?;
776        }
777        if self.expire_time.is_some() {
778            state.serialize_entry("expireTime", &self.expire_time)?;
779        }
780        if !self.name.is_empty() {
781            state.serialize_entry("name", &self.name)?;
782        }
783        if self.create_time.is_some() {
784            state.serialize_entry("createTime", &self.create_time)?;
785        }
786        if !wkt::internal::is_default(&self.size_bytes) {
787            struct __With<'a>(&'a i64);
788            impl<'a> serde::ser::Serialize for __With<'a> {
789                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
790                where
791                    S: serde::ser::Serializer,
792                {
793                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
794                }
795            }
796            state.serialize_entry("sizeBytes", &__With(&self.size_bytes))?;
797        }
798        if !wkt::internal::is_default(&self.freeable_size_bytes) {
799            struct __With<'a>(&'a i64);
800            impl<'a> serde::ser::Serialize for __With<'a> {
801                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
802                where
803                    S: serde::ser::Serializer,
804                {
805                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
806                }
807            }
808            state.serialize_entry("freeableSizeBytes", &__With(&self.freeable_size_bytes))?;
809        }
810        if !wkt::internal::is_default(&self.exclusive_size_bytes) {
811            struct __With<'a>(&'a i64);
812            impl<'a> serde::ser::Serialize for __With<'a> {
813                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
814                where
815                    S: serde::ser::Serializer,
816                {
817                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
818                }
819            }
820            state.serialize_entry("exclusiveSizeBytes", &__With(&self.exclusive_size_bytes))?;
821        }
822        if !wkt::internal::is_default(&self.state) {
823            state.serialize_entry("state", &self.state)?;
824        }
825        if !self.referencing_databases.is_empty() {
826            state.serialize_entry("referencingDatabases", &self.referencing_databases)?;
827        }
828        if self.encryption_info.is_some() {
829            state.serialize_entry("encryptionInfo", &self.encryption_info)?;
830        }
831        if !self.encryption_information.is_empty() {
832            state.serialize_entry("encryptionInformation", &self.encryption_information)?;
833        }
834        if !wkt::internal::is_default(&self.database_dialect) {
835            state.serialize_entry("databaseDialect", &self.database_dialect)?;
836        }
837        if !self.referencing_backups.is_empty() {
838            state.serialize_entry("referencingBackups", &self.referencing_backups)?;
839        }
840        if self.max_expire_time.is_some() {
841            state.serialize_entry("maxExpireTime", &self.max_expire_time)?;
842        }
843        if !self.backup_schedules.is_empty() {
844            state.serialize_entry("backupSchedules", &self.backup_schedules)?;
845        }
846        if !self.incremental_backup_chain_id.is_empty() {
847            state.serialize_entry(
848                "incrementalBackupChainId",
849                &self.incremental_backup_chain_id,
850            )?;
851        }
852        if self.oldest_version_time.is_some() {
853            state.serialize_entry("oldestVersionTime", &self.oldest_version_time)?;
854        }
855        if !self.instance_partitions.is_empty() {
856            state.serialize_entry("instancePartitions", &self.instance_partitions)?;
857        }
858        if !self._unknown_fields.is_empty() {
859            for (key, value) in self._unknown_fields.iter() {
860                state.serialize_entry(key, &value)?;
861            }
862        }
863        state.end()
864    }
865}
866
867impl std::fmt::Debug for Backup {
868    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
869        let mut debug_struct = f.debug_struct("Backup");
870        debug_struct.field("database", &self.database);
871        debug_struct.field("version_time", &self.version_time);
872        debug_struct.field("expire_time", &self.expire_time);
873        debug_struct.field("name", &self.name);
874        debug_struct.field("create_time", &self.create_time);
875        debug_struct.field("size_bytes", &self.size_bytes);
876        debug_struct.field("freeable_size_bytes", &self.freeable_size_bytes);
877        debug_struct.field("exclusive_size_bytes", &self.exclusive_size_bytes);
878        debug_struct.field("state", &self.state);
879        debug_struct.field("referencing_databases", &self.referencing_databases);
880        debug_struct.field("encryption_info", &self.encryption_info);
881        debug_struct.field("encryption_information", &self.encryption_information);
882        debug_struct.field("database_dialect", &self.database_dialect);
883        debug_struct.field("referencing_backups", &self.referencing_backups);
884        debug_struct.field("max_expire_time", &self.max_expire_time);
885        debug_struct.field("backup_schedules", &self.backup_schedules);
886        debug_struct.field(
887            "incremental_backup_chain_id",
888            &self.incremental_backup_chain_id,
889        );
890        debug_struct.field("oldest_version_time", &self.oldest_version_time);
891        debug_struct.field("instance_partitions", &self.instance_partitions);
892        if !self._unknown_fields.is_empty() {
893            debug_struct.field("_unknown_fields", &self._unknown_fields);
894        }
895        debug_struct.finish()
896    }
897}
898
899/// Defines additional types related to [Backup].
900pub mod backup {
901    #[allow(unused_imports)]
902    use super::*;
903
904    /// Indicates the current state of the backup.
905    ///
906    /// # Working with unknown values
907    ///
908    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
909    /// additional enum variants at any time. Adding new variants is not considered
910    /// a breaking change. Applications should write their code in anticipation of:
911    ///
912    /// - New values appearing in future releases of the client library, **and**
913    /// - New values received dynamically, without application changes.
914    ///
915    /// Please consult the [Working with enums] section in the user guide for some
916    /// guidelines.
917    ///
918    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
919    #[derive(Clone, Debug, PartialEq)]
920    #[non_exhaustive]
921    pub enum State {
922        /// Not specified.
923        Unspecified,
924        /// The pending backup is still being created. Operations on the
925        /// backup may fail with `FAILED_PRECONDITION` in this state.
926        Creating,
927        /// The backup is complete and ready for use.
928        Ready,
929        /// If set, the enum was initialized with an unknown value.
930        ///
931        /// Applications can examine the value using [State::value] or
932        /// [State::name].
933        UnknownValue(state::UnknownValue),
934    }
935
936    #[doc(hidden)]
937    pub mod state {
938        #[allow(unused_imports)]
939        use super::*;
940        #[derive(Clone, Debug, PartialEq)]
941        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
942    }
943
944    impl State {
945        /// Gets the enum value.
946        ///
947        /// Returns `None` if the enum contains an unknown value deserialized from
948        /// the string representation of enums.
949        pub fn value(&self) -> std::option::Option<i32> {
950            match self {
951                Self::Unspecified => std::option::Option::Some(0),
952                Self::Creating => std::option::Option::Some(1),
953                Self::Ready => std::option::Option::Some(2),
954                Self::UnknownValue(u) => u.0.value(),
955            }
956        }
957
958        /// Gets the enum value as a string.
959        ///
960        /// Returns `None` if the enum contains an unknown value deserialized from
961        /// the integer representation of enums.
962        pub fn name(&self) -> std::option::Option<&str> {
963            match self {
964                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
965                Self::Creating => std::option::Option::Some("CREATING"),
966                Self::Ready => std::option::Option::Some("READY"),
967                Self::UnknownValue(u) => u.0.name(),
968            }
969        }
970    }
971
972    impl std::default::Default for State {
973        fn default() -> Self {
974            use std::convert::From;
975            Self::from(0)
976        }
977    }
978
979    impl std::fmt::Display for State {
980        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
981            wkt::internal::display_enum(f, self.name(), self.value())
982        }
983    }
984
985    impl std::convert::From<i32> for State {
986        fn from(value: i32) -> Self {
987            match value {
988                0 => Self::Unspecified,
989                1 => Self::Creating,
990                2 => Self::Ready,
991                _ => Self::UnknownValue(state::UnknownValue(
992                    wkt::internal::UnknownEnumValue::Integer(value),
993                )),
994            }
995        }
996    }
997
998    impl std::convert::From<&str> for State {
999        fn from(value: &str) -> Self {
1000            use std::string::ToString;
1001            match value {
1002                "STATE_UNSPECIFIED" => Self::Unspecified,
1003                "CREATING" => Self::Creating,
1004                "READY" => Self::Ready,
1005                _ => Self::UnknownValue(state::UnknownValue(
1006                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1007                )),
1008            }
1009        }
1010    }
1011
1012    impl serde::ser::Serialize for State {
1013        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1014        where
1015            S: serde::Serializer,
1016        {
1017            match self {
1018                Self::Unspecified => serializer.serialize_i32(0),
1019                Self::Creating => serializer.serialize_i32(1),
1020                Self::Ready => serializer.serialize_i32(2),
1021                Self::UnknownValue(u) => u.0.serialize(serializer),
1022            }
1023        }
1024    }
1025
1026    impl<'de> serde::de::Deserialize<'de> for State {
1027        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1028        where
1029            D: serde::Deserializer<'de>,
1030        {
1031            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1032                ".google.spanner.admin.database.v1.Backup.State",
1033            ))
1034        }
1035    }
1036}
1037
1038/// The request for
1039/// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup].
1040///
1041/// [google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]: crate::client::DatabaseAdmin::create_backup
1042#[derive(Clone, Default, PartialEq)]
1043#[non_exhaustive]
1044pub struct CreateBackupRequest {
1045    /// Required. The name of the instance in which the backup will be
1046    /// created. This must be the same instance that contains the database the
1047    /// backup will be created from. The backup will be stored in the
1048    /// location(s) specified in the instance configuration of this
1049    /// instance. Values are of the form
1050    /// `projects/<project>/instances/<instance>`.
1051    pub parent: std::string::String,
1052
1053    /// Required. The id of the backup to be created. The `backup_id` appended to
1054    /// `parent` forms the full backup name of the form
1055    /// `projects/<project>/instances/<instance>/backups/<backup_id>`.
1056    pub backup_id: std::string::String,
1057
1058    /// Required. The backup to create.
1059    pub backup: std::option::Option<crate::model::Backup>,
1060
1061    /// Optional. The encryption configuration used to encrypt the backup. If this
1062    /// field is not specified, the backup will use the same encryption
1063    /// configuration as the database by default, namely
1064    /// [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type]
1065    /// = `USE_DATABASE_ENCRYPTION`.
1066    ///
1067    /// [google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type]: crate::model::CreateBackupEncryptionConfig::encryption_type
1068    pub encryption_config: std::option::Option<crate::model::CreateBackupEncryptionConfig>,
1069
1070    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1071}
1072
1073impl CreateBackupRequest {
1074    pub fn new() -> Self {
1075        std::default::Default::default()
1076    }
1077
1078    /// Sets the value of [parent][crate::model::CreateBackupRequest::parent].
1079    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1080        self.parent = v.into();
1081        self
1082    }
1083
1084    /// Sets the value of [backup_id][crate::model::CreateBackupRequest::backup_id].
1085    pub fn set_backup_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1086        self.backup_id = v.into();
1087        self
1088    }
1089
1090    /// Sets the value of [backup][crate::model::CreateBackupRequest::backup].
1091    pub fn set_backup<T>(mut self, v: T) -> Self
1092    where
1093        T: std::convert::Into<crate::model::Backup>,
1094    {
1095        self.backup = std::option::Option::Some(v.into());
1096        self
1097    }
1098
1099    /// Sets or clears the value of [backup][crate::model::CreateBackupRequest::backup].
1100    pub fn set_or_clear_backup<T>(mut self, v: std::option::Option<T>) -> Self
1101    where
1102        T: std::convert::Into<crate::model::Backup>,
1103    {
1104        self.backup = v.map(|x| x.into());
1105        self
1106    }
1107
1108    /// Sets the value of [encryption_config][crate::model::CreateBackupRequest::encryption_config].
1109    pub fn set_encryption_config<T>(mut self, v: T) -> Self
1110    where
1111        T: std::convert::Into<crate::model::CreateBackupEncryptionConfig>,
1112    {
1113        self.encryption_config = std::option::Option::Some(v.into());
1114        self
1115    }
1116
1117    /// Sets or clears the value of [encryption_config][crate::model::CreateBackupRequest::encryption_config].
1118    pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
1119    where
1120        T: std::convert::Into<crate::model::CreateBackupEncryptionConfig>,
1121    {
1122        self.encryption_config = v.map(|x| x.into());
1123        self
1124    }
1125}
1126
1127impl wkt::message::Message for CreateBackupRequest {
1128    fn typename() -> &'static str {
1129        "type.googleapis.com/google.spanner.admin.database.v1.CreateBackupRequest"
1130    }
1131}
1132
1133#[doc(hidden)]
1134impl<'de> serde::de::Deserialize<'de> for CreateBackupRequest {
1135    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1136    where
1137        D: serde::Deserializer<'de>,
1138    {
1139        #[allow(non_camel_case_types)]
1140        #[doc(hidden)]
1141        #[derive(PartialEq, Eq, Hash)]
1142        enum __FieldTag {
1143            __parent,
1144            __backup_id,
1145            __backup,
1146            __encryption_config,
1147            Unknown(std::string::String),
1148        }
1149        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1150            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1151            where
1152                D: serde::Deserializer<'de>,
1153            {
1154                struct Visitor;
1155                impl<'de> serde::de::Visitor<'de> for Visitor {
1156                    type Value = __FieldTag;
1157                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1158                        formatter.write_str("a field name for CreateBackupRequest")
1159                    }
1160                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1161                    where
1162                        E: serde::de::Error,
1163                    {
1164                        use std::result::Result::Ok;
1165                        use std::string::ToString;
1166                        match value {
1167                            "parent" => Ok(__FieldTag::__parent),
1168                            "backupId" => Ok(__FieldTag::__backup_id),
1169                            "backup_id" => Ok(__FieldTag::__backup_id),
1170                            "backup" => Ok(__FieldTag::__backup),
1171                            "encryptionConfig" => Ok(__FieldTag::__encryption_config),
1172                            "encryption_config" => Ok(__FieldTag::__encryption_config),
1173                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1174                        }
1175                    }
1176                }
1177                deserializer.deserialize_identifier(Visitor)
1178            }
1179        }
1180        struct Visitor;
1181        impl<'de> serde::de::Visitor<'de> for Visitor {
1182            type Value = CreateBackupRequest;
1183            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1184                formatter.write_str("struct CreateBackupRequest")
1185            }
1186            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1187            where
1188                A: serde::de::MapAccess<'de>,
1189            {
1190                #[allow(unused_imports)]
1191                use serde::de::Error;
1192                use std::option::Option::Some;
1193                let mut fields = std::collections::HashSet::new();
1194                let mut result = Self::Value::new();
1195                while let Some(tag) = map.next_key::<__FieldTag>()? {
1196                    #[allow(clippy::match_single_binding)]
1197                    match tag {
1198                        __FieldTag::__parent => {
1199                            if !fields.insert(__FieldTag::__parent) {
1200                                return std::result::Result::Err(A::Error::duplicate_field(
1201                                    "multiple values for parent",
1202                                ));
1203                            }
1204                            result.parent = map
1205                                .next_value::<std::option::Option<std::string::String>>()?
1206                                .unwrap_or_default();
1207                        }
1208                        __FieldTag::__backup_id => {
1209                            if !fields.insert(__FieldTag::__backup_id) {
1210                                return std::result::Result::Err(A::Error::duplicate_field(
1211                                    "multiple values for backup_id",
1212                                ));
1213                            }
1214                            result.backup_id = map
1215                                .next_value::<std::option::Option<std::string::String>>()?
1216                                .unwrap_or_default();
1217                        }
1218                        __FieldTag::__backup => {
1219                            if !fields.insert(__FieldTag::__backup) {
1220                                return std::result::Result::Err(A::Error::duplicate_field(
1221                                    "multiple values for backup",
1222                                ));
1223                            }
1224                            result.backup =
1225                                map.next_value::<std::option::Option<crate::model::Backup>>()?;
1226                        }
1227                        __FieldTag::__encryption_config => {
1228                            if !fields.insert(__FieldTag::__encryption_config) {
1229                                return std::result::Result::Err(A::Error::duplicate_field(
1230                                    "multiple values for encryption_config",
1231                                ));
1232                            }
1233                            result.encryption_config = map.next_value::<std::option::Option<crate::model::CreateBackupEncryptionConfig>>()?
1234                                ;
1235                        }
1236                        __FieldTag::Unknown(key) => {
1237                            let value = map.next_value::<serde_json::Value>()?;
1238                            result._unknown_fields.insert(key, value);
1239                        }
1240                    }
1241                }
1242                std::result::Result::Ok(result)
1243            }
1244        }
1245        deserializer.deserialize_any(Visitor)
1246    }
1247}
1248
1249#[doc(hidden)]
1250impl serde::ser::Serialize for CreateBackupRequest {
1251    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1252    where
1253        S: serde::ser::Serializer,
1254    {
1255        use serde::ser::SerializeMap;
1256        #[allow(unused_imports)]
1257        use std::option::Option::Some;
1258        let mut state = serializer.serialize_map(std::option::Option::None)?;
1259        if !self.parent.is_empty() {
1260            state.serialize_entry("parent", &self.parent)?;
1261        }
1262        if !self.backup_id.is_empty() {
1263            state.serialize_entry("backupId", &self.backup_id)?;
1264        }
1265        if self.backup.is_some() {
1266            state.serialize_entry("backup", &self.backup)?;
1267        }
1268        if self.encryption_config.is_some() {
1269            state.serialize_entry("encryptionConfig", &self.encryption_config)?;
1270        }
1271        if !self._unknown_fields.is_empty() {
1272            for (key, value) in self._unknown_fields.iter() {
1273                state.serialize_entry(key, &value)?;
1274            }
1275        }
1276        state.end()
1277    }
1278}
1279
1280impl std::fmt::Debug for CreateBackupRequest {
1281    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1282        let mut debug_struct = f.debug_struct("CreateBackupRequest");
1283        debug_struct.field("parent", &self.parent);
1284        debug_struct.field("backup_id", &self.backup_id);
1285        debug_struct.field("backup", &self.backup);
1286        debug_struct.field("encryption_config", &self.encryption_config);
1287        if !self._unknown_fields.is_empty() {
1288            debug_struct.field("_unknown_fields", &self._unknown_fields);
1289        }
1290        debug_struct.finish()
1291    }
1292}
1293
1294/// Metadata type for the operation returned by
1295/// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup].
1296///
1297/// [google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]: crate::client::DatabaseAdmin::create_backup
1298#[derive(Clone, Default, PartialEq)]
1299#[non_exhaustive]
1300pub struct CreateBackupMetadata {
1301    /// The name of the backup being created.
1302    pub name: std::string::String,
1303
1304    /// The name of the database the backup is created from.
1305    pub database: std::string::String,
1306
1307    /// The progress of the
1308    /// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
1309    /// operation.
1310    ///
1311    /// [google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]: crate::client::DatabaseAdmin::create_backup
1312    pub progress: std::option::Option<crate::model::OperationProgress>,
1313
1314    /// The time at which cancellation of this operation was received.
1315    /// [Operations.CancelOperation][google.longrunning.Operations.CancelOperation]
1316    /// starts asynchronous cancellation on a long-running operation. The server
1317    /// makes a best effort to cancel the operation, but success is not guaranteed.
1318    /// Clients can use
1319    /// [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
1320    /// other methods to check whether the cancellation succeeded or whether the
1321    /// operation completed despite cancellation. On successful cancellation,
1322    /// the operation is not deleted; instead, it becomes an operation with
1323    /// an [Operation.error][google.longrunning.Operation.error] value with a
1324    /// [google.rpc.Status.code][google.rpc.Status.code] of 1,
1325    /// corresponding to `Code.CANCELLED`.
1326    ///
1327    /// [google.longrunning.Operation.error]: longrunning::model::Operation::result
1328    /// [google.rpc.Status.code]: rpc::model::Status::code
1329    pub cancel_time: std::option::Option<wkt::Timestamp>,
1330
1331    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1332}
1333
1334impl CreateBackupMetadata {
1335    pub fn new() -> Self {
1336        std::default::Default::default()
1337    }
1338
1339    /// Sets the value of [name][crate::model::CreateBackupMetadata::name].
1340    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1341        self.name = v.into();
1342        self
1343    }
1344
1345    /// Sets the value of [database][crate::model::CreateBackupMetadata::database].
1346    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1347        self.database = v.into();
1348        self
1349    }
1350
1351    /// Sets the value of [progress][crate::model::CreateBackupMetadata::progress].
1352    pub fn set_progress<T>(mut self, v: T) -> Self
1353    where
1354        T: std::convert::Into<crate::model::OperationProgress>,
1355    {
1356        self.progress = std::option::Option::Some(v.into());
1357        self
1358    }
1359
1360    /// Sets or clears the value of [progress][crate::model::CreateBackupMetadata::progress].
1361    pub fn set_or_clear_progress<T>(mut self, v: std::option::Option<T>) -> Self
1362    where
1363        T: std::convert::Into<crate::model::OperationProgress>,
1364    {
1365        self.progress = v.map(|x| x.into());
1366        self
1367    }
1368
1369    /// Sets the value of [cancel_time][crate::model::CreateBackupMetadata::cancel_time].
1370    pub fn set_cancel_time<T>(mut self, v: T) -> Self
1371    where
1372        T: std::convert::Into<wkt::Timestamp>,
1373    {
1374        self.cancel_time = std::option::Option::Some(v.into());
1375        self
1376    }
1377
1378    /// Sets or clears the value of [cancel_time][crate::model::CreateBackupMetadata::cancel_time].
1379    pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
1380    where
1381        T: std::convert::Into<wkt::Timestamp>,
1382    {
1383        self.cancel_time = v.map(|x| x.into());
1384        self
1385    }
1386}
1387
1388impl wkt::message::Message for CreateBackupMetadata {
1389    fn typename() -> &'static str {
1390        "type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata"
1391    }
1392}
1393
1394#[doc(hidden)]
1395impl<'de> serde::de::Deserialize<'de> for CreateBackupMetadata {
1396    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1397    where
1398        D: serde::Deserializer<'de>,
1399    {
1400        #[allow(non_camel_case_types)]
1401        #[doc(hidden)]
1402        #[derive(PartialEq, Eq, Hash)]
1403        enum __FieldTag {
1404            __name,
1405            __database,
1406            __progress,
1407            __cancel_time,
1408            Unknown(std::string::String),
1409        }
1410        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1411            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1412            where
1413                D: serde::Deserializer<'de>,
1414            {
1415                struct Visitor;
1416                impl<'de> serde::de::Visitor<'de> for Visitor {
1417                    type Value = __FieldTag;
1418                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1419                        formatter.write_str("a field name for CreateBackupMetadata")
1420                    }
1421                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1422                    where
1423                        E: serde::de::Error,
1424                    {
1425                        use std::result::Result::Ok;
1426                        use std::string::ToString;
1427                        match value {
1428                            "name" => Ok(__FieldTag::__name),
1429                            "database" => Ok(__FieldTag::__database),
1430                            "progress" => Ok(__FieldTag::__progress),
1431                            "cancelTime" => Ok(__FieldTag::__cancel_time),
1432                            "cancel_time" => Ok(__FieldTag::__cancel_time),
1433                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1434                        }
1435                    }
1436                }
1437                deserializer.deserialize_identifier(Visitor)
1438            }
1439        }
1440        struct Visitor;
1441        impl<'de> serde::de::Visitor<'de> for Visitor {
1442            type Value = CreateBackupMetadata;
1443            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1444                formatter.write_str("struct CreateBackupMetadata")
1445            }
1446            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1447            where
1448                A: serde::de::MapAccess<'de>,
1449            {
1450                #[allow(unused_imports)]
1451                use serde::de::Error;
1452                use std::option::Option::Some;
1453                let mut fields = std::collections::HashSet::new();
1454                let mut result = Self::Value::new();
1455                while let Some(tag) = map.next_key::<__FieldTag>()? {
1456                    #[allow(clippy::match_single_binding)]
1457                    match tag {
1458                        __FieldTag::__name => {
1459                            if !fields.insert(__FieldTag::__name) {
1460                                return std::result::Result::Err(A::Error::duplicate_field(
1461                                    "multiple values for name",
1462                                ));
1463                            }
1464                            result.name = map
1465                                .next_value::<std::option::Option<std::string::String>>()?
1466                                .unwrap_or_default();
1467                        }
1468                        __FieldTag::__database => {
1469                            if !fields.insert(__FieldTag::__database) {
1470                                return std::result::Result::Err(A::Error::duplicate_field(
1471                                    "multiple values for database",
1472                                ));
1473                            }
1474                            result.database = map
1475                                .next_value::<std::option::Option<std::string::String>>()?
1476                                .unwrap_or_default();
1477                        }
1478                        __FieldTag::__progress => {
1479                            if !fields.insert(__FieldTag::__progress) {
1480                                return std::result::Result::Err(A::Error::duplicate_field(
1481                                    "multiple values for progress",
1482                                ));
1483                            }
1484                            result.progress = map
1485                                .next_value::<std::option::Option<crate::model::OperationProgress>>(
1486                                )?;
1487                        }
1488                        __FieldTag::__cancel_time => {
1489                            if !fields.insert(__FieldTag::__cancel_time) {
1490                                return std::result::Result::Err(A::Error::duplicate_field(
1491                                    "multiple values for cancel_time",
1492                                ));
1493                            }
1494                            result.cancel_time =
1495                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1496                        }
1497                        __FieldTag::Unknown(key) => {
1498                            let value = map.next_value::<serde_json::Value>()?;
1499                            result._unknown_fields.insert(key, value);
1500                        }
1501                    }
1502                }
1503                std::result::Result::Ok(result)
1504            }
1505        }
1506        deserializer.deserialize_any(Visitor)
1507    }
1508}
1509
1510#[doc(hidden)]
1511impl serde::ser::Serialize for CreateBackupMetadata {
1512    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1513    where
1514        S: serde::ser::Serializer,
1515    {
1516        use serde::ser::SerializeMap;
1517        #[allow(unused_imports)]
1518        use std::option::Option::Some;
1519        let mut state = serializer.serialize_map(std::option::Option::None)?;
1520        if !self.name.is_empty() {
1521            state.serialize_entry("name", &self.name)?;
1522        }
1523        if !self.database.is_empty() {
1524            state.serialize_entry("database", &self.database)?;
1525        }
1526        if self.progress.is_some() {
1527            state.serialize_entry("progress", &self.progress)?;
1528        }
1529        if self.cancel_time.is_some() {
1530            state.serialize_entry("cancelTime", &self.cancel_time)?;
1531        }
1532        if !self._unknown_fields.is_empty() {
1533            for (key, value) in self._unknown_fields.iter() {
1534                state.serialize_entry(key, &value)?;
1535            }
1536        }
1537        state.end()
1538    }
1539}
1540
1541impl std::fmt::Debug for CreateBackupMetadata {
1542    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1543        let mut debug_struct = f.debug_struct("CreateBackupMetadata");
1544        debug_struct.field("name", &self.name);
1545        debug_struct.field("database", &self.database);
1546        debug_struct.field("progress", &self.progress);
1547        debug_struct.field("cancel_time", &self.cancel_time);
1548        if !self._unknown_fields.is_empty() {
1549            debug_struct.field("_unknown_fields", &self._unknown_fields);
1550        }
1551        debug_struct.finish()
1552    }
1553}
1554
1555/// The request for
1556/// [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup].
1557///
1558/// [google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup]: crate::client::DatabaseAdmin::copy_backup
1559#[derive(Clone, Default, PartialEq)]
1560#[non_exhaustive]
1561pub struct CopyBackupRequest {
1562    /// Required. The name of the destination instance that will contain the backup
1563    /// copy. Values are of the form: `projects/<project>/instances/<instance>`.
1564    pub parent: std::string::String,
1565
1566    /// Required. The id of the backup copy.
1567    /// The `backup_id` appended to `parent` forms the full backup_uri of the form
1568    /// `projects/<project>/instances/<instance>/backups/<backup>`.
1569    pub backup_id: std::string::String,
1570
1571    /// Required. The source backup to be copied.
1572    /// The source backup needs to be in READY state for it to be copied.
1573    /// Once CopyBackup is in progress, the source backup cannot be deleted or
1574    /// cleaned up on expiration until CopyBackup is finished.
1575    /// Values are of the form:
1576    /// `projects/<project>/instances/<instance>/backups/<backup>`.
1577    pub source_backup: std::string::String,
1578
1579    /// Required. The expiration time of the backup in microsecond granularity.
1580    /// The expiration time must be at least 6 hours and at most 366 days
1581    /// from the `create_time` of the source backup. Once the `expire_time` has
1582    /// passed, the backup is eligible to be automatically deleted by Cloud Spanner
1583    /// to free the resources used by the backup.
1584    pub expire_time: std::option::Option<wkt::Timestamp>,
1585
1586    /// Optional. The encryption configuration used to encrypt the backup. If this
1587    /// field is not specified, the backup will use the same encryption
1588    /// configuration as the source backup by default, namely
1589    /// [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type]
1590    /// = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`.
1591    ///
1592    /// [google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type]: crate::model::CopyBackupEncryptionConfig::encryption_type
1593    pub encryption_config: std::option::Option<crate::model::CopyBackupEncryptionConfig>,
1594
1595    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1596}
1597
1598impl CopyBackupRequest {
1599    pub fn new() -> Self {
1600        std::default::Default::default()
1601    }
1602
1603    /// Sets the value of [parent][crate::model::CopyBackupRequest::parent].
1604    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1605        self.parent = v.into();
1606        self
1607    }
1608
1609    /// Sets the value of [backup_id][crate::model::CopyBackupRequest::backup_id].
1610    pub fn set_backup_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1611        self.backup_id = v.into();
1612        self
1613    }
1614
1615    /// Sets the value of [source_backup][crate::model::CopyBackupRequest::source_backup].
1616    pub fn set_source_backup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1617        self.source_backup = v.into();
1618        self
1619    }
1620
1621    /// Sets the value of [expire_time][crate::model::CopyBackupRequest::expire_time].
1622    pub fn set_expire_time<T>(mut self, v: T) -> Self
1623    where
1624        T: std::convert::Into<wkt::Timestamp>,
1625    {
1626        self.expire_time = std::option::Option::Some(v.into());
1627        self
1628    }
1629
1630    /// Sets or clears the value of [expire_time][crate::model::CopyBackupRequest::expire_time].
1631    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
1632    where
1633        T: std::convert::Into<wkt::Timestamp>,
1634    {
1635        self.expire_time = v.map(|x| x.into());
1636        self
1637    }
1638
1639    /// Sets the value of [encryption_config][crate::model::CopyBackupRequest::encryption_config].
1640    pub fn set_encryption_config<T>(mut self, v: T) -> Self
1641    where
1642        T: std::convert::Into<crate::model::CopyBackupEncryptionConfig>,
1643    {
1644        self.encryption_config = std::option::Option::Some(v.into());
1645        self
1646    }
1647
1648    /// Sets or clears the value of [encryption_config][crate::model::CopyBackupRequest::encryption_config].
1649    pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
1650    where
1651        T: std::convert::Into<crate::model::CopyBackupEncryptionConfig>,
1652    {
1653        self.encryption_config = v.map(|x| x.into());
1654        self
1655    }
1656}
1657
1658impl wkt::message::Message for CopyBackupRequest {
1659    fn typename() -> &'static str {
1660        "type.googleapis.com/google.spanner.admin.database.v1.CopyBackupRequest"
1661    }
1662}
1663
1664#[doc(hidden)]
1665impl<'de> serde::de::Deserialize<'de> for CopyBackupRequest {
1666    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1667    where
1668        D: serde::Deserializer<'de>,
1669    {
1670        #[allow(non_camel_case_types)]
1671        #[doc(hidden)]
1672        #[derive(PartialEq, Eq, Hash)]
1673        enum __FieldTag {
1674            __parent,
1675            __backup_id,
1676            __source_backup,
1677            __expire_time,
1678            __encryption_config,
1679            Unknown(std::string::String),
1680        }
1681        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1682            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1683            where
1684                D: serde::Deserializer<'de>,
1685            {
1686                struct Visitor;
1687                impl<'de> serde::de::Visitor<'de> for Visitor {
1688                    type Value = __FieldTag;
1689                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1690                        formatter.write_str("a field name for CopyBackupRequest")
1691                    }
1692                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1693                    where
1694                        E: serde::de::Error,
1695                    {
1696                        use std::result::Result::Ok;
1697                        use std::string::ToString;
1698                        match value {
1699                            "parent" => Ok(__FieldTag::__parent),
1700                            "backupId" => Ok(__FieldTag::__backup_id),
1701                            "backup_id" => Ok(__FieldTag::__backup_id),
1702                            "sourceBackup" => Ok(__FieldTag::__source_backup),
1703                            "source_backup" => Ok(__FieldTag::__source_backup),
1704                            "expireTime" => Ok(__FieldTag::__expire_time),
1705                            "expire_time" => Ok(__FieldTag::__expire_time),
1706                            "encryptionConfig" => Ok(__FieldTag::__encryption_config),
1707                            "encryption_config" => Ok(__FieldTag::__encryption_config),
1708                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1709                        }
1710                    }
1711                }
1712                deserializer.deserialize_identifier(Visitor)
1713            }
1714        }
1715        struct Visitor;
1716        impl<'de> serde::de::Visitor<'de> for Visitor {
1717            type Value = CopyBackupRequest;
1718            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1719                formatter.write_str("struct CopyBackupRequest")
1720            }
1721            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1722            where
1723                A: serde::de::MapAccess<'de>,
1724            {
1725                #[allow(unused_imports)]
1726                use serde::de::Error;
1727                use std::option::Option::Some;
1728                let mut fields = std::collections::HashSet::new();
1729                let mut result = Self::Value::new();
1730                while let Some(tag) = map.next_key::<__FieldTag>()? {
1731                    #[allow(clippy::match_single_binding)]
1732                    match tag {
1733                        __FieldTag::__parent => {
1734                            if !fields.insert(__FieldTag::__parent) {
1735                                return std::result::Result::Err(A::Error::duplicate_field(
1736                                    "multiple values for parent",
1737                                ));
1738                            }
1739                            result.parent = map
1740                                .next_value::<std::option::Option<std::string::String>>()?
1741                                .unwrap_or_default();
1742                        }
1743                        __FieldTag::__backup_id => {
1744                            if !fields.insert(__FieldTag::__backup_id) {
1745                                return std::result::Result::Err(A::Error::duplicate_field(
1746                                    "multiple values for backup_id",
1747                                ));
1748                            }
1749                            result.backup_id = map
1750                                .next_value::<std::option::Option<std::string::String>>()?
1751                                .unwrap_or_default();
1752                        }
1753                        __FieldTag::__source_backup => {
1754                            if !fields.insert(__FieldTag::__source_backup) {
1755                                return std::result::Result::Err(A::Error::duplicate_field(
1756                                    "multiple values for source_backup",
1757                                ));
1758                            }
1759                            result.source_backup = map
1760                                .next_value::<std::option::Option<std::string::String>>()?
1761                                .unwrap_or_default();
1762                        }
1763                        __FieldTag::__expire_time => {
1764                            if !fields.insert(__FieldTag::__expire_time) {
1765                                return std::result::Result::Err(A::Error::duplicate_field(
1766                                    "multiple values for expire_time",
1767                                ));
1768                            }
1769                            result.expire_time =
1770                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1771                        }
1772                        __FieldTag::__encryption_config => {
1773                            if !fields.insert(__FieldTag::__encryption_config) {
1774                                return std::result::Result::Err(A::Error::duplicate_field(
1775                                    "multiple values for encryption_config",
1776                                ));
1777                            }
1778                            result.encryption_config = map.next_value::<std::option::Option<crate::model::CopyBackupEncryptionConfig>>()?
1779                                ;
1780                        }
1781                        __FieldTag::Unknown(key) => {
1782                            let value = map.next_value::<serde_json::Value>()?;
1783                            result._unknown_fields.insert(key, value);
1784                        }
1785                    }
1786                }
1787                std::result::Result::Ok(result)
1788            }
1789        }
1790        deserializer.deserialize_any(Visitor)
1791    }
1792}
1793
1794#[doc(hidden)]
1795impl serde::ser::Serialize for CopyBackupRequest {
1796    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1797    where
1798        S: serde::ser::Serializer,
1799    {
1800        use serde::ser::SerializeMap;
1801        #[allow(unused_imports)]
1802        use std::option::Option::Some;
1803        let mut state = serializer.serialize_map(std::option::Option::None)?;
1804        if !self.parent.is_empty() {
1805            state.serialize_entry("parent", &self.parent)?;
1806        }
1807        if !self.backup_id.is_empty() {
1808            state.serialize_entry("backupId", &self.backup_id)?;
1809        }
1810        if !self.source_backup.is_empty() {
1811            state.serialize_entry("sourceBackup", &self.source_backup)?;
1812        }
1813        if self.expire_time.is_some() {
1814            state.serialize_entry("expireTime", &self.expire_time)?;
1815        }
1816        if self.encryption_config.is_some() {
1817            state.serialize_entry("encryptionConfig", &self.encryption_config)?;
1818        }
1819        if !self._unknown_fields.is_empty() {
1820            for (key, value) in self._unknown_fields.iter() {
1821                state.serialize_entry(key, &value)?;
1822            }
1823        }
1824        state.end()
1825    }
1826}
1827
1828impl std::fmt::Debug for CopyBackupRequest {
1829    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1830        let mut debug_struct = f.debug_struct("CopyBackupRequest");
1831        debug_struct.field("parent", &self.parent);
1832        debug_struct.field("backup_id", &self.backup_id);
1833        debug_struct.field("source_backup", &self.source_backup);
1834        debug_struct.field("expire_time", &self.expire_time);
1835        debug_struct.field("encryption_config", &self.encryption_config);
1836        if !self._unknown_fields.is_empty() {
1837            debug_struct.field("_unknown_fields", &self._unknown_fields);
1838        }
1839        debug_struct.finish()
1840    }
1841}
1842
1843/// Metadata type for the operation returned by
1844/// [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup].
1845///
1846/// [google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup]: crate::client::DatabaseAdmin::copy_backup
1847#[derive(Clone, Default, PartialEq)]
1848#[non_exhaustive]
1849pub struct CopyBackupMetadata {
1850    /// The name of the backup being created through the copy operation.
1851    /// Values are of the form
1852    /// `projects/<project>/instances/<instance>/backups/<backup>`.
1853    pub name: std::string::String,
1854
1855    /// The name of the source backup that is being copied.
1856    /// Values are of the form
1857    /// `projects/<project>/instances/<instance>/backups/<backup>`.
1858    pub source_backup: std::string::String,
1859
1860    /// The progress of the
1861    /// [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup]
1862    /// operation.
1863    ///
1864    /// [google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup]: crate::client::DatabaseAdmin::copy_backup
1865    pub progress: std::option::Option<crate::model::OperationProgress>,
1866
1867    /// The time at which cancellation of CopyBackup operation was received.
1868    /// [Operations.CancelOperation][google.longrunning.Operations.CancelOperation]
1869    /// starts asynchronous cancellation on a long-running operation. The server
1870    /// makes a best effort to cancel the operation, but success is not guaranteed.
1871    /// Clients can use
1872    /// [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
1873    /// other methods to check whether the cancellation succeeded or whether the
1874    /// operation completed despite cancellation. On successful cancellation,
1875    /// the operation is not deleted; instead, it becomes an operation with
1876    /// an [Operation.error][google.longrunning.Operation.error] value with a
1877    /// [google.rpc.Status.code][google.rpc.Status.code] of 1,
1878    /// corresponding to `Code.CANCELLED`.
1879    ///
1880    /// [google.longrunning.Operation.error]: longrunning::model::Operation::result
1881    /// [google.rpc.Status.code]: rpc::model::Status::code
1882    pub cancel_time: std::option::Option<wkt::Timestamp>,
1883
1884    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1885}
1886
1887impl CopyBackupMetadata {
1888    pub fn new() -> Self {
1889        std::default::Default::default()
1890    }
1891
1892    /// Sets the value of [name][crate::model::CopyBackupMetadata::name].
1893    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1894        self.name = v.into();
1895        self
1896    }
1897
1898    /// Sets the value of [source_backup][crate::model::CopyBackupMetadata::source_backup].
1899    pub fn set_source_backup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1900        self.source_backup = v.into();
1901        self
1902    }
1903
1904    /// Sets the value of [progress][crate::model::CopyBackupMetadata::progress].
1905    pub fn set_progress<T>(mut self, v: T) -> Self
1906    where
1907        T: std::convert::Into<crate::model::OperationProgress>,
1908    {
1909        self.progress = std::option::Option::Some(v.into());
1910        self
1911    }
1912
1913    /// Sets or clears the value of [progress][crate::model::CopyBackupMetadata::progress].
1914    pub fn set_or_clear_progress<T>(mut self, v: std::option::Option<T>) -> Self
1915    where
1916        T: std::convert::Into<crate::model::OperationProgress>,
1917    {
1918        self.progress = v.map(|x| x.into());
1919        self
1920    }
1921
1922    /// Sets the value of [cancel_time][crate::model::CopyBackupMetadata::cancel_time].
1923    pub fn set_cancel_time<T>(mut self, v: T) -> Self
1924    where
1925        T: std::convert::Into<wkt::Timestamp>,
1926    {
1927        self.cancel_time = std::option::Option::Some(v.into());
1928        self
1929    }
1930
1931    /// Sets or clears the value of [cancel_time][crate::model::CopyBackupMetadata::cancel_time].
1932    pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
1933    where
1934        T: std::convert::Into<wkt::Timestamp>,
1935    {
1936        self.cancel_time = v.map(|x| x.into());
1937        self
1938    }
1939}
1940
1941impl wkt::message::Message for CopyBackupMetadata {
1942    fn typename() -> &'static str {
1943        "type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata"
1944    }
1945}
1946
1947#[doc(hidden)]
1948impl<'de> serde::de::Deserialize<'de> for CopyBackupMetadata {
1949    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1950    where
1951        D: serde::Deserializer<'de>,
1952    {
1953        #[allow(non_camel_case_types)]
1954        #[doc(hidden)]
1955        #[derive(PartialEq, Eq, Hash)]
1956        enum __FieldTag {
1957            __name,
1958            __source_backup,
1959            __progress,
1960            __cancel_time,
1961            Unknown(std::string::String),
1962        }
1963        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1964            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1965            where
1966                D: serde::Deserializer<'de>,
1967            {
1968                struct Visitor;
1969                impl<'de> serde::de::Visitor<'de> for Visitor {
1970                    type Value = __FieldTag;
1971                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1972                        formatter.write_str("a field name for CopyBackupMetadata")
1973                    }
1974                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1975                    where
1976                        E: serde::de::Error,
1977                    {
1978                        use std::result::Result::Ok;
1979                        use std::string::ToString;
1980                        match value {
1981                            "name" => Ok(__FieldTag::__name),
1982                            "sourceBackup" => Ok(__FieldTag::__source_backup),
1983                            "source_backup" => Ok(__FieldTag::__source_backup),
1984                            "progress" => Ok(__FieldTag::__progress),
1985                            "cancelTime" => Ok(__FieldTag::__cancel_time),
1986                            "cancel_time" => Ok(__FieldTag::__cancel_time),
1987                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1988                        }
1989                    }
1990                }
1991                deserializer.deserialize_identifier(Visitor)
1992            }
1993        }
1994        struct Visitor;
1995        impl<'de> serde::de::Visitor<'de> for Visitor {
1996            type Value = CopyBackupMetadata;
1997            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1998                formatter.write_str("struct CopyBackupMetadata")
1999            }
2000            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2001            where
2002                A: serde::de::MapAccess<'de>,
2003            {
2004                #[allow(unused_imports)]
2005                use serde::de::Error;
2006                use std::option::Option::Some;
2007                let mut fields = std::collections::HashSet::new();
2008                let mut result = Self::Value::new();
2009                while let Some(tag) = map.next_key::<__FieldTag>()? {
2010                    #[allow(clippy::match_single_binding)]
2011                    match tag {
2012                        __FieldTag::__name => {
2013                            if !fields.insert(__FieldTag::__name) {
2014                                return std::result::Result::Err(A::Error::duplicate_field(
2015                                    "multiple values for name",
2016                                ));
2017                            }
2018                            result.name = map
2019                                .next_value::<std::option::Option<std::string::String>>()?
2020                                .unwrap_or_default();
2021                        }
2022                        __FieldTag::__source_backup => {
2023                            if !fields.insert(__FieldTag::__source_backup) {
2024                                return std::result::Result::Err(A::Error::duplicate_field(
2025                                    "multiple values for source_backup",
2026                                ));
2027                            }
2028                            result.source_backup = map
2029                                .next_value::<std::option::Option<std::string::String>>()?
2030                                .unwrap_or_default();
2031                        }
2032                        __FieldTag::__progress => {
2033                            if !fields.insert(__FieldTag::__progress) {
2034                                return std::result::Result::Err(A::Error::duplicate_field(
2035                                    "multiple values for progress",
2036                                ));
2037                            }
2038                            result.progress = map
2039                                .next_value::<std::option::Option<crate::model::OperationProgress>>(
2040                                )?;
2041                        }
2042                        __FieldTag::__cancel_time => {
2043                            if !fields.insert(__FieldTag::__cancel_time) {
2044                                return std::result::Result::Err(A::Error::duplicate_field(
2045                                    "multiple values for cancel_time",
2046                                ));
2047                            }
2048                            result.cancel_time =
2049                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
2050                        }
2051                        __FieldTag::Unknown(key) => {
2052                            let value = map.next_value::<serde_json::Value>()?;
2053                            result._unknown_fields.insert(key, value);
2054                        }
2055                    }
2056                }
2057                std::result::Result::Ok(result)
2058            }
2059        }
2060        deserializer.deserialize_any(Visitor)
2061    }
2062}
2063
2064#[doc(hidden)]
2065impl serde::ser::Serialize for CopyBackupMetadata {
2066    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2067    where
2068        S: serde::ser::Serializer,
2069    {
2070        use serde::ser::SerializeMap;
2071        #[allow(unused_imports)]
2072        use std::option::Option::Some;
2073        let mut state = serializer.serialize_map(std::option::Option::None)?;
2074        if !self.name.is_empty() {
2075            state.serialize_entry("name", &self.name)?;
2076        }
2077        if !self.source_backup.is_empty() {
2078            state.serialize_entry("sourceBackup", &self.source_backup)?;
2079        }
2080        if self.progress.is_some() {
2081            state.serialize_entry("progress", &self.progress)?;
2082        }
2083        if self.cancel_time.is_some() {
2084            state.serialize_entry("cancelTime", &self.cancel_time)?;
2085        }
2086        if !self._unknown_fields.is_empty() {
2087            for (key, value) in self._unknown_fields.iter() {
2088                state.serialize_entry(key, &value)?;
2089            }
2090        }
2091        state.end()
2092    }
2093}
2094
2095impl std::fmt::Debug for CopyBackupMetadata {
2096    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2097        let mut debug_struct = f.debug_struct("CopyBackupMetadata");
2098        debug_struct.field("name", &self.name);
2099        debug_struct.field("source_backup", &self.source_backup);
2100        debug_struct.field("progress", &self.progress);
2101        debug_struct.field("cancel_time", &self.cancel_time);
2102        if !self._unknown_fields.is_empty() {
2103            debug_struct.field("_unknown_fields", &self._unknown_fields);
2104        }
2105        debug_struct.finish()
2106    }
2107}
2108
2109/// The request for
2110/// [UpdateBackup][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup].
2111///
2112/// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup]: crate::client::DatabaseAdmin::update_backup
2113#[derive(Clone, Default, PartialEq)]
2114#[non_exhaustive]
2115pub struct UpdateBackupRequest {
2116    /// Required. The backup to update. `backup.name`, and the fields to be updated
2117    /// as specified by `update_mask` are required. Other fields are ignored.
2118    /// Update is only supported for the following fields:
2119    ///
2120    /// * `backup.expire_time`.
2121    pub backup: std::option::Option<crate::model::Backup>,
2122
2123    /// Required. A mask specifying which fields (e.g. `expire_time`) in the
2124    /// Backup resource should be updated. This mask is relative to the Backup
2125    /// resource, not to the request message. The field mask must always be
2126    /// specified; this prevents any future fields from being erased accidentally
2127    /// by clients that do not know about them.
2128    pub update_mask: std::option::Option<wkt::FieldMask>,
2129
2130    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2131}
2132
2133impl UpdateBackupRequest {
2134    pub fn new() -> Self {
2135        std::default::Default::default()
2136    }
2137
2138    /// Sets the value of [backup][crate::model::UpdateBackupRequest::backup].
2139    pub fn set_backup<T>(mut self, v: T) -> Self
2140    where
2141        T: std::convert::Into<crate::model::Backup>,
2142    {
2143        self.backup = std::option::Option::Some(v.into());
2144        self
2145    }
2146
2147    /// Sets or clears the value of [backup][crate::model::UpdateBackupRequest::backup].
2148    pub fn set_or_clear_backup<T>(mut self, v: std::option::Option<T>) -> Self
2149    where
2150        T: std::convert::Into<crate::model::Backup>,
2151    {
2152        self.backup = v.map(|x| x.into());
2153        self
2154    }
2155
2156    /// Sets the value of [update_mask][crate::model::UpdateBackupRequest::update_mask].
2157    pub fn set_update_mask<T>(mut self, v: T) -> Self
2158    where
2159        T: std::convert::Into<wkt::FieldMask>,
2160    {
2161        self.update_mask = std::option::Option::Some(v.into());
2162        self
2163    }
2164
2165    /// Sets or clears the value of [update_mask][crate::model::UpdateBackupRequest::update_mask].
2166    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2167    where
2168        T: std::convert::Into<wkt::FieldMask>,
2169    {
2170        self.update_mask = v.map(|x| x.into());
2171        self
2172    }
2173}
2174
2175impl wkt::message::Message for UpdateBackupRequest {
2176    fn typename() -> &'static str {
2177        "type.googleapis.com/google.spanner.admin.database.v1.UpdateBackupRequest"
2178    }
2179}
2180
2181#[doc(hidden)]
2182impl<'de> serde::de::Deserialize<'de> for UpdateBackupRequest {
2183    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2184    where
2185        D: serde::Deserializer<'de>,
2186    {
2187        #[allow(non_camel_case_types)]
2188        #[doc(hidden)]
2189        #[derive(PartialEq, Eq, Hash)]
2190        enum __FieldTag {
2191            __backup,
2192            __update_mask,
2193            Unknown(std::string::String),
2194        }
2195        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2196            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2197            where
2198                D: serde::Deserializer<'de>,
2199            {
2200                struct Visitor;
2201                impl<'de> serde::de::Visitor<'de> for Visitor {
2202                    type Value = __FieldTag;
2203                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2204                        formatter.write_str("a field name for UpdateBackupRequest")
2205                    }
2206                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2207                    where
2208                        E: serde::de::Error,
2209                    {
2210                        use std::result::Result::Ok;
2211                        use std::string::ToString;
2212                        match value {
2213                            "backup" => Ok(__FieldTag::__backup),
2214                            "updateMask" => Ok(__FieldTag::__update_mask),
2215                            "update_mask" => Ok(__FieldTag::__update_mask),
2216                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2217                        }
2218                    }
2219                }
2220                deserializer.deserialize_identifier(Visitor)
2221            }
2222        }
2223        struct Visitor;
2224        impl<'de> serde::de::Visitor<'de> for Visitor {
2225            type Value = UpdateBackupRequest;
2226            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2227                formatter.write_str("struct UpdateBackupRequest")
2228            }
2229            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2230            where
2231                A: serde::de::MapAccess<'de>,
2232            {
2233                #[allow(unused_imports)]
2234                use serde::de::Error;
2235                use std::option::Option::Some;
2236                let mut fields = std::collections::HashSet::new();
2237                let mut result = Self::Value::new();
2238                while let Some(tag) = map.next_key::<__FieldTag>()? {
2239                    #[allow(clippy::match_single_binding)]
2240                    match tag {
2241                        __FieldTag::__backup => {
2242                            if !fields.insert(__FieldTag::__backup) {
2243                                return std::result::Result::Err(A::Error::duplicate_field(
2244                                    "multiple values for backup",
2245                                ));
2246                            }
2247                            result.backup =
2248                                map.next_value::<std::option::Option<crate::model::Backup>>()?;
2249                        }
2250                        __FieldTag::__update_mask => {
2251                            if !fields.insert(__FieldTag::__update_mask) {
2252                                return std::result::Result::Err(A::Error::duplicate_field(
2253                                    "multiple values for update_mask",
2254                                ));
2255                            }
2256                            result.update_mask =
2257                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
2258                        }
2259                        __FieldTag::Unknown(key) => {
2260                            let value = map.next_value::<serde_json::Value>()?;
2261                            result._unknown_fields.insert(key, value);
2262                        }
2263                    }
2264                }
2265                std::result::Result::Ok(result)
2266            }
2267        }
2268        deserializer.deserialize_any(Visitor)
2269    }
2270}
2271
2272#[doc(hidden)]
2273impl serde::ser::Serialize for UpdateBackupRequest {
2274    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2275    where
2276        S: serde::ser::Serializer,
2277    {
2278        use serde::ser::SerializeMap;
2279        #[allow(unused_imports)]
2280        use std::option::Option::Some;
2281        let mut state = serializer.serialize_map(std::option::Option::None)?;
2282        if self.backup.is_some() {
2283            state.serialize_entry("backup", &self.backup)?;
2284        }
2285        if self.update_mask.is_some() {
2286            state.serialize_entry("updateMask", &self.update_mask)?;
2287        }
2288        if !self._unknown_fields.is_empty() {
2289            for (key, value) in self._unknown_fields.iter() {
2290                state.serialize_entry(key, &value)?;
2291            }
2292        }
2293        state.end()
2294    }
2295}
2296
2297impl std::fmt::Debug for UpdateBackupRequest {
2298    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2299        let mut debug_struct = f.debug_struct("UpdateBackupRequest");
2300        debug_struct.field("backup", &self.backup);
2301        debug_struct.field("update_mask", &self.update_mask);
2302        if !self._unknown_fields.is_empty() {
2303            debug_struct.field("_unknown_fields", &self._unknown_fields);
2304        }
2305        debug_struct.finish()
2306    }
2307}
2308
2309/// The request for
2310/// [GetBackup][google.spanner.admin.database.v1.DatabaseAdmin.GetBackup].
2311///
2312/// [google.spanner.admin.database.v1.DatabaseAdmin.GetBackup]: crate::client::DatabaseAdmin::get_backup
2313#[derive(Clone, Default, PartialEq)]
2314#[non_exhaustive]
2315pub struct GetBackupRequest {
2316    /// Required. Name of the backup.
2317    /// Values are of the form
2318    /// `projects/<project>/instances/<instance>/backups/<backup>`.
2319    pub name: std::string::String,
2320
2321    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2322}
2323
2324impl GetBackupRequest {
2325    pub fn new() -> Self {
2326        std::default::Default::default()
2327    }
2328
2329    /// Sets the value of [name][crate::model::GetBackupRequest::name].
2330    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2331        self.name = v.into();
2332        self
2333    }
2334}
2335
2336impl wkt::message::Message for GetBackupRequest {
2337    fn typename() -> &'static str {
2338        "type.googleapis.com/google.spanner.admin.database.v1.GetBackupRequest"
2339    }
2340}
2341
2342#[doc(hidden)]
2343impl<'de> serde::de::Deserialize<'de> for GetBackupRequest {
2344    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2345    where
2346        D: serde::Deserializer<'de>,
2347    {
2348        #[allow(non_camel_case_types)]
2349        #[doc(hidden)]
2350        #[derive(PartialEq, Eq, Hash)]
2351        enum __FieldTag {
2352            __name,
2353            Unknown(std::string::String),
2354        }
2355        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2356            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2357            where
2358                D: serde::Deserializer<'de>,
2359            {
2360                struct Visitor;
2361                impl<'de> serde::de::Visitor<'de> for Visitor {
2362                    type Value = __FieldTag;
2363                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2364                        formatter.write_str("a field name for GetBackupRequest")
2365                    }
2366                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2367                    where
2368                        E: serde::de::Error,
2369                    {
2370                        use std::result::Result::Ok;
2371                        use std::string::ToString;
2372                        match value {
2373                            "name" => Ok(__FieldTag::__name),
2374                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2375                        }
2376                    }
2377                }
2378                deserializer.deserialize_identifier(Visitor)
2379            }
2380        }
2381        struct Visitor;
2382        impl<'de> serde::de::Visitor<'de> for Visitor {
2383            type Value = GetBackupRequest;
2384            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2385                formatter.write_str("struct GetBackupRequest")
2386            }
2387            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2388            where
2389                A: serde::de::MapAccess<'de>,
2390            {
2391                #[allow(unused_imports)]
2392                use serde::de::Error;
2393                use std::option::Option::Some;
2394                let mut fields = std::collections::HashSet::new();
2395                let mut result = Self::Value::new();
2396                while let Some(tag) = map.next_key::<__FieldTag>()? {
2397                    #[allow(clippy::match_single_binding)]
2398                    match tag {
2399                        __FieldTag::__name => {
2400                            if !fields.insert(__FieldTag::__name) {
2401                                return std::result::Result::Err(A::Error::duplicate_field(
2402                                    "multiple values for name",
2403                                ));
2404                            }
2405                            result.name = map
2406                                .next_value::<std::option::Option<std::string::String>>()?
2407                                .unwrap_or_default();
2408                        }
2409                        __FieldTag::Unknown(key) => {
2410                            let value = map.next_value::<serde_json::Value>()?;
2411                            result._unknown_fields.insert(key, value);
2412                        }
2413                    }
2414                }
2415                std::result::Result::Ok(result)
2416            }
2417        }
2418        deserializer.deserialize_any(Visitor)
2419    }
2420}
2421
2422#[doc(hidden)]
2423impl serde::ser::Serialize for GetBackupRequest {
2424    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2425    where
2426        S: serde::ser::Serializer,
2427    {
2428        use serde::ser::SerializeMap;
2429        #[allow(unused_imports)]
2430        use std::option::Option::Some;
2431        let mut state = serializer.serialize_map(std::option::Option::None)?;
2432        if !self.name.is_empty() {
2433            state.serialize_entry("name", &self.name)?;
2434        }
2435        if !self._unknown_fields.is_empty() {
2436            for (key, value) in self._unknown_fields.iter() {
2437                state.serialize_entry(key, &value)?;
2438            }
2439        }
2440        state.end()
2441    }
2442}
2443
2444impl std::fmt::Debug for GetBackupRequest {
2445    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2446        let mut debug_struct = f.debug_struct("GetBackupRequest");
2447        debug_struct.field("name", &self.name);
2448        if !self._unknown_fields.is_empty() {
2449            debug_struct.field("_unknown_fields", &self._unknown_fields);
2450        }
2451        debug_struct.finish()
2452    }
2453}
2454
2455/// The request for
2456/// [DeleteBackup][google.spanner.admin.database.v1.DatabaseAdmin.DeleteBackup].
2457///
2458/// [google.spanner.admin.database.v1.DatabaseAdmin.DeleteBackup]: crate::client::DatabaseAdmin::delete_backup
2459#[derive(Clone, Default, PartialEq)]
2460#[non_exhaustive]
2461pub struct DeleteBackupRequest {
2462    /// Required. Name of the backup to delete.
2463    /// Values are of the form
2464    /// `projects/<project>/instances/<instance>/backups/<backup>`.
2465    pub name: std::string::String,
2466
2467    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2468}
2469
2470impl DeleteBackupRequest {
2471    pub fn new() -> Self {
2472        std::default::Default::default()
2473    }
2474
2475    /// Sets the value of [name][crate::model::DeleteBackupRequest::name].
2476    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2477        self.name = v.into();
2478        self
2479    }
2480}
2481
2482impl wkt::message::Message for DeleteBackupRequest {
2483    fn typename() -> &'static str {
2484        "type.googleapis.com/google.spanner.admin.database.v1.DeleteBackupRequest"
2485    }
2486}
2487
2488#[doc(hidden)]
2489impl<'de> serde::de::Deserialize<'de> for DeleteBackupRequest {
2490    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2491    where
2492        D: serde::Deserializer<'de>,
2493    {
2494        #[allow(non_camel_case_types)]
2495        #[doc(hidden)]
2496        #[derive(PartialEq, Eq, Hash)]
2497        enum __FieldTag {
2498            __name,
2499            Unknown(std::string::String),
2500        }
2501        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2502            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2503            where
2504                D: serde::Deserializer<'de>,
2505            {
2506                struct Visitor;
2507                impl<'de> serde::de::Visitor<'de> for Visitor {
2508                    type Value = __FieldTag;
2509                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2510                        formatter.write_str("a field name for DeleteBackupRequest")
2511                    }
2512                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2513                    where
2514                        E: serde::de::Error,
2515                    {
2516                        use std::result::Result::Ok;
2517                        use std::string::ToString;
2518                        match value {
2519                            "name" => Ok(__FieldTag::__name),
2520                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2521                        }
2522                    }
2523                }
2524                deserializer.deserialize_identifier(Visitor)
2525            }
2526        }
2527        struct Visitor;
2528        impl<'de> serde::de::Visitor<'de> for Visitor {
2529            type Value = DeleteBackupRequest;
2530            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2531                formatter.write_str("struct DeleteBackupRequest")
2532            }
2533            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2534            where
2535                A: serde::de::MapAccess<'de>,
2536            {
2537                #[allow(unused_imports)]
2538                use serde::de::Error;
2539                use std::option::Option::Some;
2540                let mut fields = std::collections::HashSet::new();
2541                let mut result = Self::Value::new();
2542                while let Some(tag) = map.next_key::<__FieldTag>()? {
2543                    #[allow(clippy::match_single_binding)]
2544                    match tag {
2545                        __FieldTag::__name => {
2546                            if !fields.insert(__FieldTag::__name) {
2547                                return std::result::Result::Err(A::Error::duplicate_field(
2548                                    "multiple values for name",
2549                                ));
2550                            }
2551                            result.name = map
2552                                .next_value::<std::option::Option<std::string::String>>()?
2553                                .unwrap_or_default();
2554                        }
2555                        __FieldTag::Unknown(key) => {
2556                            let value = map.next_value::<serde_json::Value>()?;
2557                            result._unknown_fields.insert(key, value);
2558                        }
2559                    }
2560                }
2561                std::result::Result::Ok(result)
2562            }
2563        }
2564        deserializer.deserialize_any(Visitor)
2565    }
2566}
2567
2568#[doc(hidden)]
2569impl serde::ser::Serialize for DeleteBackupRequest {
2570    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2571    where
2572        S: serde::ser::Serializer,
2573    {
2574        use serde::ser::SerializeMap;
2575        #[allow(unused_imports)]
2576        use std::option::Option::Some;
2577        let mut state = serializer.serialize_map(std::option::Option::None)?;
2578        if !self.name.is_empty() {
2579            state.serialize_entry("name", &self.name)?;
2580        }
2581        if !self._unknown_fields.is_empty() {
2582            for (key, value) in self._unknown_fields.iter() {
2583                state.serialize_entry(key, &value)?;
2584            }
2585        }
2586        state.end()
2587    }
2588}
2589
2590impl std::fmt::Debug for DeleteBackupRequest {
2591    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2592        let mut debug_struct = f.debug_struct("DeleteBackupRequest");
2593        debug_struct.field("name", &self.name);
2594        if !self._unknown_fields.is_empty() {
2595            debug_struct.field("_unknown_fields", &self._unknown_fields);
2596        }
2597        debug_struct.finish()
2598    }
2599}
2600
2601/// The request for
2602/// [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups].
2603///
2604/// [google.spanner.admin.database.v1.DatabaseAdmin.ListBackups]: crate::client::DatabaseAdmin::list_backups
2605#[derive(Clone, Default, PartialEq)]
2606#[non_exhaustive]
2607pub struct ListBackupsRequest {
2608    /// Required. The instance to list backups from.  Values are of the
2609    /// form `projects/<project>/instances/<instance>`.
2610    pub parent: std::string::String,
2611
2612    /// An expression that filters the list of returned backups.
2613    ///
2614    /// A filter expression consists of a field name, a comparison operator, and a
2615    /// value for filtering.
2616    /// The value must be a string, a number, or a boolean. The comparison operator
2617    /// must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
2618    /// Colon `:` is the contains operator. Filter rules are not case sensitive.
2619    ///
2620    /// The following fields in the
2621    /// [Backup][google.spanner.admin.database.v1.Backup] are eligible for
2622    /// filtering:
2623    ///
2624    /// * `name`
2625    /// * `database`
2626    /// * `state`
2627    /// * `create_time`  (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
2628    /// * `expire_time`  (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
2629    /// * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
2630    /// * `size_bytes`
2631    /// * `backup_schedules`
2632    ///
2633    /// You can combine multiple expressions by enclosing each expression in
2634    /// parentheses. By default, expressions are combined with AND logic, but
2635    /// you can specify AND, OR, and NOT logic explicitly.
2636    ///
2637    /// Here are a few examples:
2638    ///
2639    /// * `name:Howl` - The backup's name contains the string "howl".
2640    /// * `database:prod` - The database's name contains the string "prod".
2641    /// * `state:CREATING` - The backup is pending creation.
2642    /// * `state:READY` - The backup is fully created and ready for use.
2643    /// * `(name:howl) AND (create_time < \"2018-03-28T14:50:00Z\")` - The backup
2644    ///   name contains the string "howl" and `create_time` of the backup is before
2645    ///   2018-03-28T14:50:00Z.
2646    /// * `expire_time < \"2018-03-28T14:50:00Z\"` - The backup `expire_time` is
2647    ///   before 2018-03-28T14:50:00Z.
2648    /// * `size_bytes > 10000000000` - The backup's size is greater than 10GB
2649    /// * `backup_schedules:daily` - The backup is created from a schedule with
2650    ///   "daily" in its name.
2651    ///
2652    /// [google.spanner.admin.database.v1.Backup]: crate::model::Backup
2653    pub filter: std::string::String,
2654
2655    /// Number of backups to be returned in the response. If 0 or
2656    /// less, defaults to the server's maximum allowed page size.
2657    pub page_size: i32,
2658
2659    /// If non-empty, `page_token` should contain a
2660    /// [next_page_token][google.spanner.admin.database.v1.ListBackupsResponse.next_page_token]
2661    /// from a previous
2662    /// [ListBackupsResponse][google.spanner.admin.database.v1.ListBackupsResponse]
2663    /// to the same `parent` and with the same `filter`.
2664    ///
2665    /// [google.spanner.admin.database.v1.ListBackupsResponse]: crate::model::ListBackupsResponse
2666    /// [google.spanner.admin.database.v1.ListBackupsResponse.next_page_token]: crate::model::ListBackupsResponse::next_page_token
2667    pub page_token: std::string::String,
2668
2669    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2670}
2671
2672impl ListBackupsRequest {
2673    pub fn new() -> Self {
2674        std::default::Default::default()
2675    }
2676
2677    /// Sets the value of [parent][crate::model::ListBackupsRequest::parent].
2678    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2679        self.parent = v.into();
2680        self
2681    }
2682
2683    /// Sets the value of [filter][crate::model::ListBackupsRequest::filter].
2684    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2685        self.filter = v.into();
2686        self
2687    }
2688
2689    /// Sets the value of [page_size][crate::model::ListBackupsRequest::page_size].
2690    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2691        self.page_size = v.into();
2692        self
2693    }
2694
2695    /// Sets the value of [page_token][crate::model::ListBackupsRequest::page_token].
2696    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2697        self.page_token = v.into();
2698        self
2699    }
2700}
2701
2702impl wkt::message::Message for ListBackupsRequest {
2703    fn typename() -> &'static str {
2704        "type.googleapis.com/google.spanner.admin.database.v1.ListBackupsRequest"
2705    }
2706}
2707
2708#[doc(hidden)]
2709impl<'de> serde::de::Deserialize<'de> for ListBackupsRequest {
2710    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2711    where
2712        D: serde::Deserializer<'de>,
2713    {
2714        #[allow(non_camel_case_types)]
2715        #[doc(hidden)]
2716        #[derive(PartialEq, Eq, Hash)]
2717        enum __FieldTag {
2718            __parent,
2719            __filter,
2720            __page_size,
2721            __page_token,
2722            Unknown(std::string::String),
2723        }
2724        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2725            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2726            where
2727                D: serde::Deserializer<'de>,
2728            {
2729                struct Visitor;
2730                impl<'de> serde::de::Visitor<'de> for Visitor {
2731                    type Value = __FieldTag;
2732                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2733                        formatter.write_str("a field name for ListBackupsRequest")
2734                    }
2735                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2736                    where
2737                        E: serde::de::Error,
2738                    {
2739                        use std::result::Result::Ok;
2740                        use std::string::ToString;
2741                        match value {
2742                            "parent" => Ok(__FieldTag::__parent),
2743                            "filter" => Ok(__FieldTag::__filter),
2744                            "pageSize" => Ok(__FieldTag::__page_size),
2745                            "page_size" => Ok(__FieldTag::__page_size),
2746                            "pageToken" => Ok(__FieldTag::__page_token),
2747                            "page_token" => Ok(__FieldTag::__page_token),
2748                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2749                        }
2750                    }
2751                }
2752                deserializer.deserialize_identifier(Visitor)
2753            }
2754        }
2755        struct Visitor;
2756        impl<'de> serde::de::Visitor<'de> for Visitor {
2757            type Value = ListBackupsRequest;
2758            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2759                formatter.write_str("struct ListBackupsRequest")
2760            }
2761            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2762            where
2763                A: serde::de::MapAccess<'de>,
2764            {
2765                #[allow(unused_imports)]
2766                use serde::de::Error;
2767                use std::option::Option::Some;
2768                let mut fields = std::collections::HashSet::new();
2769                let mut result = Self::Value::new();
2770                while let Some(tag) = map.next_key::<__FieldTag>()? {
2771                    #[allow(clippy::match_single_binding)]
2772                    match tag {
2773                        __FieldTag::__parent => {
2774                            if !fields.insert(__FieldTag::__parent) {
2775                                return std::result::Result::Err(A::Error::duplicate_field(
2776                                    "multiple values for parent",
2777                                ));
2778                            }
2779                            result.parent = map
2780                                .next_value::<std::option::Option<std::string::String>>()?
2781                                .unwrap_or_default();
2782                        }
2783                        __FieldTag::__filter => {
2784                            if !fields.insert(__FieldTag::__filter) {
2785                                return std::result::Result::Err(A::Error::duplicate_field(
2786                                    "multiple values for filter",
2787                                ));
2788                            }
2789                            result.filter = map
2790                                .next_value::<std::option::Option<std::string::String>>()?
2791                                .unwrap_or_default();
2792                        }
2793                        __FieldTag::__page_size => {
2794                            if !fields.insert(__FieldTag::__page_size) {
2795                                return std::result::Result::Err(A::Error::duplicate_field(
2796                                    "multiple values for page_size",
2797                                ));
2798                            }
2799                            struct __With(std::option::Option<i32>);
2800                            impl<'de> serde::de::Deserialize<'de> for __With {
2801                                fn deserialize<D>(
2802                                    deserializer: D,
2803                                ) -> std::result::Result<Self, D::Error>
2804                                where
2805                                    D: serde::de::Deserializer<'de>,
2806                                {
2807                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
2808                                }
2809                            }
2810                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
2811                        }
2812                        __FieldTag::__page_token => {
2813                            if !fields.insert(__FieldTag::__page_token) {
2814                                return std::result::Result::Err(A::Error::duplicate_field(
2815                                    "multiple values for page_token",
2816                                ));
2817                            }
2818                            result.page_token = map
2819                                .next_value::<std::option::Option<std::string::String>>()?
2820                                .unwrap_or_default();
2821                        }
2822                        __FieldTag::Unknown(key) => {
2823                            let value = map.next_value::<serde_json::Value>()?;
2824                            result._unknown_fields.insert(key, value);
2825                        }
2826                    }
2827                }
2828                std::result::Result::Ok(result)
2829            }
2830        }
2831        deserializer.deserialize_any(Visitor)
2832    }
2833}
2834
2835#[doc(hidden)]
2836impl serde::ser::Serialize for ListBackupsRequest {
2837    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2838    where
2839        S: serde::ser::Serializer,
2840    {
2841        use serde::ser::SerializeMap;
2842        #[allow(unused_imports)]
2843        use std::option::Option::Some;
2844        let mut state = serializer.serialize_map(std::option::Option::None)?;
2845        if !self.parent.is_empty() {
2846            state.serialize_entry("parent", &self.parent)?;
2847        }
2848        if !self.filter.is_empty() {
2849            state.serialize_entry("filter", &self.filter)?;
2850        }
2851        if !wkt::internal::is_default(&self.page_size) {
2852            struct __With<'a>(&'a i32);
2853            impl<'a> serde::ser::Serialize for __With<'a> {
2854                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2855                where
2856                    S: serde::ser::Serializer,
2857                {
2858                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
2859                }
2860            }
2861            state.serialize_entry("pageSize", &__With(&self.page_size))?;
2862        }
2863        if !self.page_token.is_empty() {
2864            state.serialize_entry("pageToken", &self.page_token)?;
2865        }
2866        if !self._unknown_fields.is_empty() {
2867            for (key, value) in self._unknown_fields.iter() {
2868                state.serialize_entry(key, &value)?;
2869            }
2870        }
2871        state.end()
2872    }
2873}
2874
2875impl std::fmt::Debug for ListBackupsRequest {
2876    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2877        let mut debug_struct = f.debug_struct("ListBackupsRequest");
2878        debug_struct.field("parent", &self.parent);
2879        debug_struct.field("filter", &self.filter);
2880        debug_struct.field("page_size", &self.page_size);
2881        debug_struct.field("page_token", &self.page_token);
2882        if !self._unknown_fields.is_empty() {
2883            debug_struct.field("_unknown_fields", &self._unknown_fields);
2884        }
2885        debug_struct.finish()
2886    }
2887}
2888
2889/// The response for
2890/// [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups].
2891///
2892/// [google.spanner.admin.database.v1.DatabaseAdmin.ListBackups]: crate::client::DatabaseAdmin::list_backups
2893#[derive(Clone, Default, PartialEq)]
2894#[non_exhaustive]
2895pub struct ListBackupsResponse {
2896    /// The list of matching backups. Backups returned are ordered by `create_time`
2897    /// in descending order, starting from the most recent `create_time`.
2898    pub backups: std::vec::Vec<crate::model::Backup>,
2899
2900    /// `next_page_token` can be sent in a subsequent
2901    /// [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups]
2902    /// call to fetch more of the matching backups.
2903    ///
2904    /// [google.spanner.admin.database.v1.DatabaseAdmin.ListBackups]: crate::client::DatabaseAdmin::list_backups
2905    pub next_page_token: std::string::String,
2906
2907    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2908}
2909
2910impl ListBackupsResponse {
2911    pub fn new() -> Self {
2912        std::default::Default::default()
2913    }
2914
2915    /// Sets the value of [backups][crate::model::ListBackupsResponse::backups].
2916    pub fn set_backups<T, V>(mut self, v: T) -> Self
2917    where
2918        T: std::iter::IntoIterator<Item = V>,
2919        V: std::convert::Into<crate::model::Backup>,
2920    {
2921        use std::iter::Iterator;
2922        self.backups = v.into_iter().map(|i| i.into()).collect();
2923        self
2924    }
2925
2926    /// Sets the value of [next_page_token][crate::model::ListBackupsResponse::next_page_token].
2927    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2928        self.next_page_token = v.into();
2929        self
2930    }
2931}
2932
2933impl wkt::message::Message for ListBackupsResponse {
2934    fn typename() -> &'static str {
2935        "type.googleapis.com/google.spanner.admin.database.v1.ListBackupsResponse"
2936    }
2937}
2938
2939#[doc(hidden)]
2940impl gax::paginator::internal::PageableResponse for ListBackupsResponse {
2941    type PageItem = crate::model::Backup;
2942
2943    fn items(self) -> std::vec::Vec<Self::PageItem> {
2944        self.backups
2945    }
2946
2947    fn next_page_token(&self) -> std::string::String {
2948        use std::clone::Clone;
2949        self.next_page_token.clone()
2950    }
2951}
2952
2953#[doc(hidden)]
2954impl<'de> serde::de::Deserialize<'de> for ListBackupsResponse {
2955    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2956    where
2957        D: serde::Deserializer<'de>,
2958    {
2959        #[allow(non_camel_case_types)]
2960        #[doc(hidden)]
2961        #[derive(PartialEq, Eq, Hash)]
2962        enum __FieldTag {
2963            __backups,
2964            __next_page_token,
2965            Unknown(std::string::String),
2966        }
2967        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2968            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2969            where
2970                D: serde::Deserializer<'de>,
2971            {
2972                struct Visitor;
2973                impl<'de> serde::de::Visitor<'de> for Visitor {
2974                    type Value = __FieldTag;
2975                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2976                        formatter.write_str("a field name for ListBackupsResponse")
2977                    }
2978                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2979                    where
2980                        E: serde::de::Error,
2981                    {
2982                        use std::result::Result::Ok;
2983                        use std::string::ToString;
2984                        match value {
2985                            "backups" => Ok(__FieldTag::__backups),
2986                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
2987                            "next_page_token" => Ok(__FieldTag::__next_page_token),
2988                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2989                        }
2990                    }
2991                }
2992                deserializer.deserialize_identifier(Visitor)
2993            }
2994        }
2995        struct Visitor;
2996        impl<'de> serde::de::Visitor<'de> for Visitor {
2997            type Value = ListBackupsResponse;
2998            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2999                formatter.write_str("struct ListBackupsResponse")
3000            }
3001            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3002            where
3003                A: serde::de::MapAccess<'de>,
3004            {
3005                #[allow(unused_imports)]
3006                use serde::de::Error;
3007                use std::option::Option::Some;
3008                let mut fields = std::collections::HashSet::new();
3009                let mut result = Self::Value::new();
3010                while let Some(tag) = map.next_key::<__FieldTag>()? {
3011                    #[allow(clippy::match_single_binding)]
3012                    match tag {
3013                        __FieldTag::__backups => {
3014                            if !fields.insert(__FieldTag::__backups) {
3015                                return std::result::Result::Err(A::Error::duplicate_field(
3016                                    "multiple values for backups",
3017                                ));
3018                            }
3019                            result.backups = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Backup>>>()?.unwrap_or_default();
3020                        }
3021                        __FieldTag::__next_page_token => {
3022                            if !fields.insert(__FieldTag::__next_page_token) {
3023                                return std::result::Result::Err(A::Error::duplicate_field(
3024                                    "multiple values for next_page_token",
3025                                ));
3026                            }
3027                            result.next_page_token = map
3028                                .next_value::<std::option::Option<std::string::String>>()?
3029                                .unwrap_or_default();
3030                        }
3031                        __FieldTag::Unknown(key) => {
3032                            let value = map.next_value::<serde_json::Value>()?;
3033                            result._unknown_fields.insert(key, value);
3034                        }
3035                    }
3036                }
3037                std::result::Result::Ok(result)
3038            }
3039        }
3040        deserializer.deserialize_any(Visitor)
3041    }
3042}
3043
3044#[doc(hidden)]
3045impl serde::ser::Serialize for ListBackupsResponse {
3046    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3047    where
3048        S: serde::ser::Serializer,
3049    {
3050        use serde::ser::SerializeMap;
3051        #[allow(unused_imports)]
3052        use std::option::Option::Some;
3053        let mut state = serializer.serialize_map(std::option::Option::None)?;
3054        if !self.backups.is_empty() {
3055            state.serialize_entry("backups", &self.backups)?;
3056        }
3057        if !self.next_page_token.is_empty() {
3058            state.serialize_entry("nextPageToken", &self.next_page_token)?;
3059        }
3060        if !self._unknown_fields.is_empty() {
3061            for (key, value) in self._unknown_fields.iter() {
3062                state.serialize_entry(key, &value)?;
3063            }
3064        }
3065        state.end()
3066    }
3067}
3068
3069impl std::fmt::Debug for ListBackupsResponse {
3070    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3071        let mut debug_struct = f.debug_struct("ListBackupsResponse");
3072        debug_struct.field("backups", &self.backups);
3073        debug_struct.field("next_page_token", &self.next_page_token);
3074        if !self._unknown_fields.is_empty() {
3075            debug_struct.field("_unknown_fields", &self._unknown_fields);
3076        }
3077        debug_struct.finish()
3078    }
3079}
3080
3081/// The request for
3082/// [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations].
3083///
3084/// [google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations]: crate::client::DatabaseAdmin::list_backup_operations
3085#[derive(Clone, Default, PartialEq)]
3086#[non_exhaustive]
3087pub struct ListBackupOperationsRequest {
3088    /// Required. The instance of the backup operations. Values are of
3089    /// the form `projects/<project>/instances/<instance>`.
3090    pub parent: std::string::String,
3091
3092    /// An expression that filters the list of returned backup operations.
3093    ///
3094    /// A filter expression consists of a field name, a
3095    /// comparison operator, and a value for filtering.
3096    /// The value must be a string, a number, or a boolean. The comparison operator
3097    /// must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
3098    /// Colon `:` is the contains operator. Filter rules are not case sensitive.
3099    ///
3100    /// The following fields in the [operation][google.longrunning.Operation]
3101    /// are eligible for filtering:
3102    ///
3103    /// * `name` - The name of the long-running operation
3104    /// * `done` - False if the operation is in progress, else true.
3105    /// * `metadata.@type` - the type of metadata. For example, the type string
3106    ///   for
3107    ///   [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]
3108    ///   is
3109    ///   `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`.
3110    /// * `metadata.<field_name>` - any field in metadata.value.
3111    ///   `metadata.@type` must be specified first if filtering on metadata
3112    ///   fields.
3113    /// * `error` - Error associated with the long-running operation.
3114    /// * `response.@type` - the type of response.
3115    /// * `response.<field_name>` - any field in response.value.
3116    ///
3117    /// You can combine multiple expressions by enclosing each expression in
3118    /// parentheses. By default, expressions are combined with AND logic, but
3119    /// you can specify AND, OR, and NOT logic explicitly.
3120    ///
3121    /// Here are a few examples:
3122    ///
3123    /// * `done:true` - The operation is complete.
3124    /// * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
3125    ///   `metadata.database:prod` - Returns operations where:
3126    ///   * The operation's metadata type is
3127    ///     [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata].
3128    ///   * The source database name of backup contains the string "prod".
3129    /// * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
3130    ///   `(metadata.name:howl) AND` \
3131    ///   `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
3132    ///   `(error:*)` - Returns operations where:
3133    ///   * The operation's metadata type is
3134    ///     [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata].
3135    ///   * The backup name contains the string "howl".
3136    ///   * The operation started before 2018-03-28T14:50:00Z.
3137    ///   * The operation resulted in an error.
3138    /// * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \
3139    ///   `(metadata.source_backup:test) AND` \
3140    ///   `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \
3141    ///   `(error:*)` - Returns operations where:
3142    ///   * The operation's metadata type is
3143    ///     [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata].
3144    ///   * The source backup name contains the string "test".
3145    ///   * The operation started before 2022-01-18T14:50:00Z.
3146    ///   * The operation resulted in an error.
3147    /// * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
3148    ///   `(metadata.database:test_db)) OR` \
3149    ///   `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata)
3150    ///   AND` \
3151    ///   `(metadata.source_backup:test_bkp)) AND` \
3152    ///   `(error:*)` - Returns operations where:
3153    ///   * The operation's metadata matches either of criteria:
3154    ///     * The operation's metadata type is
3155    ///       [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]
3156    ///       AND the source database name of the backup contains the string
3157    ///       "test_db"
3158    ///     * The operation's metadata type is
3159    ///       [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]
3160    ///       AND the source backup name contains the string "test_bkp"
3161    ///   * The operation resulted in an error.
3162    ///
3163    /// [google.longrunning.Operation]: longrunning::model::Operation
3164    /// [google.spanner.admin.database.v1.CopyBackupMetadata]: crate::model::CopyBackupMetadata
3165    /// [google.spanner.admin.database.v1.CreateBackupMetadata]: crate::model::CreateBackupMetadata
3166    pub filter: std::string::String,
3167
3168    /// Number of operations to be returned in the response. If 0 or
3169    /// less, defaults to the server's maximum allowed page size.
3170    pub page_size: i32,
3171
3172    /// If non-empty, `page_token` should contain a
3173    /// [next_page_token][google.spanner.admin.database.v1.ListBackupOperationsResponse.next_page_token]
3174    /// from a previous
3175    /// [ListBackupOperationsResponse][google.spanner.admin.database.v1.ListBackupOperationsResponse]
3176    /// to the same `parent` and with the same `filter`.
3177    ///
3178    /// [google.spanner.admin.database.v1.ListBackupOperationsResponse]: crate::model::ListBackupOperationsResponse
3179    /// [google.spanner.admin.database.v1.ListBackupOperationsResponse.next_page_token]: crate::model::ListBackupOperationsResponse::next_page_token
3180    pub page_token: std::string::String,
3181
3182    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3183}
3184
3185impl ListBackupOperationsRequest {
3186    pub fn new() -> Self {
3187        std::default::Default::default()
3188    }
3189
3190    /// Sets the value of [parent][crate::model::ListBackupOperationsRequest::parent].
3191    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3192        self.parent = v.into();
3193        self
3194    }
3195
3196    /// Sets the value of [filter][crate::model::ListBackupOperationsRequest::filter].
3197    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3198        self.filter = v.into();
3199        self
3200    }
3201
3202    /// Sets the value of [page_size][crate::model::ListBackupOperationsRequest::page_size].
3203    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3204        self.page_size = v.into();
3205        self
3206    }
3207
3208    /// Sets the value of [page_token][crate::model::ListBackupOperationsRequest::page_token].
3209    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3210        self.page_token = v.into();
3211        self
3212    }
3213}
3214
3215impl wkt::message::Message for ListBackupOperationsRequest {
3216    fn typename() -> &'static str {
3217        "type.googleapis.com/google.spanner.admin.database.v1.ListBackupOperationsRequest"
3218    }
3219}
3220
3221#[doc(hidden)]
3222impl<'de> serde::de::Deserialize<'de> for ListBackupOperationsRequest {
3223    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3224    where
3225        D: serde::Deserializer<'de>,
3226    {
3227        #[allow(non_camel_case_types)]
3228        #[doc(hidden)]
3229        #[derive(PartialEq, Eq, Hash)]
3230        enum __FieldTag {
3231            __parent,
3232            __filter,
3233            __page_size,
3234            __page_token,
3235            Unknown(std::string::String),
3236        }
3237        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3238            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3239            where
3240                D: serde::Deserializer<'de>,
3241            {
3242                struct Visitor;
3243                impl<'de> serde::de::Visitor<'de> for Visitor {
3244                    type Value = __FieldTag;
3245                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3246                        formatter.write_str("a field name for ListBackupOperationsRequest")
3247                    }
3248                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3249                    where
3250                        E: serde::de::Error,
3251                    {
3252                        use std::result::Result::Ok;
3253                        use std::string::ToString;
3254                        match value {
3255                            "parent" => Ok(__FieldTag::__parent),
3256                            "filter" => Ok(__FieldTag::__filter),
3257                            "pageSize" => Ok(__FieldTag::__page_size),
3258                            "page_size" => Ok(__FieldTag::__page_size),
3259                            "pageToken" => Ok(__FieldTag::__page_token),
3260                            "page_token" => Ok(__FieldTag::__page_token),
3261                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3262                        }
3263                    }
3264                }
3265                deserializer.deserialize_identifier(Visitor)
3266            }
3267        }
3268        struct Visitor;
3269        impl<'de> serde::de::Visitor<'de> for Visitor {
3270            type Value = ListBackupOperationsRequest;
3271            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3272                formatter.write_str("struct ListBackupOperationsRequest")
3273            }
3274            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3275            where
3276                A: serde::de::MapAccess<'de>,
3277            {
3278                #[allow(unused_imports)]
3279                use serde::de::Error;
3280                use std::option::Option::Some;
3281                let mut fields = std::collections::HashSet::new();
3282                let mut result = Self::Value::new();
3283                while let Some(tag) = map.next_key::<__FieldTag>()? {
3284                    #[allow(clippy::match_single_binding)]
3285                    match tag {
3286                        __FieldTag::__parent => {
3287                            if !fields.insert(__FieldTag::__parent) {
3288                                return std::result::Result::Err(A::Error::duplicate_field(
3289                                    "multiple values for parent",
3290                                ));
3291                            }
3292                            result.parent = map
3293                                .next_value::<std::option::Option<std::string::String>>()?
3294                                .unwrap_or_default();
3295                        }
3296                        __FieldTag::__filter => {
3297                            if !fields.insert(__FieldTag::__filter) {
3298                                return std::result::Result::Err(A::Error::duplicate_field(
3299                                    "multiple values for filter",
3300                                ));
3301                            }
3302                            result.filter = map
3303                                .next_value::<std::option::Option<std::string::String>>()?
3304                                .unwrap_or_default();
3305                        }
3306                        __FieldTag::__page_size => {
3307                            if !fields.insert(__FieldTag::__page_size) {
3308                                return std::result::Result::Err(A::Error::duplicate_field(
3309                                    "multiple values for page_size",
3310                                ));
3311                            }
3312                            struct __With(std::option::Option<i32>);
3313                            impl<'de> serde::de::Deserialize<'de> for __With {
3314                                fn deserialize<D>(
3315                                    deserializer: D,
3316                                ) -> std::result::Result<Self, D::Error>
3317                                where
3318                                    D: serde::de::Deserializer<'de>,
3319                                {
3320                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3321                                }
3322                            }
3323                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
3324                        }
3325                        __FieldTag::__page_token => {
3326                            if !fields.insert(__FieldTag::__page_token) {
3327                                return std::result::Result::Err(A::Error::duplicate_field(
3328                                    "multiple values for page_token",
3329                                ));
3330                            }
3331                            result.page_token = map
3332                                .next_value::<std::option::Option<std::string::String>>()?
3333                                .unwrap_or_default();
3334                        }
3335                        __FieldTag::Unknown(key) => {
3336                            let value = map.next_value::<serde_json::Value>()?;
3337                            result._unknown_fields.insert(key, value);
3338                        }
3339                    }
3340                }
3341                std::result::Result::Ok(result)
3342            }
3343        }
3344        deserializer.deserialize_any(Visitor)
3345    }
3346}
3347
3348#[doc(hidden)]
3349impl serde::ser::Serialize for ListBackupOperationsRequest {
3350    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3351    where
3352        S: serde::ser::Serializer,
3353    {
3354        use serde::ser::SerializeMap;
3355        #[allow(unused_imports)]
3356        use std::option::Option::Some;
3357        let mut state = serializer.serialize_map(std::option::Option::None)?;
3358        if !self.parent.is_empty() {
3359            state.serialize_entry("parent", &self.parent)?;
3360        }
3361        if !self.filter.is_empty() {
3362            state.serialize_entry("filter", &self.filter)?;
3363        }
3364        if !wkt::internal::is_default(&self.page_size) {
3365            struct __With<'a>(&'a i32);
3366            impl<'a> serde::ser::Serialize for __With<'a> {
3367                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3368                where
3369                    S: serde::ser::Serializer,
3370                {
3371                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3372                }
3373            }
3374            state.serialize_entry("pageSize", &__With(&self.page_size))?;
3375        }
3376        if !self.page_token.is_empty() {
3377            state.serialize_entry("pageToken", &self.page_token)?;
3378        }
3379        if !self._unknown_fields.is_empty() {
3380            for (key, value) in self._unknown_fields.iter() {
3381                state.serialize_entry(key, &value)?;
3382            }
3383        }
3384        state.end()
3385    }
3386}
3387
3388impl std::fmt::Debug for ListBackupOperationsRequest {
3389    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3390        let mut debug_struct = f.debug_struct("ListBackupOperationsRequest");
3391        debug_struct.field("parent", &self.parent);
3392        debug_struct.field("filter", &self.filter);
3393        debug_struct.field("page_size", &self.page_size);
3394        debug_struct.field("page_token", &self.page_token);
3395        if !self._unknown_fields.is_empty() {
3396            debug_struct.field("_unknown_fields", &self._unknown_fields);
3397        }
3398        debug_struct.finish()
3399    }
3400}
3401
3402/// The response for
3403/// [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations].
3404///
3405/// [google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations]: crate::client::DatabaseAdmin::list_backup_operations
3406#[derive(Clone, Default, PartialEq)]
3407#[non_exhaustive]
3408pub struct ListBackupOperationsResponse {
3409    /// The list of matching backup [long-running
3410    /// operations][google.longrunning.Operation]. Each operation's name will be
3411    /// prefixed by the backup's name. The operation's
3412    /// [metadata][google.longrunning.Operation.metadata] field type
3413    /// `metadata.type_url` describes the type of the metadata. Operations returned
3414    /// include those that are pending or have completed/failed/canceled within the
3415    /// last 7 days. Operations returned are ordered by
3416    /// `operation.metadata.value.progress.start_time` in descending order starting
3417    /// from the most recently started operation.
3418    ///
3419    /// [google.longrunning.Operation]: longrunning::model::Operation
3420    /// [google.longrunning.Operation.metadata]: longrunning::model::Operation::metadata
3421    pub operations: std::vec::Vec<longrunning::model::Operation>,
3422
3423    /// `next_page_token` can be sent in a subsequent
3424    /// [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations]
3425    /// call to fetch more of the matching metadata.
3426    ///
3427    /// [google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations]: crate::client::DatabaseAdmin::list_backup_operations
3428    pub next_page_token: std::string::String,
3429
3430    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3431}
3432
3433impl ListBackupOperationsResponse {
3434    pub fn new() -> Self {
3435        std::default::Default::default()
3436    }
3437
3438    /// Sets the value of [operations][crate::model::ListBackupOperationsResponse::operations].
3439    pub fn set_operations<T, V>(mut self, v: T) -> Self
3440    where
3441        T: std::iter::IntoIterator<Item = V>,
3442        V: std::convert::Into<longrunning::model::Operation>,
3443    {
3444        use std::iter::Iterator;
3445        self.operations = v.into_iter().map(|i| i.into()).collect();
3446        self
3447    }
3448
3449    /// Sets the value of [next_page_token][crate::model::ListBackupOperationsResponse::next_page_token].
3450    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3451        self.next_page_token = v.into();
3452        self
3453    }
3454}
3455
3456impl wkt::message::Message for ListBackupOperationsResponse {
3457    fn typename() -> &'static str {
3458        "type.googleapis.com/google.spanner.admin.database.v1.ListBackupOperationsResponse"
3459    }
3460}
3461
3462#[doc(hidden)]
3463impl gax::paginator::internal::PageableResponse for ListBackupOperationsResponse {
3464    type PageItem = longrunning::model::Operation;
3465
3466    fn items(self) -> std::vec::Vec<Self::PageItem> {
3467        self.operations
3468    }
3469
3470    fn next_page_token(&self) -> std::string::String {
3471        use std::clone::Clone;
3472        self.next_page_token.clone()
3473    }
3474}
3475
3476#[doc(hidden)]
3477impl<'de> serde::de::Deserialize<'de> for ListBackupOperationsResponse {
3478    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3479    where
3480        D: serde::Deserializer<'de>,
3481    {
3482        #[allow(non_camel_case_types)]
3483        #[doc(hidden)]
3484        #[derive(PartialEq, Eq, Hash)]
3485        enum __FieldTag {
3486            __operations,
3487            __next_page_token,
3488            Unknown(std::string::String),
3489        }
3490        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3491            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3492            where
3493                D: serde::Deserializer<'de>,
3494            {
3495                struct Visitor;
3496                impl<'de> serde::de::Visitor<'de> for Visitor {
3497                    type Value = __FieldTag;
3498                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3499                        formatter.write_str("a field name for ListBackupOperationsResponse")
3500                    }
3501                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3502                    where
3503                        E: serde::de::Error,
3504                    {
3505                        use std::result::Result::Ok;
3506                        use std::string::ToString;
3507                        match value {
3508                            "operations" => Ok(__FieldTag::__operations),
3509                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
3510                            "next_page_token" => Ok(__FieldTag::__next_page_token),
3511                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3512                        }
3513                    }
3514                }
3515                deserializer.deserialize_identifier(Visitor)
3516            }
3517        }
3518        struct Visitor;
3519        impl<'de> serde::de::Visitor<'de> for Visitor {
3520            type Value = ListBackupOperationsResponse;
3521            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3522                formatter.write_str("struct ListBackupOperationsResponse")
3523            }
3524            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3525            where
3526                A: serde::de::MapAccess<'de>,
3527            {
3528                #[allow(unused_imports)]
3529                use serde::de::Error;
3530                use std::option::Option::Some;
3531                let mut fields = std::collections::HashSet::new();
3532                let mut result = Self::Value::new();
3533                while let Some(tag) = map.next_key::<__FieldTag>()? {
3534                    #[allow(clippy::match_single_binding)]
3535                    match tag {
3536                        __FieldTag::__operations => {
3537                            if !fields.insert(__FieldTag::__operations) {
3538                                return std::result::Result::Err(A::Error::duplicate_field(
3539                                    "multiple values for operations",
3540                                ));
3541                            }
3542                            result.operations =
3543                                map.next_value::<std::option::Option<
3544                                    std::vec::Vec<longrunning::model::Operation>,
3545                                >>()?
3546                                .unwrap_or_default();
3547                        }
3548                        __FieldTag::__next_page_token => {
3549                            if !fields.insert(__FieldTag::__next_page_token) {
3550                                return std::result::Result::Err(A::Error::duplicate_field(
3551                                    "multiple values for next_page_token",
3552                                ));
3553                            }
3554                            result.next_page_token = map
3555                                .next_value::<std::option::Option<std::string::String>>()?
3556                                .unwrap_or_default();
3557                        }
3558                        __FieldTag::Unknown(key) => {
3559                            let value = map.next_value::<serde_json::Value>()?;
3560                            result._unknown_fields.insert(key, value);
3561                        }
3562                    }
3563                }
3564                std::result::Result::Ok(result)
3565            }
3566        }
3567        deserializer.deserialize_any(Visitor)
3568    }
3569}
3570
3571#[doc(hidden)]
3572impl serde::ser::Serialize for ListBackupOperationsResponse {
3573    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3574    where
3575        S: serde::ser::Serializer,
3576    {
3577        use serde::ser::SerializeMap;
3578        #[allow(unused_imports)]
3579        use std::option::Option::Some;
3580        let mut state = serializer.serialize_map(std::option::Option::None)?;
3581        if !self.operations.is_empty() {
3582            state.serialize_entry("operations", &self.operations)?;
3583        }
3584        if !self.next_page_token.is_empty() {
3585            state.serialize_entry("nextPageToken", &self.next_page_token)?;
3586        }
3587        if !self._unknown_fields.is_empty() {
3588            for (key, value) in self._unknown_fields.iter() {
3589                state.serialize_entry(key, &value)?;
3590            }
3591        }
3592        state.end()
3593    }
3594}
3595
3596impl std::fmt::Debug for ListBackupOperationsResponse {
3597    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3598        let mut debug_struct = f.debug_struct("ListBackupOperationsResponse");
3599        debug_struct.field("operations", &self.operations);
3600        debug_struct.field("next_page_token", &self.next_page_token);
3601        if !self._unknown_fields.is_empty() {
3602            debug_struct.field("_unknown_fields", &self._unknown_fields);
3603        }
3604        debug_struct.finish()
3605    }
3606}
3607
3608/// Information about a backup.
3609#[derive(Clone, Default, PartialEq)]
3610#[non_exhaustive]
3611pub struct BackupInfo {
3612    /// Name of the backup.
3613    pub backup: std::string::String,
3614
3615    /// The backup contains an externally consistent copy of `source_database` at
3616    /// the timestamp specified by `version_time`. If the
3617    /// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
3618    /// request did not specify `version_time`, the `version_time` of the backup is
3619    /// equivalent to the `create_time`.
3620    ///
3621    /// [google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]: crate::client::DatabaseAdmin::create_backup
3622    pub version_time: std::option::Option<wkt::Timestamp>,
3623
3624    /// The time the
3625    /// [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
3626    /// request was received.
3627    ///
3628    /// [google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]: crate::client::DatabaseAdmin::create_backup
3629    pub create_time: std::option::Option<wkt::Timestamp>,
3630
3631    /// Name of the database the backup was created from.
3632    pub source_database: std::string::String,
3633
3634    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3635}
3636
3637impl BackupInfo {
3638    pub fn new() -> Self {
3639        std::default::Default::default()
3640    }
3641
3642    /// Sets the value of [backup][crate::model::BackupInfo::backup].
3643    pub fn set_backup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3644        self.backup = v.into();
3645        self
3646    }
3647
3648    /// Sets the value of [version_time][crate::model::BackupInfo::version_time].
3649    pub fn set_version_time<T>(mut self, v: T) -> Self
3650    where
3651        T: std::convert::Into<wkt::Timestamp>,
3652    {
3653        self.version_time = std::option::Option::Some(v.into());
3654        self
3655    }
3656
3657    /// Sets or clears the value of [version_time][crate::model::BackupInfo::version_time].
3658    pub fn set_or_clear_version_time<T>(mut self, v: std::option::Option<T>) -> Self
3659    where
3660        T: std::convert::Into<wkt::Timestamp>,
3661    {
3662        self.version_time = v.map(|x| x.into());
3663        self
3664    }
3665
3666    /// Sets the value of [create_time][crate::model::BackupInfo::create_time].
3667    pub fn set_create_time<T>(mut self, v: T) -> Self
3668    where
3669        T: std::convert::Into<wkt::Timestamp>,
3670    {
3671        self.create_time = std::option::Option::Some(v.into());
3672        self
3673    }
3674
3675    /// Sets or clears the value of [create_time][crate::model::BackupInfo::create_time].
3676    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3677    where
3678        T: std::convert::Into<wkt::Timestamp>,
3679    {
3680        self.create_time = v.map(|x| x.into());
3681        self
3682    }
3683
3684    /// Sets the value of [source_database][crate::model::BackupInfo::source_database].
3685    pub fn set_source_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3686        self.source_database = v.into();
3687        self
3688    }
3689}
3690
3691impl wkt::message::Message for BackupInfo {
3692    fn typename() -> &'static str {
3693        "type.googleapis.com/google.spanner.admin.database.v1.BackupInfo"
3694    }
3695}
3696
3697#[doc(hidden)]
3698impl<'de> serde::de::Deserialize<'de> for BackupInfo {
3699    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3700    where
3701        D: serde::Deserializer<'de>,
3702    {
3703        #[allow(non_camel_case_types)]
3704        #[doc(hidden)]
3705        #[derive(PartialEq, Eq, Hash)]
3706        enum __FieldTag {
3707            __backup,
3708            __version_time,
3709            __create_time,
3710            __source_database,
3711            Unknown(std::string::String),
3712        }
3713        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3714            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3715            where
3716                D: serde::Deserializer<'de>,
3717            {
3718                struct Visitor;
3719                impl<'de> serde::de::Visitor<'de> for Visitor {
3720                    type Value = __FieldTag;
3721                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3722                        formatter.write_str("a field name for BackupInfo")
3723                    }
3724                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3725                    where
3726                        E: serde::de::Error,
3727                    {
3728                        use std::result::Result::Ok;
3729                        use std::string::ToString;
3730                        match value {
3731                            "backup" => Ok(__FieldTag::__backup),
3732                            "versionTime" => Ok(__FieldTag::__version_time),
3733                            "version_time" => Ok(__FieldTag::__version_time),
3734                            "createTime" => Ok(__FieldTag::__create_time),
3735                            "create_time" => Ok(__FieldTag::__create_time),
3736                            "sourceDatabase" => Ok(__FieldTag::__source_database),
3737                            "source_database" => Ok(__FieldTag::__source_database),
3738                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3739                        }
3740                    }
3741                }
3742                deserializer.deserialize_identifier(Visitor)
3743            }
3744        }
3745        struct Visitor;
3746        impl<'de> serde::de::Visitor<'de> for Visitor {
3747            type Value = BackupInfo;
3748            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3749                formatter.write_str("struct BackupInfo")
3750            }
3751            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3752            where
3753                A: serde::de::MapAccess<'de>,
3754            {
3755                #[allow(unused_imports)]
3756                use serde::de::Error;
3757                use std::option::Option::Some;
3758                let mut fields = std::collections::HashSet::new();
3759                let mut result = Self::Value::new();
3760                while let Some(tag) = map.next_key::<__FieldTag>()? {
3761                    #[allow(clippy::match_single_binding)]
3762                    match tag {
3763                        __FieldTag::__backup => {
3764                            if !fields.insert(__FieldTag::__backup) {
3765                                return std::result::Result::Err(A::Error::duplicate_field(
3766                                    "multiple values for backup",
3767                                ));
3768                            }
3769                            result.backup = map
3770                                .next_value::<std::option::Option<std::string::String>>()?
3771                                .unwrap_or_default();
3772                        }
3773                        __FieldTag::__version_time => {
3774                            if !fields.insert(__FieldTag::__version_time) {
3775                                return std::result::Result::Err(A::Error::duplicate_field(
3776                                    "multiple values for version_time",
3777                                ));
3778                            }
3779                            result.version_time =
3780                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
3781                        }
3782                        __FieldTag::__create_time => {
3783                            if !fields.insert(__FieldTag::__create_time) {
3784                                return std::result::Result::Err(A::Error::duplicate_field(
3785                                    "multiple values for create_time",
3786                                ));
3787                            }
3788                            result.create_time =
3789                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
3790                        }
3791                        __FieldTag::__source_database => {
3792                            if !fields.insert(__FieldTag::__source_database) {
3793                                return std::result::Result::Err(A::Error::duplicate_field(
3794                                    "multiple values for source_database",
3795                                ));
3796                            }
3797                            result.source_database = map
3798                                .next_value::<std::option::Option<std::string::String>>()?
3799                                .unwrap_or_default();
3800                        }
3801                        __FieldTag::Unknown(key) => {
3802                            let value = map.next_value::<serde_json::Value>()?;
3803                            result._unknown_fields.insert(key, value);
3804                        }
3805                    }
3806                }
3807                std::result::Result::Ok(result)
3808            }
3809        }
3810        deserializer.deserialize_any(Visitor)
3811    }
3812}
3813
3814#[doc(hidden)]
3815impl serde::ser::Serialize for BackupInfo {
3816    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3817    where
3818        S: serde::ser::Serializer,
3819    {
3820        use serde::ser::SerializeMap;
3821        #[allow(unused_imports)]
3822        use std::option::Option::Some;
3823        let mut state = serializer.serialize_map(std::option::Option::None)?;
3824        if !self.backup.is_empty() {
3825            state.serialize_entry("backup", &self.backup)?;
3826        }
3827        if self.version_time.is_some() {
3828            state.serialize_entry("versionTime", &self.version_time)?;
3829        }
3830        if self.create_time.is_some() {
3831            state.serialize_entry("createTime", &self.create_time)?;
3832        }
3833        if !self.source_database.is_empty() {
3834            state.serialize_entry("sourceDatabase", &self.source_database)?;
3835        }
3836        if !self._unknown_fields.is_empty() {
3837            for (key, value) in self._unknown_fields.iter() {
3838                state.serialize_entry(key, &value)?;
3839            }
3840        }
3841        state.end()
3842    }
3843}
3844
3845impl std::fmt::Debug for BackupInfo {
3846    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3847        let mut debug_struct = f.debug_struct("BackupInfo");
3848        debug_struct.field("backup", &self.backup);
3849        debug_struct.field("version_time", &self.version_time);
3850        debug_struct.field("create_time", &self.create_time);
3851        debug_struct.field("source_database", &self.source_database);
3852        if !self._unknown_fields.is_empty() {
3853            debug_struct.field("_unknown_fields", &self._unknown_fields);
3854        }
3855        debug_struct.finish()
3856    }
3857}
3858
3859/// Encryption configuration for the backup to create.
3860#[derive(Clone, Default, PartialEq)]
3861#[non_exhaustive]
3862pub struct CreateBackupEncryptionConfig {
3863    /// Required. The encryption type of the backup.
3864    pub encryption_type: crate::model::create_backup_encryption_config::EncryptionType,
3865
3866    /// Optional. The Cloud KMS key that will be used to protect the backup.
3867    /// This field should be set only when
3868    /// [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type]
3869    /// is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form
3870    /// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
3871    ///
3872    /// [google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type]: crate::model::CreateBackupEncryptionConfig::encryption_type
3873    pub kms_key_name: std::string::String,
3874
3875    /// Optional. Specifies the KMS configuration for the one or more keys used to
3876    /// protect the backup. Values are of the form
3877    /// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
3878    ///
3879    /// The keys referenced by kms_key_names must fully cover all
3880    /// regions of the backup's instance configuration. Some examples:
3881    ///
3882    /// * For single region instance configs, specify a single regional
3883    ///   location KMS key.
3884    /// * For multi-regional instance configs of type GOOGLE_MANAGED,
3885    ///   either specify a multi-regional location KMS key or multiple regional
3886    ///   location KMS keys that cover all regions in the instance config.
3887    /// * For an instance config of type USER_MANAGED, please specify only
3888    ///   regional location KMS keys to cover each region in the instance config.
3889    ///   Multi-regional location KMS keys are not supported for USER_MANAGED
3890    ///   instance configs.
3891    pub kms_key_names: std::vec::Vec<std::string::String>,
3892
3893    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3894}
3895
3896impl CreateBackupEncryptionConfig {
3897    pub fn new() -> Self {
3898        std::default::Default::default()
3899    }
3900
3901    /// Sets the value of [encryption_type][crate::model::CreateBackupEncryptionConfig::encryption_type].
3902    pub fn set_encryption_type<
3903        T: std::convert::Into<crate::model::create_backup_encryption_config::EncryptionType>,
3904    >(
3905        mut self,
3906        v: T,
3907    ) -> Self {
3908        self.encryption_type = v.into();
3909        self
3910    }
3911
3912    /// Sets the value of [kms_key_name][crate::model::CreateBackupEncryptionConfig::kms_key_name].
3913    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3914        self.kms_key_name = v.into();
3915        self
3916    }
3917
3918    /// Sets the value of [kms_key_names][crate::model::CreateBackupEncryptionConfig::kms_key_names].
3919    pub fn set_kms_key_names<T, V>(mut self, v: T) -> Self
3920    where
3921        T: std::iter::IntoIterator<Item = V>,
3922        V: std::convert::Into<std::string::String>,
3923    {
3924        use std::iter::Iterator;
3925        self.kms_key_names = v.into_iter().map(|i| i.into()).collect();
3926        self
3927    }
3928}
3929
3930impl wkt::message::Message for CreateBackupEncryptionConfig {
3931    fn typename() -> &'static str {
3932        "type.googleapis.com/google.spanner.admin.database.v1.CreateBackupEncryptionConfig"
3933    }
3934}
3935
3936#[doc(hidden)]
3937impl<'de> serde::de::Deserialize<'de> for CreateBackupEncryptionConfig {
3938    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3939    where
3940        D: serde::Deserializer<'de>,
3941    {
3942        #[allow(non_camel_case_types)]
3943        #[doc(hidden)]
3944        #[derive(PartialEq, Eq, Hash)]
3945        enum __FieldTag {
3946            __encryption_type,
3947            __kms_key_name,
3948            __kms_key_names,
3949            Unknown(std::string::String),
3950        }
3951        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3952            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3953            where
3954                D: serde::Deserializer<'de>,
3955            {
3956                struct Visitor;
3957                impl<'de> serde::de::Visitor<'de> for Visitor {
3958                    type Value = __FieldTag;
3959                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3960                        formatter.write_str("a field name for CreateBackupEncryptionConfig")
3961                    }
3962                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3963                    where
3964                        E: serde::de::Error,
3965                    {
3966                        use std::result::Result::Ok;
3967                        use std::string::ToString;
3968                        match value {
3969                            "encryptionType" => Ok(__FieldTag::__encryption_type),
3970                            "encryption_type" => Ok(__FieldTag::__encryption_type),
3971                            "kmsKeyName" => Ok(__FieldTag::__kms_key_name),
3972                            "kms_key_name" => Ok(__FieldTag::__kms_key_name),
3973                            "kmsKeyNames" => Ok(__FieldTag::__kms_key_names),
3974                            "kms_key_names" => Ok(__FieldTag::__kms_key_names),
3975                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3976                        }
3977                    }
3978                }
3979                deserializer.deserialize_identifier(Visitor)
3980            }
3981        }
3982        struct Visitor;
3983        impl<'de> serde::de::Visitor<'de> for Visitor {
3984            type Value = CreateBackupEncryptionConfig;
3985            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3986                formatter.write_str("struct CreateBackupEncryptionConfig")
3987            }
3988            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3989            where
3990                A: serde::de::MapAccess<'de>,
3991            {
3992                #[allow(unused_imports)]
3993                use serde::de::Error;
3994                use std::option::Option::Some;
3995                let mut fields = std::collections::HashSet::new();
3996                let mut result = Self::Value::new();
3997                while let Some(tag) = map.next_key::<__FieldTag>()? {
3998                    #[allow(clippy::match_single_binding)]
3999                    match tag {
4000                        __FieldTag::__encryption_type => {
4001                            if !fields.insert(__FieldTag::__encryption_type) {
4002                                return std::result::Result::Err(A::Error::duplicate_field(
4003                                    "multiple values for encryption_type",
4004                                ));
4005                            }
4006                            result.encryption_type = map
4007                                .next_value::<std::option::Option<
4008                                    crate::model::create_backup_encryption_config::EncryptionType,
4009                                >>()?
4010                                .unwrap_or_default();
4011                        }
4012                        __FieldTag::__kms_key_name => {
4013                            if !fields.insert(__FieldTag::__kms_key_name) {
4014                                return std::result::Result::Err(A::Error::duplicate_field(
4015                                    "multiple values for kms_key_name",
4016                                ));
4017                            }
4018                            result.kms_key_name = map
4019                                .next_value::<std::option::Option<std::string::String>>()?
4020                                .unwrap_or_default();
4021                        }
4022                        __FieldTag::__kms_key_names => {
4023                            if !fields.insert(__FieldTag::__kms_key_names) {
4024                                return std::result::Result::Err(A::Error::duplicate_field(
4025                                    "multiple values for kms_key_names",
4026                                ));
4027                            }
4028                            result.kms_key_names = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
4029                        }
4030                        __FieldTag::Unknown(key) => {
4031                            let value = map.next_value::<serde_json::Value>()?;
4032                            result._unknown_fields.insert(key, value);
4033                        }
4034                    }
4035                }
4036                std::result::Result::Ok(result)
4037            }
4038        }
4039        deserializer.deserialize_any(Visitor)
4040    }
4041}
4042
4043#[doc(hidden)]
4044impl serde::ser::Serialize for CreateBackupEncryptionConfig {
4045    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4046    where
4047        S: serde::ser::Serializer,
4048    {
4049        use serde::ser::SerializeMap;
4050        #[allow(unused_imports)]
4051        use std::option::Option::Some;
4052        let mut state = serializer.serialize_map(std::option::Option::None)?;
4053        if !wkt::internal::is_default(&self.encryption_type) {
4054            state.serialize_entry("encryptionType", &self.encryption_type)?;
4055        }
4056        if !self.kms_key_name.is_empty() {
4057            state.serialize_entry("kmsKeyName", &self.kms_key_name)?;
4058        }
4059        if !self.kms_key_names.is_empty() {
4060            state.serialize_entry("kmsKeyNames", &self.kms_key_names)?;
4061        }
4062        if !self._unknown_fields.is_empty() {
4063            for (key, value) in self._unknown_fields.iter() {
4064                state.serialize_entry(key, &value)?;
4065            }
4066        }
4067        state.end()
4068    }
4069}
4070
4071impl std::fmt::Debug for CreateBackupEncryptionConfig {
4072    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4073        let mut debug_struct = f.debug_struct("CreateBackupEncryptionConfig");
4074        debug_struct.field("encryption_type", &self.encryption_type);
4075        debug_struct.field("kms_key_name", &self.kms_key_name);
4076        debug_struct.field("kms_key_names", &self.kms_key_names);
4077        if !self._unknown_fields.is_empty() {
4078            debug_struct.field("_unknown_fields", &self._unknown_fields);
4079        }
4080        debug_struct.finish()
4081    }
4082}
4083
4084/// Defines additional types related to [CreateBackupEncryptionConfig].
4085pub mod create_backup_encryption_config {
4086    #[allow(unused_imports)]
4087    use super::*;
4088
4089    /// Encryption types for the backup.
4090    ///
4091    /// # Working with unknown values
4092    ///
4093    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4094    /// additional enum variants at any time. Adding new variants is not considered
4095    /// a breaking change. Applications should write their code in anticipation of:
4096    ///
4097    /// - New values appearing in future releases of the client library, **and**
4098    /// - New values received dynamically, without application changes.
4099    ///
4100    /// Please consult the [Working with enums] section in the user guide for some
4101    /// guidelines.
4102    ///
4103    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4104    #[derive(Clone, Debug, PartialEq)]
4105    #[non_exhaustive]
4106    pub enum EncryptionType {
4107        /// Unspecified. Do not use.
4108        Unspecified,
4109        /// Use the same encryption configuration as the database. This is the
4110        /// default option when
4111        /// [encryption_config][google.spanner.admin.database.v1.CreateBackupEncryptionConfig]
4112        /// is empty. For example, if the database is using
4113        /// `Customer_Managed_Encryption`, the backup will be using the same Cloud
4114        /// KMS key as the database.
4115        ///
4116        /// [google.spanner.admin.database.v1.CreateBackupEncryptionConfig]: crate::model::CreateBackupEncryptionConfig
4117        UseDatabaseEncryption,
4118        /// Use Google default encryption.
4119        GoogleDefaultEncryption,
4120        /// Use customer managed encryption. If specified, `kms_key_name`
4121        /// must contain a valid Cloud KMS key.
4122        CustomerManagedEncryption,
4123        /// If set, the enum was initialized with an unknown value.
4124        ///
4125        /// Applications can examine the value using [EncryptionType::value] or
4126        /// [EncryptionType::name].
4127        UnknownValue(encryption_type::UnknownValue),
4128    }
4129
4130    #[doc(hidden)]
4131    pub mod encryption_type {
4132        #[allow(unused_imports)]
4133        use super::*;
4134        #[derive(Clone, Debug, PartialEq)]
4135        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4136    }
4137
4138    impl EncryptionType {
4139        /// Gets the enum value.
4140        ///
4141        /// Returns `None` if the enum contains an unknown value deserialized from
4142        /// the string representation of enums.
4143        pub fn value(&self) -> std::option::Option<i32> {
4144            match self {
4145                Self::Unspecified => std::option::Option::Some(0),
4146                Self::UseDatabaseEncryption => std::option::Option::Some(1),
4147                Self::GoogleDefaultEncryption => std::option::Option::Some(2),
4148                Self::CustomerManagedEncryption => std::option::Option::Some(3),
4149                Self::UnknownValue(u) => u.0.value(),
4150            }
4151        }
4152
4153        /// Gets the enum value as a string.
4154        ///
4155        /// Returns `None` if the enum contains an unknown value deserialized from
4156        /// the integer representation of enums.
4157        pub fn name(&self) -> std::option::Option<&str> {
4158            match self {
4159                Self::Unspecified => std::option::Option::Some("ENCRYPTION_TYPE_UNSPECIFIED"),
4160                Self::UseDatabaseEncryption => std::option::Option::Some("USE_DATABASE_ENCRYPTION"),
4161                Self::GoogleDefaultEncryption => {
4162                    std::option::Option::Some("GOOGLE_DEFAULT_ENCRYPTION")
4163                }
4164                Self::CustomerManagedEncryption => {
4165                    std::option::Option::Some("CUSTOMER_MANAGED_ENCRYPTION")
4166                }
4167                Self::UnknownValue(u) => u.0.name(),
4168            }
4169        }
4170    }
4171
4172    impl std::default::Default for EncryptionType {
4173        fn default() -> Self {
4174            use std::convert::From;
4175            Self::from(0)
4176        }
4177    }
4178
4179    impl std::fmt::Display for EncryptionType {
4180        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4181            wkt::internal::display_enum(f, self.name(), self.value())
4182        }
4183    }
4184
4185    impl std::convert::From<i32> for EncryptionType {
4186        fn from(value: i32) -> Self {
4187            match value {
4188                0 => Self::Unspecified,
4189                1 => Self::UseDatabaseEncryption,
4190                2 => Self::GoogleDefaultEncryption,
4191                3 => Self::CustomerManagedEncryption,
4192                _ => Self::UnknownValue(encryption_type::UnknownValue(
4193                    wkt::internal::UnknownEnumValue::Integer(value),
4194                )),
4195            }
4196        }
4197    }
4198
4199    impl std::convert::From<&str> for EncryptionType {
4200        fn from(value: &str) -> Self {
4201            use std::string::ToString;
4202            match value {
4203                "ENCRYPTION_TYPE_UNSPECIFIED" => Self::Unspecified,
4204                "USE_DATABASE_ENCRYPTION" => Self::UseDatabaseEncryption,
4205                "GOOGLE_DEFAULT_ENCRYPTION" => Self::GoogleDefaultEncryption,
4206                "CUSTOMER_MANAGED_ENCRYPTION" => Self::CustomerManagedEncryption,
4207                _ => Self::UnknownValue(encryption_type::UnknownValue(
4208                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4209                )),
4210            }
4211        }
4212    }
4213
4214    impl serde::ser::Serialize for EncryptionType {
4215        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4216        where
4217            S: serde::Serializer,
4218        {
4219            match self {
4220                Self::Unspecified => serializer.serialize_i32(0),
4221                Self::UseDatabaseEncryption => serializer.serialize_i32(1),
4222                Self::GoogleDefaultEncryption => serializer.serialize_i32(2),
4223                Self::CustomerManagedEncryption => serializer.serialize_i32(3),
4224                Self::UnknownValue(u) => u.0.serialize(serializer),
4225            }
4226        }
4227    }
4228
4229    impl<'de> serde::de::Deserialize<'de> for EncryptionType {
4230        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4231        where
4232            D: serde::Deserializer<'de>,
4233        {
4234            deserializer.deserialize_any(wkt::internal::EnumVisitor::<EncryptionType>::new(
4235                ".google.spanner.admin.database.v1.CreateBackupEncryptionConfig.EncryptionType",
4236            ))
4237        }
4238    }
4239}
4240
4241/// Encryption configuration for the copied backup.
4242#[derive(Clone, Default, PartialEq)]
4243#[non_exhaustive]
4244pub struct CopyBackupEncryptionConfig {
4245    /// Required. The encryption type of the backup.
4246    pub encryption_type: crate::model::copy_backup_encryption_config::EncryptionType,
4247
4248    /// Optional. The Cloud KMS key that will be used to protect the backup.
4249    /// This field should be set only when
4250    /// [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type]
4251    /// is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form
4252    /// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
4253    ///
4254    /// [google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type]: crate::model::CopyBackupEncryptionConfig::encryption_type
4255    pub kms_key_name: std::string::String,
4256
4257    /// Optional. Specifies the KMS configuration for the one or more keys used to
4258    /// protect the backup. Values are of the form
4259    /// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
4260    /// Kms keys specified can be in any order.
4261    ///
4262    /// The keys referenced by kms_key_names must fully cover all
4263    /// regions of the backup's instance configuration. Some examples:
4264    ///
4265    /// * For single region instance configs, specify a single regional
4266    ///   location KMS key.
4267    /// * For multi-regional instance configs of type GOOGLE_MANAGED,
4268    ///   either specify a multi-regional location KMS key or multiple regional
4269    ///   location KMS keys that cover all regions in the instance config.
4270    /// * For an instance config of type USER_MANAGED, please specify only
4271    ///   regional location KMS keys to cover each region in the instance config.
4272    ///   Multi-regional location KMS keys are not supported for USER_MANAGED
4273    ///   instance configs.
4274    pub kms_key_names: std::vec::Vec<std::string::String>,
4275
4276    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4277}
4278
4279impl CopyBackupEncryptionConfig {
4280    pub fn new() -> Self {
4281        std::default::Default::default()
4282    }
4283
4284    /// Sets the value of [encryption_type][crate::model::CopyBackupEncryptionConfig::encryption_type].
4285    pub fn set_encryption_type<
4286        T: std::convert::Into<crate::model::copy_backup_encryption_config::EncryptionType>,
4287    >(
4288        mut self,
4289        v: T,
4290    ) -> Self {
4291        self.encryption_type = v.into();
4292        self
4293    }
4294
4295    /// Sets the value of [kms_key_name][crate::model::CopyBackupEncryptionConfig::kms_key_name].
4296    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4297        self.kms_key_name = v.into();
4298        self
4299    }
4300
4301    /// Sets the value of [kms_key_names][crate::model::CopyBackupEncryptionConfig::kms_key_names].
4302    pub fn set_kms_key_names<T, V>(mut self, v: T) -> Self
4303    where
4304        T: std::iter::IntoIterator<Item = V>,
4305        V: std::convert::Into<std::string::String>,
4306    {
4307        use std::iter::Iterator;
4308        self.kms_key_names = v.into_iter().map(|i| i.into()).collect();
4309        self
4310    }
4311}
4312
4313impl wkt::message::Message for CopyBackupEncryptionConfig {
4314    fn typename() -> &'static str {
4315        "type.googleapis.com/google.spanner.admin.database.v1.CopyBackupEncryptionConfig"
4316    }
4317}
4318
4319#[doc(hidden)]
4320impl<'de> serde::de::Deserialize<'de> for CopyBackupEncryptionConfig {
4321    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4322    where
4323        D: serde::Deserializer<'de>,
4324    {
4325        #[allow(non_camel_case_types)]
4326        #[doc(hidden)]
4327        #[derive(PartialEq, Eq, Hash)]
4328        enum __FieldTag {
4329            __encryption_type,
4330            __kms_key_name,
4331            __kms_key_names,
4332            Unknown(std::string::String),
4333        }
4334        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4335            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4336            where
4337                D: serde::Deserializer<'de>,
4338            {
4339                struct Visitor;
4340                impl<'de> serde::de::Visitor<'de> for Visitor {
4341                    type Value = __FieldTag;
4342                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4343                        formatter.write_str("a field name for CopyBackupEncryptionConfig")
4344                    }
4345                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4346                    where
4347                        E: serde::de::Error,
4348                    {
4349                        use std::result::Result::Ok;
4350                        use std::string::ToString;
4351                        match value {
4352                            "encryptionType" => Ok(__FieldTag::__encryption_type),
4353                            "encryption_type" => Ok(__FieldTag::__encryption_type),
4354                            "kmsKeyName" => Ok(__FieldTag::__kms_key_name),
4355                            "kms_key_name" => Ok(__FieldTag::__kms_key_name),
4356                            "kmsKeyNames" => Ok(__FieldTag::__kms_key_names),
4357                            "kms_key_names" => Ok(__FieldTag::__kms_key_names),
4358                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4359                        }
4360                    }
4361                }
4362                deserializer.deserialize_identifier(Visitor)
4363            }
4364        }
4365        struct Visitor;
4366        impl<'de> serde::de::Visitor<'de> for Visitor {
4367            type Value = CopyBackupEncryptionConfig;
4368            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4369                formatter.write_str("struct CopyBackupEncryptionConfig")
4370            }
4371            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4372            where
4373                A: serde::de::MapAccess<'de>,
4374            {
4375                #[allow(unused_imports)]
4376                use serde::de::Error;
4377                use std::option::Option::Some;
4378                let mut fields = std::collections::HashSet::new();
4379                let mut result = Self::Value::new();
4380                while let Some(tag) = map.next_key::<__FieldTag>()? {
4381                    #[allow(clippy::match_single_binding)]
4382                    match tag {
4383                        __FieldTag::__encryption_type => {
4384                            if !fields.insert(__FieldTag::__encryption_type) {
4385                                return std::result::Result::Err(A::Error::duplicate_field(
4386                                    "multiple values for encryption_type",
4387                                ));
4388                            }
4389                            result.encryption_type = map
4390                                .next_value::<std::option::Option<
4391                                    crate::model::copy_backup_encryption_config::EncryptionType,
4392                                >>()?
4393                                .unwrap_or_default();
4394                        }
4395                        __FieldTag::__kms_key_name => {
4396                            if !fields.insert(__FieldTag::__kms_key_name) {
4397                                return std::result::Result::Err(A::Error::duplicate_field(
4398                                    "multiple values for kms_key_name",
4399                                ));
4400                            }
4401                            result.kms_key_name = map
4402                                .next_value::<std::option::Option<std::string::String>>()?
4403                                .unwrap_or_default();
4404                        }
4405                        __FieldTag::__kms_key_names => {
4406                            if !fields.insert(__FieldTag::__kms_key_names) {
4407                                return std::result::Result::Err(A::Error::duplicate_field(
4408                                    "multiple values for kms_key_names",
4409                                ));
4410                            }
4411                            result.kms_key_names = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
4412                        }
4413                        __FieldTag::Unknown(key) => {
4414                            let value = map.next_value::<serde_json::Value>()?;
4415                            result._unknown_fields.insert(key, value);
4416                        }
4417                    }
4418                }
4419                std::result::Result::Ok(result)
4420            }
4421        }
4422        deserializer.deserialize_any(Visitor)
4423    }
4424}
4425
4426#[doc(hidden)]
4427impl serde::ser::Serialize for CopyBackupEncryptionConfig {
4428    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4429    where
4430        S: serde::ser::Serializer,
4431    {
4432        use serde::ser::SerializeMap;
4433        #[allow(unused_imports)]
4434        use std::option::Option::Some;
4435        let mut state = serializer.serialize_map(std::option::Option::None)?;
4436        if !wkt::internal::is_default(&self.encryption_type) {
4437            state.serialize_entry("encryptionType", &self.encryption_type)?;
4438        }
4439        if !self.kms_key_name.is_empty() {
4440            state.serialize_entry("kmsKeyName", &self.kms_key_name)?;
4441        }
4442        if !self.kms_key_names.is_empty() {
4443            state.serialize_entry("kmsKeyNames", &self.kms_key_names)?;
4444        }
4445        if !self._unknown_fields.is_empty() {
4446            for (key, value) in self._unknown_fields.iter() {
4447                state.serialize_entry(key, &value)?;
4448            }
4449        }
4450        state.end()
4451    }
4452}
4453
4454impl std::fmt::Debug for CopyBackupEncryptionConfig {
4455    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4456        let mut debug_struct = f.debug_struct("CopyBackupEncryptionConfig");
4457        debug_struct.field("encryption_type", &self.encryption_type);
4458        debug_struct.field("kms_key_name", &self.kms_key_name);
4459        debug_struct.field("kms_key_names", &self.kms_key_names);
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/// Defines additional types related to [CopyBackupEncryptionConfig].
4468pub mod copy_backup_encryption_config {
4469    #[allow(unused_imports)]
4470    use super::*;
4471
4472    /// Encryption types for the backup.
4473    ///
4474    /// # Working with unknown values
4475    ///
4476    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4477    /// additional enum variants at any time. Adding new variants is not considered
4478    /// a breaking change. Applications should write their code in anticipation of:
4479    ///
4480    /// - New values appearing in future releases of the client library, **and**
4481    /// - New values received dynamically, without application changes.
4482    ///
4483    /// Please consult the [Working with enums] section in the user guide for some
4484    /// guidelines.
4485    ///
4486    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4487    #[derive(Clone, Debug, PartialEq)]
4488    #[non_exhaustive]
4489    pub enum EncryptionType {
4490        /// Unspecified. Do not use.
4491        Unspecified,
4492        /// This is the default option for
4493        /// [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup]
4494        /// when
4495        /// [encryption_config][google.spanner.admin.database.v1.CopyBackupEncryptionConfig]
4496        /// is not specified. For example, if the source backup is using
4497        /// `Customer_Managed_Encryption`, the backup will be using the same Cloud
4498        /// KMS key as the source backup.
4499        ///
4500        /// [google.spanner.admin.database.v1.CopyBackupEncryptionConfig]: crate::model::CopyBackupEncryptionConfig
4501        /// [google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup]: crate::client::DatabaseAdmin::copy_backup
4502        UseConfigDefaultOrBackupEncryption,
4503        /// Use Google default encryption.
4504        GoogleDefaultEncryption,
4505        /// Use customer managed encryption. If specified, either `kms_key_name` or
4506        /// `kms_key_names` must contain valid Cloud KMS key(s).
4507        CustomerManagedEncryption,
4508        /// If set, the enum was initialized with an unknown value.
4509        ///
4510        /// Applications can examine the value using [EncryptionType::value] or
4511        /// [EncryptionType::name].
4512        UnknownValue(encryption_type::UnknownValue),
4513    }
4514
4515    #[doc(hidden)]
4516    pub mod encryption_type {
4517        #[allow(unused_imports)]
4518        use super::*;
4519        #[derive(Clone, Debug, PartialEq)]
4520        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4521    }
4522
4523    impl EncryptionType {
4524        /// Gets the enum value.
4525        ///
4526        /// Returns `None` if the enum contains an unknown value deserialized from
4527        /// the string representation of enums.
4528        pub fn value(&self) -> std::option::Option<i32> {
4529            match self {
4530                Self::Unspecified => std::option::Option::Some(0),
4531                Self::UseConfigDefaultOrBackupEncryption => std::option::Option::Some(1),
4532                Self::GoogleDefaultEncryption => std::option::Option::Some(2),
4533                Self::CustomerManagedEncryption => std::option::Option::Some(3),
4534                Self::UnknownValue(u) => u.0.value(),
4535            }
4536        }
4537
4538        /// Gets the enum value as a string.
4539        ///
4540        /// Returns `None` if the enum contains an unknown value deserialized from
4541        /// the integer representation of enums.
4542        pub fn name(&self) -> std::option::Option<&str> {
4543            match self {
4544                Self::Unspecified => std::option::Option::Some("ENCRYPTION_TYPE_UNSPECIFIED"),
4545                Self::UseConfigDefaultOrBackupEncryption => {
4546                    std::option::Option::Some("USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION")
4547                }
4548                Self::GoogleDefaultEncryption => {
4549                    std::option::Option::Some("GOOGLE_DEFAULT_ENCRYPTION")
4550                }
4551                Self::CustomerManagedEncryption => {
4552                    std::option::Option::Some("CUSTOMER_MANAGED_ENCRYPTION")
4553                }
4554                Self::UnknownValue(u) => u.0.name(),
4555            }
4556        }
4557    }
4558
4559    impl std::default::Default for EncryptionType {
4560        fn default() -> Self {
4561            use std::convert::From;
4562            Self::from(0)
4563        }
4564    }
4565
4566    impl std::fmt::Display for EncryptionType {
4567        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4568            wkt::internal::display_enum(f, self.name(), self.value())
4569        }
4570    }
4571
4572    impl std::convert::From<i32> for EncryptionType {
4573        fn from(value: i32) -> Self {
4574            match value {
4575                0 => Self::Unspecified,
4576                1 => Self::UseConfigDefaultOrBackupEncryption,
4577                2 => Self::GoogleDefaultEncryption,
4578                3 => Self::CustomerManagedEncryption,
4579                _ => Self::UnknownValue(encryption_type::UnknownValue(
4580                    wkt::internal::UnknownEnumValue::Integer(value),
4581                )),
4582            }
4583        }
4584    }
4585
4586    impl std::convert::From<&str> for EncryptionType {
4587        fn from(value: &str) -> Self {
4588            use std::string::ToString;
4589            match value {
4590                "ENCRYPTION_TYPE_UNSPECIFIED" => Self::Unspecified,
4591                "USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION" => {
4592                    Self::UseConfigDefaultOrBackupEncryption
4593                }
4594                "GOOGLE_DEFAULT_ENCRYPTION" => Self::GoogleDefaultEncryption,
4595                "CUSTOMER_MANAGED_ENCRYPTION" => Self::CustomerManagedEncryption,
4596                _ => Self::UnknownValue(encryption_type::UnknownValue(
4597                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4598                )),
4599            }
4600        }
4601    }
4602
4603    impl serde::ser::Serialize for EncryptionType {
4604        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4605        where
4606            S: serde::Serializer,
4607        {
4608            match self {
4609                Self::Unspecified => serializer.serialize_i32(0),
4610                Self::UseConfigDefaultOrBackupEncryption => serializer.serialize_i32(1),
4611                Self::GoogleDefaultEncryption => serializer.serialize_i32(2),
4612                Self::CustomerManagedEncryption => serializer.serialize_i32(3),
4613                Self::UnknownValue(u) => u.0.serialize(serializer),
4614            }
4615        }
4616    }
4617
4618    impl<'de> serde::de::Deserialize<'de> for EncryptionType {
4619        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4620        where
4621            D: serde::Deserializer<'de>,
4622        {
4623            deserializer.deserialize_any(wkt::internal::EnumVisitor::<EncryptionType>::new(
4624                ".google.spanner.admin.database.v1.CopyBackupEncryptionConfig.EncryptionType",
4625            ))
4626        }
4627    }
4628}
4629
4630/// The specification for full backups.
4631/// A full backup stores the entire contents of the database at a given
4632/// version time.
4633#[derive(Clone, Default, PartialEq)]
4634#[non_exhaustive]
4635pub struct FullBackupSpec {
4636    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4637}
4638
4639impl FullBackupSpec {
4640    pub fn new() -> Self {
4641        std::default::Default::default()
4642    }
4643}
4644
4645impl wkt::message::Message for FullBackupSpec {
4646    fn typename() -> &'static str {
4647        "type.googleapis.com/google.spanner.admin.database.v1.FullBackupSpec"
4648    }
4649}
4650
4651#[doc(hidden)]
4652impl<'de> serde::de::Deserialize<'de> for FullBackupSpec {
4653    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4654    where
4655        D: serde::Deserializer<'de>,
4656    {
4657        #[allow(non_camel_case_types)]
4658        #[doc(hidden)]
4659        #[derive(PartialEq, Eq, Hash)]
4660        enum __FieldTag {
4661            Unknown(std::string::String),
4662        }
4663        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4664            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4665            where
4666                D: serde::Deserializer<'de>,
4667            {
4668                struct Visitor;
4669                impl<'de> serde::de::Visitor<'de> for Visitor {
4670                    type Value = __FieldTag;
4671                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4672                        formatter.write_str("a field name for FullBackupSpec")
4673                    }
4674                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4675                    where
4676                        E: serde::de::Error,
4677                    {
4678                        use std::result::Result::Ok;
4679                        use std::string::ToString;
4680                        Ok(__FieldTag::Unknown(value.to_string()))
4681                    }
4682                }
4683                deserializer.deserialize_identifier(Visitor)
4684            }
4685        }
4686        struct Visitor;
4687        impl<'de> serde::de::Visitor<'de> for Visitor {
4688            type Value = FullBackupSpec;
4689            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4690                formatter.write_str("struct FullBackupSpec")
4691            }
4692            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4693            where
4694                A: serde::de::MapAccess<'de>,
4695            {
4696                #[allow(unused_imports)]
4697                use serde::de::Error;
4698                use std::option::Option::Some;
4699                let mut result = Self::Value::new();
4700                while let Some(tag) = map.next_key::<__FieldTag>()? {
4701                    #[allow(clippy::match_single_binding)]
4702                    match tag {
4703                        __FieldTag::Unknown(key) => {
4704                            let value = map.next_value::<serde_json::Value>()?;
4705                            result._unknown_fields.insert(key, value);
4706                        }
4707                    }
4708                }
4709                std::result::Result::Ok(result)
4710            }
4711        }
4712        deserializer.deserialize_any(Visitor)
4713    }
4714}
4715
4716#[doc(hidden)]
4717impl serde::ser::Serialize for FullBackupSpec {
4718    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4719    where
4720        S: serde::ser::Serializer,
4721    {
4722        use serde::ser::SerializeMap;
4723        #[allow(unused_imports)]
4724        use std::option::Option::Some;
4725        let mut state = serializer.serialize_map(std::option::Option::None)?;
4726        if !self._unknown_fields.is_empty() {
4727            for (key, value) in self._unknown_fields.iter() {
4728                state.serialize_entry(key, &value)?;
4729            }
4730        }
4731        state.end()
4732    }
4733}
4734
4735impl std::fmt::Debug for FullBackupSpec {
4736    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4737        let mut debug_struct = f.debug_struct("FullBackupSpec");
4738        if !self._unknown_fields.is_empty() {
4739            debug_struct.field("_unknown_fields", &self._unknown_fields);
4740        }
4741        debug_struct.finish()
4742    }
4743}
4744
4745/// The specification for incremental backup chains.
4746/// An incremental backup stores the delta of changes between a previous
4747/// backup and the database contents at a given version time. An
4748/// incremental backup chain consists of a full backup and zero or more
4749/// successive incremental backups. The first backup created for an
4750/// incremental backup chain is always a full backup.
4751#[derive(Clone, Default, PartialEq)]
4752#[non_exhaustive]
4753pub struct IncrementalBackupSpec {
4754    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4755}
4756
4757impl IncrementalBackupSpec {
4758    pub fn new() -> Self {
4759        std::default::Default::default()
4760    }
4761}
4762
4763impl wkt::message::Message for IncrementalBackupSpec {
4764    fn typename() -> &'static str {
4765        "type.googleapis.com/google.spanner.admin.database.v1.IncrementalBackupSpec"
4766    }
4767}
4768
4769#[doc(hidden)]
4770impl<'de> serde::de::Deserialize<'de> for IncrementalBackupSpec {
4771    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4772    where
4773        D: serde::Deserializer<'de>,
4774    {
4775        #[allow(non_camel_case_types)]
4776        #[doc(hidden)]
4777        #[derive(PartialEq, Eq, Hash)]
4778        enum __FieldTag {
4779            Unknown(std::string::String),
4780        }
4781        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4782            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4783            where
4784                D: serde::Deserializer<'de>,
4785            {
4786                struct Visitor;
4787                impl<'de> serde::de::Visitor<'de> for Visitor {
4788                    type Value = __FieldTag;
4789                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4790                        formatter.write_str("a field name for IncrementalBackupSpec")
4791                    }
4792                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4793                    where
4794                        E: serde::de::Error,
4795                    {
4796                        use std::result::Result::Ok;
4797                        use std::string::ToString;
4798                        Ok(__FieldTag::Unknown(value.to_string()))
4799                    }
4800                }
4801                deserializer.deserialize_identifier(Visitor)
4802            }
4803        }
4804        struct Visitor;
4805        impl<'de> serde::de::Visitor<'de> for Visitor {
4806            type Value = IncrementalBackupSpec;
4807            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4808                formatter.write_str("struct IncrementalBackupSpec")
4809            }
4810            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4811            where
4812                A: serde::de::MapAccess<'de>,
4813            {
4814                #[allow(unused_imports)]
4815                use serde::de::Error;
4816                use std::option::Option::Some;
4817                let mut result = Self::Value::new();
4818                while let Some(tag) = map.next_key::<__FieldTag>()? {
4819                    #[allow(clippy::match_single_binding)]
4820                    match tag {
4821                        __FieldTag::Unknown(key) => {
4822                            let value = map.next_value::<serde_json::Value>()?;
4823                            result._unknown_fields.insert(key, value);
4824                        }
4825                    }
4826                }
4827                std::result::Result::Ok(result)
4828            }
4829        }
4830        deserializer.deserialize_any(Visitor)
4831    }
4832}
4833
4834#[doc(hidden)]
4835impl serde::ser::Serialize for IncrementalBackupSpec {
4836    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4837    where
4838        S: serde::ser::Serializer,
4839    {
4840        use serde::ser::SerializeMap;
4841        #[allow(unused_imports)]
4842        use std::option::Option::Some;
4843        let mut state = serializer.serialize_map(std::option::Option::None)?;
4844        if !self._unknown_fields.is_empty() {
4845            for (key, value) in self._unknown_fields.iter() {
4846                state.serialize_entry(key, &value)?;
4847            }
4848        }
4849        state.end()
4850    }
4851}
4852
4853impl std::fmt::Debug for IncrementalBackupSpec {
4854    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4855        let mut debug_struct = f.debug_struct("IncrementalBackupSpec");
4856        if !self._unknown_fields.is_empty() {
4857            debug_struct.field("_unknown_fields", &self._unknown_fields);
4858        }
4859        debug_struct.finish()
4860    }
4861}
4862
4863/// Instance partition information for the backup.
4864#[derive(Clone, Default, PartialEq)]
4865#[non_exhaustive]
4866pub struct BackupInstancePartition {
4867    /// A unique identifier for the instance partition. Values are of the form
4868    /// `projects/<project>/instances/<instance>/instancePartitions/<instance_partition_id>`
4869    pub instance_partition: std::string::String,
4870
4871    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4872}
4873
4874impl BackupInstancePartition {
4875    pub fn new() -> Self {
4876        std::default::Default::default()
4877    }
4878
4879    /// Sets the value of [instance_partition][crate::model::BackupInstancePartition::instance_partition].
4880    pub fn set_instance_partition<T: std::convert::Into<std::string::String>>(
4881        mut self,
4882        v: T,
4883    ) -> Self {
4884        self.instance_partition = v.into();
4885        self
4886    }
4887}
4888
4889impl wkt::message::Message for BackupInstancePartition {
4890    fn typename() -> &'static str {
4891        "type.googleapis.com/google.spanner.admin.database.v1.BackupInstancePartition"
4892    }
4893}
4894
4895#[doc(hidden)]
4896impl<'de> serde::de::Deserialize<'de> for BackupInstancePartition {
4897    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4898    where
4899        D: serde::Deserializer<'de>,
4900    {
4901        #[allow(non_camel_case_types)]
4902        #[doc(hidden)]
4903        #[derive(PartialEq, Eq, Hash)]
4904        enum __FieldTag {
4905            __instance_partition,
4906            Unknown(std::string::String),
4907        }
4908        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4909            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4910            where
4911                D: serde::Deserializer<'de>,
4912            {
4913                struct Visitor;
4914                impl<'de> serde::de::Visitor<'de> for Visitor {
4915                    type Value = __FieldTag;
4916                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4917                        formatter.write_str("a field name for BackupInstancePartition")
4918                    }
4919                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4920                    where
4921                        E: serde::de::Error,
4922                    {
4923                        use std::result::Result::Ok;
4924                        use std::string::ToString;
4925                        match value {
4926                            "instancePartition" => Ok(__FieldTag::__instance_partition),
4927                            "instance_partition" => Ok(__FieldTag::__instance_partition),
4928                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4929                        }
4930                    }
4931                }
4932                deserializer.deserialize_identifier(Visitor)
4933            }
4934        }
4935        struct Visitor;
4936        impl<'de> serde::de::Visitor<'de> for Visitor {
4937            type Value = BackupInstancePartition;
4938            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4939                formatter.write_str("struct BackupInstancePartition")
4940            }
4941            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4942            where
4943                A: serde::de::MapAccess<'de>,
4944            {
4945                #[allow(unused_imports)]
4946                use serde::de::Error;
4947                use std::option::Option::Some;
4948                let mut fields = std::collections::HashSet::new();
4949                let mut result = Self::Value::new();
4950                while let Some(tag) = map.next_key::<__FieldTag>()? {
4951                    #[allow(clippy::match_single_binding)]
4952                    match tag {
4953                        __FieldTag::__instance_partition => {
4954                            if !fields.insert(__FieldTag::__instance_partition) {
4955                                return std::result::Result::Err(A::Error::duplicate_field(
4956                                    "multiple values for instance_partition",
4957                                ));
4958                            }
4959                            result.instance_partition = map
4960                                .next_value::<std::option::Option<std::string::String>>()?
4961                                .unwrap_or_default();
4962                        }
4963                        __FieldTag::Unknown(key) => {
4964                            let value = map.next_value::<serde_json::Value>()?;
4965                            result._unknown_fields.insert(key, value);
4966                        }
4967                    }
4968                }
4969                std::result::Result::Ok(result)
4970            }
4971        }
4972        deserializer.deserialize_any(Visitor)
4973    }
4974}
4975
4976#[doc(hidden)]
4977impl serde::ser::Serialize for BackupInstancePartition {
4978    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4979    where
4980        S: serde::ser::Serializer,
4981    {
4982        use serde::ser::SerializeMap;
4983        #[allow(unused_imports)]
4984        use std::option::Option::Some;
4985        let mut state = serializer.serialize_map(std::option::Option::None)?;
4986        if !self.instance_partition.is_empty() {
4987            state.serialize_entry("instancePartition", &self.instance_partition)?;
4988        }
4989        if !self._unknown_fields.is_empty() {
4990            for (key, value) in self._unknown_fields.iter() {
4991                state.serialize_entry(key, &value)?;
4992            }
4993        }
4994        state.end()
4995    }
4996}
4997
4998impl std::fmt::Debug for BackupInstancePartition {
4999    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5000        let mut debug_struct = f.debug_struct("BackupInstancePartition");
5001        debug_struct.field("instance_partition", &self.instance_partition);
5002        if !self._unknown_fields.is_empty() {
5003            debug_struct.field("_unknown_fields", &self._unknown_fields);
5004        }
5005        debug_struct.finish()
5006    }
5007}
5008
5009/// Defines specifications of the backup schedule.
5010#[derive(Clone, Default, PartialEq)]
5011#[non_exhaustive]
5012pub struct BackupScheduleSpec {
5013    /// Required.
5014    pub schedule_spec: std::option::Option<crate::model::backup_schedule_spec::ScheduleSpec>,
5015
5016    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5017}
5018
5019impl BackupScheduleSpec {
5020    pub fn new() -> Self {
5021        std::default::Default::default()
5022    }
5023
5024    /// Sets the value of [schedule_spec][crate::model::BackupScheduleSpec::schedule_spec].
5025    ///
5026    /// Note that all the setters affecting `schedule_spec` are mutually
5027    /// exclusive.
5028    pub fn set_schedule_spec<
5029        T: std::convert::Into<std::option::Option<crate::model::backup_schedule_spec::ScheduleSpec>>,
5030    >(
5031        mut self,
5032        v: T,
5033    ) -> Self {
5034        self.schedule_spec = v.into();
5035        self
5036    }
5037
5038    /// The value of [schedule_spec][crate::model::BackupScheduleSpec::schedule_spec]
5039    /// if it holds a `CronSpec`, `None` if the field is not set or
5040    /// holds a different branch.
5041    pub fn cron_spec(&self) -> std::option::Option<&std::boxed::Box<crate::model::CrontabSpec>> {
5042        #[allow(unreachable_patterns)]
5043        self.schedule_spec.as_ref().and_then(|v| match v {
5044            crate::model::backup_schedule_spec::ScheduleSpec::CronSpec(v) => {
5045                std::option::Option::Some(v)
5046            }
5047            _ => std::option::Option::None,
5048        })
5049    }
5050
5051    /// Sets the value of [schedule_spec][crate::model::BackupScheduleSpec::schedule_spec]
5052    /// to hold a `CronSpec`.
5053    ///
5054    /// Note that all the setters affecting `schedule_spec` are
5055    /// mutually exclusive.
5056    pub fn set_cron_spec<T: std::convert::Into<std::boxed::Box<crate::model::CrontabSpec>>>(
5057        mut self,
5058        v: T,
5059    ) -> Self {
5060        self.schedule_spec = std::option::Option::Some(
5061            crate::model::backup_schedule_spec::ScheduleSpec::CronSpec(v.into()),
5062        );
5063        self
5064    }
5065}
5066
5067impl wkt::message::Message for BackupScheduleSpec {
5068    fn typename() -> &'static str {
5069        "type.googleapis.com/google.spanner.admin.database.v1.BackupScheduleSpec"
5070    }
5071}
5072
5073#[doc(hidden)]
5074impl<'de> serde::de::Deserialize<'de> for BackupScheduleSpec {
5075    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5076    where
5077        D: serde::Deserializer<'de>,
5078    {
5079        #[allow(non_camel_case_types)]
5080        #[doc(hidden)]
5081        #[derive(PartialEq, Eq, Hash)]
5082        enum __FieldTag {
5083            __cron_spec,
5084            Unknown(std::string::String),
5085        }
5086        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5087            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5088            where
5089                D: serde::Deserializer<'de>,
5090            {
5091                struct Visitor;
5092                impl<'de> serde::de::Visitor<'de> for Visitor {
5093                    type Value = __FieldTag;
5094                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5095                        formatter.write_str("a field name for BackupScheduleSpec")
5096                    }
5097                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5098                    where
5099                        E: serde::de::Error,
5100                    {
5101                        use std::result::Result::Ok;
5102                        use std::string::ToString;
5103                        match value {
5104                            "cronSpec" => Ok(__FieldTag::__cron_spec),
5105                            "cron_spec" => Ok(__FieldTag::__cron_spec),
5106                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5107                        }
5108                    }
5109                }
5110                deserializer.deserialize_identifier(Visitor)
5111            }
5112        }
5113        struct Visitor;
5114        impl<'de> serde::de::Visitor<'de> for Visitor {
5115            type Value = BackupScheduleSpec;
5116            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5117                formatter.write_str("struct BackupScheduleSpec")
5118            }
5119            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5120            where
5121                A: serde::de::MapAccess<'de>,
5122            {
5123                #[allow(unused_imports)]
5124                use serde::de::Error;
5125                use std::option::Option::Some;
5126                let mut fields = std::collections::HashSet::new();
5127                let mut result = Self::Value::new();
5128                while let Some(tag) = map.next_key::<__FieldTag>()? {
5129                    #[allow(clippy::match_single_binding)]
5130                    match tag {
5131                        __FieldTag::__cron_spec => {
5132                            if !fields.insert(__FieldTag::__cron_spec) {
5133                                return std::result::Result::Err(A::Error::duplicate_field(
5134                                    "multiple values for cron_spec",
5135                                ));
5136                            }
5137                            if result.schedule_spec.is_some() {
5138                                return std::result::Result::Err(A::Error::duplicate_field(
5139                                    "multiple values for `schedule_spec`, a oneof with full ID .google.spanner.admin.database.v1.BackupScheduleSpec.cron_spec, latest field was cronSpec",
5140                                ));
5141                            }
5142                            result.schedule_spec = std::option::Option::Some(
5143                                crate::model::backup_schedule_spec::ScheduleSpec::CronSpec(
5144                                    map.next_value::<std::option::Option<
5145                                        std::boxed::Box<crate::model::CrontabSpec>,
5146                                    >>()?
5147                                    .unwrap_or_default(),
5148                                ),
5149                            );
5150                        }
5151                        __FieldTag::Unknown(key) => {
5152                            let value = map.next_value::<serde_json::Value>()?;
5153                            result._unknown_fields.insert(key, value);
5154                        }
5155                    }
5156                }
5157                std::result::Result::Ok(result)
5158            }
5159        }
5160        deserializer.deserialize_any(Visitor)
5161    }
5162}
5163
5164#[doc(hidden)]
5165impl serde::ser::Serialize for BackupScheduleSpec {
5166    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5167    where
5168        S: serde::ser::Serializer,
5169    {
5170        use serde::ser::SerializeMap;
5171        #[allow(unused_imports)]
5172        use std::option::Option::Some;
5173        let mut state = serializer.serialize_map(std::option::Option::None)?;
5174        if let Some(value) = self.cron_spec() {
5175            state.serialize_entry("cronSpec", value)?;
5176        }
5177        if !self._unknown_fields.is_empty() {
5178            for (key, value) in self._unknown_fields.iter() {
5179                state.serialize_entry(key, &value)?;
5180            }
5181        }
5182        state.end()
5183    }
5184}
5185
5186impl std::fmt::Debug for BackupScheduleSpec {
5187    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5188        let mut debug_struct = f.debug_struct("BackupScheduleSpec");
5189        debug_struct.field("schedule_spec", &self.schedule_spec);
5190        if !self._unknown_fields.is_empty() {
5191            debug_struct.field("_unknown_fields", &self._unknown_fields);
5192        }
5193        debug_struct.finish()
5194    }
5195}
5196
5197/// Defines additional types related to [BackupScheduleSpec].
5198pub mod backup_schedule_spec {
5199    #[allow(unused_imports)]
5200    use super::*;
5201
5202    /// Required.
5203    #[derive(Clone, Debug, PartialEq)]
5204    #[non_exhaustive]
5205    pub enum ScheduleSpec {
5206        /// Cron style schedule specification.
5207        CronSpec(std::boxed::Box<crate::model::CrontabSpec>),
5208    }
5209}
5210
5211/// BackupSchedule expresses the automated backup creation specification for a
5212/// Spanner database.
5213/// Next ID: 10
5214#[derive(Clone, Default, PartialEq)]
5215#[non_exhaustive]
5216pub struct BackupSchedule {
5217    /// Identifier. Output only for the
5218    /// [CreateBackupSchedule][DatabaseAdmin.CreateBackupSchededule] operation.
5219    /// Required for the
5220    /// [UpdateBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule]
5221    /// operation. A globally unique identifier for the backup schedule which
5222    /// cannot be changed. Values are of the form
5223    /// `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/[a-z][a-z0-9_\-]*[a-z0-9]`
5224    /// The final segment of the name must be between 2 and 60 characters in
5225    /// length.
5226    ///
5227    /// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule]: crate::client::DatabaseAdmin::update_backup_schedule
5228    pub name: std::string::String,
5229
5230    /// Optional. The schedule specification based on which the backup creations
5231    /// are triggered.
5232    pub spec: std::option::Option<crate::model::BackupScheduleSpec>,
5233
5234    /// Optional. The retention duration of a backup that must be at least 6 hours
5235    /// and at most 366 days. The backup is eligible to be automatically deleted
5236    /// once the retention period has elapsed.
5237    pub retention_duration: std::option::Option<wkt::Duration>,
5238
5239    /// Optional. The encryption configuration that will be used to encrypt the
5240    /// backup. If this field is not specified, the backup will use the same
5241    /// encryption configuration as the database.
5242    pub encryption_config: std::option::Option<crate::model::CreateBackupEncryptionConfig>,
5243
5244    /// Output only. The timestamp at which the schedule was last updated.
5245    /// If the schedule has never been updated, this field contains the timestamp
5246    /// when the schedule was first created.
5247    pub update_time: std::option::Option<wkt::Timestamp>,
5248
5249    /// Required. Backup type spec determines the type of backup that is created by
5250    /// the backup schedule. Currently, only full backups are supported.
5251    pub backup_type_spec: std::option::Option<crate::model::backup_schedule::BackupTypeSpec>,
5252
5253    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5254}
5255
5256impl BackupSchedule {
5257    pub fn new() -> Self {
5258        std::default::Default::default()
5259    }
5260
5261    /// Sets the value of [name][crate::model::BackupSchedule::name].
5262    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5263        self.name = v.into();
5264        self
5265    }
5266
5267    /// Sets the value of [spec][crate::model::BackupSchedule::spec].
5268    pub fn set_spec<T>(mut self, v: T) -> Self
5269    where
5270        T: std::convert::Into<crate::model::BackupScheduleSpec>,
5271    {
5272        self.spec = std::option::Option::Some(v.into());
5273        self
5274    }
5275
5276    /// Sets or clears the value of [spec][crate::model::BackupSchedule::spec].
5277    pub fn set_or_clear_spec<T>(mut self, v: std::option::Option<T>) -> Self
5278    where
5279        T: std::convert::Into<crate::model::BackupScheduleSpec>,
5280    {
5281        self.spec = v.map(|x| x.into());
5282        self
5283    }
5284
5285    /// Sets the value of [retention_duration][crate::model::BackupSchedule::retention_duration].
5286    pub fn set_retention_duration<T>(mut self, v: T) -> Self
5287    where
5288        T: std::convert::Into<wkt::Duration>,
5289    {
5290        self.retention_duration = std::option::Option::Some(v.into());
5291        self
5292    }
5293
5294    /// Sets or clears the value of [retention_duration][crate::model::BackupSchedule::retention_duration].
5295    pub fn set_or_clear_retention_duration<T>(mut self, v: std::option::Option<T>) -> Self
5296    where
5297        T: std::convert::Into<wkt::Duration>,
5298    {
5299        self.retention_duration = v.map(|x| x.into());
5300        self
5301    }
5302
5303    /// Sets the value of [encryption_config][crate::model::BackupSchedule::encryption_config].
5304    pub fn set_encryption_config<T>(mut self, v: T) -> Self
5305    where
5306        T: std::convert::Into<crate::model::CreateBackupEncryptionConfig>,
5307    {
5308        self.encryption_config = std::option::Option::Some(v.into());
5309        self
5310    }
5311
5312    /// Sets or clears the value of [encryption_config][crate::model::BackupSchedule::encryption_config].
5313    pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
5314    where
5315        T: std::convert::Into<crate::model::CreateBackupEncryptionConfig>,
5316    {
5317        self.encryption_config = v.map(|x| x.into());
5318        self
5319    }
5320
5321    /// Sets the value of [update_time][crate::model::BackupSchedule::update_time].
5322    pub fn set_update_time<T>(mut self, v: T) -> Self
5323    where
5324        T: std::convert::Into<wkt::Timestamp>,
5325    {
5326        self.update_time = std::option::Option::Some(v.into());
5327        self
5328    }
5329
5330    /// Sets or clears the value of [update_time][crate::model::BackupSchedule::update_time].
5331    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5332    where
5333        T: std::convert::Into<wkt::Timestamp>,
5334    {
5335        self.update_time = v.map(|x| x.into());
5336        self
5337    }
5338
5339    /// Sets the value of [backup_type_spec][crate::model::BackupSchedule::backup_type_spec].
5340    ///
5341    /// Note that all the setters affecting `backup_type_spec` are mutually
5342    /// exclusive.
5343    pub fn set_backup_type_spec<
5344        T: std::convert::Into<std::option::Option<crate::model::backup_schedule::BackupTypeSpec>>,
5345    >(
5346        mut self,
5347        v: T,
5348    ) -> Self {
5349        self.backup_type_spec = v.into();
5350        self
5351    }
5352
5353    /// The value of [backup_type_spec][crate::model::BackupSchedule::backup_type_spec]
5354    /// if it holds a `FullBackupSpec`, `None` if the field is not set or
5355    /// holds a different branch.
5356    pub fn full_backup_spec(
5357        &self,
5358    ) -> std::option::Option<&std::boxed::Box<crate::model::FullBackupSpec>> {
5359        #[allow(unreachable_patterns)]
5360        self.backup_type_spec.as_ref().and_then(|v| match v {
5361            crate::model::backup_schedule::BackupTypeSpec::FullBackupSpec(v) => {
5362                std::option::Option::Some(v)
5363            }
5364            _ => std::option::Option::None,
5365        })
5366    }
5367
5368    /// Sets the value of [backup_type_spec][crate::model::BackupSchedule::backup_type_spec]
5369    /// to hold a `FullBackupSpec`.
5370    ///
5371    /// Note that all the setters affecting `backup_type_spec` are
5372    /// mutually exclusive.
5373    pub fn set_full_backup_spec<
5374        T: std::convert::Into<std::boxed::Box<crate::model::FullBackupSpec>>,
5375    >(
5376        mut self,
5377        v: T,
5378    ) -> Self {
5379        self.backup_type_spec = std::option::Option::Some(
5380            crate::model::backup_schedule::BackupTypeSpec::FullBackupSpec(v.into()),
5381        );
5382        self
5383    }
5384
5385    /// The value of [backup_type_spec][crate::model::BackupSchedule::backup_type_spec]
5386    /// if it holds a `IncrementalBackupSpec`, `None` if the field is not set or
5387    /// holds a different branch.
5388    pub fn incremental_backup_spec(
5389        &self,
5390    ) -> std::option::Option<&std::boxed::Box<crate::model::IncrementalBackupSpec>> {
5391        #[allow(unreachable_patterns)]
5392        self.backup_type_spec.as_ref().and_then(|v| match v {
5393            crate::model::backup_schedule::BackupTypeSpec::IncrementalBackupSpec(v) => {
5394                std::option::Option::Some(v)
5395            }
5396            _ => std::option::Option::None,
5397        })
5398    }
5399
5400    /// Sets the value of [backup_type_spec][crate::model::BackupSchedule::backup_type_spec]
5401    /// to hold a `IncrementalBackupSpec`.
5402    ///
5403    /// Note that all the setters affecting `backup_type_spec` are
5404    /// mutually exclusive.
5405    pub fn set_incremental_backup_spec<
5406        T: std::convert::Into<std::boxed::Box<crate::model::IncrementalBackupSpec>>,
5407    >(
5408        mut self,
5409        v: T,
5410    ) -> Self {
5411        self.backup_type_spec = std::option::Option::Some(
5412            crate::model::backup_schedule::BackupTypeSpec::IncrementalBackupSpec(v.into()),
5413        );
5414        self
5415    }
5416}
5417
5418impl wkt::message::Message for BackupSchedule {
5419    fn typename() -> &'static str {
5420        "type.googleapis.com/google.spanner.admin.database.v1.BackupSchedule"
5421    }
5422}
5423
5424#[doc(hidden)]
5425impl<'de> serde::de::Deserialize<'de> for BackupSchedule {
5426    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5427    where
5428        D: serde::Deserializer<'de>,
5429    {
5430        #[allow(non_camel_case_types)]
5431        #[doc(hidden)]
5432        #[derive(PartialEq, Eq, Hash)]
5433        enum __FieldTag {
5434            __name,
5435            __spec,
5436            __retention_duration,
5437            __encryption_config,
5438            __full_backup_spec,
5439            __incremental_backup_spec,
5440            __update_time,
5441            Unknown(std::string::String),
5442        }
5443        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5444            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5445            where
5446                D: serde::Deserializer<'de>,
5447            {
5448                struct Visitor;
5449                impl<'de> serde::de::Visitor<'de> for Visitor {
5450                    type Value = __FieldTag;
5451                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5452                        formatter.write_str("a field name for BackupSchedule")
5453                    }
5454                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5455                    where
5456                        E: serde::de::Error,
5457                    {
5458                        use std::result::Result::Ok;
5459                        use std::string::ToString;
5460                        match value {
5461                            "name" => Ok(__FieldTag::__name),
5462                            "spec" => Ok(__FieldTag::__spec),
5463                            "retentionDuration" => Ok(__FieldTag::__retention_duration),
5464                            "retention_duration" => Ok(__FieldTag::__retention_duration),
5465                            "encryptionConfig" => Ok(__FieldTag::__encryption_config),
5466                            "encryption_config" => Ok(__FieldTag::__encryption_config),
5467                            "fullBackupSpec" => Ok(__FieldTag::__full_backup_spec),
5468                            "full_backup_spec" => Ok(__FieldTag::__full_backup_spec),
5469                            "incrementalBackupSpec" => Ok(__FieldTag::__incremental_backup_spec),
5470                            "incremental_backup_spec" => Ok(__FieldTag::__incremental_backup_spec),
5471                            "updateTime" => Ok(__FieldTag::__update_time),
5472                            "update_time" => Ok(__FieldTag::__update_time),
5473                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5474                        }
5475                    }
5476                }
5477                deserializer.deserialize_identifier(Visitor)
5478            }
5479        }
5480        struct Visitor;
5481        impl<'de> serde::de::Visitor<'de> for Visitor {
5482            type Value = BackupSchedule;
5483            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5484                formatter.write_str("struct BackupSchedule")
5485            }
5486            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5487            where
5488                A: serde::de::MapAccess<'de>,
5489            {
5490                #[allow(unused_imports)]
5491                use serde::de::Error;
5492                use std::option::Option::Some;
5493                let mut fields = std::collections::HashSet::new();
5494                let mut result = Self::Value::new();
5495                while let Some(tag) = map.next_key::<__FieldTag>()? {
5496                    #[allow(clippy::match_single_binding)]
5497                    match tag {
5498                        __FieldTag::__name => {
5499                            if !fields.insert(__FieldTag::__name) {
5500                                return std::result::Result::Err(A::Error::duplicate_field(
5501                                    "multiple values for name",
5502                                ));
5503                            }
5504                            result.name = map
5505                                .next_value::<std::option::Option<std::string::String>>()?
5506                                .unwrap_or_default();
5507                        }
5508                        __FieldTag::__spec => {
5509                            if !fields.insert(__FieldTag::__spec) {
5510                                return std::result::Result::Err(A::Error::duplicate_field(
5511                                    "multiple values for spec",
5512                                ));
5513                            }
5514                            result.spec = map.next_value::<std::option::Option<crate::model::BackupScheduleSpec>>()?
5515                                ;
5516                        }
5517                        __FieldTag::__retention_duration => {
5518                            if !fields.insert(__FieldTag::__retention_duration) {
5519                                return std::result::Result::Err(A::Error::duplicate_field(
5520                                    "multiple values for retention_duration",
5521                                ));
5522                            }
5523                            result.retention_duration =
5524                                map.next_value::<std::option::Option<wkt::Duration>>()?;
5525                        }
5526                        __FieldTag::__encryption_config => {
5527                            if !fields.insert(__FieldTag::__encryption_config) {
5528                                return std::result::Result::Err(A::Error::duplicate_field(
5529                                    "multiple values for encryption_config",
5530                                ));
5531                            }
5532                            result.encryption_config = map.next_value::<std::option::Option<crate::model::CreateBackupEncryptionConfig>>()?
5533                                ;
5534                        }
5535                        __FieldTag::__full_backup_spec => {
5536                            if !fields.insert(__FieldTag::__full_backup_spec) {
5537                                return std::result::Result::Err(A::Error::duplicate_field(
5538                                    "multiple values for full_backup_spec",
5539                                ));
5540                            }
5541                            if result.backup_type_spec.is_some() {
5542                                return std::result::Result::Err(A::Error::duplicate_field(
5543                                    "multiple values for `backup_type_spec`, a oneof with full ID .google.spanner.admin.database.v1.BackupSchedule.full_backup_spec, latest field was fullBackupSpec",
5544                                ));
5545                            }
5546                            result.backup_type_spec = std::option::Option::Some(
5547                                crate::model::backup_schedule::BackupTypeSpec::FullBackupSpec(
5548                                    map.next_value::<std::option::Option<
5549                                        std::boxed::Box<crate::model::FullBackupSpec>,
5550                                    >>()?
5551                                    .unwrap_or_default(),
5552                                ),
5553                            );
5554                        }
5555                        __FieldTag::__incremental_backup_spec => {
5556                            if !fields.insert(__FieldTag::__incremental_backup_spec) {
5557                                return std::result::Result::Err(A::Error::duplicate_field(
5558                                    "multiple values for incremental_backup_spec",
5559                                ));
5560                            }
5561                            if result.backup_type_spec.is_some() {
5562                                return std::result::Result::Err(A::Error::duplicate_field(
5563                                    "multiple values for `backup_type_spec`, a oneof with full ID .google.spanner.admin.database.v1.BackupSchedule.incremental_backup_spec, latest field was incrementalBackupSpec",
5564                                ));
5565                            }
5566                            result.backup_type_spec = std::option::Option::Some(
5567                                crate::model::backup_schedule::BackupTypeSpec::IncrementalBackupSpec(
5568                                    map.next_value::<std::option::Option<std::boxed::Box<crate::model::IncrementalBackupSpec>>>()?.unwrap_or_default()
5569                                ),
5570                            );
5571                        }
5572                        __FieldTag::__update_time => {
5573                            if !fields.insert(__FieldTag::__update_time) {
5574                                return std::result::Result::Err(A::Error::duplicate_field(
5575                                    "multiple values for update_time",
5576                                ));
5577                            }
5578                            result.update_time =
5579                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
5580                        }
5581                        __FieldTag::Unknown(key) => {
5582                            let value = map.next_value::<serde_json::Value>()?;
5583                            result._unknown_fields.insert(key, value);
5584                        }
5585                    }
5586                }
5587                std::result::Result::Ok(result)
5588            }
5589        }
5590        deserializer.deserialize_any(Visitor)
5591    }
5592}
5593
5594#[doc(hidden)]
5595impl serde::ser::Serialize for BackupSchedule {
5596    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5597    where
5598        S: serde::ser::Serializer,
5599    {
5600        use serde::ser::SerializeMap;
5601        #[allow(unused_imports)]
5602        use std::option::Option::Some;
5603        let mut state = serializer.serialize_map(std::option::Option::None)?;
5604        if !self.name.is_empty() {
5605            state.serialize_entry("name", &self.name)?;
5606        }
5607        if self.spec.is_some() {
5608            state.serialize_entry("spec", &self.spec)?;
5609        }
5610        if self.retention_duration.is_some() {
5611            state.serialize_entry("retentionDuration", &self.retention_duration)?;
5612        }
5613        if self.encryption_config.is_some() {
5614            state.serialize_entry("encryptionConfig", &self.encryption_config)?;
5615        }
5616        if let Some(value) = self.full_backup_spec() {
5617            state.serialize_entry("fullBackupSpec", value)?;
5618        }
5619        if let Some(value) = self.incremental_backup_spec() {
5620            state.serialize_entry("incrementalBackupSpec", value)?;
5621        }
5622        if self.update_time.is_some() {
5623            state.serialize_entry("updateTime", &self.update_time)?;
5624        }
5625        if !self._unknown_fields.is_empty() {
5626            for (key, value) in self._unknown_fields.iter() {
5627                state.serialize_entry(key, &value)?;
5628            }
5629        }
5630        state.end()
5631    }
5632}
5633
5634impl std::fmt::Debug for BackupSchedule {
5635    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5636        let mut debug_struct = f.debug_struct("BackupSchedule");
5637        debug_struct.field("name", &self.name);
5638        debug_struct.field("spec", &self.spec);
5639        debug_struct.field("retention_duration", &self.retention_duration);
5640        debug_struct.field("encryption_config", &self.encryption_config);
5641        debug_struct.field("update_time", &self.update_time);
5642        debug_struct.field("backup_type_spec", &self.backup_type_spec);
5643        if !self._unknown_fields.is_empty() {
5644            debug_struct.field("_unknown_fields", &self._unknown_fields);
5645        }
5646        debug_struct.finish()
5647    }
5648}
5649
5650/// Defines additional types related to [BackupSchedule].
5651pub mod backup_schedule {
5652    #[allow(unused_imports)]
5653    use super::*;
5654
5655    /// Required. Backup type spec determines the type of backup that is created by
5656    /// the backup schedule. Currently, only full backups are supported.
5657    #[derive(Clone, Debug, PartialEq)]
5658    #[non_exhaustive]
5659    pub enum BackupTypeSpec {
5660        /// The schedule creates only full backups.
5661        FullBackupSpec(std::boxed::Box<crate::model::FullBackupSpec>),
5662        /// The schedule creates incremental backup chains.
5663        IncrementalBackupSpec(std::boxed::Box<crate::model::IncrementalBackupSpec>),
5664    }
5665}
5666
5667/// CrontabSpec can be used to specify the version time and frequency at
5668/// which the backup should be created.
5669#[derive(Clone, Default, PartialEq)]
5670#[non_exhaustive]
5671pub struct CrontabSpec {
5672    /// Required. Textual representation of the crontab. User can customize the
5673    /// backup frequency and the backup version time using the cron
5674    /// expression. The version time must be in UTC timezone.
5675    ///
5676    /// The backup will contain an externally consistent copy of the
5677    /// database at the version time. Allowed frequencies are 12 hour, 1 day,
5678    /// 1 week and 1 month. Examples of valid cron specifications:
5679    ///
5680    /// * `0 2/12 * * * ` : every 12 hours at (2, 14) hours past midnight in UTC.
5681    /// * `0 2,14 * * * ` : every 12 hours at (2,14) hours past midnight in UTC.
5682    /// * `0 2 * * * `    : once a day at 2 past midnight in UTC.
5683    /// * `0 2 * * 0 `    : once a week every Sunday at 2 past midnight in UTC.
5684    /// * `0 2 8 * * `    : once a month on 8th day at 2 past midnight in UTC.
5685    pub text: std::string::String,
5686
5687    /// Output only. The time zone of the times in `CrontabSpec.text`. Currently
5688    /// only UTC is supported.
5689    pub time_zone: std::string::String,
5690
5691    /// Output only. Schedule backups will contain an externally consistent copy
5692    /// of the database at the version time specified in
5693    /// `schedule_spec.cron_spec`. However, Spanner may not initiate the creation
5694    /// of the scheduled backups at that version time. Spanner will initiate
5695    /// the creation of scheduled backups within the time window bounded by the
5696    /// version_time specified in `schedule_spec.cron_spec` and version_time +
5697    /// `creation_window`.
5698    pub creation_window: std::option::Option<wkt::Duration>,
5699
5700    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5701}
5702
5703impl CrontabSpec {
5704    pub fn new() -> Self {
5705        std::default::Default::default()
5706    }
5707
5708    /// Sets the value of [text][crate::model::CrontabSpec::text].
5709    pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5710        self.text = v.into();
5711        self
5712    }
5713
5714    /// Sets the value of [time_zone][crate::model::CrontabSpec::time_zone].
5715    pub fn set_time_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5716        self.time_zone = v.into();
5717        self
5718    }
5719
5720    /// Sets the value of [creation_window][crate::model::CrontabSpec::creation_window].
5721    pub fn set_creation_window<T>(mut self, v: T) -> Self
5722    where
5723        T: std::convert::Into<wkt::Duration>,
5724    {
5725        self.creation_window = std::option::Option::Some(v.into());
5726        self
5727    }
5728
5729    /// Sets or clears the value of [creation_window][crate::model::CrontabSpec::creation_window].
5730    pub fn set_or_clear_creation_window<T>(mut self, v: std::option::Option<T>) -> Self
5731    where
5732        T: std::convert::Into<wkt::Duration>,
5733    {
5734        self.creation_window = v.map(|x| x.into());
5735        self
5736    }
5737}
5738
5739impl wkt::message::Message for CrontabSpec {
5740    fn typename() -> &'static str {
5741        "type.googleapis.com/google.spanner.admin.database.v1.CrontabSpec"
5742    }
5743}
5744
5745#[doc(hidden)]
5746impl<'de> serde::de::Deserialize<'de> for CrontabSpec {
5747    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5748    where
5749        D: serde::Deserializer<'de>,
5750    {
5751        #[allow(non_camel_case_types)]
5752        #[doc(hidden)]
5753        #[derive(PartialEq, Eq, Hash)]
5754        enum __FieldTag {
5755            __text,
5756            __time_zone,
5757            __creation_window,
5758            Unknown(std::string::String),
5759        }
5760        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5761            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5762            where
5763                D: serde::Deserializer<'de>,
5764            {
5765                struct Visitor;
5766                impl<'de> serde::de::Visitor<'de> for Visitor {
5767                    type Value = __FieldTag;
5768                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5769                        formatter.write_str("a field name for CrontabSpec")
5770                    }
5771                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5772                    where
5773                        E: serde::de::Error,
5774                    {
5775                        use std::result::Result::Ok;
5776                        use std::string::ToString;
5777                        match value {
5778                            "text" => Ok(__FieldTag::__text),
5779                            "timeZone" => Ok(__FieldTag::__time_zone),
5780                            "time_zone" => Ok(__FieldTag::__time_zone),
5781                            "creationWindow" => Ok(__FieldTag::__creation_window),
5782                            "creation_window" => Ok(__FieldTag::__creation_window),
5783                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5784                        }
5785                    }
5786                }
5787                deserializer.deserialize_identifier(Visitor)
5788            }
5789        }
5790        struct Visitor;
5791        impl<'de> serde::de::Visitor<'de> for Visitor {
5792            type Value = CrontabSpec;
5793            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5794                formatter.write_str("struct CrontabSpec")
5795            }
5796            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5797            where
5798                A: serde::de::MapAccess<'de>,
5799            {
5800                #[allow(unused_imports)]
5801                use serde::de::Error;
5802                use std::option::Option::Some;
5803                let mut fields = std::collections::HashSet::new();
5804                let mut result = Self::Value::new();
5805                while let Some(tag) = map.next_key::<__FieldTag>()? {
5806                    #[allow(clippy::match_single_binding)]
5807                    match tag {
5808                        __FieldTag::__text => {
5809                            if !fields.insert(__FieldTag::__text) {
5810                                return std::result::Result::Err(A::Error::duplicate_field(
5811                                    "multiple values for text",
5812                                ));
5813                            }
5814                            result.text = map
5815                                .next_value::<std::option::Option<std::string::String>>()?
5816                                .unwrap_or_default();
5817                        }
5818                        __FieldTag::__time_zone => {
5819                            if !fields.insert(__FieldTag::__time_zone) {
5820                                return std::result::Result::Err(A::Error::duplicate_field(
5821                                    "multiple values for time_zone",
5822                                ));
5823                            }
5824                            result.time_zone = map
5825                                .next_value::<std::option::Option<std::string::String>>()?
5826                                .unwrap_or_default();
5827                        }
5828                        __FieldTag::__creation_window => {
5829                            if !fields.insert(__FieldTag::__creation_window) {
5830                                return std::result::Result::Err(A::Error::duplicate_field(
5831                                    "multiple values for creation_window",
5832                                ));
5833                            }
5834                            result.creation_window =
5835                                map.next_value::<std::option::Option<wkt::Duration>>()?;
5836                        }
5837                        __FieldTag::Unknown(key) => {
5838                            let value = map.next_value::<serde_json::Value>()?;
5839                            result._unknown_fields.insert(key, value);
5840                        }
5841                    }
5842                }
5843                std::result::Result::Ok(result)
5844            }
5845        }
5846        deserializer.deserialize_any(Visitor)
5847    }
5848}
5849
5850#[doc(hidden)]
5851impl serde::ser::Serialize for CrontabSpec {
5852    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5853    where
5854        S: serde::ser::Serializer,
5855    {
5856        use serde::ser::SerializeMap;
5857        #[allow(unused_imports)]
5858        use std::option::Option::Some;
5859        let mut state = serializer.serialize_map(std::option::Option::None)?;
5860        if !self.text.is_empty() {
5861            state.serialize_entry("text", &self.text)?;
5862        }
5863        if !self.time_zone.is_empty() {
5864            state.serialize_entry("timeZone", &self.time_zone)?;
5865        }
5866        if self.creation_window.is_some() {
5867            state.serialize_entry("creationWindow", &self.creation_window)?;
5868        }
5869        if !self._unknown_fields.is_empty() {
5870            for (key, value) in self._unknown_fields.iter() {
5871                state.serialize_entry(key, &value)?;
5872            }
5873        }
5874        state.end()
5875    }
5876}
5877
5878impl std::fmt::Debug for CrontabSpec {
5879    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5880        let mut debug_struct = f.debug_struct("CrontabSpec");
5881        debug_struct.field("text", &self.text);
5882        debug_struct.field("time_zone", &self.time_zone);
5883        debug_struct.field("creation_window", &self.creation_window);
5884        if !self._unknown_fields.is_empty() {
5885            debug_struct.field("_unknown_fields", &self._unknown_fields);
5886        }
5887        debug_struct.finish()
5888    }
5889}
5890
5891/// The request for
5892/// [CreateBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackupSchedule].
5893///
5894/// [google.spanner.admin.database.v1.DatabaseAdmin.CreateBackupSchedule]: crate::client::DatabaseAdmin::create_backup_schedule
5895#[derive(Clone, Default, PartialEq)]
5896#[non_exhaustive]
5897pub struct CreateBackupScheduleRequest {
5898    /// Required. The name of the database that this backup schedule applies to.
5899    pub parent: std::string::String,
5900
5901    /// Required. The Id to use for the backup schedule. The `backup_schedule_id`
5902    /// appended to `parent` forms the full backup schedule name of the form
5903    /// `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`.
5904    pub backup_schedule_id: std::string::String,
5905
5906    /// Required. The backup schedule to create.
5907    pub backup_schedule: std::option::Option<crate::model::BackupSchedule>,
5908
5909    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5910}
5911
5912impl CreateBackupScheduleRequest {
5913    pub fn new() -> Self {
5914        std::default::Default::default()
5915    }
5916
5917    /// Sets the value of [parent][crate::model::CreateBackupScheduleRequest::parent].
5918    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5919        self.parent = v.into();
5920        self
5921    }
5922
5923    /// Sets the value of [backup_schedule_id][crate::model::CreateBackupScheduleRequest::backup_schedule_id].
5924    pub fn set_backup_schedule_id<T: std::convert::Into<std::string::String>>(
5925        mut self,
5926        v: T,
5927    ) -> Self {
5928        self.backup_schedule_id = v.into();
5929        self
5930    }
5931
5932    /// Sets the value of [backup_schedule][crate::model::CreateBackupScheduleRequest::backup_schedule].
5933    pub fn set_backup_schedule<T>(mut self, v: T) -> Self
5934    where
5935        T: std::convert::Into<crate::model::BackupSchedule>,
5936    {
5937        self.backup_schedule = std::option::Option::Some(v.into());
5938        self
5939    }
5940
5941    /// Sets or clears the value of [backup_schedule][crate::model::CreateBackupScheduleRequest::backup_schedule].
5942    pub fn set_or_clear_backup_schedule<T>(mut self, v: std::option::Option<T>) -> Self
5943    where
5944        T: std::convert::Into<crate::model::BackupSchedule>,
5945    {
5946        self.backup_schedule = v.map(|x| x.into());
5947        self
5948    }
5949}
5950
5951impl wkt::message::Message for CreateBackupScheduleRequest {
5952    fn typename() -> &'static str {
5953        "type.googleapis.com/google.spanner.admin.database.v1.CreateBackupScheduleRequest"
5954    }
5955}
5956
5957#[doc(hidden)]
5958impl<'de> serde::de::Deserialize<'de> for CreateBackupScheduleRequest {
5959    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5960    where
5961        D: serde::Deserializer<'de>,
5962    {
5963        #[allow(non_camel_case_types)]
5964        #[doc(hidden)]
5965        #[derive(PartialEq, Eq, Hash)]
5966        enum __FieldTag {
5967            __parent,
5968            __backup_schedule_id,
5969            __backup_schedule,
5970            Unknown(std::string::String),
5971        }
5972        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5973            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5974            where
5975                D: serde::Deserializer<'de>,
5976            {
5977                struct Visitor;
5978                impl<'de> serde::de::Visitor<'de> for Visitor {
5979                    type Value = __FieldTag;
5980                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5981                        formatter.write_str("a field name for CreateBackupScheduleRequest")
5982                    }
5983                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5984                    where
5985                        E: serde::de::Error,
5986                    {
5987                        use std::result::Result::Ok;
5988                        use std::string::ToString;
5989                        match value {
5990                            "parent" => Ok(__FieldTag::__parent),
5991                            "backupScheduleId" => Ok(__FieldTag::__backup_schedule_id),
5992                            "backup_schedule_id" => Ok(__FieldTag::__backup_schedule_id),
5993                            "backupSchedule" => Ok(__FieldTag::__backup_schedule),
5994                            "backup_schedule" => Ok(__FieldTag::__backup_schedule),
5995                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5996                        }
5997                    }
5998                }
5999                deserializer.deserialize_identifier(Visitor)
6000            }
6001        }
6002        struct Visitor;
6003        impl<'de> serde::de::Visitor<'de> for Visitor {
6004            type Value = CreateBackupScheduleRequest;
6005            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6006                formatter.write_str("struct CreateBackupScheduleRequest")
6007            }
6008            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6009            where
6010                A: serde::de::MapAccess<'de>,
6011            {
6012                #[allow(unused_imports)]
6013                use serde::de::Error;
6014                use std::option::Option::Some;
6015                let mut fields = std::collections::HashSet::new();
6016                let mut result = Self::Value::new();
6017                while let Some(tag) = map.next_key::<__FieldTag>()? {
6018                    #[allow(clippy::match_single_binding)]
6019                    match tag {
6020                        __FieldTag::__parent => {
6021                            if !fields.insert(__FieldTag::__parent) {
6022                                return std::result::Result::Err(A::Error::duplicate_field(
6023                                    "multiple values for parent",
6024                                ));
6025                            }
6026                            result.parent = map
6027                                .next_value::<std::option::Option<std::string::String>>()?
6028                                .unwrap_or_default();
6029                        }
6030                        __FieldTag::__backup_schedule_id => {
6031                            if !fields.insert(__FieldTag::__backup_schedule_id) {
6032                                return std::result::Result::Err(A::Error::duplicate_field(
6033                                    "multiple values for backup_schedule_id",
6034                                ));
6035                            }
6036                            result.backup_schedule_id = map
6037                                .next_value::<std::option::Option<std::string::String>>()?
6038                                .unwrap_or_default();
6039                        }
6040                        __FieldTag::__backup_schedule => {
6041                            if !fields.insert(__FieldTag::__backup_schedule) {
6042                                return std::result::Result::Err(A::Error::duplicate_field(
6043                                    "multiple values for backup_schedule",
6044                                ));
6045                            }
6046                            result.backup_schedule = map
6047                                .next_value::<std::option::Option<crate::model::BackupSchedule>>(
6048                                )?;
6049                        }
6050                        __FieldTag::Unknown(key) => {
6051                            let value = map.next_value::<serde_json::Value>()?;
6052                            result._unknown_fields.insert(key, value);
6053                        }
6054                    }
6055                }
6056                std::result::Result::Ok(result)
6057            }
6058        }
6059        deserializer.deserialize_any(Visitor)
6060    }
6061}
6062
6063#[doc(hidden)]
6064impl serde::ser::Serialize for CreateBackupScheduleRequest {
6065    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6066    where
6067        S: serde::ser::Serializer,
6068    {
6069        use serde::ser::SerializeMap;
6070        #[allow(unused_imports)]
6071        use std::option::Option::Some;
6072        let mut state = serializer.serialize_map(std::option::Option::None)?;
6073        if !self.parent.is_empty() {
6074            state.serialize_entry("parent", &self.parent)?;
6075        }
6076        if !self.backup_schedule_id.is_empty() {
6077            state.serialize_entry("backupScheduleId", &self.backup_schedule_id)?;
6078        }
6079        if self.backup_schedule.is_some() {
6080            state.serialize_entry("backupSchedule", &self.backup_schedule)?;
6081        }
6082        if !self._unknown_fields.is_empty() {
6083            for (key, value) in self._unknown_fields.iter() {
6084                state.serialize_entry(key, &value)?;
6085            }
6086        }
6087        state.end()
6088    }
6089}
6090
6091impl std::fmt::Debug for CreateBackupScheduleRequest {
6092    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6093        let mut debug_struct = f.debug_struct("CreateBackupScheduleRequest");
6094        debug_struct.field("parent", &self.parent);
6095        debug_struct.field("backup_schedule_id", &self.backup_schedule_id);
6096        debug_struct.field("backup_schedule", &self.backup_schedule);
6097        if !self._unknown_fields.is_empty() {
6098            debug_struct.field("_unknown_fields", &self._unknown_fields);
6099        }
6100        debug_struct.finish()
6101    }
6102}
6103
6104/// The request for
6105/// [GetBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.GetBackupSchedule].
6106///
6107/// [google.spanner.admin.database.v1.DatabaseAdmin.GetBackupSchedule]: crate::client::DatabaseAdmin::get_backup_schedule
6108#[derive(Clone, Default, PartialEq)]
6109#[non_exhaustive]
6110pub struct GetBackupScheduleRequest {
6111    /// Required. The name of the schedule to retrieve.
6112    /// Values are of the form
6113    /// `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`.
6114    pub name: std::string::String,
6115
6116    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6117}
6118
6119impl GetBackupScheduleRequest {
6120    pub fn new() -> Self {
6121        std::default::Default::default()
6122    }
6123
6124    /// Sets the value of [name][crate::model::GetBackupScheduleRequest::name].
6125    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6126        self.name = v.into();
6127        self
6128    }
6129}
6130
6131impl wkt::message::Message for GetBackupScheduleRequest {
6132    fn typename() -> &'static str {
6133        "type.googleapis.com/google.spanner.admin.database.v1.GetBackupScheduleRequest"
6134    }
6135}
6136
6137#[doc(hidden)]
6138impl<'de> serde::de::Deserialize<'de> for GetBackupScheduleRequest {
6139    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6140    where
6141        D: serde::Deserializer<'de>,
6142    {
6143        #[allow(non_camel_case_types)]
6144        #[doc(hidden)]
6145        #[derive(PartialEq, Eq, Hash)]
6146        enum __FieldTag {
6147            __name,
6148            Unknown(std::string::String),
6149        }
6150        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6151            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6152            where
6153                D: serde::Deserializer<'de>,
6154            {
6155                struct Visitor;
6156                impl<'de> serde::de::Visitor<'de> for Visitor {
6157                    type Value = __FieldTag;
6158                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6159                        formatter.write_str("a field name for GetBackupScheduleRequest")
6160                    }
6161                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6162                    where
6163                        E: serde::de::Error,
6164                    {
6165                        use std::result::Result::Ok;
6166                        use std::string::ToString;
6167                        match value {
6168                            "name" => Ok(__FieldTag::__name),
6169                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6170                        }
6171                    }
6172                }
6173                deserializer.deserialize_identifier(Visitor)
6174            }
6175        }
6176        struct Visitor;
6177        impl<'de> serde::de::Visitor<'de> for Visitor {
6178            type Value = GetBackupScheduleRequest;
6179            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6180                formatter.write_str("struct GetBackupScheduleRequest")
6181            }
6182            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6183            where
6184                A: serde::de::MapAccess<'de>,
6185            {
6186                #[allow(unused_imports)]
6187                use serde::de::Error;
6188                use std::option::Option::Some;
6189                let mut fields = std::collections::HashSet::new();
6190                let mut result = Self::Value::new();
6191                while let Some(tag) = map.next_key::<__FieldTag>()? {
6192                    #[allow(clippy::match_single_binding)]
6193                    match tag {
6194                        __FieldTag::__name => {
6195                            if !fields.insert(__FieldTag::__name) {
6196                                return std::result::Result::Err(A::Error::duplicate_field(
6197                                    "multiple values for name",
6198                                ));
6199                            }
6200                            result.name = map
6201                                .next_value::<std::option::Option<std::string::String>>()?
6202                                .unwrap_or_default();
6203                        }
6204                        __FieldTag::Unknown(key) => {
6205                            let value = map.next_value::<serde_json::Value>()?;
6206                            result._unknown_fields.insert(key, value);
6207                        }
6208                    }
6209                }
6210                std::result::Result::Ok(result)
6211            }
6212        }
6213        deserializer.deserialize_any(Visitor)
6214    }
6215}
6216
6217#[doc(hidden)]
6218impl serde::ser::Serialize for GetBackupScheduleRequest {
6219    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6220    where
6221        S: serde::ser::Serializer,
6222    {
6223        use serde::ser::SerializeMap;
6224        #[allow(unused_imports)]
6225        use std::option::Option::Some;
6226        let mut state = serializer.serialize_map(std::option::Option::None)?;
6227        if !self.name.is_empty() {
6228            state.serialize_entry("name", &self.name)?;
6229        }
6230        if !self._unknown_fields.is_empty() {
6231            for (key, value) in self._unknown_fields.iter() {
6232                state.serialize_entry(key, &value)?;
6233            }
6234        }
6235        state.end()
6236    }
6237}
6238
6239impl std::fmt::Debug for GetBackupScheduleRequest {
6240    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6241        let mut debug_struct = f.debug_struct("GetBackupScheduleRequest");
6242        debug_struct.field("name", &self.name);
6243        if !self._unknown_fields.is_empty() {
6244            debug_struct.field("_unknown_fields", &self._unknown_fields);
6245        }
6246        debug_struct.finish()
6247    }
6248}
6249
6250/// The request for
6251/// [DeleteBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.DeleteBackupSchedule].
6252///
6253/// [google.spanner.admin.database.v1.DatabaseAdmin.DeleteBackupSchedule]: crate::client::DatabaseAdmin::delete_backup_schedule
6254#[derive(Clone, Default, PartialEq)]
6255#[non_exhaustive]
6256pub struct DeleteBackupScheduleRequest {
6257    /// Required. The name of the schedule to delete.
6258    /// Values are of the form
6259    /// `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`.
6260    pub name: std::string::String,
6261
6262    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6263}
6264
6265impl DeleteBackupScheduleRequest {
6266    pub fn new() -> Self {
6267        std::default::Default::default()
6268    }
6269
6270    /// Sets the value of [name][crate::model::DeleteBackupScheduleRequest::name].
6271    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6272        self.name = v.into();
6273        self
6274    }
6275}
6276
6277impl wkt::message::Message for DeleteBackupScheduleRequest {
6278    fn typename() -> &'static str {
6279        "type.googleapis.com/google.spanner.admin.database.v1.DeleteBackupScheduleRequest"
6280    }
6281}
6282
6283#[doc(hidden)]
6284impl<'de> serde::de::Deserialize<'de> for DeleteBackupScheduleRequest {
6285    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6286    where
6287        D: serde::Deserializer<'de>,
6288    {
6289        #[allow(non_camel_case_types)]
6290        #[doc(hidden)]
6291        #[derive(PartialEq, Eq, Hash)]
6292        enum __FieldTag {
6293            __name,
6294            Unknown(std::string::String),
6295        }
6296        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6297            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6298            where
6299                D: serde::Deserializer<'de>,
6300            {
6301                struct Visitor;
6302                impl<'de> serde::de::Visitor<'de> for Visitor {
6303                    type Value = __FieldTag;
6304                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6305                        formatter.write_str("a field name for DeleteBackupScheduleRequest")
6306                    }
6307                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6308                    where
6309                        E: serde::de::Error,
6310                    {
6311                        use std::result::Result::Ok;
6312                        use std::string::ToString;
6313                        match value {
6314                            "name" => Ok(__FieldTag::__name),
6315                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6316                        }
6317                    }
6318                }
6319                deserializer.deserialize_identifier(Visitor)
6320            }
6321        }
6322        struct Visitor;
6323        impl<'de> serde::de::Visitor<'de> for Visitor {
6324            type Value = DeleteBackupScheduleRequest;
6325            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6326                formatter.write_str("struct DeleteBackupScheduleRequest")
6327            }
6328            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6329            where
6330                A: serde::de::MapAccess<'de>,
6331            {
6332                #[allow(unused_imports)]
6333                use serde::de::Error;
6334                use std::option::Option::Some;
6335                let mut fields = std::collections::HashSet::new();
6336                let mut result = Self::Value::new();
6337                while let Some(tag) = map.next_key::<__FieldTag>()? {
6338                    #[allow(clippy::match_single_binding)]
6339                    match tag {
6340                        __FieldTag::__name => {
6341                            if !fields.insert(__FieldTag::__name) {
6342                                return std::result::Result::Err(A::Error::duplicate_field(
6343                                    "multiple values for name",
6344                                ));
6345                            }
6346                            result.name = map
6347                                .next_value::<std::option::Option<std::string::String>>()?
6348                                .unwrap_or_default();
6349                        }
6350                        __FieldTag::Unknown(key) => {
6351                            let value = map.next_value::<serde_json::Value>()?;
6352                            result._unknown_fields.insert(key, value);
6353                        }
6354                    }
6355                }
6356                std::result::Result::Ok(result)
6357            }
6358        }
6359        deserializer.deserialize_any(Visitor)
6360    }
6361}
6362
6363#[doc(hidden)]
6364impl serde::ser::Serialize for DeleteBackupScheduleRequest {
6365    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6366    where
6367        S: serde::ser::Serializer,
6368    {
6369        use serde::ser::SerializeMap;
6370        #[allow(unused_imports)]
6371        use std::option::Option::Some;
6372        let mut state = serializer.serialize_map(std::option::Option::None)?;
6373        if !self.name.is_empty() {
6374            state.serialize_entry("name", &self.name)?;
6375        }
6376        if !self._unknown_fields.is_empty() {
6377            for (key, value) in self._unknown_fields.iter() {
6378                state.serialize_entry(key, &value)?;
6379            }
6380        }
6381        state.end()
6382    }
6383}
6384
6385impl std::fmt::Debug for DeleteBackupScheduleRequest {
6386    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6387        let mut debug_struct = f.debug_struct("DeleteBackupScheduleRequest");
6388        debug_struct.field("name", &self.name);
6389        if !self._unknown_fields.is_empty() {
6390            debug_struct.field("_unknown_fields", &self._unknown_fields);
6391        }
6392        debug_struct.finish()
6393    }
6394}
6395
6396/// The request for
6397/// [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules].
6398///
6399/// [google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules]: crate::client::DatabaseAdmin::list_backup_schedules
6400#[derive(Clone, Default, PartialEq)]
6401#[non_exhaustive]
6402pub struct ListBackupSchedulesRequest {
6403    /// Required. Database is the parent resource whose backup schedules should be
6404    /// listed. Values are of the form
6405    /// projects/\<project\>/instances/\<instance\>/databases/\<database\>
6406    pub parent: std::string::String,
6407
6408    /// Optional. Number of backup schedules to be returned in the response. If 0
6409    /// or less, defaults to the server's maximum allowed page size.
6410    pub page_size: i32,
6411
6412    /// Optional. If non-empty, `page_token` should contain a
6413    /// [next_page_token][google.spanner.admin.database.v1.ListBackupSchedulesResponse.next_page_token]
6414    /// from a previous
6415    /// [ListBackupSchedulesResponse][google.spanner.admin.database.v1.ListBackupSchedulesResponse]
6416    /// to the same `parent`.
6417    ///
6418    /// [google.spanner.admin.database.v1.ListBackupSchedulesResponse]: crate::model::ListBackupSchedulesResponse
6419    /// [google.spanner.admin.database.v1.ListBackupSchedulesResponse.next_page_token]: crate::model::ListBackupSchedulesResponse::next_page_token
6420    pub page_token: std::string::String,
6421
6422    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6423}
6424
6425impl ListBackupSchedulesRequest {
6426    pub fn new() -> Self {
6427        std::default::Default::default()
6428    }
6429
6430    /// Sets the value of [parent][crate::model::ListBackupSchedulesRequest::parent].
6431    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6432        self.parent = v.into();
6433        self
6434    }
6435
6436    /// Sets the value of [page_size][crate::model::ListBackupSchedulesRequest::page_size].
6437    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6438        self.page_size = v.into();
6439        self
6440    }
6441
6442    /// Sets the value of [page_token][crate::model::ListBackupSchedulesRequest::page_token].
6443    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6444        self.page_token = v.into();
6445        self
6446    }
6447}
6448
6449impl wkt::message::Message for ListBackupSchedulesRequest {
6450    fn typename() -> &'static str {
6451        "type.googleapis.com/google.spanner.admin.database.v1.ListBackupSchedulesRequest"
6452    }
6453}
6454
6455#[doc(hidden)]
6456impl<'de> serde::de::Deserialize<'de> for ListBackupSchedulesRequest {
6457    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6458    where
6459        D: serde::Deserializer<'de>,
6460    {
6461        #[allow(non_camel_case_types)]
6462        #[doc(hidden)]
6463        #[derive(PartialEq, Eq, Hash)]
6464        enum __FieldTag {
6465            __parent,
6466            __page_size,
6467            __page_token,
6468            Unknown(std::string::String),
6469        }
6470        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6471            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6472            where
6473                D: serde::Deserializer<'de>,
6474            {
6475                struct Visitor;
6476                impl<'de> serde::de::Visitor<'de> for Visitor {
6477                    type Value = __FieldTag;
6478                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6479                        formatter.write_str("a field name for ListBackupSchedulesRequest")
6480                    }
6481                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6482                    where
6483                        E: serde::de::Error,
6484                    {
6485                        use std::result::Result::Ok;
6486                        use std::string::ToString;
6487                        match value {
6488                            "parent" => Ok(__FieldTag::__parent),
6489                            "pageSize" => Ok(__FieldTag::__page_size),
6490                            "page_size" => Ok(__FieldTag::__page_size),
6491                            "pageToken" => Ok(__FieldTag::__page_token),
6492                            "page_token" => Ok(__FieldTag::__page_token),
6493                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6494                        }
6495                    }
6496                }
6497                deserializer.deserialize_identifier(Visitor)
6498            }
6499        }
6500        struct Visitor;
6501        impl<'de> serde::de::Visitor<'de> for Visitor {
6502            type Value = ListBackupSchedulesRequest;
6503            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6504                formatter.write_str("struct ListBackupSchedulesRequest")
6505            }
6506            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6507            where
6508                A: serde::de::MapAccess<'de>,
6509            {
6510                #[allow(unused_imports)]
6511                use serde::de::Error;
6512                use std::option::Option::Some;
6513                let mut fields = std::collections::HashSet::new();
6514                let mut result = Self::Value::new();
6515                while let Some(tag) = map.next_key::<__FieldTag>()? {
6516                    #[allow(clippy::match_single_binding)]
6517                    match tag {
6518                        __FieldTag::__parent => {
6519                            if !fields.insert(__FieldTag::__parent) {
6520                                return std::result::Result::Err(A::Error::duplicate_field(
6521                                    "multiple values for parent",
6522                                ));
6523                            }
6524                            result.parent = map
6525                                .next_value::<std::option::Option<std::string::String>>()?
6526                                .unwrap_or_default();
6527                        }
6528                        __FieldTag::__page_size => {
6529                            if !fields.insert(__FieldTag::__page_size) {
6530                                return std::result::Result::Err(A::Error::duplicate_field(
6531                                    "multiple values for page_size",
6532                                ));
6533                            }
6534                            struct __With(std::option::Option<i32>);
6535                            impl<'de> serde::de::Deserialize<'de> for __With {
6536                                fn deserialize<D>(
6537                                    deserializer: D,
6538                                ) -> std::result::Result<Self, D::Error>
6539                                where
6540                                    D: serde::de::Deserializer<'de>,
6541                                {
6542                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
6543                                }
6544                            }
6545                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
6546                        }
6547                        __FieldTag::__page_token => {
6548                            if !fields.insert(__FieldTag::__page_token) {
6549                                return std::result::Result::Err(A::Error::duplicate_field(
6550                                    "multiple values for page_token",
6551                                ));
6552                            }
6553                            result.page_token = map
6554                                .next_value::<std::option::Option<std::string::String>>()?
6555                                .unwrap_or_default();
6556                        }
6557                        __FieldTag::Unknown(key) => {
6558                            let value = map.next_value::<serde_json::Value>()?;
6559                            result._unknown_fields.insert(key, value);
6560                        }
6561                    }
6562                }
6563                std::result::Result::Ok(result)
6564            }
6565        }
6566        deserializer.deserialize_any(Visitor)
6567    }
6568}
6569
6570#[doc(hidden)]
6571impl serde::ser::Serialize for ListBackupSchedulesRequest {
6572    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6573    where
6574        S: serde::ser::Serializer,
6575    {
6576        use serde::ser::SerializeMap;
6577        #[allow(unused_imports)]
6578        use std::option::Option::Some;
6579        let mut state = serializer.serialize_map(std::option::Option::None)?;
6580        if !self.parent.is_empty() {
6581            state.serialize_entry("parent", &self.parent)?;
6582        }
6583        if !wkt::internal::is_default(&self.page_size) {
6584            struct __With<'a>(&'a i32);
6585            impl<'a> serde::ser::Serialize for __With<'a> {
6586                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6587                where
6588                    S: serde::ser::Serializer,
6589                {
6590                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
6591                }
6592            }
6593            state.serialize_entry("pageSize", &__With(&self.page_size))?;
6594        }
6595        if !self.page_token.is_empty() {
6596            state.serialize_entry("pageToken", &self.page_token)?;
6597        }
6598        if !self._unknown_fields.is_empty() {
6599            for (key, value) in self._unknown_fields.iter() {
6600                state.serialize_entry(key, &value)?;
6601            }
6602        }
6603        state.end()
6604    }
6605}
6606
6607impl std::fmt::Debug for ListBackupSchedulesRequest {
6608    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6609        let mut debug_struct = f.debug_struct("ListBackupSchedulesRequest");
6610        debug_struct.field("parent", &self.parent);
6611        debug_struct.field("page_size", &self.page_size);
6612        debug_struct.field("page_token", &self.page_token);
6613        if !self._unknown_fields.is_empty() {
6614            debug_struct.field("_unknown_fields", &self._unknown_fields);
6615        }
6616        debug_struct.finish()
6617    }
6618}
6619
6620/// The response for
6621/// [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules].
6622///
6623/// [google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules]: crate::client::DatabaseAdmin::list_backup_schedules
6624#[derive(Clone, Default, PartialEq)]
6625#[non_exhaustive]
6626pub struct ListBackupSchedulesResponse {
6627    /// The list of backup schedules for a database.
6628    pub backup_schedules: std::vec::Vec<crate::model::BackupSchedule>,
6629
6630    /// `next_page_token` can be sent in a subsequent
6631    /// [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules]
6632    /// call to fetch more of the schedules.
6633    ///
6634    /// [google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules]: crate::client::DatabaseAdmin::list_backup_schedules
6635    pub next_page_token: std::string::String,
6636
6637    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6638}
6639
6640impl ListBackupSchedulesResponse {
6641    pub fn new() -> Self {
6642        std::default::Default::default()
6643    }
6644
6645    /// Sets the value of [backup_schedules][crate::model::ListBackupSchedulesResponse::backup_schedules].
6646    pub fn set_backup_schedules<T, V>(mut self, v: T) -> Self
6647    where
6648        T: std::iter::IntoIterator<Item = V>,
6649        V: std::convert::Into<crate::model::BackupSchedule>,
6650    {
6651        use std::iter::Iterator;
6652        self.backup_schedules = v.into_iter().map(|i| i.into()).collect();
6653        self
6654    }
6655
6656    /// Sets the value of [next_page_token][crate::model::ListBackupSchedulesResponse::next_page_token].
6657    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6658        self.next_page_token = v.into();
6659        self
6660    }
6661}
6662
6663impl wkt::message::Message for ListBackupSchedulesResponse {
6664    fn typename() -> &'static str {
6665        "type.googleapis.com/google.spanner.admin.database.v1.ListBackupSchedulesResponse"
6666    }
6667}
6668
6669#[doc(hidden)]
6670impl gax::paginator::internal::PageableResponse for ListBackupSchedulesResponse {
6671    type PageItem = crate::model::BackupSchedule;
6672
6673    fn items(self) -> std::vec::Vec<Self::PageItem> {
6674        self.backup_schedules
6675    }
6676
6677    fn next_page_token(&self) -> std::string::String {
6678        use std::clone::Clone;
6679        self.next_page_token.clone()
6680    }
6681}
6682
6683#[doc(hidden)]
6684impl<'de> serde::de::Deserialize<'de> for ListBackupSchedulesResponse {
6685    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6686    where
6687        D: serde::Deserializer<'de>,
6688    {
6689        #[allow(non_camel_case_types)]
6690        #[doc(hidden)]
6691        #[derive(PartialEq, Eq, Hash)]
6692        enum __FieldTag {
6693            __backup_schedules,
6694            __next_page_token,
6695            Unknown(std::string::String),
6696        }
6697        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6698            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6699            where
6700                D: serde::Deserializer<'de>,
6701            {
6702                struct Visitor;
6703                impl<'de> serde::de::Visitor<'de> for Visitor {
6704                    type Value = __FieldTag;
6705                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6706                        formatter.write_str("a field name for ListBackupSchedulesResponse")
6707                    }
6708                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6709                    where
6710                        E: serde::de::Error,
6711                    {
6712                        use std::result::Result::Ok;
6713                        use std::string::ToString;
6714                        match value {
6715                            "backupSchedules" => Ok(__FieldTag::__backup_schedules),
6716                            "backup_schedules" => Ok(__FieldTag::__backup_schedules),
6717                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
6718                            "next_page_token" => Ok(__FieldTag::__next_page_token),
6719                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6720                        }
6721                    }
6722                }
6723                deserializer.deserialize_identifier(Visitor)
6724            }
6725        }
6726        struct Visitor;
6727        impl<'de> serde::de::Visitor<'de> for Visitor {
6728            type Value = ListBackupSchedulesResponse;
6729            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6730                formatter.write_str("struct ListBackupSchedulesResponse")
6731            }
6732            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6733            where
6734                A: serde::de::MapAccess<'de>,
6735            {
6736                #[allow(unused_imports)]
6737                use serde::de::Error;
6738                use std::option::Option::Some;
6739                let mut fields = std::collections::HashSet::new();
6740                let mut result = Self::Value::new();
6741                while let Some(tag) = map.next_key::<__FieldTag>()? {
6742                    #[allow(clippy::match_single_binding)]
6743                    match tag {
6744                        __FieldTag::__backup_schedules => {
6745                            if !fields.insert(__FieldTag::__backup_schedules) {
6746                                return std::result::Result::Err(A::Error::duplicate_field(
6747                                    "multiple values for backup_schedules",
6748                                ));
6749                            }
6750                            result.backup_schedules =
6751                                map.next_value::<std::option::Option<
6752                                    std::vec::Vec<crate::model::BackupSchedule>,
6753                                >>()?
6754                                .unwrap_or_default();
6755                        }
6756                        __FieldTag::__next_page_token => {
6757                            if !fields.insert(__FieldTag::__next_page_token) {
6758                                return std::result::Result::Err(A::Error::duplicate_field(
6759                                    "multiple values for next_page_token",
6760                                ));
6761                            }
6762                            result.next_page_token = map
6763                                .next_value::<std::option::Option<std::string::String>>()?
6764                                .unwrap_or_default();
6765                        }
6766                        __FieldTag::Unknown(key) => {
6767                            let value = map.next_value::<serde_json::Value>()?;
6768                            result._unknown_fields.insert(key, value);
6769                        }
6770                    }
6771                }
6772                std::result::Result::Ok(result)
6773            }
6774        }
6775        deserializer.deserialize_any(Visitor)
6776    }
6777}
6778
6779#[doc(hidden)]
6780impl serde::ser::Serialize for ListBackupSchedulesResponse {
6781    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6782    where
6783        S: serde::ser::Serializer,
6784    {
6785        use serde::ser::SerializeMap;
6786        #[allow(unused_imports)]
6787        use std::option::Option::Some;
6788        let mut state = serializer.serialize_map(std::option::Option::None)?;
6789        if !self.backup_schedules.is_empty() {
6790            state.serialize_entry("backupSchedules", &self.backup_schedules)?;
6791        }
6792        if !self.next_page_token.is_empty() {
6793            state.serialize_entry("nextPageToken", &self.next_page_token)?;
6794        }
6795        if !self._unknown_fields.is_empty() {
6796            for (key, value) in self._unknown_fields.iter() {
6797                state.serialize_entry(key, &value)?;
6798            }
6799        }
6800        state.end()
6801    }
6802}
6803
6804impl std::fmt::Debug for ListBackupSchedulesResponse {
6805    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6806        let mut debug_struct = f.debug_struct("ListBackupSchedulesResponse");
6807        debug_struct.field("backup_schedules", &self.backup_schedules);
6808        debug_struct.field("next_page_token", &self.next_page_token);
6809        if !self._unknown_fields.is_empty() {
6810            debug_struct.field("_unknown_fields", &self._unknown_fields);
6811        }
6812        debug_struct.finish()
6813    }
6814}
6815
6816/// The request for
6817/// [UpdateBackupScheduleRequest][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule].
6818///
6819/// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule]: crate::client::DatabaseAdmin::update_backup_schedule
6820#[derive(Clone, Default, PartialEq)]
6821#[non_exhaustive]
6822pub struct UpdateBackupScheduleRequest {
6823    /// Required. The backup schedule to update. `backup_schedule.name`, and the
6824    /// fields to be updated as specified by `update_mask` are required. Other
6825    /// fields are ignored.
6826    pub backup_schedule: std::option::Option<crate::model::BackupSchedule>,
6827
6828    /// Required. A mask specifying which fields in the BackupSchedule resource
6829    /// should be updated. This mask is relative to the BackupSchedule resource,
6830    /// not to the request message. The field mask must always be
6831    /// specified; this prevents any future fields from being erased
6832    /// accidentally.
6833    pub update_mask: std::option::Option<wkt::FieldMask>,
6834
6835    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6836}
6837
6838impl UpdateBackupScheduleRequest {
6839    pub fn new() -> Self {
6840        std::default::Default::default()
6841    }
6842
6843    /// Sets the value of [backup_schedule][crate::model::UpdateBackupScheduleRequest::backup_schedule].
6844    pub fn set_backup_schedule<T>(mut self, v: T) -> Self
6845    where
6846        T: std::convert::Into<crate::model::BackupSchedule>,
6847    {
6848        self.backup_schedule = std::option::Option::Some(v.into());
6849        self
6850    }
6851
6852    /// Sets or clears the value of [backup_schedule][crate::model::UpdateBackupScheduleRequest::backup_schedule].
6853    pub fn set_or_clear_backup_schedule<T>(mut self, v: std::option::Option<T>) -> Self
6854    where
6855        T: std::convert::Into<crate::model::BackupSchedule>,
6856    {
6857        self.backup_schedule = v.map(|x| x.into());
6858        self
6859    }
6860
6861    /// Sets the value of [update_mask][crate::model::UpdateBackupScheduleRequest::update_mask].
6862    pub fn set_update_mask<T>(mut self, v: T) -> Self
6863    where
6864        T: std::convert::Into<wkt::FieldMask>,
6865    {
6866        self.update_mask = std::option::Option::Some(v.into());
6867        self
6868    }
6869
6870    /// Sets or clears the value of [update_mask][crate::model::UpdateBackupScheduleRequest::update_mask].
6871    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6872    where
6873        T: std::convert::Into<wkt::FieldMask>,
6874    {
6875        self.update_mask = v.map(|x| x.into());
6876        self
6877    }
6878}
6879
6880impl wkt::message::Message for UpdateBackupScheduleRequest {
6881    fn typename() -> &'static str {
6882        "type.googleapis.com/google.spanner.admin.database.v1.UpdateBackupScheduleRequest"
6883    }
6884}
6885
6886#[doc(hidden)]
6887impl<'de> serde::de::Deserialize<'de> for UpdateBackupScheduleRequest {
6888    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6889    where
6890        D: serde::Deserializer<'de>,
6891    {
6892        #[allow(non_camel_case_types)]
6893        #[doc(hidden)]
6894        #[derive(PartialEq, Eq, Hash)]
6895        enum __FieldTag {
6896            __backup_schedule,
6897            __update_mask,
6898            Unknown(std::string::String),
6899        }
6900        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6901            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6902            where
6903                D: serde::Deserializer<'de>,
6904            {
6905                struct Visitor;
6906                impl<'de> serde::de::Visitor<'de> for Visitor {
6907                    type Value = __FieldTag;
6908                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6909                        formatter.write_str("a field name for UpdateBackupScheduleRequest")
6910                    }
6911                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6912                    where
6913                        E: serde::de::Error,
6914                    {
6915                        use std::result::Result::Ok;
6916                        use std::string::ToString;
6917                        match value {
6918                            "backupSchedule" => Ok(__FieldTag::__backup_schedule),
6919                            "backup_schedule" => Ok(__FieldTag::__backup_schedule),
6920                            "updateMask" => Ok(__FieldTag::__update_mask),
6921                            "update_mask" => Ok(__FieldTag::__update_mask),
6922                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6923                        }
6924                    }
6925                }
6926                deserializer.deserialize_identifier(Visitor)
6927            }
6928        }
6929        struct Visitor;
6930        impl<'de> serde::de::Visitor<'de> for Visitor {
6931            type Value = UpdateBackupScheduleRequest;
6932            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6933                formatter.write_str("struct UpdateBackupScheduleRequest")
6934            }
6935            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6936            where
6937                A: serde::de::MapAccess<'de>,
6938            {
6939                #[allow(unused_imports)]
6940                use serde::de::Error;
6941                use std::option::Option::Some;
6942                let mut fields = std::collections::HashSet::new();
6943                let mut result = Self::Value::new();
6944                while let Some(tag) = map.next_key::<__FieldTag>()? {
6945                    #[allow(clippy::match_single_binding)]
6946                    match tag {
6947                        __FieldTag::__backup_schedule => {
6948                            if !fields.insert(__FieldTag::__backup_schedule) {
6949                                return std::result::Result::Err(A::Error::duplicate_field(
6950                                    "multiple values for backup_schedule",
6951                                ));
6952                            }
6953                            result.backup_schedule = map
6954                                .next_value::<std::option::Option<crate::model::BackupSchedule>>(
6955                                )?;
6956                        }
6957                        __FieldTag::__update_mask => {
6958                            if !fields.insert(__FieldTag::__update_mask) {
6959                                return std::result::Result::Err(A::Error::duplicate_field(
6960                                    "multiple values for update_mask",
6961                                ));
6962                            }
6963                            result.update_mask =
6964                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
6965                        }
6966                        __FieldTag::Unknown(key) => {
6967                            let value = map.next_value::<serde_json::Value>()?;
6968                            result._unknown_fields.insert(key, value);
6969                        }
6970                    }
6971                }
6972                std::result::Result::Ok(result)
6973            }
6974        }
6975        deserializer.deserialize_any(Visitor)
6976    }
6977}
6978
6979#[doc(hidden)]
6980impl serde::ser::Serialize for UpdateBackupScheduleRequest {
6981    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6982    where
6983        S: serde::ser::Serializer,
6984    {
6985        use serde::ser::SerializeMap;
6986        #[allow(unused_imports)]
6987        use std::option::Option::Some;
6988        let mut state = serializer.serialize_map(std::option::Option::None)?;
6989        if self.backup_schedule.is_some() {
6990            state.serialize_entry("backupSchedule", &self.backup_schedule)?;
6991        }
6992        if self.update_mask.is_some() {
6993            state.serialize_entry("updateMask", &self.update_mask)?;
6994        }
6995        if !self._unknown_fields.is_empty() {
6996            for (key, value) in self._unknown_fields.iter() {
6997                state.serialize_entry(key, &value)?;
6998            }
6999        }
7000        state.end()
7001    }
7002}
7003
7004impl std::fmt::Debug for UpdateBackupScheduleRequest {
7005    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7006        let mut debug_struct = f.debug_struct("UpdateBackupScheduleRequest");
7007        debug_struct.field("backup_schedule", &self.backup_schedule);
7008        debug_struct.field("update_mask", &self.update_mask);
7009        if !self._unknown_fields.is_empty() {
7010            debug_struct.field("_unknown_fields", &self._unknown_fields);
7011        }
7012        debug_struct.finish()
7013    }
7014}
7015
7016/// Encapsulates progress related information for a Cloud Spanner long
7017/// running operation.
7018#[derive(Clone, Default, PartialEq)]
7019#[non_exhaustive]
7020pub struct OperationProgress {
7021    /// Percent completion of the operation.
7022    /// Values are between 0 and 100 inclusive.
7023    pub progress_percent: i32,
7024
7025    /// Time the request was received.
7026    pub start_time: std::option::Option<wkt::Timestamp>,
7027
7028    /// If set, the time at which this operation failed or was completed
7029    /// successfully.
7030    pub end_time: std::option::Option<wkt::Timestamp>,
7031
7032    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7033}
7034
7035impl OperationProgress {
7036    pub fn new() -> Self {
7037        std::default::Default::default()
7038    }
7039
7040    /// Sets the value of [progress_percent][crate::model::OperationProgress::progress_percent].
7041    pub fn set_progress_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7042        self.progress_percent = v.into();
7043        self
7044    }
7045
7046    /// Sets the value of [start_time][crate::model::OperationProgress::start_time].
7047    pub fn set_start_time<T>(mut self, v: T) -> Self
7048    where
7049        T: std::convert::Into<wkt::Timestamp>,
7050    {
7051        self.start_time = std::option::Option::Some(v.into());
7052        self
7053    }
7054
7055    /// Sets or clears the value of [start_time][crate::model::OperationProgress::start_time].
7056    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
7057    where
7058        T: std::convert::Into<wkt::Timestamp>,
7059    {
7060        self.start_time = v.map(|x| x.into());
7061        self
7062    }
7063
7064    /// Sets the value of [end_time][crate::model::OperationProgress::end_time].
7065    pub fn set_end_time<T>(mut self, v: T) -> Self
7066    where
7067        T: std::convert::Into<wkt::Timestamp>,
7068    {
7069        self.end_time = std::option::Option::Some(v.into());
7070        self
7071    }
7072
7073    /// Sets or clears the value of [end_time][crate::model::OperationProgress::end_time].
7074    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
7075    where
7076        T: std::convert::Into<wkt::Timestamp>,
7077    {
7078        self.end_time = v.map(|x| x.into());
7079        self
7080    }
7081}
7082
7083impl wkt::message::Message for OperationProgress {
7084    fn typename() -> &'static str {
7085        "type.googleapis.com/google.spanner.admin.database.v1.OperationProgress"
7086    }
7087}
7088
7089#[doc(hidden)]
7090impl<'de> serde::de::Deserialize<'de> for OperationProgress {
7091    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7092    where
7093        D: serde::Deserializer<'de>,
7094    {
7095        #[allow(non_camel_case_types)]
7096        #[doc(hidden)]
7097        #[derive(PartialEq, Eq, Hash)]
7098        enum __FieldTag {
7099            __progress_percent,
7100            __start_time,
7101            __end_time,
7102            Unknown(std::string::String),
7103        }
7104        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7105            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7106            where
7107                D: serde::Deserializer<'de>,
7108            {
7109                struct Visitor;
7110                impl<'de> serde::de::Visitor<'de> for Visitor {
7111                    type Value = __FieldTag;
7112                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7113                        formatter.write_str("a field name for OperationProgress")
7114                    }
7115                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7116                    where
7117                        E: serde::de::Error,
7118                    {
7119                        use std::result::Result::Ok;
7120                        use std::string::ToString;
7121                        match value {
7122                            "progressPercent" => Ok(__FieldTag::__progress_percent),
7123                            "progress_percent" => Ok(__FieldTag::__progress_percent),
7124                            "startTime" => Ok(__FieldTag::__start_time),
7125                            "start_time" => Ok(__FieldTag::__start_time),
7126                            "endTime" => Ok(__FieldTag::__end_time),
7127                            "end_time" => Ok(__FieldTag::__end_time),
7128                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7129                        }
7130                    }
7131                }
7132                deserializer.deserialize_identifier(Visitor)
7133            }
7134        }
7135        struct Visitor;
7136        impl<'de> serde::de::Visitor<'de> for Visitor {
7137            type Value = OperationProgress;
7138            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7139                formatter.write_str("struct OperationProgress")
7140            }
7141            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7142            where
7143                A: serde::de::MapAccess<'de>,
7144            {
7145                #[allow(unused_imports)]
7146                use serde::de::Error;
7147                use std::option::Option::Some;
7148                let mut fields = std::collections::HashSet::new();
7149                let mut result = Self::Value::new();
7150                while let Some(tag) = map.next_key::<__FieldTag>()? {
7151                    #[allow(clippy::match_single_binding)]
7152                    match tag {
7153                        __FieldTag::__progress_percent => {
7154                            if !fields.insert(__FieldTag::__progress_percent) {
7155                                return std::result::Result::Err(A::Error::duplicate_field(
7156                                    "multiple values for progress_percent",
7157                                ));
7158                            }
7159                            struct __With(std::option::Option<i32>);
7160                            impl<'de> serde::de::Deserialize<'de> for __With {
7161                                fn deserialize<D>(
7162                                    deserializer: D,
7163                                ) -> std::result::Result<Self, D::Error>
7164                                where
7165                                    D: serde::de::Deserializer<'de>,
7166                                {
7167                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
7168                                }
7169                            }
7170                            result.progress_percent =
7171                                map.next_value::<__With>()?.0.unwrap_or_default();
7172                        }
7173                        __FieldTag::__start_time => {
7174                            if !fields.insert(__FieldTag::__start_time) {
7175                                return std::result::Result::Err(A::Error::duplicate_field(
7176                                    "multiple values for start_time",
7177                                ));
7178                            }
7179                            result.start_time =
7180                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
7181                        }
7182                        __FieldTag::__end_time => {
7183                            if !fields.insert(__FieldTag::__end_time) {
7184                                return std::result::Result::Err(A::Error::duplicate_field(
7185                                    "multiple values for end_time",
7186                                ));
7187                            }
7188                            result.end_time =
7189                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
7190                        }
7191                        __FieldTag::Unknown(key) => {
7192                            let value = map.next_value::<serde_json::Value>()?;
7193                            result._unknown_fields.insert(key, value);
7194                        }
7195                    }
7196                }
7197                std::result::Result::Ok(result)
7198            }
7199        }
7200        deserializer.deserialize_any(Visitor)
7201    }
7202}
7203
7204#[doc(hidden)]
7205impl serde::ser::Serialize for OperationProgress {
7206    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7207    where
7208        S: serde::ser::Serializer,
7209    {
7210        use serde::ser::SerializeMap;
7211        #[allow(unused_imports)]
7212        use std::option::Option::Some;
7213        let mut state = serializer.serialize_map(std::option::Option::None)?;
7214        if !wkt::internal::is_default(&self.progress_percent) {
7215            struct __With<'a>(&'a i32);
7216            impl<'a> serde::ser::Serialize for __With<'a> {
7217                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7218                where
7219                    S: serde::ser::Serializer,
7220                {
7221                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
7222                }
7223            }
7224            state.serialize_entry("progressPercent", &__With(&self.progress_percent))?;
7225        }
7226        if self.start_time.is_some() {
7227            state.serialize_entry("startTime", &self.start_time)?;
7228        }
7229        if self.end_time.is_some() {
7230            state.serialize_entry("endTime", &self.end_time)?;
7231        }
7232        if !self._unknown_fields.is_empty() {
7233            for (key, value) in self._unknown_fields.iter() {
7234                state.serialize_entry(key, &value)?;
7235            }
7236        }
7237        state.end()
7238    }
7239}
7240
7241impl std::fmt::Debug for OperationProgress {
7242    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7243        let mut debug_struct = f.debug_struct("OperationProgress");
7244        debug_struct.field("progress_percent", &self.progress_percent);
7245        debug_struct.field("start_time", &self.start_time);
7246        debug_struct.field("end_time", &self.end_time);
7247        if !self._unknown_fields.is_empty() {
7248            debug_struct.field("_unknown_fields", &self._unknown_fields);
7249        }
7250        debug_struct.finish()
7251    }
7252}
7253
7254/// Encryption configuration for a Cloud Spanner database.
7255#[derive(Clone, Default, PartialEq)]
7256#[non_exhaustive]
7257pub struct EncryptionConfig {
7258    /// The Cloud KMS key to be used for encrypting and decrypting
7259    /// the database. Values are of the form
7260    /// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
7261    pub kms_key_name: std::string::String,
7262
7263    /// Specifies the KMS configuration for the one or more keys used to encrypt
7264    /// the database. Values are of the form
7265    /// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
7266    ///
7267    /// The keys referenced by kms_key_names must fully cover all
7268    /// regions of the database instance configuration. Some examples:
7269    ///
7270    /// * For single region database instance configs, specify a single regional
7271    ///   location KMS key.
7272    /// * For multi-regional database instance configs of type GOOGLE_MANAGED,
7273    ///   either specify a multi-regional location KMS key or multiple regional
7274    ///   location KMS keys that cover all regions in the instance config.
7275    /// * For a database instance config of type USER_MANAGED, please specify only
7276    ///   regional location KMS keys to cover each region in the instance config.
7277    ///   Multi-regional location KMS keys are not supported for USER_MANAGED
7278    ///   instance configs.
7279    pub kms_key_names: std::vec::Vec<std::string::String>,
7280
7281    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7282}
7283
7284impl EncryptionConfig {
7285    pub fn new() -> Self {
7286        std::default::Default::default()
7287    }
7288
7289    /// Sets the value of [kms_key_name][crate::model::EncryptionConfig::kms_key_name].
7290    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7291        self.kms_key_name = v.into();
7292        self
7293    }
7294
7295    /// Sets the value of [kms_key_names][crate::model::EncryptionConfig::kms_key_names].
7296    pub fn set_kms_key_names<T, V>(mut self, v: T) -> Self
7297    where
7298        T: std::iter::IntoIterator<Item = V>,
7299        V: std::convert::Into<std::string::String>,
7300    {
7301        use std::iter::Iterator;
7302        self.kms_key_names = v.into_iter().map(|i| i.into()).collect();
7303        self
7304    }
7305}
7306
7307impl wkt::message::Message for EncryptionConfig {
7308    fn typename() -> &'static str {
7309        "type.googleapis.com/google.spanner.admin.database.v1.EncryptionConfig"
7310    }
7311}
7312
7313#[doc(hidden)]
7314impl<'de> serde::de::Deserialize<'de> for EncryptionConfig {
7315    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7316    where
7317        D: serde::Deserializer<'de>,
7318    {
7319        #[allow(non_camel_case_types)]
7320        #[doc(hidden)]
7321        #[derive(PartialEq, Eq, Hash)]
7322        enum __FieldTag {
7323            __kms_key_name,
7324            __kms_key_names,
7325            Unknown(std::string::String),
7326        }
7327        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7328            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7329            where
7330                D: serde::Deserializer<'de>,
7331            {
7332                struct Visitor;
7333                impl<'de> serde::de::Visitor<'de> for Visitor {
7334                    type Value = __FieldTag;
7335                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7336                        formatter.write_str("a field name for EncryptionConfig")
7337                    }
7338                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7339                    where
7340                        E: serde::de::Error,
7341                    {
7342                        use std::result::Result::Ok;
7343                        use std::string::ToString;
7344                        match value {
7345                            "kmsKeyName" => Ok(__FieldTag::__kms_key_name),
7346                            "kms_key_name" => Ok(__FieldTag::__kms_key_name),
7347                            "kmsKeyNames" => Ok(__FieldTag::__kms_key_names),
7348                            "kms_key_names" => Ok(__FieldTag::__kms_key_names),
7349                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7350                        }
7351                    }
7352                }
7353                deserializer.deserialize_identifier(Visitor)
7354            }
7355        }
7356        struct Visitor;
7357        impl<'de> serde::de::Visitor<'de> for Visitor {
7358            type Value = EncryptionConfig;
7359            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7360                formatter.write_str("struct EncryptionConfig")
7361            }
7362            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7363            where
7364                A: serde::de::MapAccess<'de>,
7365            {
7366                #[allow(unused_imports)]
7367                use serde::de::Error;
7368                use std::option::Option::Some;
7369                let mut fields = std::collections::HashSet::new();
7370                let mut result = Self::Value::new();
7371                while let Some(tag) = map.next_key::<__FieldTag>()? {
7372                    #[allow(clippy::match_single_binding)]
7373                    match tag {
7374                        __FieldTag::__kms_key_name => {
7375                            if !fields.insert(__FieldTag::__kms_key_name) {
7376                                return std::result::Result::Err(A::Error::duplicate_field(
7377                                    "multiple values for kms_key_name",
7378                                ));
7379                            }
7380                            result.kms_key_name = map
7381                                .next_value::<std::option::Option<std::string::String>>()?
7382                                .unwrap_or_default();
7383                        }
7384                        __FieldTag::__kms_key_names => {
7385                            if !fields.insert(__FieldTag::__kms_key_names) {
7386                                return std::result::Result::Err(A::Error::duplicate_field(
7387                                    "multiple values for kms_key_names",
7388                                ));
7389                            }
7390                            result.kms_key_names = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
7391                        }
7392                        __FieldTag::Unknown(key) => {
7393                            let value = map.next_value::<serde_json::Value>()?;
7394                            result._unknown_fields.insert(key, value);
7395                        }
7396                    }
7397                }
7398                std::result::Result::Ok(result)
7399            }
7400        }
7401        deserializer.deserialize_any(Visitor)
7402    }
7403}
7404
7405#[doc(hidden)]
7406impl serde::ser::Serialize for EncryptionConfig {
7407    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7408    where
7409        S: serde::ser::Serializer,
7410    {
7411        use serde::ser::SerializeMap;
7412        #[allow(unused_imports)]
7413        use std::option::Option::Some;
7414        let mut state = serializer.serialize_map(std::option::Option::None)?;
7415        if !self.kms_key_name.is_empty() {
7416            state.serialize_entry("kmsKeyName", &self.kms_key_name)?;
7417        }
7418        if !self.kms_key_names.is_empty() {
7419            state.serialize_entry("kmsKeyNames", &self.kms_key_names)?;
7420        }
7421        if !self._unknown_fields.is_empty() {
7422            for (key, value) in self._unknown_fields.iter() {
7423                state.serialize_entry(key, &value)?;
7424            }
7425        }
7426        state.end()
7427    }
7428}
7429
7430impl std::fmt::Debug for EncryptionConfig {
7431    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7432        let mut debug_struct = f.debug_struct("EncryptionConfig");
7433        debug_struct.field("kms_key_name", &self.kms_key_name);
7434        debug_struct.field("kms_key_names", &self.kms_key_names);
7435        if !self._unknown_fields.is_empty() {
7436            debug_struct.field("_unknown_fields", &self._unknown_fields);
7437        }
7438        debug_struct.finish()
7439    }
7440}
7441
7442/// Encryption information for a Cloud Spanner database or backup.
7443#[derive(Clone, Default, PartialEq)]
7444#[non_exhaustive]
7445pub struct EncryptionInfo {
7446    /// Output only. The type of encryption.
7447    pub encryption_type: crate::model::encryption_info::Type,
7448
7449    /// Output only. If present, the status of a recent encrypt/decrypt call on
7450    /// underlying data for this database or backup. Regardless of status, data is
7451    /// always encrypted at rest.
7452    pub encryption_status: std::option::Option<rpc::model::Status>,
7453
7454    /// Output only. A Cloud KMS key version that is being used to protect the
7455    /// database or backup.
7456    pub kms_key_version: std::string::String,
7457
7458    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7459}
7460
7461impl EncryptionInfo {
7462    pub fn new() -> Self {
7463        std::default::Default::default()
7464    }
7465
7466    /// Sets the value of [encryption_type][crate::model::EncryptionInfo::encryption_type].
7467    pub fn set_encryption_type<T: std::convert::Into<crate::model::encryption_info::Type>>(
7468        mut self,
7469        v: T,
7470    ) -> Self {
7471        self.encryption_type = v.into();
7472        self
7473    }
7474
7475    /// Sets the value of [encryption_status][crate::model::EncryptionInfo::encryption_status].
7476    pub fn set_encryption_status<T>(mut self, v: T) -> Self
7477    where
7478        T: std::convert::Into<rpc::model::Status>,
7479    {
7480        self.encryption_status = std::option::Option::Some(v.into());
7481        self
7482    }
7483
7484    /// Sets or clears the value of [encryption_status][crate::model::EncryptionInfo::encryption_status].
7485    pub fn set_or_clear_encryption_status<T>(mut self, v: std::option::Option<T>) -> Self
7486    where
7487        T: std::convert::Into<rpc::model::Status>,
7488    {
7489        self.encryption_status = v.map(|x| x.into());
7490        self
7491    }
7492
7493    /// Sets the value of [kms_key_version][crate::model::EncryptionInfo::kms_key_version].
7494    pub fn set_kms_key_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7495        self.kms_key_version = v.into();
7496        self
7497    }
7498}
7499
7500impl wkt::message::Message for EncryptionInfo {
7501    fn typename() -> &'static str {
7502        "type.googleapis.com/google.spanner.admin.database.v1.EncryptionInfo"
7503    }
7504}
7505
7506#[doc(hidden)]
7507impl<'de> serde::de::Deserialize<'de> for EncryptionInfo {
7508    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7509    where
7510        D: serde::Deserializer<'de>,
7511    {
7512        #[allow(non_camel_case_types)]
7513        #[doc(hidden)]
7514        #[derive(PartialEq, Eq, Hash)]
7515        enum __FieldTag {
7516            __encryption_type,
7517            __encryption_status,
7518            __kms_key_version,
7519            Unknown(std::string::String),
7520        }
7521        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7522            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7523            where
7524                D: serde::Deserializer<'de>,
7525            {
7526                struct Visitor;
7527                impl<'de> serde::de::Visitor<'de> for Visitor {
7528                    type Value = __FieldTag;
7529                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7530                        formatter.write_str("a field name for EncryptionInfo")
7531                    }
7532                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7533                    where
7534                        E: serde::de::Error,
7535                    {
7536                        use std::result::Result::Ok;
7537                        use std::string::ToString;
7538                        match value {
7539                            "encryptionType" => Ok(__FieldTag::__encryption_type),
7540                            "encryption_type" => Ok(__FieldTag::__encryption_type),
7541                            "encryptionStatus" => Ok(__FieldTag::__encryption_status),
7542                            "encryption_status" => Ok(__FieldTag::__encryption_status),
7543                            "kmsKeyVersion" => Ok(__FieldTag::__kms_key_version),
7544                            "kms_key_version" => Ok(__FieldTag::__kms_key_version),
7545                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7546                        }
7547                    }
7548                }
7549                deserializer.deserialize_identifier(Visitor)
7550            }
7551        }
7552        struct Visitor;
7553        impl<'de> serde::de::Visitor<'de> for Visitor {
7554            type Value = EncryptionInfo;
7555            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7556                formatter.write_str("struct EncryptionInfo")
7557            }
7558            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7559            where
7560                A: serde::de::MapAccess<'de>,
7561            {
7562                #[allow(unused_imports)]
7563                use serde::de::Error;
7564                use std::option::Option::Some;
7565                let mut fields = std::collections::HashSet::new();
7566                let mut result = Self::Value::new();
7567                while let Some(tag) = map.next_key::<__FieldTag>()? {
7568                    #[allow(clippy::match_single_binding)]
7569                    match tag {
7570                        __FieldTag::__encryption_type => {
7571                            if !fields.insert(__FieldTag::__encryption_type) {
7572                                return std::result::Result::Err(A::Error::duplicate_field(
7573                                    "multiple values for encryption_type",
7574                                ));
7575                            }
7576                            result.encryption_type = map.next_value::<std::option::Option<crate::model::encryption_info::Type>>()?.unwrap_or_default();
7577                        }
7578                        __FieldTag::__encryption_status => {
7579                            if !fields.insert(__FieldTag::__encryption_status) {
7580                                return std::result::Result::Err(A::Error::duplicate_field(
7581                                    "multiple values for encryption_status",
7582                                ));
7583                            }
7584                            result.encryption_status =
7585                                map.next_value::<std::option::Option<rpc::model::Status>>()?;
7586                        }
7587                        __FieldTag::__kms_key_version => {
7588                            if !fields.insert(__FieldTag::__kms_key_version) {
7589                                return std::result::Result::Err(A::Error::duplicate_field(
7590                                    "multiple values for kms_key_version",
7591                                ));
7592                            }
7593                            result.kms_key_version = map
7594                                .next_value::<std::option::Option<std::string::String>>()?
7595                                .unwrap_or_default();
7596                        }
7597                        __FieldTag::Unknown(key) => {
7598                            let value = map.next_value::<serde_json::Value>()?;
7599                            result._unknown_fields.insert(key, value);
7600                        }
7601                    }
7602                }
7603                std::result::Result::Ok(result)
7604            }
7605        }
7606        deserializer.deserialize_any(Visitor)
7607    }
7608}
7609
7610#[doc(hidden)]
7611impl serde::ser::Serialize for EncryptionInfo {
7612    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7613    where
7614        S: serde::ser::Serializer,
7615    {
7616        use serde::ser::SerializeMap;
7617        #[allow(unused_imports)]
7618        use std::option::Option::Some;
7619        let mut state = serializer.serialize_map(std::option::Option::None)?;
7620        if !wkt::internal::is_default(&self.encryption_type) {
7621            state.serialize_entry("encryptionType", &self.encryption_type)?;
7622        }
7623        if self.encryption_status.is_some() {
7624            state.serialize_entry("encryptionStatus", &self.encryption_status)?;
7625        }
7626        if !self.kms_key_version.is_empty() {
7627            state.serialize_entry("kmsKeyVersion", &self.kms_key_version)?;
7628        }
7629        if !self._unknown_fields.is_empty() {
7630            for (key, value) in self._unknown_fields.iter() {
7631                state.serialize_entry(key, &value)?;
7632            }
7633        }
7634        state.end()
7635    }
7636}
7637
7638impl std::fmt::Debug for EncryptionInfo {
7639    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7640        let mut debug_struct = f.debug_struct("EncryptionInfo");
7641        debug_struct.field("encryption_type", &self.encryption_type);
7642        debug_struct.field("encryption_status", &self.encryption_status);
7643        debug_struct.field("kms_key_version", &self.kms_key_version);
7644        if !self._unknown_fields.is_empty() {
7645            debug_struct.field("_unknown_fields", &self._unknown_fields);
7646        }
7647        debug_struct.finish()
7648    }
7649}
7650
7651/// Defines additional types related to [EncryptionInfo].
7652pub mod encryption_info {
7653    #[allow(unused_imports)]
7654    use super::*;
7655
7656    /// Possible encryption types.
7657    ///
7658    /// # Working with unknown values
7659    ///
7660    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7661    /// additional enum variants at any time. Adding new variants is not considered
7662    /// a breaking change. Applications should write their code in anticipation of:
7663    ///
7664    /// - New values appearing in future releases of the client library, **and**
7665    /// - New values received dynamically, without application changes.
7666    ///
7667    /// Please consult the [Working with enums] section in the user guide for some
7668    /// guidelines.
7669    ///
7670    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7671    #[derive(Clone, Debug, PartialEq)]
7672    #[non_exhaustive]
7673    pub enum Type {
7674        /// Encryption type was not specified, though data at rest remains encrypted.
7675        Unspecified,
7676        /// The data is encrypted at rest with a key that is
7677        /// fully managed by Google. No key version or status will be populated.
7678        /// This is the default state.
7679        GoogleDefaultEncryption,
7680        /// The data is encrypted at rest with a key that is
7681        /// managed by the customer. The active version of the key. `kms_key_version`
7682        /// will be populated, and `encryption_status` may be populated.
7683        CustomerManagedEncryption,
7684        /// If set, the enum was initialized with an unknown value.
7685        ///
7686        /// Applications can examine the value using [Type::value] or
7687        /// [Type::name].
7688        UnknownValue(r#type::UnknownValue),
7689    }
7690
7691    #[doc(hidden)]
7692    pub mod r#type {
7693        #[allow(unused_imports)]
7694        use super::*;
7695        #[derive(Clone, Debug, PartialEq)]
7696        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7697    }
7698
7699    impl Type {
7700        /// Gets the enum value.
7701        ///
7702        /// Returns `None` if the enum contains an unknown value deserialized from
7703        /// the string representation of enums.
7704        pub fn value(&self) -> std::option::Option<i32> {
7705            match self {
7706                Self::Unspecified => std::option::Option::Some(0),
7707                Self::GoogleDefaultEncryption => std::option::Option::Some(1),
7708                Self::CustomerManagedEncryption => std::option::Option::Some(2),
7709                Self::UnknownValue(u) => u.0.value(),
7710            }
7711        }
7712
7713        /// Gets the enum value as a string.
7714        ///
7715        /// Returns `None` if the enum contains an unknown value deserialized from
7716        /// the integer representation of enums.
7717        pub fn name(&self) -> std::option::Option<&str> {
7718            match self {
7719                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
7720                Self::GoogleDefaultEncryption => {
7721                    std::option::Option::Some("GOOGLE_DEFAULT_ENCRYPTION")
7722                }
7723                Self::CustomerManagedEncryption => {
7724                    std::option::Option::Some("CUSTOMER_MANAGED_ENCRYPTION")
7725                }
7726                Self::UnknownValue(u) => u.0.name(),
7727            }
7728        }
7729    }
7730
7731    impl std::default::Default for Type {
7732        fn default() -> Self {
7733            use std::convert::From;
7734            Self::from(0)
7735        }
7736    }
7737
7738    impl std::fmt::Display for Type {
7739        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7740            wkt::internal::display_enum(f, self.name(), self.value())
7741        }
7742    }
7743
7744    impl std::convert::From<i32> for Type {
7745        fn from(value: i32) -> Self {
7746            match value {
7747                0 => Self::Unspecified,
7748                1 => Self::GoogleDefaultEncryption,
7749                2 => Self::CustomerManagedEncryption,
7750                _ => Self::UnknownValue(r#type::UnknownValue(
7751                    wkt::internal::UnknownEnumValue::Integer(value),
7752                )),
7753            }
7754        }
7755    }
7756
7757    impl std::convert::From<&str> for Type {
7758        fn from(value: &str) -> Self {
7759            use std::string::ToString;
7760            match value {
7761                "TYPE_UNSPECIFIED" => Self::Unspecified,
7762                "GOOGLE_DEFAULT_ENCRYPTION" => Self::GoogleDefaultEncryption,
7763                "CUSTOMER_MANAGED_ENCRYPTION" => Self::CustomerManagedEncryption,
7764                _ => Self::UnknownValue(r#type::UnknownValue(
7765                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7766                )),
7767            }
7768        }
7769    }
7770
7771    impl serde::ser::Serialize for Type {
7772        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7773        where
7774            S: serde::Serializer,
7775        {
7776            match self {
7777                Self::Unspecified => serializer.serialize_i32(0),
7778                Self::GoogleDefaultEncryption => serializer.serialize_i32(1),
7779                Self::CustomerManagedEncryption => serializer.serialize_i32(2),
7780                Self::UnknownValue(u) => u.0.serialize(serializer),
7781            }
7782        }
7783    }
7784
7785    impl<'de> serde::de::Deserialize<'de> for Type {
7786        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7787        where
7788            D: serde::Deserializer<'de>,
7789        {
7790            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
7791                ".google.spanner.admin.database.v1.EncryptionInfo.Type",
7792            ))
7793        }
7794    }
7795}
7796
7797/// Information about the database restore.
7798#[derive(Clone, Default, PartialEq)]
7799#[non_exhaustive]
7800pub struct RestoreInfo {
7801    /// The type of the restore source.
7802    pub source_type: crate::model::RestoreSourceType,
7803
7804    /// Information about the source used to restore the database.
7805    pub source_info: std::option::Option<crate::model::restore_info::SourceInfo>,
7806
7807    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7808}
7809
7810impl RestoreInfo {
7811    pub fn new() -> Self {
7812        std::default::Default::default()
7813    }
7814
7815    /// Sets the value of [source_type][crate::model::RestoreInfo::source_type].
7816    pub fn set_source_type<T: std::convert::Into<crate::model::RestoreSourceType>>(
7817        mut self,
7818        v: T,
7819    ) -> Self {
7820        self.source_type = v.into();
7821        self
7822    }
7823
7824    /// Sets the value of [source_info][crate::model::RestoreInfo::source_info].
7825    ///
7826    /// Note that all the setters affecting `source_info` are mutually
7827    /// exclusive.
7828    pub fn set_source_info<
7829        T: std::convert::Into<std::option::Option<crate::model::restore_info::SourceInfo>>,
7830    >(
7831        mut self,
7832        v: T,
7833    ) -> Self {
7834        self.source_info = v.into();
7835        self
7836    }
7837
7838    /// The value of [source_info][crate::model::RestoreInfo::source_info]
7839    /// if it holds a `BackupInfo`, `None` if the field is not set or
7840    /// holds a different branch.
7841    pub fn backup_info(&self) -> std::option::Option<&std::boxed::Box<crate::model::BackupInfo>> {
7842        #[allow(unreachable_patterns)]
7843        self.source_info.as_ref().and_then(|v| match v {
7844            crate::model::restore_info::SourceInfo::BackupInfo(v) => std::option::Option::Some(v),
7845            _ => std::option::Option::None,
7846        })
7847    }
7848
7849    /// Sets the value of [source_info][crate::model::RestoreInfo::source_info]
7850    /// to hold a `BackupInfo`.
7851    ///
7852    /// Note that all the setters affecting `source_info` are
7853    /// mutually exclusive.
7854    pub fn set_backup_info<T: std::convert::Into<std::boxed::Box<crate::model::BackupInfo>>>(
7855        mut self,
7856        v: T,
7857    ) -> Self {
7858        self.source_info =
7859            std::option::Option::Some(crate::model::restore_info::SourceInfo::BackupInfo(v.into()));
7860        self
7861    }
7862}
7863
7864impl wkt::message::Message for RestoreInfo {
7865    fn typename() -> &'static str {
7866        "type.googleapis.com/google.spanner.admin.database.v1.RestoreInfo"
7867    }
7868}
7869
7870#[doc(hidden)]
7871impl<'de> serde::de::Deserialize<'de> for RestoreInfo {
7872    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7873    where
7874        D: serde::Deserializer<'de>,
7875    {
7876        #[allow(non_camel_case_types)]
7877        #[doc(hidden)]
7878        #[derive(PartialEq, Eq, Hash)]
7879        enum __FieldTag {
7880            __source_type,
7881            __backup_info,
7882            Unknown(std::string::String),
7883        }
7884        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7885            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7886            where
7887                D: serde::Deserializer<'de>,
7888            {
7889                struct Visitor;
7890                impl<'de> serde::de::Visitor<'de> for Visitor {
7891                    type Value = __FieldTag;
7892                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7893                        formatter.write_str("a field name for RestoreInfo")
7894                    }
7895                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7896                    where
7897                        E: serde::de::Error,
7898                    {
7899                        use std::result::Result::Ok;
7900                        use std::string::ToString;
7901                        match value {
7902                            "sourceType" => Ok(__FieldTag::__source_type),
7903                            "source_type" => Ok(__FieldTag::__source_type),
7904                            "backupInfo" => Ok(__FieldTag::__backup_info),
7905                            "backup_info" => Ok(__FieldTag::__backup_info),
7906                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7907                        }
7908                    }
7909                }
7910                deserializer.deserialize_identifier(Visitor)
7911            }
7912        }
7913        struct Visitor;
7914        impl<'de> serde::de::Visitor<'de> for Visitor {
7915            type Value = RestoreInfo;
7916            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7917                formatter.write_str("struct RestoreInfo")
7918            }
7919            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7920            where
7921                A: serde::de::MapAccess<'de>,
7922            {
7923                #[allow(unused_imports)]
7924                use serde::de::Error;
7925                use std::option::Option::Some;
7926                let mut fields = std::collections::HashSet::new();
7927                let mut result = Self::Value::new();
7928                while let Some(tag) = map.next_key::<__FieldTag>()? {
7929                    #[allow(clippy::match_single_binding)]
7930                    match tag {
7931                        __FieldTag::__source_type => {
7932                            if !fields.insert(__FieldTag::__source_type) {
7933                                return std::result::Result::Err(A::Error::duplicate_field(
7934                                    "multiple values for source_type",
7935                                ));
7936                            }
7937                            result.source_type = map
7938                                .next_value::<std::option::Option<crate::model::RestoreSourceType>>(
7939                                )?
7940                                .unwrap_or_default();
7941                        }
7942                        __FieldTag::__backup_info => {
7943                            if !fields.insert(__FieldTag::__backup_info) {
7944                                return std::result::Result::Err(A::Error::duplicate_field(
7945                                    "multiple values for backup_info",
7946                                ));
7947                            }
7948                            if result.source_info.is_some() {
7949                                return std::result::Result::Err(A::Error::duplicate_field(
7950                                    "multiple values for `source_info`, a oneof with full ID .google.spanner.admin.database.v1.RestoreInfo.backup_info, latest field was backupInfo",
7951                                ));
7952                            }
7953                            result.source_info = std::option::Option::Some(
7954                                crate::model::restore_info::SourceInfo::BackupInfo(
7955                                    map.next_value::<std::option::Option<
7956                                        std::boxed::Box<crate::model::BackupInfo>,
7957                                    >>()?
7958                                    .unwrap_or_default(),
7959                                ),
7960                            );
7961                        }
7962                        __FieldTag::Unknown(key) => {
7963                            let value = map.next_value::<serde_json::Value>()?;
7964                            result._unknown_fields.insert(key, value);
7965                        }
7966                    }
7967                }
7968                std::result::Result::Ok(result)
7969            }
7970        }
7971        deserializer.deserialize_any(Visitor)
7972    }
7973}
7974
7975#[doc(hidden)]
7976impl serde::ser::Serialize for RestoreInfo {
7977    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7978    where
7979        S: serde::ser::Serializer,
7980    {
7981        use serde::ser::SerializeMap;
7982        #[allow(unused_imports)]
7983        use std::option::Option::Some;
7984        let mut state = serializer.serialize_map(std::option::Option::None)?;
7985        if !wkt::internal::is_default(&self.source_type) {
7986            state.serialize_entry("sourceType", &self.source_type)?;
7987        }
7988        if let Some(value) = self.backup_info() {
7989            state.serialize_entry("backupInfo", value)?;
7990        }
7991        if !self._unknown_fields.is_empty() {
7992            for (key, value) in self._unknown_fields.iter() {
7993                state.serialize_entry(key, &value)?;
7994            }
7995        }
7996        state.end()
7997    }
7998}
7999
8000impl std::fmt::Debug for RestoreInfo {
8001    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8002        let mut debug_struct = f.debug_struct("RestoreInfo");
8003        debug_struct.field("source_type", &self.source_type);
8004        debug_struct.field("source_info", &self.source_info);
8005        if !self._unknown_fields.is_empty() {
8006            debug_struct.field("_unknown_fields", &self._unknown_fields);
8007        }
8008        debug_struct.finish()
8009    }
8010}
8011
8012/// Defines additional types related to [RestoreInfo].
8013pub mod restore_info {
8014    #[allow(unused_imports)]
8015    use super::*;
8016
8017    /// Information about the source used to restore the database.
8018    #[derive(Clone, Debug, PartialEq)]
8019    #[non_exhaustive]
8020    pub enum SourceInfo {
8021        /// Information about the backup used to restore the database. The backup
8022        /// may no longer exist.
8023        BackupInfo(std::boxed::Box<crate::model::BackupInfo>),
8024    }
8025}
8026
8027/// A Cloud Spanner database.
8028#[derive(Clone, Default, PartialEq)]
8029#[non_exhaustive]
8030pub struct Database {
8031    /// Required. The name of the database. Values are of the form
8032    /// `projects/<project>/instances/<instance>/databases/<database>`,
8033    /// where `<database>` is as specified in the `CREATE DATABASE`
8034    /// statement. This name can be passed to other API methods to
8035    /// identify the database.
8036    pub name: std::string::String,
8037
8038    /// Output only. The current database state.
8039    pub state: crate::model::database::State,
8040
8041    /// Output only. If exists, the time at which the database creation started.
8042    pub create_time: std::option::Option<wkt::Timestamp>,
8043
8044    /// Output only. Applicable only for restored databases. Contains information
8045    /// about the restore source.
8046    pub restore_info: std::option::Option<crate::model::RestoreInfo>,
8047
8048    /// Output only. For databases that are using customer managed encryption, this
8049    /// field contains the encryption configuration for the database.
8050    /// For databases that are using Google default or other types of encryption,
8051    /// this field is empty.
8052    pub encryption_config: std::option::Option<crate::model::EncryptionConfig>,
8053
8054    /// Output only. For databases that are using customer managed encryption, this
8055    /// field contains the encryption information for the database, such as
8056    /// all Cloud KMS key versions that are in use. The `encryption_status' field
8057    /// inside of each `EncryptionInfo` is not populated.
8058    ///
8059    /// For databases that are using Google default or other types of encryption,
8060    /// this field is empty.
8061    ///
8062    /// This field is propagated lazily from the backend. There might be a delay
8063    /// from when a key version is being used and when it appears in this field.
8064    pub encryption_info: std::vec::Vec<crate::model::EncryptionInfo>,
8065
8066    /// Output only. The period in which Cloud Spanner retains all versions of data
8067    /// for the database. This is the same as the value of version_retention_period
8068    /// database option set using
8069    /// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl].
8070    /// Defaults to 1 hour, if not set.
8071    ///
8072    /// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]: crate::client::DatabaseAdmin::update_database_ddl
8073    pub version_retention_period: std::string::String,
8074
8075    /// Output only. Earliest timestamp at which older versions of the data can be
8076    /// read. This value is continuously updated by Cloud Spanner and becomes stale
8077    /// the moment it is queried. If you are using this value to recover data, make
8078    /// sure to account for the time from the moment when the value is queried to
8079    /// the moment when you initiate the recovery.
8080    pub earliest_version_time: std::option::Option<wkt::Timestamp>,
8081
8082    /// Output only. The read-write region which contains the database's leader
8083    /// replicas.
8084    ///
8085    /// This is the same as the value of default_leader
8086    /// database option set using DatabaseAdmin.CreateDatabase or
8087    /// DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty.
8088    pub default_leader: std::string::String,
8089
8090    /// Output only. The dialect of the Cloud Spanner Database.
8091    pub database_dialect: crate::model::DatabaseDialect,
8092
8093    /// Whether drop protection is enabled for this database. Defaults to false,
8094    /// if not set. For more details, please see how to [prevent accidental
8095    /// database
8096    /// deletion](https://cloud.google.com/spanner/docs/prevent-database-deletion).
8097    pub enable_drop_protection: bool,
8098
8099    /// Output only. If true, the database is being updated. If false, there are no
8100    /// ongoing update operations for the database.
8101    pub reconciling: bool,
8102
8103    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8104}
8105
8106impl Database {
8107    pub fn new() -> Self {
8108        std::default::Default::default()
8109    }
8110
8111    /// Sets the value of [name][crate::model::Database::name].
8112    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8113        self.name = v.into();
8114        self
8115    }
8116
8117    /// Sets the value of [state][crate::model::Database::state].
8118    pub fn set_state<T: std::convert::Into<crate::model::database::State>>(mut self, v: T) -> Self {
8119        self.state = v.into();
8120        self
8121    }
8122
8123    /// Sets the value of [create_time][crate::model::Database::create_time].
8124    pub fn set_create_time<T>(mut self, v: T) -> Self
8125    where
8126        T: std::convert::Into<wkt::Timestamp>,
8127    {
8128        self.create_time = std::option::Option::Some(v.into());
8129        self
8130    }
8131
8132    /// Sets or clears the value of [create_time][crate::model::Database::create_time].
8133    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8134    where
8135        T: std::convert::Into<wkt::Timestamp>,
8136    {
8137        self.create_time = v.map(|x| x.into());
8138        self
8139    }
8140
8141    /// Sets the value of [restore_info][crate::model::Database::restore_info].
8142    pub fn set_restore_info<T>(mut self, v: T) -> Self
8143    where
8144        T: std::convert::Into<crate::model::RestoreInfo>,
8145    {
8146        self.restore_info = std::option::Option::Some(v.into());
8147        self
8148    }
8149
8150    /// Sets or clears the value of [restore_info][crate::model::Database::restore_info].
8151    pub fn set_or_clear_restore_info<T>(mut self, v: std::option::Option<T>) -> Self
8152    where
8153        T: std::convert::Into<crate::model::RestoreInfo>,
8154    {
8155        self.restore_info = v.map(|x| x.into());
8156        self
8157    }
8158
8159    /// Sets the value of [encryption_config][crate::model::Database::encryption_config].
8160    pub fn set_encryption_config<T>(mut self, v: T) -> Self
8161    where
8162        T: std::convert::Into<crate::model::EncryptionConfig>,
8163    {
8164        self.encryption_config = std::option::Option::Some(v.into());
8165        self
8166    }
8167
8168    /// Sets or clears the value of [encryption_config][crate::model::Database::encryption_config].
8169    pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
8170    where
8171        T: std::convert::Into<crate::model::EncryptionConfig>,
8172    {
8173        self.encryption_config = v.map(|x| x.into());
8174        self
8175    }
8176
8177    /// Sets the value of [encryption_info][crate::model::Database::encryption_info].
8178    pub fn set_encryption_info<T, V>(mut self, v: T) -> Self
8179    where
8180        T: std::iter::IntoIterator<Item = V>,
8181        V: std::convert::Into<crate::model::EncryptionInfo>,
8182    {
8183        use std::iter::Iterator;
8184        self.encryption_info = v.into_iter().map(|i| i.into()).collect();
8185        self
8186    }
8187
8188    /// Sets the value of [version_retention_period][crate::model::Database::version_retention_period].
8189    pub fn set_version_retention_period<T: std::convert::Into<std::string::String>>(
8190        mut self,
8191        v: T,
8192    ) -> Self {
8193        self.version_retention_period = v.into();
8194        self
8195    }
8196
8197    /// Sets the value of [earliest_version_time][crate::model::Database::earliest_version_time].
8198    pub fn set_earliest_version_time<T>(mut self, v: T) -> Self
8199    where
8200        T: std::convert::Into<wkt::Timestamp>,
8201    {
8202        self.earliest_version_time = std::option::Option::Some(v.into());
8203        self
8204    }
8205
8206    /// Sets or clears the value of [earliest_version_time][crate::model::Database::earliest_version_time].
8207    pub fn set_or_clear_earliest_version_time<T>(mut self, v: std::option::Option<T>) -> Self
8208    where
8209        T: std::convert::Into<wkt::Timestamp>,
8210    {
8211        self.earliest_version_time = v.map(|x| x.into());
8212        self
8213    }
8214
8215    /// Sets the value of [default_leader][crate::model::Database::default_leader].
8216    pub fn set_default_leader<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8217        self.default_leader = v.into();
8218        self
8219    }
8220
8221    /// Sets the value of [database_dialect][crate::model::Database::database_dialect].
8222    pub fn set_database_dialect<T: std::convert::Into<crate::model::DatabaseDialect>>(
8223        mut self,
8224        v: T,
8225    ) -> Self {
8226        self.database_dialect = v.into();
8227        self
8228    }
8229
8230    /// Sets the value of [enable_drop_protection][crate::model::Database::enable_drop_protection].
8231    pub fn set_enable_drop_protection<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8232        self.enable_drop_protection = v.into();
8233        self
8234    }
8235
8236    /// Sets the value of [reconciling][crate::model::Database::reconciling].
8237    pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8238        self.reconciling = v.into();
8239        self
8240    }
8241}
8242
8243impl wkt::message::Message for Database {
8244    fn typename() -> &'static str {
8245        "type.googleapis.com/google.spanner.admin.database.v1.Database"
8246    }
8247}
8248
8249#[doc(hidden)]
8250impl<'de> serde::de::Deserialize<'de> for Database {
8251    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8252    where
8253        D: serde::Deserializer<'de>,
8254    {
8255        #[allow(non_camel_case_types)]
8256        #[doc(hidden)]
8257        #[derive(PartialEq, Eq, Hash)]
8258        enum __FieldTag {
8259            __name,
8260            __state,
8261            __create_time,
8262            __restore_info,
8263            __encryption_config,
8264            __encryption_info,
8265            __version_retention_period,
8266            __earliest_version_time,
8267            __default_leader,
8268            __database_dialect,
8269            __enable_drop_protection,
8270            __reconciling,
8271            Unknown(std::string::String),
8272        }
8273        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8274            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8275            where
8276                D: serde::Deserializer<'de>,
8277            {
8278                struct Visitor;
8279                impl<'de> serde::de::Visitor<'de> for Visitor {
8280                    type Value = __FieldTag;
8281                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8282                        formatter.write_str("a field name for Database")
8283                    }
8284                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8285                    where
8286                        E: serde::de::Error,
8287                    {
8288                        use std::result::Result::Ok;
8289                        use std::string::ToString;
8290                        match value {
8291                            "name" => Ok(__FieldTag::__name),
8292                            "state" => Ok(__FieldTag::__state),
8293                            "createTime" => Ok(__FieldTag::__create_time),
8294                            "create_time" => Ok(__FieldTag::__create_time),
8295                            "restoreInfo" => Ok(__FieldTag::__restore_info),
8296                            "restore_info" => Ok(__FieldTag::__restore_info),
8297                            "encryptionConfig" => Ok(__FieldTag::__encryption_config),
8298                            "encryption_config" => Ok(__FieldTag::__encryption_config),
8299                            "encryptionInfo" => Ok(__FieldTag::__encryption_info),
8300                            "encryption_info" => Ok(__FieldTag::__encryption_info),
8301                            "versionRetentionPeriod" => Ok(__FieldTag::__version_retention_period),
8302                            "version_retention_period" => {
8303                                Ok(__FieldTag::__version_retention_period)
8304                            }
8305                            "earliestVersionTime" => Ok(__FieldTag::__earliest_version_time),
8306                            "earliest_version_time" => Ok(__FieldTag::__earliest_version_time),
8307                            "defaultLeader" => Ok(__FieldTag::__default_leader),
8308                            "default_leader" => Ok(__FieldTag::__default_leader),
8309                            "databaseDialect" => Ok(__FieldTag::__database_dialect),
8310                            "database_dialect" => Ok(__FieldTag::__database_dialect),
8311                            "enableDropProtection" => Ok(__FieldTag::__enable_drop_protection),
8312                            "enable_drop_protection" => Ok(__FieldTag::__enable_drop_protection),
8313                            "reconciling" => Ok(__FieldTag::__reconciling),
8314                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8315                        }
8316                    }
8317                }
8318                deserializer.deserialize_identifier(Visitor)
8319            }
8320        }
8321        struct Visitor;
8322        impl<'de> serde::de::Visitor<'de> for Visitor {
8323            type Value = Database;
8324            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8325                formatter.write_str("struct Database")
8326            }
8327            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8328            where
8329                A: serde::de::MapAccess<'de>,
8330            {
8331                #[allow(unused_imports)]
8332                use serde::de::Error;
8333                use std::option::Option::Some;
8334                let mut fields = std::collections::HashSet::new();
8335                let mut result = Self::Value::new();
8336                while let Some(tag) = map.next_key::<__FieldTag>()? {
8337                    #[allow(clippy::match_single_binding)]
8338                    match tag {
8339                        __FieldTag::__name => {
8340                            if !fields.insert(__FieldTag::__name) {
8341                                return std::result::Result::Err(A::Error::duplicate_field(
8342                                    "multiple values for name",
8343                                ));
8344                            }
8345                            result.name = map
8346                                .next_value::<std::option::Option<std::string::String>>()?
8347                                .unwrap_or_default();
8348                        }
8349                        __FieldTag::__state => {
8350                            if !fields.insert(__FieldTag::__state) {
8351                                return std::result::Result::Err(A::Error::duplicate_field(
8352                                    "multiple values for state",
8353                                ));
8354                            }
8355                            result.state = map
8356                                .next_value::<std::option::Option<crate::model::database::State>>()?
8357                                .unwrap_or_default();
8358                        }
8359                        __FieldTag::__create_time => {
8360                            if !fields.insert(__FieldTag::__create_time) {
8361                                return std::result::Result::Err(A::Error::duplicate_field(
8362                                    "multiple values for create_time",
8363                                ));
8364                            }
8365                            result.create_time =
8366                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
8367                        }
8368                        __FieldTag::__restore_info => {
8369                            if !fields.insert(__FieldTag::__restore_info) {
8370                                return std::result::Result::Err(A::Error::duplicate_field(
8371                                    "multiple values for restore_info",
8372                                ));
8373                            }
8374                            result.restore_info =
8375                                map.next_value::<std::option::Option<crate::model::RestoreInfo>>()?;
8376                        }
8377                        __FieldTag::__encryption_config => {
8378                            if !fields.insert(__FieldTag::__encryption_config) {
8379                                return std::result::Result::Err(A::Error::duplicate_field(
8380                                    "multiple values for encryption_config",
8381                                ));
8382                            }
8383                            result.encryption_config = map
8384                                .next_value::<std::option::Option<crate::model::EncryptionConfig>>(
8385                                )?;
8386                        }
8387                        __FieldTag::__encryption_info => {
8388                            if !fields.insert(__FieldTag::__encryption_info) {
8389                                return std::result::Result::Err(A::Error::duplicate_field(
8390                                    "multiple values for encryption_info",
8391                                ));
8392                            }
8393                            result.encryption_info =
8394                                map.next_value::<std::option::Option<
8395                                    std::vec::Vec<crate::model::EncryptionInfo>,
8396                                >>()?
8397                                .unwrap_or_default();
8398                        }
8399                        __FieldTag::__version_retention_period => {
8400                            if !fields.insert(__FieldTag::__version_retention_period) {
8401                                return std::result::Result::Err(A::Error::duplicate_field(
8402                                    "multiple values for version_retention_period",
8403                                ));
8404                            }
8405                            result.version_retention_period = map
8406                                .next_value::<std::option::Option<std::string::String>>()?
8407                                .unwrap_or_default();
8408                        }
8409                        __FieldTag::__earliest_version_time => {
8410                            if !fields.insert(__FieldTag::__earliest_version_time) {
8411                                return std::result::Result::Err(A::Error::duplicate_field(
8412                                    "multiple values for earliest_version_time",
8413                                ));
8414                            }
8415                            result.earliest_version_time =
8416                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
8417                        }
8418                        __FieldTag::__default_leader => {
8419                            if !fields.insert(__FieldTag::__default_leader) {
8420                                return std::result::Result::Err(A::Error::duplicate_field(
8421                                    "multiple values for default_leader",
8422                                ));
8423                            }
8424                            result.default_leader = map
8425                                .next_value::<std::option::Option<std::string::String>>()?
8426                                .unwrap_or_default();
8427                        }
8428                        __FieldTag::__database_dialect => {
8429                            if !fields.insert(__FieldTag::__database_dialect) {
8430                                return std::result::Result::Err(A::Error::duplicate_field(
8431                                    "multiple values for database_dialect",
8432                                ));
8433                            }
8434                            result.database_dialect = map
8435                                .next_value::<std::option::Option<crate::model::DatabaseDialect>>()?
8436                                .unwrap_or_default();
8437                        }
8438                        __FieldTag::__enable_drop_protection => {
8439                            if !fields.insert(__FieldTag::__enable_drop_protection) {
8440                                return std::result::Result::Err(A::Error::duplicate_field(
8441                                    "multiple values for enable_drop_protection",
8442                                ));
8443                            }
8444                            result.enable_drop_protection = map
8445                                .next_value::<std::option::Option<bool>>()?
8446                                .unwrap_or_default();
8447                        }
8448                        __FieldTag::__reconciling => {
8449                            if !fields.insert(__FieldTag::__reconciling) {
8450                                return std::result::Result::Err(A::Error::duplicate_field(
8451                                    "multiple values for reconciling",
8452                                ));
8453                            }
8454                            result.reconciling = map
8455                                .next_value::<std::option::Option<bool>>()?
8456                                .unwrap_or_default();
8457                        }
8458                        __FieldTag::Unknown(key) => {
8459                            let value = map.next_value::<serde_json::Value>()?;
8460                            result._unknown_fields.insert(key, value);
8461                        }
8462                    }
8463                }
8464                std::result::Result::Ok(result)
8465            }
8466        }
8467        deserializer.deserialize_any(Visitor)
8468    }
8469}
8470
8471#[doc(hidden)]
8472impl serde::ser::Serialize for Database {
8473    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8474    where
8475        S: serde::ser::Serializer,
8476    {
8477        use serde::ser::SerializeMap;
8478        #[allow(unused_imports)]
8479        use std::option::Option::Some;
8480        let mut state = serializer.serialize_map(std::option::Option::None)?;
8481        if !self.name.is_empty() {
8482            state.serialize_entry("name", &self.name)?;
8483        }
8484        if !wkt::internal::is_default(&self.state) {
8485            state.serialize_entry("state", &self.state)?;
8486        }
8487        if self.create_time.is_some() {
8488            state.serialize_entry("createTime", &self.create_time)?;
8489        }
8490        if self.restore_info.is_some() {
8491            state.serialize_entry("restoreInfo", &self.restore_info)?;
8492        }
8493        if self.encryption_config.is_some() {
8494            state.serialize_entry("encryptionConfig", &self.encryption_config)?;
8495        }
8496        if !self.encryption_info.is_empty() {
8497            state.serialize_entry("encryptionInfo", &self.encryption_info)?;
8498        }
8499        if !self.version_retention_period.is_empty() {
8500            state.serialize_entry("versionRetentionPeriod", &self.version_retention_period)?;
8501        }
8502        if self.earliest_version_time.is_some() {
8503            state.serialize_entry("earliestVersionTime", &self.earliest_version_time)?;
8504        }
8505        if !self.default_leader.is_empty() {
8506            state.serialize_entry("defaultLeader", &self.default_leader)?;
8507        }
8508        if !wkt::internal::is_default(&self.database_dialect) {
8509            state.serialize_entry("databaseDialect", &self.database_dialect)?;
8510        }
8511        if !wkt::internal::is_default(&self.enable_drop_protection) {
8512            state.serialize_entry("enableDropProtection", &self.enable_drop_protection)?;
8513        }
8514        if !wkt::internal::is_default(&self.reconciling) {
8515            state.serialize_entry("reconciling", &self.reconciling)?;
8516        }
8517        if !self._unknown_fields.is_empty() {
8518            for (key, value) in self._unknown_fields.iter() {
8519                state.serialize_entry(key, &value)?;
8520            }
8521        }
8522        state.end()
8523    }
8524}
8525
8526impl std::fmt::Debug for Database {
8527    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8528        let mut debug_struct = f.debug_struct("Database");
8529        debug_struct.field("name", &self.name);
8530        debug_struct.field("state", &self.state);
8531        debug_struct.field("create_time", &self.create_time);
8532        debug_struct.field("restore_info", &self.restore_info);
8533        debug_struct.field("encryption_config", &self.encryption_config);
8534        debug_struct.field("encryption_info", &self.encryption_info);
8535        debug_struct.field("version_retention_period", &self.version_retention_period);
8536        debug_struct.field("earliest_version_time", &self.earliest_version_time);
8537        debug_struct.field("default_leader", &self.default_leader);
8538        debug_struct.field("database_dialect", &self.database_dialect);
8539        debug_struct.field("enable_drop_protection", &self.enable_drop_protection);
8540        debug_struct.field("reconciling", &self.reconciling);
8541        if !self._unknown_fields.is_empty() {
8542            debug_struct.field("_unknown_fields", &self._unknown_fields);
8543        }
8544        debug_struct.finish()
8545    }
8546}
8547
8548/// Defines additional types related to [Database].
8549pub mod database {
8550    #[allow(unused_imports)]
8551    use super::*;
8552
8553    /// Indicates the current state of the database.
8554    ///
8555    /// # Working with unknown values
8556    ///
8557    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8558    /// additional enum variants at any time. Adding new variants is not considered
8559    /// a breaking change. Applications should write their code in anticipation of:
8560    ///
8561    /// - New values appearing in future releases of the client library, **and**
8562    /// - New values received dynamically, without application changes.
8563    ///
8564    /// Please consult the [Working with enums] section in the user guide for some
8565    /// guidelines.
8566    ///
8567    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8568    #[derive(Clone, Debug, PartialEq)]
8569    #[non_exhaustive]
8570    pub enum State {
8571        /// Not specified.
8572        Unspecified,
8573        /// The database is still being created. Operations on the database may fail
8574        /// with `FAILED_PRECONDITION` in this state.
8575        Creating,
8576        /// The database is fully created and ready for use.
8577        Ready,
8578        /// The database is fully created and ready for use, but is still
8579        /// being optimized for performance and cannot handle full load.
8580        ///
8581        /// In this state, the database still references the backup
8582        /// it was restore from, preventing the backup
8583        /// from being deleted. When optimizations are complete, the full performance
8584        /// of the database will be restored, and the database will transition to
8585        /// `READY` state.
8586        ReadyOptimizing,
8587        /// If set, the enum was initialized with an unknown value.
8588        ///
8589        /// Applications can examine the value using [State::value] or
8590        /// [State::name].
8591        UnknownValue(state::UnknownValue),
8592    }
8593
8594    #[doc(hidden)]
8595    pub mod state {
8596        #[allow(unused_imports)]
8597        use super::*;
8598        #[derive(Clone, Debug, PartialEq)]
8599        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8600    }
8601
8602    impl State {
8603        /// Gets the enum value.
8604        ///
8605        /// Returns `None` if the enum contains an unknown value deserialized from
8606        /// the string representation of enums.
8607        pub fn value(&self) -> std::option::Option<i32> {
8608            match self {
8609                Self::Unspecified => std::option::Option::Some(0),
8610                Self::Creating => std::option::Option::Some(1),
8611                Self::Ready => std::option::Option::Some(2),
8612                Self::ReadyOptimizing => std::option::Option::Some(3),
8613                Self::UnknownValue(u) => u.0.value(),
8614            }
8615        }
8616
8617        /// Gets the enum value as a string.
8618        ///
8619        /// Returns `None` if the enum contains an unknown value deserialized from
8620        /// the integer representation of enums.
8621        pub fn name(&self) -> std::option::Option<&str> {
8622            match self {
8623                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
8624                Self::Creating => std::option::Option::Some("CREATING"),
8625                Self::Ready => std::option::Option::Some("READY"),
8626                Self::ReadyOptimizing => std::option::Option::Some("READY_OPTIMIZING"),
8627                Self::UnknownValue(u) => u.0.name(),
8628            }
8629        }
8630    }
8631
8632    impl std::default::Default for State {
8633        fn default() -> Self {
8634            use std::convert::From;
8635            Self::from(0)
8636        }
8637    }
8638
8639    impl std::fmt::Display for State {
8640        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8641            wkt::internal::display_enum(f, self.name(), self.value())
8642        }
8643    }
8644
8645    impl std::convert::From<i32> for State {
8646        fn from(value: i32) -> Self {
8647            match value {
8648                0 => Self::Unspecified,
8649                1 => Self::Creating,
8650                2 => Self::Ready,
8651                3 => Self::ReadyOptimizing,
8652                _ => Self::UnknownValue(state::UnknownValue(
8653                    wkt::internal::UnknownEnumValue::Integer(value),
8654                )),
8655            }
8656        }
8657    }
8658
8659    impl std::convert::From<&str> for State {
8660        fn from(value: &str) -> Self {
8661            use std::string::ToString;
8662            match value {
8663                "STATE_UNSPECIFIED" => Self::Unspecified,
8664                "CREATING" => Self::Creating,
8665                "READY" => Self::Ready,
8666                "READY_OPTIMIZING" => Self::ReadyOptimizing,
8667                _ => Self::UnknownValue(state::UnknownValue(
8668                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8669                )),
8670            }
8671        }
8672    }
8673
8674    impl serde::ser::Serialize for State {
8675        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8676        where
8677            S: serde::Serializer,
8678        {
8679            match self {
8680                Self::Unspecified => serializer.serialize_i32(0),
8681                Self::Creating => serializer.serialize_i32(1),
8682                Self::Ready => serializer.serialize_i32(2),
8683                Self::ReadyOptimizing => serializer.serialize_i32(3),
8684                Self::UnknownValue(u) => u.0.serialize(serializer),
8685            }
8686        }
8687    }
8688
8689    impl<'de> serde::de::Deserialize<'de> for State {
8690        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8691        where
8692            D: serde::Deserializer<'de>,
8693        {
8694            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
8695                ".google.spanner.admin.database.v1.Database.State",
8696            ))
8697        }
8698    }
8699}
8700
8701/// The request for
8702/// [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].
8703///
8704/// [google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases]: crate::client::DatabaseAdmin::list_databases
8705#[derive(Clone, Default, PartialEq)]
8706#[non_exhaustive]
8707pub struct ListDatabasesRequest {
8708    /// Required. The instance whose databases should be listed.
8709    /// Values are of the form `projects/<project>/instances/<instance>`.
8710    pub parent: std::string::String,
8711
8712    /// Number of databases to be returned in the response. If 0 or less,
8713    /// defaults to the server's maximum allowed page size.
8714    pub page_size: i32,
8715
8716    /// If non-empty, `page_token` should contain a
8717    /// [next_page_token][google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token]
8718    /// from a previous
8719    /// [ListDatabasesResponse][google.spanner.admin.database.v1.ListDatabasesResponse].
8720    ///
8721    /// [google.spanner.admin.database.v1.ListDatabasesResponse]: crate::model::ListDatabasesResponse
8722    /// [google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token]: crate::model::ListDatabasesResponse::next_page_token
8723    pub page_token: std::string::String,
8724
8725    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8726}
8727
8728impl ListDatabasesRequest {
8729    pub fn new() -> Self {
8730        std::default::Default::default()
8731    }
8732
8733    /// Sets the value of [parent][crate::model::ListDatabasesRequest::parent].
8734    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8735        self.parent = v.into();
8736        self
8737    }
8738
8739    /// Sets the value of [page_size][crate::model::ListDatabasesRequest::page_size].
8740    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8741        self.page_size = v.into();
8742        self
8743    }
8744
8745    /// Sets the value of [page_token][crate::model::ListDatabasesRequest::page_token].
8746    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8747        self.page_token = v.into();
8748        self
8749    }
8750}
8751
8752impl wkt::message::Message for ListDatabasesRequest {
8753    fn typename() -> &'static str {
8754        "type.googleapis.com/google.spanner.admin.database.v1.ListDatabasesRequest"
8755    }
8756}
8757
8758#[doc(hidden)]
8759impl<'de> serde::de::Deserialize<'de> for ListDatabasesRequest {
8760    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8761    where
8762        D: serde::Deserializer<'de>,
8763    {
8764        #[allow(non_camel_case_types)]
8765        #[doc(hidden)]
8766        #[derive(PartialEq, Eq, Hash)]
8767        enum __FieldTag {
8768            __parent,
8769            __page_size,
8770            __page_token,
8771            Unknown(std::string::String),
8772        }
8773        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8774            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8775            where
8776                D: serde::Deserializer<'de>,
8777            {
8778                struct Visitor;
8779                impl<'de> serde::de::Visitor<'de> for Visitor {
8780                    type Value = __FieldTag;
8781                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8782                        formatter.write_str("a field name for ListDatabasesRequest")
8783                    }
8784                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8785                    where
8786                        E: serde::de::Error,
8787                    {
8788                        use std::result::Result::Ok;
8789                        use std::string::ToString;
8790                        match value {
8791                            "parent" => Ok(__FieldTag::__parent),
8792                            "pageSize" => Ok(__FieldTag::__page_size),
8793                            "page_size" => Ok(__FieldTag::__page_size),
8794                            "pageToken" => Ok(__FieldTag::__page_token),
8795                            "page_token" => Ok(__FieldTag::__page_token),
8796                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8797                        }
8798                    }
8799                }
8800                deserializer.deserialize_identifier(Visitor)
8801            }
8802        }
8803        struct Visitor;
8804        impl<'de> serde::de::Visitor<'de> for Visitor {
8805            type Value = ListDatabasesRequest;
8806            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8807                formatter.write_str("struct ListDatabasesRequest")
8808            }
8809            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8810            where
8811                A: serde::de::MapAccess<'de>,
8812            {
8813                #[allow(unused_imports)]
8814                use serde::de::Error;
8815                use std::option::Option::Some;
8816                let mut fields = std::collections::HashSet::new();
8817                let mut result = Self::Value::new();
8818                while let Some(tag) = map.next_key::<__FieldTag>()? {
8819                    #[allow(clippy::match_single_binding)]
8820                    match tag {
8821                        __FieldTag::__parent => {
8822                            if !fields.insert(__FieldTag::__parent) {
8823                                return std::result::Result::Err(A::Error::duplicate_field(
8824                                    "multiple values for parent",
8825                                ));
8826                            }
8827                            result.parent = map
8828                                .next_value::<std::option::Option<std::string::String>>()?
8829                                .unwrap_or_default();
8830                        }
8831                        __FieldTag::__page_size => {
8832                            if !fields.insert(__FieldTag::__page_size) {
8833                                return std::result::Result::Err(A::Error::duplicate_field(
8834                                    "multiple values for page_size",
8835                                ));
8836                            }
8837                            struct __With(std::option::Option<i32>);
8838                            impl<'de> serde::de::Deserialize<'de> for __With {
8839                                fn deserialize<D>(
8840                                    deserializer: D,
8841                                ) -> std::result::Result<Self, D::Error>
8842                                where
8843                                    D: serde::de::Deserializer<'de>,
8844                                {
8845                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
8846                                }
8847                            }
8848                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
8849                        }
8850                        __FieldTag::__page_token => {
8851                            if !fields.insert(__FieldTag::__page_token) {
8852                                return std::result::Result::Err(A::Error::duplicate_field(
8853                                    "multiple values for page_token",
8854                                ));
8855                            }
8856                            result.page_token = map
8857                                .next_value::<std::option::Option<std::string::String>>()?
8858                                .unwrap_or_default();
8859                        }
8860                        __FieldTag::Unknown(key) => {
8861                            let value = map.next_value::<serde_json::Value>()?;
8862                            result._unknown_fields.insert(key, value);
8863                        }
8864                    }
8865                }
8866                std::result::Result::Ok(result)
8867            }
8868        }
8869        deserializer.deserialize_any(Visitor)
8870    }
8871}
8872
8873#[doc(hidden)]
8874impl serde::ser::Serialize for ListDatabasesRequest {
8875    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8876    where
8877        S: serde::ser::Serializer,
8878    {
8879        use serde::ser::SerializeMap;
8880        #[allow(unused_imports)]
8881        use std::option::Option::Some;
8882        let mut state = serializer.serialize_map(std::option::Option::None)?;
8883        if !self.parent.is_empty() {
8884            state.serialize_entry("parent", &self.parent)?;
8885        }
8886        if !wkt::internal::is_default(&self.page_size) {
8887            struct __With<'a>(&'a i32);
8888            impl<'a> serde::ser::Serialize for __With<'a> {
8889                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8890                where
8891                    S: serde::ser::Serializer,
8892                {
8893                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
8894                }
8895            }
8896            state.serialize_entry("pageSize", &__With(&self.page_size))?;
8897        }
8898        if !self.page_token.is_empty() {
8899            state.serialize_entry("pageToken", &self.page_token)?;
8900        }
8901        if !self._unknown_fields.is_empty() {
8902            for (key, value) in self._unknown_fields.iter() {
8903                state.serialize_entry(key, &value)?;
8904            }
8905        }
8906        state.end()
8907    }
8908}
8909
8910impl std::fmt::Debug for ListDatabasesRequest {
8911    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8912        let mut debug_struct = f.debug_struct("ListDatabasesRequest");
8913        debug_struct.field("parent", &self.parent);
8914        debug_struct.field("page_size", &self.page_size);
8915        debug_struct.field("page_token", &self.page_token);
8916        if !self._unknown_fields.is_empty() {
8917            debug_struct.field("_unknown_fields", &self._unknown_fields);
8918        }
8919        debug_struct.finish()
8920    }
8921}
8922
8923/// The response for
8924/// [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].
8925///
8926/// [google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases]: crate::client::DatabaseAdmin::list_databases
8927#[derive(Clone, Default, PartialEq)]
8928#[non_exhaustive]
8929pub struct ListDatabasesResponse {
8930    /// Databases that matched the request.
8931    pub databases: std::vec::Vec<crate::model::Database>,
8932
8933    /// `next_page_token` can be sent in a subsequent
8934    /// [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases]
8935    /// call to fetch more of the matching databases.
8936    ///
8937    /// [google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases]: crate::client::DatabaseAdmin::list_databases
8938    pub next_page_token: std::string::String,
8939
8940    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8941}
8942
8943impl ListDatabasesResponse {
8944    pub fn new() -> Self {
8945        std::default::Default::default()
8946    }
8947
8948    /// Sets the value of [databases][crate::model::ListDatabasesResponse::databases].
8949    pub fn set_databases<T, V>(mut self, v: T) -> Self
8950    where
8951        T: std::iter::IntoIterator<Item = V>,
8952        V: std::convert::Into<crate::model::Database>,
8953    {
8954        use std::iter::Iterator;
8955        self.databases = v.into_iter().map(|i| i.into()).collect();
8956        self
8957    }
8958
8959    /// Sets the value of [next_page_token][crate::model::ListDatabasesResponse::next_page_token].
8960    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8961        self.next_page_token = v.into();
8962        self
8963    }
8964}
8965
8966impl wkt::message::Message for ListDatabasesResponse {
8967    fn typename() -> &'static str {
8968        "type.googleapis.com/google.spanner.admin.database.v1.ListDatabasesResponse"
8969    }
8970}
8971
8972#[doc(hidden)]
8973impl gax::paginator::internal::PageableResponse for ListDatabasesResponse {
8974    type PageItem = crate::model::Database;
8975
8976    fn items(self) -> std::vec::Vec<Self::PageItem> {
8977        self.databases
8978    }
8979
8980    fn next_page_token(&self) -> std::string::String {
8981        use std::clone::Clone;
8982        self.next_page_token.clone()
8983    }
8984}
8985
8986#[doc(hidden)]
8987impl<'de> serde::de::Deserialize<'de> for ListDatabasesResponse {
8988    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8989    where
8990        D: serde::Deserializer<'de>,
8991    {
8992        #[allow(non_camel_case_types)]
8993        #[doc(hidden)]
8994        #[derive(PartialEq, Eq, Hash)]
8995        enum __FieldTag {
8996            __databases,
8997            __next_page_token,
8998            Unknown(std::string::String),
8999        }
9000        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9001            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9002            where
9003                D: serde::Deserializer<'de>,
9004            {
9005                struct Visitor;
9006                impl<'de> serde::de::Visitor<'de> for Visitor {
9007                    type Value = __FieldTag;
9008                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9009                        formatter.write_str("a field name for ListDatabasesResponse")
9010                    }
9011                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9012                    where
9013                        E: serde::de::Error,
9014                    {
9015                        use std::result::Result::Ok;
9016                        use std::string::ToString;
9017                        match value {
9018                            "databases" => Ok(__FieldTag::__databases),
9019                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
9020                            "next_page_token" => Ok(__FieldTag::__next_page_token),
9021                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9022                        }
9023                    }
9024                }
9025                deserializer.deserialize_identifier(Visitor)
9026            }
9027        }
9028        struct Visitor;
9029        impl<'de> serde::de::Visitor<'de> for Visitor {
9030            type Value = ListDatabasesResponse;
9031            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9032                formatter.write_str("struct ListDatabasesResponse")
9033            }
9034            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9035            where
9036                A: serde::de::MapAccess<'de>,
9037            {
9038                #[allow(unused_imports)]
9039                use serde::de::Error;
9040                use std::option::Option::Some;
9041                let mut fields = std::collections::HashSet::new();
9042                let mut result = Self::Value::new();
9043                while let Some(tag) = map.next_key::<__FieldTag>()? {
9044                    #[allow(clippy::match_single_binding)]
9045                    match tag {
9046                        __FieldTag::__databases => {
9047                            if !fields.insert(__FieldTag::__databases) {
9048                                return std::result::Result::Err(A::Error::duplicate_field(
9049                                    "multiple values for databases",
9050                                ));
9051                            }
9052                            result.databases = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Database>>>()?.unwrap_or_default();
9053                        }
9054                        __FieldTag::__next_page_token => {
9055                            if !fields.insert(__FieldTag::__next_page_token) {
9056                                return std::result::Result::Err(A::Error::duplicate_field(
9057                                    "multiple values for next_page_token",
9058                                ));
9059                            }
9060                            result.next_page_token = map
9061                                .next_value::<std::option::Option<std::string::String>>()?
9062                                .unwrap_or_default();
9063                        }
9064                        __FieldTag::Unknown(key) => {
9065                            let value = map.next_value::<serde_json::Value>()?;
9066                            result._unknown_fields.insert(key, value);
9067                        }
9068                    }
9069                }
9070                std::result::Result::Ok(result)
9071            }
9072        }
9073        deserializer.deserialize_any(Visitor)
9074    }
9075}
9076
9077#[doc(hidden)]
9078impl serde::ser::Serialize for ListDatabasesResponse {
9079    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9080    where
9081        S: serde::ser::Serializer,
9082    {
9083        use serde::ser::SerializeMap;
9084        #[allow(unused_imports)]
9085        use std::option::Option::Some;
9086        let mut state = serializer.serialize_map(std::option::Option::None)?;
9087        if !self.databases.is_empty() {
9088            state.serialize_entry("databases", &self.databases)?;
9089        }
9090        if !self.next_page_token.is_empty() {
9091            state.serialize_entry("nextPageToken", &self.next_page_token)?;
9092        }
9093        if !self._unknown_fields.is_empty() {
9094            for (key, value) in self._unknown_fields.iter() {
9095                state.serialize_entry(key, &value)?;
9096            }
9097        }
9098        state.end()
9099    }
9100}
9101
9102impl std::fmt::Debug for ListDatabasesResponse {
9103    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9104        let mut debug_struct = f.debug_struct("ListDatabasesResponse");
9105        debug_struct.field("databases", &self.databases);
9106        debug_struct.field("next_page_token", &self.next_page_token);
9107        if !self._unknown_fields.is_empty() {
9108            debug_struct.field("_unknown_fields", &self._unknown_fields);
9109        }
9110        debug_struct.finish()
9111    }
9112}
9113
9114/// The request for
9115/// [CreateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase].
9116///
9117/// [google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase]: crate::client::DatabaseAdmin::create_database
9118#[derive(Clone, Default, PartialEq)]
9119#[non_exhaustive]
9120pub struct CreateDatabaseRequest {
9121    /// Required. The name of the instance that will serve the new database.
9122    /// Values are of the form `projects/<project>/instances/<instance>`.
9123    pub parent: std::string::String,
9124
9125    /// Required. A `CREATE DATABASE` statement, which specifies the ID of the
9126    /// new database.  The database ID must conform to the regular expression
9127    /// `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length.
9128    /// If the database ID is a reserved word or if it contains a hyphen, the
9129    /// database ID must be enclosed in backticks (`` ` ``).
9130    pub create_statement: std::string::String,
9131
9132    /// Optional. A list of DDL statements to run inside the newly created
9133    /// database. Statements can create tables, indexes, etc. These
9134    /// statements execute atomically with the creation of the database:
9135    /// if there is an error in any statement, the database is not created.
9136    pub extra_statements: std::vec::Vec<std::string::String>,
9137
9138    /// Optional. The encryption configuration for the database. If this field is
9139    /// not specified, Cloud Spanner will encrypt/decrypt all data at rest using
9140    /// Google default encryption.
9141    pub encryption_config: std::option::Option<crate::model::EncryptionConfig>,
9142
9143    /// Optional. The dialect of the Cloud Spanner Database.
9144    pub database_dialect: crate::model::DatabaseDialect,
9145
9146    /// Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in
9147    /// 'extra_statements' above.
9148    /// Contains a protobuf-serialized
9149    /// [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto).
9150    /// To generate it, [install](https://grpc.io/docs/protoc-installation/) and
9151    /// run `protoc` with --include_imports and --descriptor_set_out. For example,
9152    /// to generate for moon/shot/app.proto, run
9153    ///
9154    /// ```norust
9155    /// $protoc  --proto_path=/app_path --proto_path=/lib_path \
9156    ///          --include_imports \
9157    ///          --descriptor_set_out=descriptors.data \
9158    ///          moon/shot/app.proto
9159    /// ```
9160    ///
9161    /// For more details, see protobuffer [self
9162    /// description](https://developers.google.com/protocol-buffers/docs/techniques#self-description).
9163    pub proto_descriptors: ::bytes::Bytes,
9164
9165    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9166}
9167
9168impl CreateDatabaseRequest {
9169    pub fn new() -> Self {
9170        std::default::Default::default()
9171    }
9172
9173    /// Sets the value of [parent][crate::model::CreateDatabaseRequest::parent].
9174    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9175        self.parent = v.into();
9176        self
9177    }
9178
9179    /// Sets the value of [create_statement][crate::model::CreateDatabaseRequest::create_statement].
9180    pub fn set_create_statement<T: std::convert::Into<std::string::String>>(
9181        mut self,
9182        v: T,
9183    ) -> Self {
9184        self.create_statement = v.into();
9185        self
9186    }
9187
9188    /// Sets the value of [extra_statements][crate::model::CreateDatabaseRequest::extra_statements].
9189    pub fn set_extra_statements<T, V>(mut self, v: T) -> Self
9190    where
9191        T: std::iter::IntoIterator<Item = V>,
9192        V: std::convert::Into<std::string::String>,
9193    {
9194        use std::iter::Iterator;
9195        self.extra_statements = v.into_iter().map(|i| i.into()).collect();
9196        self
9197    }
9198
9199    /// Sets the value of [encryption_config][crate::model::CreateDatabaseRequest::encryption_config].
9200    pub fn set_encryption_config<T>(mut self, v: T) -> Self
9201    where
9202        T: std::convert::Into<crate::model::EncryptionConfig>,
9203    {
9204        self.encryption_config = std::option::Option::Some(v.into());
9205        self
9206    }
9207
9208    /// Sets or clears the value of [encryption_config][crate::model::CreateDatabaseRequest::encryption_config].
9209    pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
9210    where
9211        T: std::convert::Into<crate::model::EncryptionConfig>,
9212    {
9213        self.encryption_config = v.map(|x| x.into());
9214        self
9215    }
9216
9217    /// Sets the value of [database_dialect][crate::model::CreateDatabaseRequest::database_dialect].
9218    pub fn set_database_dialect<T: std::convert::Into<crate::model::DatabaseDialect>>(
9219        mut self,
9220        v: T,
9221    ) -> Self {
9222        self.database_dialect = v.into();
9223        self
9224    }
9225
9226    /// Sets the value of [proto_descriptors][crate::model::CreateDatabaseRequest::proto_descriptors].
9227    pub fn set_proto_descriptors<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9228        self.proto_descriptors = v.into();
9229        self
9230    }
9231}
9232
9233impl wkt::message::Message for CreateDatabaseRequest {
9234    fn typename() -> &'static str {
9235        "type.googleapis.com/google.spanner.admin.database.v1.CreateDatabaseRequest"
9236    }
9237}
9238
9239#[doc(hidden)]
9240impl<'de> serde::de::Deserialize<'de> for CreateDatabaseRequest {
9241    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9242    where
9243        D: serde::Deserializer<'de>,
9244    {
9245        #[allow(non_camel_case_types)]
9246        #[doc(hidden)]
9247        #[derive(PartialEq, Eq, Hash)]
9248        enum __FieldTag {
9249            __parent,
9250            __create_statement,
9251            __extra_statements,
9252            __encryption_config,
9253            __database_dialect,
9254            __proto_descriptors,
9255            Unknown(std::string::String),
9256        }
9257        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9258            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9259            where
9260                D: serde::Deserializer<'de>,
9261            {
9262                struct Visitor;
9263                impl<'de> serde::de::Visitor<'de> for Visitor {
9264                    type Value = __FieldTag;
9265                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9266                        formatter.write_str("a field name for CreateDatabaseRequest")
9267                    }
9268                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9269                    where
9270                        E: serde::de::Error,
9271                    {
9272                        use std::result::Result::Ok;
9273                        use std::string::ToString;
9274                        match value {
9275                            "parent" => Ok(__FieldTag::__parent),
9276                            "createStatement" => Ok(__FieldTag::__create_statement),
9277                            "create_statement" => Ok(__FieldTag::__create_statement),
9278                            "extraStatements" => Ok(__FieldTag::__extra_statements),
9279                            "extra_statements" => Ok(__FieldTag::__extra_statements),
9280                            "encryptionConfig" => Ok(__FieldTag::__encryption_config),
9281                            "encryption_config" => Ok(__FieldTag::__encryption_config),
9282                            "databaseDialect" => Ok(__FieldTag::__database_dialect),
9283                            "database_dialect" => Ok(__FieldTag::__database_dialect),
9284                            "protoDescriptors" => Ok(__FieldTag::__proto_descriptors),
9285                            "proto_descriptors" => Ok(__FieldTag::__proto_descriptors),
9286                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9287                        }
9288                    }
9289                }
9290                deserializer.deserialize_identifier(Visitor)
9291            }
9292        }
9293        struct Visitor;
9294        impl<'de> serde::de::Visitor<'de> for Visitor {
9295            type Value = CreateDatabaseRequest;
9296            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9297                formatter.write_str("struct CreateDatabaseRequest")
9298            }
9299            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9300            where
9301                A: serde::de::MapAccess<'de>,
9302            {
9303                #[allow(unused_imports)]
9304                use serde::de::Error;
9305                use std::option::Option::Some;
9306                let mut fields = std::collections::HashSet::new();
9307                let mut result = Self::Value::new();
9308                while let Some(tag) = map.next_key::<__FieldTag>()? {
9309                    #[allow(clippy::match_single_binding)]
9310                    match tag {
9311                        __FieldTag::__parent => {
9312                            if !fields.insert(__FieldTag::__parent) {
9313                                return std::result::Result::Err(A::Error::duplicate_field(
9314                                    "multiple values for parent",
9315                                ));
9316                            }
9317                            result.parent = map
9318                                .next_value::<std::option::Option<std::string::String>>()?
9319                                .unwrap_or_default();
9320                        }
9321                        __FieldTag::__create_statement => {
9322                            if !fields.insert(__FieldTag::__create_statement) {
9323                                return std::result::Result::Err(A::Error::duplicate_field(
9324                                    "multiple values for create_statement",
9325                                ));
9326                            }
9327                            result.create_statement = map
9328                                .next_value::<std::option::Option<std::string::String>>()?
9329                                .unwrap_or_default();
9330                        }
9331                        __FieldTag::__extra_statements => {
9332                            if !fields.insert(__FieldTag::__extra_statements) {
9333                                return std::result::Result::Err(A::Error::duplicate_field(
9334                                    "multiple values for extra_statements",
9335                                ));
9336                            }
9337                            result.extra_statements = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
9338                        }
9339                        __FieldTag::__encryption_config => {
9340                            if !fields.insert(__FieldTag::__encryption_config) {
9341                                return std::result::Result::Err(A::Error::duplicate_field(
9342                                    "multiple values for encryption_config",
9343                                ));
9344                            }
9345                            result.encryption_config = map
9346                                .next_value::<std::option::Option<crate::model::EncryptionConfig>>(
9347                                )?;
9348                        }
9349                        __FieldTag::__database_dialect => {
9350                            if !fields.insert(__FieldTag::__database_dialect) {
9351                                return std::result::Result::Err(A::Error::duplicate_field(
9352                                    "multiple values for database_dialect",
9353                                ));
9354                            }
9355                            result.database_dialect = map
9356                                .next_value::<std::option::Option<crate::model::DatabaseDialect>>()?
9357                                .unwrap_or_default();
9358                        }
9359                        __FieldTag::__proto_descriptors => {
9360                            if !fields.insert(__FieldTag::__proto_descriptors) {
9361                                return std::result::Result::Err(A::Error::duplicate_field(
9362                                    "multiple values for proto_descriptors",
9363                                ));
9364                            }
9365                            struct __With(std::option::Option<::bytes::Bytes>);
9366                            impl<'de> serde::de::Deserialize<'de> for __With {
9367                                fn deserialize<D>(
9368                                    deserializer: D,
9369                                ) -> std::result::Result<Self, D::Error>
9370                                where
9371                                    D: serde::de::Deserializer<'de>,
9372                                {
9373                                    serde_with::As::< std::option::Option<serde_with::base64::Base64> >::deserialize(deserializer).map(__With)
9374                                }
9375                            }
9376                            result.proto_descriptors =
9377                                map.next_value::<__With>()?.0.unwrap_or_default();
9378                        }
9379                        __FieldTag::Unknown(key) => {
9380                            let value = map.next_value::<serde_json::Value>()?;
9381                            result._unknown_fields.insert(key, value);
9382                        }
9383                    }
9384                }
9385                std::result::Result::Ok(result)
9386            }
9387        }
9388        deserializer.deserialize_any(Visitor)
9389    }
9390}
9391
9392#[doc(hidden)]
9393impl serde::ser::Serialize for CreateDatabaseRequest {
9394    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9395    where
9396        S: serde::ser::Serializer,
9397    {
9398        use serde::ser::SerializeMap;
9399        #[allow(unused_imports)]
9400        use std::option::Option::Some;
9401        let mut state = serializer.serialize_map(std::option::Option::None)?;
9402        if !self.parent.is_empty() {
9403            state.serialize_entry("parent", &self.parent)?;
9404        }
9405        if !self.create_statement.is_empty() {
9406            state.serialize_entry("createStatement", &self.create_statement)?;
9407        }
9408        if !self.extra_statements.is_empty() {
9409            state.serialize_entry("extraStatements", &self.extra_statements)?;
9410        }
9411        if self.encryption_config.is_some() {
9412            state.serialize_entry("encryptionConfig", &self.encryption_config)?;
9413        }
9414        if !wkt::internal::is_default(&self.database_dialect) {
9415            state.serialize_entry("databaseDialect", &self.database_dialect)?;
9416        }
9417        if !self.proto_descriptors.is_empty() {
9418            struct __With<'a>(&'a ::bytes::Bytes);
9419            impl<'a> serde::ser::Serialize for __With<'a> {
9420                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9421                where
9422                    S: serde::ser::Serializer,
9423                {
9424                    serde_with::As::<serde_with::base64::Base64>::serialize(self.0, serializer)
9425                }
9426            }
9427            state.serialize_entry("protoDescriptors", &__With(&self.proto_descriptors))?;
9428        }
9429        if !self._unknown_fields.is_empty() {
9430            for (key, value) in self._unknown_fields.iter() {
9431                state.serialize_entry(key, &value)?;
9432            }
9433        }
9434        state.end()
9435    }
9436}
9437
9438impl std::fmt::Debug for CreateDatabaseRequest {
9439    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9440        let mut debug_struct = f.debug_struct("CreateDatabaseRequest");
9441        debug_struct.field("parent", &self.parent);
9442        debug_struct.field("create_statement", &self.create_statement);
9443        debug_struct.field("extra_statements", &self.extra_statements);
9444        debug_struct.field("encryption_config", &self.encryption_config);
9445        debug_struct.field("database_dialect", &self.database_dialect);
9446        debug_struct.field("proto_descriptors", &self.proto_descriptors);
9447        if !self._unknown_fields.is_empty() {
9448            debug_struct.field("_unknown_fields", &self._unknown_fields);
9449        }
9450        debug_struct.finish()
9451    }
9452}
9453
9454/// Metadata type for the operation returned by
9455/// [CreateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase].
9456///
9457/// [google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase]: crate::client::DatabaseAdmin::create_database
9458#[derive(Clone, Default, PartialEq)]
9459#[non_exhaustive]
9460pub struct CreateDatabaseMetadata {
9461    /// The database being created.
9462    pub database: std::string::String,
9463
9464    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9465}
9466
9467impl CreateDatabaseMetadata {
9468    pub fn new() -> Self {
9469        std::default::Default::default()
9470    }
9471
9472    /// Sets the value of [database][crate::model::CreateDatabaseMetadata::database].
9473    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9474        self.database = v.into();
9475        self
9476    }
9477}
9478
9479impl wkt::message::Message for CreateDatabaseMetadata {
9480    fn typename() -> &'static str {
9481        "type.googleapis.com/google.spanner.admin.database.v1.CreateDatabaseMetadata"
9482    }
9483}
9484
9485#[doc(hidden)]
9486impl<'de> serde::de::Deserialize<'de> for CreateDatabaseMetadata {
9487    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9488    where
9489        D: serde::Deserializer<'de>,
9490    {
9491        #[allow(non_camel_case_types)]
9492        #[doc(hidden)]
9493        #[derive(PartialEq, Eq, Hash)]
9494        enum __FieldTag {
9495            __database,
9496            Unknown(std::string::String),
9497        }
9498        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9499            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9500            where
9501                D: serde::Deserializer<'de>,
9502            {
9503                struct Visitor;
9504                impl<'de> serde::de::Visitor<'de> for Visitor {
9505                    type Value = __FieldTag;
9506                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9507                        formatter.write_str("a field name for CreateDatabaseMetadata")
9508                    }
9509                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9510                    where
9511                        E: serde::de::Error,
9512                    {
9513                        use std::result::Result::Ok;
9514                        use std::string::ToString;
9515                        match value {
9516                            "database" => Ok(__FieldTag::__database),
9517                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9518                        }
9519                    }
9520                }
9521                deserializer.deserialize_identifier(Visitor)
9522            }
9523        }
9524        struct Visitor;
9525        impl<'de> serde::de::Visitor<'de> for Visitor {
9526            type Value = CreateDatabaseMetadata;
9527            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9528                formatter.write_str("struct CreateDatabaseMetadata")
9529            }
9530            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9531            where
9532                A: serde::de::MapAccess<'de>,
9533            {
9534                #[allow(unused_imports)]
9535                use serde::de::Error;
9536                use std::option::Option::Some;
9537                let mut fields = std::collections::HashSet::new();
9538                let mut result = Self::Value::new();
9539                while let Some(tag) = map.next_key::<__FieldTag>()? {
9540                    #[allow(clippy::match_single_binding)]
9541                    match tag {
9542                        __FieldTag::__database => {
9543                            if !fields.insert(__FieldTag::__database) {
9544                                return std::result::Result::Err(A::Error::duplicate_field(
9545                                    "multiple values for database",
9546                                ));
9547                            }
9548                            result.database = map
9549                                .next_value::<std::option::Option<std::string::String>>()?
9550                                .unwrap_or_default();
9551                        }
9552                        __FieldTag::Unknown(key) => {
9553                            let value = map.next_value::<serde_json::Value>()?;
9554                            result._unknown_fields.insert(key, value);
9555                        }
9556                    }
9557                }
9558                std::result::Result::Ok(result)
9559            }
9560        }
9561        deserializer.deserialize_any(Visitor)
9562    }
9563}
9564
9565#[doc(hidden)]
9566impl serde::ser::Serialize for CreateDatabaseMetadata {
9567    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9568    where
9569        S: serde::ser::Serializer,
9570    {
9571        use serde::ser::SerializeMap;
9572        #[allow(unused_imports)]
9573        use std::option::Option::Some;
9574        let mut state = serializer.serialize_map(std::option::Option::None)?;
9575        if !self.database.is_empty() {
9576            state.serialize_entry("database", &self.database)?;
9577        }
9578        if !self._unknown_fields.is_empty() {
9579            for (key, value) in self._unknown_fields.iter() {
9580                state.serialize_entry(key, &value)?;
9581            }
9582        }
9583        state.end()
9584    }
9585}
9586
9587impl std::fmt::Debug for CreateDatabaseMetadata {
9588    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9589        let mut debug_struct = f.debug_struct("CreateDatabaseMetadata");
9590        debug_struct.field("database", &self.database);
9591        if !self._unknown_fields.is_empty() {
9592            debug_struct.field("_unknown_fields", &self._unknown_fields);
9593        }
9594        debug_struct.finish()
9595    }
9596}
9597
9598/// The request for
9599/// [GetDatabase][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabase].
9600///
9601/// [google.spanner.admin.database.v1.DatabaseAdmin.GetDatabase]: crate::client::DatabaseAdmin::get_database
9602#[derive(Clone, Default, PartialEq)]
9603#[non_exhaustive]
9604pub struct GetDatabaseRequest {
9605    /// Required. The name of the requested database. Values are of the form
9606    /// `projects/<project>/instances/<instance>/databases/<database>`.
9607    pub name: std::string::String,
9608
9609    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9610}
9611
9612impl GetDatabaseRequest {
9613    pub fn new() -> Self {
9614        std::default::Default::default()
9615    }
9616
9617    /// Sets the value of [name][crate::model::GetDatabaseRequest::name].
9618    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9619        self.name = v.into();
9620        self
9621    }
9622}
9623
9624impl wkt::message::Message for GetDatabaseRequest {
9625    fn typename() -> &'static str {
9626        "type.googleapis.com/google.spanner.admin.database.v1.GetDatabaseRequest"
9627    }
9628}
9629
9630#[doc(hidden)]
9631impl<'de> serde::de::Deserialize<'de> for GetDatabaseRequest {
9632    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9633    where
9634        D: serde::Deserializer<'de>,
9635    {
9636        #[allow(non_camel_case_types)]
9637        #[doc(hidden)]
9638        #[derive(PartialEq, Eq, Hash)]
9639        enum __FieldTag {
9640            __name,
9641            Unknown(std::string::String),
9642        }
9643        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9644            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9645            where
9646                D: serde::Deserializer<'de>,
9647            {
9648                struct Visitor;
9649                impl<'de> serde::de::Visitor<'de> for Visitor {
9650                    type Value = __FieldTag;
9651                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9652                        formatter.write_str("a field name for GetDatabaseRequest")
9653                    }
9654                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9655                    where
9656                        E: serde::de::Error,
9657                    {
9658                        use std::result::Result::Ok;
9659                        use std::string::ToString;
9660                        match value {
9661                            "name" => Ok(__FieldTag::__name),
9662                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9663                        }
9664                    }
9665                }
9666                deserializer.deserialize_identifier(Visitor)
9667            }
9668        }
9669        struct Visitor;
9670        impl<'de> serde::de::Visitor<'de> for Visitor {
9671            type Value = GetDatabaseRequest;
9672            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9673                formatter.write_str("struct GetDatabaseRequest")
9674            }
9675            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9676            where
9677                A: serde::de::MapAccess<'de>,
9678            {
9679                #[allow(unused_imports)]
9680                use serde::de::Error;
9681                use std::option::Option::Some;
9682                let mut fields = std::collections::HashSet::new();
9683                let mut result = Self::Value::new();
9684                while let Some(tag) = map.next_key::<__FieldTag>()? {
9685                    #[allow(clippy::match_single_binding)]
9686                    match tag {
9687                        __FieldTag::__name => {
9688                            if !fields.insert(__FieldTag::__name) {
9689                                return std::result::Result::Err(A::Error::duplicate_field(
9690                                    "multiple values for name",
9691                                ));
9692                            }
9693                            result.name = map
9694                                .next_value::<std::option::Option<std::string::String>>()?
9695                                .unwrap_or_default();
9696                        }
9697                        __FieldTag::Unknown(key) => {
9698                            let value = map.next_value::<serde_json::Value>()?;
9699                            result._unknown_fields.insert(key, value);
9700                        }
9701                    }
9702                }
9703                std::result::Result::Ok(result)
9704            }
9705        }
9706        deserializer.deserialize_any(Visitor)
9707    }
9708}
9709
9710#[doc(hidden)]
9711impl serde::ser::Serialize for GetDatabaseRequest {
9712    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9713    where
9714        S: serde::ser::Serializer,
9715    {
9716        use serde::ser::SerializeMap;
9717        #[allow(unused_imports)]
9718        use std::option::Option::Some;
9719        let mut state = serializer.serialize_map(std::option::Option::None)?;
9720        if !self.name.is_empty() {
9721            state.serialize_entry("name", &self.name)?;
9722        }
9723        if !self._unknown_fields.is_empty() {
9724            for (key, value) in self._unknown_fields.iter() {
9725                state.serialize_entry(key, &value)?;
9726            }
9727        }
9728        state.end()
9729    }
9730}
9731
9732impl std::fmt::Debug for GetDatabaseRequest {
9733    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9734        let mut debug_struct = f.debug_struct("GetDatabaseRequest");
9735        debug_struct.field("name", &self.name);
9736        if !self._unknown_fields.is_empty() {
9737            debug_struct.field("_unknown_fields", &self._unknown_fields);
9738        }
9739        debug_struct.finish()
9740    }
9741}
9742
9743/// The request for
9744/// [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase].
9745///
9746/// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase]: crate::client::DatabaseAdmin::update_database
9747#[derive(Clone, Default, PartialEq)]
9748#[non_exhaustive]
9749pub struct UpdateDatabaseRequest {
9750    /// Required. The database to update.
9751    /// The `name` field of the database is of the form
9752    /// `projects/<project>/instances/<instance>/databases/<database>`.
9753    pub database: std::option::Option<crate::model::Database>,
9754
9755    /// Required. The list of fields to update. Currently, only
9756    /// `enable_drop_protection` field can be updated.
9757    pub update_mask: std::option::Option<wkt::FieldMask>,
9758
9759    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9760}
9761
9762impl UpdateDatabaseRequest {
9763    pub fn new() -> Self {
9764        std::default::Default::default()
9765    }
9766
9767    /// Sets the value of [database][crate::model::UpdateDatabaseRequest::database].
9768    pub fn set_database<T>(mut self, v: T) -> Self
9769    where
9770        T: std::convert::Into<crate::model::Database>,
9771    {
9772        self.database = std::option::Option::Some(v.into());
9773        self
9774    }
9775
9776    /// Sets or clears the value of [database][crate::model::UpdateDatabaseRequest::database].
9777    pub fn set_or_clear_database<T>(mut self, v: std::option::Option<T>) -> Self
9778    where
9779        T: std::convert::Into<crate::model::Database>,
9780    {
9781        self.database = v.map(|x| x.into());
9782        self
9783    }
9784
9785    /// Sets the value of [update_mask][crate::model::UpdateDatabaseRequest::update_mask].
9786    pub fn set_update_mask<T>(mut self, v: T) -> Self
9787    where
9788        T: std::convert::Into<wkt::FieldMask>,
9789    {
9790        self.update_mask = std::option::Option::Some(v.into());
9791        self
9792    }
9793
9794    /// Sets or clears the value of [update_mask][crate::model::UpdateDatabaseRequest::update_mask].
9795    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9796    where
9797        T: std::convert::Into<wkt::FieldMask>,
9798    {
9799        self.update_mask = v.map(|x| x.into());
9800        self
9801    }
9802}
9803
9804impl wkt::message::Message for UpdateDatabaseRequest {
9805    fn typename() -> &'static str {
9806        "type.googleapis.com/google.spanner.admin.database.v1.UpdateDatabaseRequest"
9807    }
9808}
9809
9810#[doc(hidden)]
9811impl<'de> serde::de::Deserialize<'de> for UpdateDatabaseRequest {
9812    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9813    where
9814        D: serde::Deserializer<'de>,
9815    {
9816        #[allow(non_camel_case_types)]
9817        #[doc(hidden)]
9818        #[derive(PartialEq, Eq, Hash)]
9819        enum __FieldTag {
9820            __database,
9821            __update_mask,
9822            Unknown(std::string::String),
9823        }
9824        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9825            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9826            where
9827                D: serde::Deserializer<'de>,
9828            {
9829                struct Visitor;
9830                impl<'de> serde::de::Visitor<'de> for Visitor {
9831                    type Value = __FieldTag;
9832                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9833                        formatter.write_str("a field name for UpdateDatabaseRequest")
9834                    }
9835                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9836                    where
9837                        E: serde::de::Error,
9838                    {
9839                        use std::result::Result::Ok;
9840                        use std::string::ToString;
9841                        match value {
9842                            "database" => Ok(__FieldTag::__database),
9843                            "updateMask" => Ok(__FieldTag::__update_mask),
9844                            "update_mask" => Ok(__FieldTag::__update_mask),
9845                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9846                        }
9847                    }
9848                }
9849                deserializer.deserialize_identifier(Visitor)
9850            }
9851        }
9852        struct Visitor;
9853        impl<'de> serde::de::Visitor<'de> for Visitor {
9854            type Value = UpdateDatabaseRequest;
9855            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9856                formatter.write_str("struct UpdateDatabaseRequest")
9857            }
9858            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9859            where
9860                A: serde::de::MapAccess<'de>,
9861            {
9862                #[allow(unused_imports)]
9863                use serde::de::Error;
9864                use std::option::Option::Some;
9865                let mut fields = std::collections::HashSet::new();
9866                let mut result = Self::Value::new();
9867                while let Some(tag) = map.next_key::<__FieldTag>()? {
9868                    #[allow(clippy::match_single_binding)]
9869                    match tag {
9870                        __FieldTag::__database => {
9871                            if !fields.insert(__FieldTag::__database) {
9872                                return std::result::Result::Err(A::Error::duplicate_field(
9873                                    "multiple values for database",
9874                                ));
9875                            }
9876                            result.database =
9877                                map.next_value::<std::option::Option<crate::model::Database>>()?;
9878                        }
9879                        __FieldTag::__update_mask => {
9880                            if !fields.insert(__FieldTag::__update_mask) {
9881                                return std::result::Result::Err(A::Error::duplicate_field(
9882                                    "multiple values for update_mask",
9883                                ));
9884                            }
9885                            result.update_mask =
9886                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
9887                        }
9888                        __FieldTag::Unknown(key) => {
9889                            let value = map.next_value::<serde_json::Value>()?;
9890                            result._unknown_fields.insert(key, value);
9891                        }
9892                    }
9893                }
9894                std::result::Result::Ok(result)
9895            }
9896        }
9897        deserializer.deserialize_any(Visitor)
9898    }
9899}
9900
9901#[doc(hidden)]
9902impl serde::ser::Serialize for UpdateDatabaseRequest {
9903    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9904    where
9905        S: serde::ser::Serializer,
9906    {
9907        use serde::ser::SerializeMap;
9908        #[allow(unused_imports)]
9909        use std::option::Option::Some;
9910        let mut state = serializer.serialize_map(std::option::Option::None)?;
9911        if self.database.is_some() {
9912            state.serialize_entry("database", &self.database)?;
9913        }
9914        if self.update_mask.is_some() {
9915            state.serialize_entry("updateMask", &self.update_mask)?;
9916        }
9917        if !self._unknown_fields.is_empty() {
9918            for (key, value) in self._unknown_fields.iter() {
9919                state.serialize_entry(key, &value)?;
9920            }
9921        }
9922        state.end()
9923    }
9924}
9925
9926impl std::fmt::Debug for UpdateDatabaseRequest {
9927    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9928        let mut debug_struct = f.debug_struct("UpdateDatabaseRequest");
9929        debug_struct.field("database", &self.database);
9930        debug_struct.field("update_mask", &self.update_mask);
9931        if !self._unknown_fields.is_empty() {
9932            debug_struct.field("_unknown_fields", &self._unknown_fields);
9933        }
9934        debug_struct.finish()
9935    }
9936}
9937
9938/// Metadata type for the operation returned by
9939/// [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase].
9940///
9941/// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase]: crate::client::DatabaseAdmin::update_database
9942#[derive(Clone, Default, PartialEq)]
9943#[non_exhaustive]
9944pub struct UpdateDatabaseMetadata {
9945    /// The request for
9946    /// [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase].
9947    ///
9948    /// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase]: crate::client::DatabaseAdmin::update_database
9949    pub request: std::option::Option<crate::model::UpdateDatabaseRequest>,
9950
9951    /// The progress of the
9952    /// [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase]
9953    /// operation.
9954    ///
9955    /// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase]: crate::client::DatabaseAdmin::update_database
9956    pub progress: std::option::Option<crate::model::OperationProgress>,
9957
9958    /// The time at which this operation was cancelled. If set, this operation is
9959    /// in the process of undoing itself (which is best-effort).
9960    pub cancel_time: std::option::Option<wkt::Timestamp>,
9961
9962    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9963}
9964
9965impl UpdateDatabaseMetadata {
9966    pub fn new() -> Self {
9967        std::default::Default::default()
9968    }
9969
9970    /// Sets the value of [request][crate::model::UpdateDatabaseMetadata::request].
9971    pub fn set_request<T>(mut self, v: T) -> Self
9972    where
9973        T: std::convert::Into<crate::model::UpdateDatabaseRequest>,
9974    {
9975        self.request = std::option::Option::Some(v.into());
9976        self
9977    }
9978
9979    /// Sets or clears the value of [request][crate::model::UpdateDatabaseMetadata::request].
9980    pub fn set_or_clear_request<T>(mut self, v: std::option::Option<T>) -> Self
9981    where
9982        T: std::convert::Into<crate::model::UpdateDatabaseRequest>,
9983    {
9984        self.request = v.map(|x| x.into());
9985        self
9986    }
9987
9988    /// Sets the value of [progress][crate::model::UpdateDatabaseMetadata::progress].
9989    pub fn set_progress<T>(mut self, v: T) -> Self
9990    where
9991        T: std::convert::Into<crate::model::OperationProgress>,
9992    {
9993        self.progress = std::option::Option::Some(v.into());
9994        self
9995    }
9996
9997    /// Sets or clears the value of [progress][crate::model::UpdateDatabaseMetadata::progress].
9998    pub fn set_or_clear_progress<T>(mut self, v: std::option::Option<T>) -> Self
9999    where
10000        T: std::convert::Into<crate::model::OperationProgress>,
10001    {
10002        self.progress = v.map(|x| x.into());
10003        self
10004    }
10005
10006    /// Sets the value of [cancel_time][crate::model::UpdateDatabaseMetadata::cancel_time].
10007    pub fn set_cancel_time<T>(mut self, v: T) -> Self
10008    where
10009        T: std::convert::Into<wkt::Timestamp>,
10010    {
10011        self.cancel_time = std::option::Option::Some(v.into());
10012        self
10013    }
10014
10015    /// Sets or clears the value of [cancel_time][crate::model::UpdateDatabaseMetadata::cancel_time].
10016    pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
10017    where
10018        T: std::convert::Into<wkt::Timestamp>,
10019    {
10020        self.cancel_time = v.map(|x| x.into());
10021        self
10022    }
10023}
10024
10025impl wkt::message::Message for UpdateDatabaseMetadata {
10026    fn typename() -> &'static str {
10027        "type.googleapis.com/google.spanner.admin.database.v1.UpdateDatabaseMetadata"
10028    }
10029}
10030
10031#[doc(hidden)]
10032impl<'de> serde::de::Deserialize<'de> for UpdateDatabaseMetadata {
10033    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10034    where
10035        D: serde::Deserializer<'de>,
10036    {
10037        #[allow(non_camel_case_types)]
10038        #[doc(hidden)]
10039        #[derive(PartialEq, Eq, Hash)]
10040        enum __FieldTag {
10041            __request,
10042            __progress,
10043            __cancel_time,
10044            Unknown(std::string::String),
10045        }
10046        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10047            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10048            where
10049                D: serde::Deserializer<'de>,
10050            {
10051                struct Visitor;
10052                impl<'de> serde::de::Visitor<'de> for Visitor {
10053                    type Value = __FieldTag;
10054                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10055                        formatter.write_str("a field name for UpdateDatabaseMetadata")
10056                    }
10057                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10058                    where
10059                        E: serde::de::Error,
10060                    {
10061                        use std::result::Result::Ok;
10062                        use std::string::ToString;
10063                        match value {
10064                            "request" => Ok(__FieldTag::__request),
10065                            "progress" => Ok(__FieldTag::__progress),
10066                            "cancelTime" => Ok(__FieldTag::__cancel_time),
10067                            "cancel_time" => Ok(__FieldTag::__cancel_time),
10068                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10069                        }
10070                    }
10071                }
10072                deserializer.deserialize_identifier(Visitor)
10073            }
10074        }
10075        struct Visitor;
10076        impl<'de> serde::de::Visitor<'de> for Visitor {
10077            type Value = UpdateDatabaseMetadata;
10078            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10079                formatter.write_str("struct UpdateDatabaseMetadata")
10080            }
10081            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10082            where
10083                A: serde::de::MapAccess<'de>,
10084            {
10085                #[allow(unused_imports)]
10086                use serde::de::Error;
10087                use std::option::Option::Some;
10088                let mut fields = std::collections::HashSet::new();
10089                let mut result = Self::Value::new();
10090                while let Some(tag) = map.next_key::<__FieldTag>()? {
10091                    #[allow(clippy::match_single_binding)]
10092                    match tag {
10093                        __FieldTag::__request => {
10094                            if !fields.insert(__FieldTag::__request) {
10095                                return std::result::Result::Err(A::Error::duplicate_field(
10096                                    "multiple values for request",
10097                                ));
10098                            }
10099                            result.request = map.next_value::<std::option::Option<crate::model::UpdateDatabaseRequest>>()?
10100                                ;
10101                        }
10102                        __FieldTag::__progress => {
10103                            if !fields.insert(__FieldTag::__progress) {
10104                                return std::result::Result::Err(A::Error::duplicate_field(
10105                                    "multiple values for progress",
10106                                ));
10107                            }
10108                            result.progress = map
10109                                .next_value::<std::option::Option<crate::model::OperationProgress>>(
10110                                )?;
10111                        }
10112                        __FieldTag::__cancel_time => {
10113                            if !fields.insert(__FieldTag::__cancel_time) {
10114                                return std::result::Result::Err(A::Error::duplicate_field(
10115                                    "multiple values for cancel_time",
10116                                ));
10117                            }
10118                            result.cancel_time =
10119                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
10120                        }
10121                        __FieldTag::Unknown(key) => {
10122                            let value = map.next_value::<serde_json::Value>()?;
10123                            result._unknown_fields.insert(key, value);
10124                        }
10125                    }
10126                }
10127                std::result::Result::Ok(result)
10128            }
10129        }
10130        deserializer.deserialize_any(Visitor)
10131    }
10132}
10133
10134#[doc(hidden)]
10135impl serde::ser::Serialize for UpdateDatabaseMetadata {
10136    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10137    where
10138        S: serde::ser::Serializer,
10139    {
10140        use serde::ser::SerializeMap;
10141        #[allow(unused_imports)]
10142        use std::option::Option::Some;
10143        let mut state = serializer.serialize_map(std::option::Option::None)?;
10144        if self.request.is_some() {
10145            state.serialize_entry("request", &self.request)?;
10146        }
10147        if self.progress.is_some() {
10148            state.serialize_entry("progress", &self.progress)?;
10149        }
10150        if self.cancel_time.is_some() {
10151            state.serialize_entry("cancelTime", &self.cancel_time)?;
10152        }
10153        if !self._unknown_fields.is_empty() {
10154            for (key, value) in self._unknown_fields.iter() {
10155                state.serialize_entry(key, &value)?;
10156            }
10157        }
10158        state.end()
10159    }
10160}
10161
10162impl std::fmt::Debug for UpdateDatabaseMetadata {
10163    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10164        let mut debug_struct = f.debug_struct("UpdateDatabaseMetadata");
10165        debug_struct.field("request", &self.request);
10166        debug_struct.field("progress", &self.progress);
10167        debug_struct.field("cancel_time", &self.cancel_time);
10168        if !self._unknown_fields.is_empty() {
10169            debug_struct.field("_unknown_fields", &self._unknown_fields);
10170        }
10171        debug_struct.finish()
10172    }
10173}
10174
10175/// Enqueues the given DDL statements to be applied, in order but not
10176/// necessarily all at once, to the database schema at some point (or
10177/// points) in the future. The server checks that the statements
10178/// are executable (syntactically valid, name tables that exist, etc.)
10179/// before enqueueing them, but they may still fail upon
10180/// later execution (e.g., if a statement from another batch of
10181/// statements is applied first and it conflicts in some way, or if
10182/// there is some data-related problem like a `NULL` value in a column to
10183/// which `NOT NULL` would be added). If a statement fails, all
10184/// subsequent statements in the batch are automatically cancelled.
10185///
10186/// Each batch of statements is assigned a name which can be used with
10187/// the [Operations][google.longrunning.Operations] API to monitor
10188/// progress. See the
10189/// [operation_id][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.operation_id]
10190/// field for more details.
10191///
10192/// [google.longrunning.Operations]: longrunning::client::Operations
10193/// [google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.operation_id]: crate::model::UpdateDatabaseDdlRequest::operation_id
10194#[derive(Clone, Default, PartialEq)]
10195#[non_exhaustive]
10196pub struct UpdateDatabaseDdlRequest {
10197    /// Required. The database to update.
10198    pub database: std::string::String,
10199
10200    /// Required. DDL statements to be applied to the database.
10201    pub statements: std::vec::Vec<std::string::String>,
10202
10203    /// If empty, the new update request is assigned an
10204    /// automatically-generated operation ID. Otherwise, `operation_id`
10205    /// is used to construct the name of the resulting
10206    /// [Operation][google.longrunning.Operation].
10207    ///
10208    /// Specifying an explicit operation ID simplifies determining
10209    /// whether the statements were executed in the event that the
10210    /// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]
10211    /// call is replayed, or the return value is otherwise lost: the
10212    /// [database][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.database]
10213    /// and `operation_id` fields can be combined to form the
10214    /// [name][google.longrunning.Operation.name] of the resulting
10215    /// [longrunning.Operation][google.longrunning.Operation]:
10216    /// `<database>/operations/<operation_id>`.
10217    ///
10218    /// `operation_id` should be unique within the database, and must be
10219    /// a valid identifier: `[a-z][a-z0-9_]*`. Note that
10220    /// automatically-generated operation IDs always begin with an
10221    /// underscore. If the named operation already exists,
10222    /// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]
10223    /// returns `ALREADY_EXISTS`.
10224    ///
10225    /// [google.longrunning.Operation]: longrunning::model::Operation
10226    /// [google.longrunning.Operation.name]: longrunning::model::Operation::name
10227    /// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]: crate::client::DatabaseAdmin::update_database_ddl
10228    /// [google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.database]: crate::model::UpdateDatabaseDdlRequest::database
10229    pub operation_id: std::string::String,
10230
10231    /// Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements.
10232    /// Contains a protobuf-serialized
10233    /// [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto).
10234    /// To generate it, [install](https://grpc.io/docs/protoc-installation/) and
10235    /// run `protoc` with --include_imports and --descriptor_set_out. For example,
10236    /// to generate for moon/shot/app.proto, run
10237    ///
10238    /// ```norust
10239    /// $protoc  --proto_path=/app_path --proto_path=/lib_path \
10240    ///          --include_imports \
10241    ///          --descriptor_set_out=descriptors.data \
10242    ///          moon/shot/app.proto
10243    /// ```
10244    ///
10245    /// For more details, see protobuffer [self
10246    /// description](https://developers.google.com/protocol-buffers/docs/techniques#self-description).
10247    pub proto_descriptors: ::bytes::Bytes,
10248
10249    /// Optional. This field is exposed to be used by the Spanner Migration Tool.
10250    /// For more details, see
10251    /// [SMT](https://github.com/GoogleCloudPlatform/spanner-migration-tool).
10252    pub throughput_mode: bool,
10253
10254    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10255}
10256
10257impl UpdateDatabaseDdlRequest {
10258    pub fn new() -> Self {
10259        std::default::Default::default()
10260    }
10261
10262    /// Sets the value of [database][crate::model::UpdateDatabaseDdlRequest::database].
10263    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10264        self.database = v.into();
10265        self
10266    }
10267
10268    /// Sets the value of [statements][crate::model::UpdateDatabaseDdlRequest::statements].
10269    pub fn set_statements<T, V>(mut self, v: T) -> Self
10270    where
10271        T: std::iter::IntoIterator<Item = V>,
10272        V: std::convert::Into<std::string::String>,
10273    {
10274        use std::iter::Iterator;
10275        self.statements = v.into_iter().map(|i| i.into()).collect();
10276        self
10277    }
10278
10279    /// Sets the value of [operation_id][crate::model::UpdateDatabaseDdlRequest::operation_id].
10280    pub fn set_operation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10281        self.operation_id = v.into();
10282        self
10283    }
10284
10285    /// Sets the value of [proto_descriptors][crate::model::UpdateDatabaseDdlRequest::proto_descriptors].
10286    pub fn set_proto_descriptors<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
10287        self.proto_descriptors = v.into();
10288        self
10289    }
10290
10291    /// Sets the value of [throughput_mode][crate::model::UpdateDatabaseDdlRequest::throughput_mode].
10292    pub fn set_throughput_mode<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10293        self.throughput_mode = v.into();
10294        self
10295    }
10296}
10297
10298impl wkt::message::Message for UpdateDatabaseDdlRequest {
10299    fn typename() -> &'static str {
10300        "type.googleapis.com/google.spanner.admin.database.v1.UpdateDatabaseDdlRequest"
10301    }
10302}
10303
10304#[doc(hidden)]
10305impl<'de> serde::de::Deserialize<'de> for UpdateDatabaseDdlRequest {
10306    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10307    where
10308        D: serde::Deserializer<'de>,
10309    {
10310        #[allow(non_camel_case_types)]
10311        #[doc(hidden)]
10312        #[derive(PartialEq, Eq, Hash)]
10313        enum __FieldTag {
10314            __database,
10315            __statements,
10316            __operation_id,
10317            __proto_descriptors,
10318            __throughput_mode,
10319            Unknown(std::string::String),
10320        }
10321        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10322            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10323            where
10324                D: serde::Deserializer<'de>,
10325            {
10326                struct Visitor;
10327                impl<'de> serde::de::Visitor<'de> for Visitor {
10328                    type Value = __FieldTag;
10329                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10330                        formatter.write_str("a field name for UpdateDatabaseDdlRequest")
10331                    }
10332                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10333                    where
10334                        E: serde::de::Error,
10335                    {
10336                        use std::result::Result::Ok;
10337                        use std::string::ToString;
10338                        match value {
10339                            "database" => Ok(__FieldTag::__database),
10340                            "statements" => Ok(__FieldTag::__statements),
10341                            "operationId" => Ok(__FieldTag::__operation_id),
10342                            "operation_id" => Ok(__FieldTag::__operation_id),
10343                            "protoDescriptors" => Ok(__FieldTag::__proto_descriptors),
10344                            "proto_descriptors" => Ok(__FieldTag::__proto_descriptors),
10345                            "throughputMode" => Ok(__FieldTag::__throughput_mode),
10346                            "throughput_mode" => Ok(__FieldTag::__throughput_mode),
10347                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10348                        }
10349                    }
10350                }
10351                deserializer.deserialize_identifier(Visitor)
10352            }
10353        }
10354        struct Visitor;
10355        impl<'de> serde::de::Visitor<'de> for Visitor {
10356            type Value = UpdateDatabaseDdlRequest;
10357            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10358                formatter.write_str("struct UpdateDatabaseDdlRequest")
10359            }
10360            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10361            where
10362                A: serde::de::MapAccess<'de>,
10363            {
10364                #[allow(unused_imports)]
10365                use serde::de::Error;
10366                use std::option::Option::Some;
10367                let mut fields = std::collections::HashSet::new();
10368                let mut result = Self::Value::new();
10369                while let Some(tag) = map.next_key::<__FieldTag>()? {
10370                    #[allow(clippy::match_single_binding)]
10371                    match tag {
10372                        __FieldTag::__database => {
10373                            if !fields.insert(__FieldTag::__database) {
10374                                return std::result::Result::Err(A::Error::duplicate_field(
10375                                    "multiple values for database",
10376                                ));
10377                            }
10378                            result.database = map
10379                                .next_value::<std::option::Option<std::string::String>>()?
10380                                .unwrap_or_default();
10381                        }
10382                        __FieldTag::__statements => {
10383                            if !fields.insert(__FieldTag::__statements) {
10384                                return std::result::Result::Err(A::Error::duplicate_field(
10385                                    "multiple values for statements",
10386                                ));
10387                            }
10388                            result.statements = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
10389                        }
10390                        __FieldTag::__operation_id => {
10391                            if !fields.insert(__FieldTag::__operation_id) {
10392                                return std::result::Result::Err(A::Error::duplicate_field(
10393                                    "multiple values for operation_id",
10394                                ));
10395                            }
10396                            result.operation_id = map
10397                                .next_value::<std::option::Option<std::string::String>>()?
10398                                .unwrap_or_default();
10399                        }
10400                        __FieldTag::__proto_descriptors => {
10401                            if !fields.insert(__FieldTag::__proto_descriptors) {
10402                                return std::result::Result::Err(A::Error::duplicate_field(
10403                                    "multiple values for proto_descriptors",
10404                                ));
10405                            }
10406                            struct __With(std::option::Option<::bytes::Bytes>);
10407                            impl<'de> serde::de::Deserialize<'de> for __With {
10408                                fn deserialize<D>(
10409                                    deserializer: D,
10410                                ) -> std::result::Result<Self, D::Error>
10411                                where
10412                                    D: serde::de::Deserializer<'de>,
10413                                {
10414                                    serde_with::As::< std::option::Option<serde_with::base64::Base64> >::deserialize(deserializer).map(__With)
10415                                }
10416                            }
10417                            result.proto_descriptors =
10418                                map.next_value::<__With>()?.0.unwrap_or_default();
10419                        }
10420                        __FieldTag::__throughput_mode => {
10421                            if !fields.insert(__FieldTag::__throughput_mode) {
10422                                return std::result::Result::Err(A::Error::duplicate_field(
10423                                    "multiple values for throughput_mode",
10424                                ));
10425                            }
10426                            result.throughput_mode = map
10427                                .next_value::<std::option::Option<bool>>()?
10428                                .unwrap_or_default();
10429                        }
10430                        __FieldTag::Unknown(key) => {
10431                            let value = map.next_value::<serde_json::Value>()?;
10432                            result._unknown_fields.insert(key, value);
10433                        }
10434                    }
10435                }
10436                std::result::Result::Ok(result)
10437            }
10438        }
10439        deserializer.deserialize_any(Visitor)
10440    }
10441}
10442
10443#[doc(hidden)]
10444impl serde::ser::Serialize for UpdateDatabaseDdlRequest {
10445    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10446    where
10447        S: serde::ser::Serializer,
10448    {
10449        use serde::ser::SerializeMap;
10450        #[allow(unused_imports)]
10451        use std::option::Option::Some;
10452        let mut state = serializer.serialize_map(std::option::Option::None)?;
10453        if !self.database.is_empty() {
10454            state.serialize_entry("database", &self.database)?;
10455        }
10456        if !self.statements.is_empty() {
10457            state.serialize_entry("statements", &self.statements)?;
10458        }
10459        if !self.operation_id.is_empty() {
10460            state.serialize_entry("operationId", &self.operation_id)?;
10461        }
10462        if !self.proto_descriptors.is_empty() {
10463            struct __With<'a>(&'a ::bytes::Bytes);
10464            impl<'a> serde::ser::Serialize for __With<'a> {
10465                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10466                where
10467                    S: serde::ser::Serializer,
10468                {
10469                    serde_with::As::<serde_with::base64::Base64>::serialize(self.0, serializer)
10470                }
10471            }
10472            state.serialize_entry("protoDescriptors", &__With(&self.proto_descriptors))?;
10473        }
10474        if !wkt::internal::is_default(&self.throughput_mode) {
10475            state.serialize_entry("throughputMode", &self.throughput_mode)?;
10476        }
10477        if !self._unknown_fields.is_empty() {
10478            for (key, value) in self._unknown_fields.iter() {
10479                state.serialize_entry(key, &value)?;
10480            }
10481        }
10482        state.end()
10483    }
10484}
10485
10486impl std::fmt::Debug for UpdateDatabaseDdlRequest {
10487    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10488        let mut debug_struct = f.debug_struct("UpdateDatabaseDdlRequest");
10489        debug_struct.field("database", &self.database);
10490        debug_struct.field("statements", &self.statements);
10491        debug_struct.field("operation_id", &self.operation_id);
10492        debug_struct.field("proto_descriptors", &self.proto_descriptors);
10493        debug_struct.field("throughput_mode", &self.throughput_mode);
10494        if !self._unknown_fields.is_empty() {
10495            debug_struct.field("_unknown_fields", &self._unknown_fields);
10496        }
10497        debug_struct.finish()
10498    }
10499}
10500
10501/// Action information extracted from a DDL statement. This proto is used to
10502/// display the brief info of the DDL statement for the operation
10503/// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl].
10504///
10505/// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]: crate::client::DatabaseAdmin::update_database_ddl
10506#[derive(Clone, Default, PartialEq)]
10507#[non_exhaustive]
10508pub struct DdlStatementActionInfo {
10509    /// The action for the DDL statement, e.g. CREATE, ALTER, DROP, GRANT, etc.
10510    /// This field is a non-empty string.
10511    pub action: std::string::String,
10512
10513    /// The entity type for the DDL statement, e.g. TABLE, INDEX, VIEW, etc.
10514    /// This field can be empty string for some DDL statement,
10515    /// e.g. for statement "ANALYZE", `entity_type` = "".
10516    pub entity_type: std::string::String,
10517
10518    /// The entity name(s) being operated on the DDL statement.
10519    /// E.g.
10520    ///
10521    /// 1. For statement "CREATE TABLE t1(...)", `entity_names` = ["t1"].
10522    /// 1. For statement "GRANT ROLE r1, r2 ...", `entity_names` = ["r1", "r2"].
10523    /// 1. For statement "ANALYZE", `entity_names` = [].
10524    pub entity_names: std::vec::Vec<std::string::String>,
10525
10526    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10527}
10528
10529impl DdlStatementActionInfo {
10530    pub fn new() -> Self {
10531        std::default::Default::default()
10532    }
10533
10534    /// Sets the value of [action][crate::model::DdlStatementActionInfo::action].
10535    pub fn set_action<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10536        self.action = v.into();
10537        self
10538    }
10539
10540    /// Sets the value of [entity_type][crate::model::DdlStatementActionInfo::entity_type].
10541    pub fn set_entity_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10542        self.entity_type = v.into();
10543        self
10544    }
10545
10546    /// Sets the value of [entity_names][crate::model::DdlStatementActionInfo::entity_names].
10547    pub fn set_entity_names<T, V>(mut self, v: T) -> Self
10548    where
10549        T: std::iter::IntoIterator<Item = V>,
10550        V: std::convert::Into<std::string::String>,
10551    {
10552        use std::iter::Iterator;
10553        self.entity_names = v.into_iter().map(|i| i.into()).collect();
10554        self
10555    }
10556}
10557
10558impl wkt::message::Message for DdlStatementActionInfo {
10559    fn typename() -> &'static str {
10560        "type.googleapis.com/google.spanner.admin.database.v1.DdlStatementActionInfo"
10561    }
10562}
10563
10564#[doc(hidden)]
10565impl<'de> serde::de::Deserialize<'de> for DdlStatementActionInfo {
10566    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10567    where
10568        D: serde::Deserializer<'de>,
10569    {
10570        #[allow(non_camel_case_types)]
10571        #[doc(hidden)]
10572        #[derive(PartialEq, Eq, Hash)]
10573        enum __FieldTag {
10574            __action,
10575            __entity_type,
10576            __entity_names,
10577            Unknown(std::string::String),
10578        }
10579        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10580            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10581            where
10582                D: serde::Deserializer<'de>,
10583            {
10584                struct Visitor;
10585                impl<'de> serde::de::Visitor<'de> for Visitor {
10586                    type Value = __FieldTag;
10587                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10588                        formatter.write_str("a field name for DdlStatementActionInfo")
10589                    }
10590                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10591                    where
10592                        E: serde::de::Error,
10593                    {
10594                        use std::result::Result::Ok;
10595                        use std::string::ToString;
10596                        match value {
10597                            "action" => Ok(__FieldTag::__action),
10598                            "entityType" => Ok(__FieldTag::__entity_type),
10599                            "entity_type" => Ok(__FieldTag::__entity_type),
10600                            "entityNames" => Ok(__FieldTag::__entity_names),
10601                            "entity_names" => Ok(__FieldTag::__entity_names),
10602                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10603                        }
10604                    }
10605                }
10606                deserializer.deserialize_identifier(Visitor)
10607            }
10608        }
10609        struct Visitor;
10610        impl<'de> serde::de::Visitor<'de> for Visitor {
10611            type Value = DdlStatementActionInfo;
10612            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10613                formatter.write_str("struct DdlStatementActionInfo")
10614            }
10615            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10616            where
10617                A: serde::de::MapAccess<'de>,
10618            {
10619                #[allow(unused_imports)]
10620                use serde::de::Error;
10621                use std::option::Option::Some;
10622                let mut fields = std::collections::HashSet::new();
10623                let mut result = Self::Value::new();
10624                while let Some(tag) = map.next_key::<__FieldTag>()? {
10625                    #[allow(clippy::match_single_binding)]
10626                    match tag {
10627                        __FieldTag::__action => {
10628                            if !fields.insert(__FieldTag::__action) {
10629                                return std::result::Result::Err(A::Error::duplicate_field(
10630                                    "multiple values for action",
10631                                ));
10632                            }
10633                            result.action = map
10634                                .next_value::<std::option::Option<std::string::String>>()?
10635                                .unwrap_or_default();
10636                        }
10637                        __FieldTag::__entity_type => {
10638                            if !fields.insert(__FieldTag::__entity_type) {
10639                                return std::result::Result::Err(A::Error::duplicate_field(
10640                                    "multiple values for entity_type",
10641                                ));
10642                            }
10643                            result.entity_type = map
10644                                .next_value::<std::option::Option<std::string::String>>()?
10645                                .unwrap_or_default();
10646                        }
10647                        __FieldTag::__entity_names => {
10648                            if !fields.insert(__FieldTag::__entity_names) {
10649                                return std::result::Result::Err(A::Error::duplicate_field(
10650                                    "multiple values for entity_names",
10651                                ));
10652                            }
10653                            result.entity_names = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
10654                        }
10655                        __FieldTag::Unknown(key) => {
10656                            let value = map.next_value::<serde_json::Value>()?;
10657                            result._unknown_fields.insert(key, value);
10658                        }
10659                    }
10660                }
10661                std::result::Result::Ok(result)
10662            }
10663        }
10664        deserializer.deserialize_any(Visitor)
10665    }
10666}
10667
10668#[doc(hidden)]
10669impl serde::ser::Serialize for DdlStatementActionInfo {
10670    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10671    where
10672        S: serde::ser::Serializer,
10673    {
10674        use serde::ser::SerializeMap;
10675        #[allow(unused_imports)]
10676        use std::option::Option::Some;
10677        let mut state = serializer.serialize_map(std::option::Option::None)?;
10678        if !self.action.is_empty() {
10679            state.serialize_entry("action", &self.action)?;
10680        }
10681        if !self.entity_type.is_empty() {
10682            state.serialize_entry("entityType", &self.entity_type)?;
10683        }
10684        if !self.entity_names.is_empty() {
10685            state.serialize_entry("entityNames", &self.entity_names)?;
10686        }
10687        if !self._unknown_fields.is_empty() {
10688            for (key, value) in self._unknown_fields.iter() {
10689                state.serialize_entry(key, &value)?;
10690            }
10691        }
10692        state.end()
10693    }
10694}
10695
10696impl std::fmt::Debug for DdlStatementActionInfo {
10697    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10698        let mut debug_struct = f.debug_struct("DdlStatementActionInfo");
10699        debug_struct.field("action", &self.action);
10700        debug_struct.field("entity_type", &self.entity_type);
10701        debug_struct.field("entity_names", &self.entity_names);
10702        if !self._unknown_fields.is_empty() {
10703            debug_struct.field("_unknown_fields", &self._unknown_fields);
10704        }
10705        debug_struct.finish()
10706    }
10707}
10708
10709/// Metadata type for the operation returned by
10710/// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl].
10711///
10712/// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]: crate::client::DatabaseAdmin::update_database_ddl
10713#[derive(Clone, Default, PartialEq)]
10714#[non_exhaustive]
10715pub struct UpdateDatabaseDdlMetadata {
10716    /// The database being modified.
10717    pub database: std::string::String,
10718
10719    /// For an update this list contains all the statements. For an
10720    /// individual statement, this list contains only that statement.
10721    pub statements: std::vec::Vec<std::string::String>,
10722
10723    /// Reports the commit timestamps of all statements that have
10724    /// succeeded so far, where `commit_timestamps[i]` is the commit
10725    /// timestamp for the statement `statements[i]`.
10726    pub commit_timestamps: std::vec::Vec<wkt::Timestamp>,
10727
10728    /// Output only. When true, indicates that the operation is throttled e.g.
10729    /// due to resource constraints. When resources become available the operation
10730    /// will resume and this field will be false again.
10731    pub throttled: bool,
10732
10733    /// The progress of the
10734    /// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]
10735    /// operations. All DDL statements will have continuously updating progress,
10736    /// and `progress[i]` is the operation progress for `statements[i]`. Also,
10737    /// `progress[i]` will have start time and end time populated with commit
10738    /// timestamp of operation, as well as a progress of 100% once the operation
10739    /// has completed.
10740    ///
10741    /// [google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]: crate::client::DatabaseAdmin::update_database_ddl
10742    pub progress: std::vec::Vec<crate::model::OperationProgress>,
10743
10744    /// The brief action info for the DDL statements.
10745    /// `actions[i]` is the brief info for `statements[i]`.
10746    pub actions: std::vec::Vec<crate::model::DdlStatementActionInfo>,
10747
10748    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10749}
10750
10751impl UpdateDatabaseDdlMetadata {
10752    pub fn new() -> Self {
10753        std::default::Default::default()
10754    }
10755
10756    /// Sets the value of [database][crate::model::UpdateDatabaseDdlMetadata::database].
10757    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10758        self.database = v.into();
10759        self
10760    }
10761
10762    /// Sets the value of [statements][crate::model::UpdateDatabaseDdlMetadata::statements].
10763    pub fn set_statements<T, V>(mut self, v: T) -> Self
10764    where
10765        T: std::iter::IntoIterator<Item = V>,
10766        V: std::convert::Into<std::string::String>,
10767    {
10768        use std::iter::Iterator;
10769        self.statements = v.into_iter().map(|i| i.into()).collect();
10770        self
10771    }
10772
10773    /// Sets the value of [commit_timestamps][crate::model::UpdateDatabaseDdlMetadata::commit_timestamps].
10774    pub fn set_commit_timestamps<T, V>(mut self, v: T) -> Self
10775    where
10776        T: std::iter::IntoIterator<Item = V>,
10777        V: std::convert::Into<wkt::Timestamp>,
10778    {
10779        use std::iter::Iterator;
10780        self.commit_timestamps = v.into_iter().map(|i| i.into()).collect();
10781        self
10782    }
10783
10784    /// Sets the value of [throttled][crate::model::UpdateDatabaseDdlMetadata::throttled].
10785    pub fn set_throttled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10786        self.throttled = v.into();
10787        self
10788    }
10789
10790    /// Sets the value of [progress][crate::model::UpdateDatabaseDdlMetadata::progress].
10791    pub fn set_progress<T, V>(mut self, v: T) -> Self
10792    where
10793        T: std::iter::IntoIterator<Item = V>,
10794        V: std::convert::Into<crate::model::OperationProgress>,
10795    {
10796        use std::iter::Iterator;
10797        self.progress = v.into_iter().map(|i| i.into()).collect();
10798        self
10799    }
10800
10801    /// Sets the value of [actions][crate::model::UpdateDatabaseDdlMetadata::actions].
10802    pub fn set_actions<T, V>(mut self, v: T) -> Self
10803    where
10804        T: std::iter::IntoIterator<Item = V>,
10805        V: std::convert::Into<crate::model::DdlStatementActionInfo>,
10806    {
10807        use std::iter::Iterator;
10808        self.actions = v.into_iter().map(|i| i.into()).collect();
10809        self
10810    }
10811}
10812
10813impl wkt::message::Message for UpdateDatabaseDdlMetadata {
10814    fn typename() -> &'static str {
10815        "type.googleapis.com/google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata"
10816    }
10817}
10818
10819#[doc(hidden)]
10820impl<'de> serde::de::Deserialize<'de> for UpdateDatabaseDdlMetadata {
10821    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10822    where
10823        D: serde::Deserializer<'de>,
10824    {
10825        #[allow(non_camel_case_types)]
10826        #[doc(hidden)]
10827        #[derive(PartialEq, Eq, Hash)]
10828        enum __FieldTag {
10829            __database,
10830            __statements,
10831            __commit_timestamps,
10832            __throttled,
10833            __progress,
10834            __actions,
10835            Unknown(std::string::String),
10836        }
10837        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10838            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10839            where
10840                D: serde::Deserializer<'de>,
10841            {
10842                struct Visitor;
10843                impl<'de> serde::de::Visitor<'de> for Visitor {
10844                    type Value = __FieldTag;
10845                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10846                        formatter.write_str("a field name for UpdateDatabaseDdlMetadata")
10847                    }
10848                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10849                    where
10850                        E: serde::de::Error,
10851                    {
10852                        use std::result::Result::Ok;
10853                        use std::string::ToString;
10854                        match value {
10855                            "database" => Ok(__FieldTag::__database),
10856                            "statements" => Ok(__FieldTag::__statements),
10857                            "commitTimestamps" => Ok(__FieldTag::__commit_timestamps),
10858                            "commit_timestamps" => Ok(__FieldTag::__commit_timestamps),
10859                            "throttled" => Ok(__FieldTag::__throttled),
10860                            "progress" => Ok(__FieldTag::__progress),
10861                            "actions" => Ok(__FieldTag::__actions),
10862                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10863                        }
10864                    }
10865                }
10866                deserializer.deserialize_identifier(Visitor)
10867            }
10868        }
10869        struct Visitor;
10870        impl<'de> serde::de::Visitor<'de> for Visitor {
10871            type Value = UpdateDatabaseDdlMetadata;
10872            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10873                formatter.write_str("struct UpdateDatabaseDdlMetadata")
10874            }
10875            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10876            where
10877                A: serde::de::MapAccess<'de>,
10878            {
10879                #[allow(unused_imports)]
10880                use serde::de::Error;
10881                use std::option::Option::Some;
10882                let mut fields = std::collections::HashSet::new();
10883                let mut result = Self::Value::new();
10884                while let Some(tag) = map.next_key::<__FieldTag>()? {
10885                    #[allow(clippy::match_single_binding)]
10886                    match tag {
10887                        __FieldTag::__database => {
10888                            if !fields.insert(__FieldTag::__database) {
10889                                return std::result::Result::Err(A::Error::duplicate_field(
10890                                    "multiple values for database",
10891                                ));
10892                            }
10893                            result.database = map
10894                                .next_value::<std::option::Option<std::string::String>>()?
10895                                .unwrap_or_default();
10896                        }
10897                        __FieldTag::__statements => {
10898                            if !fields.insert(__FieldTag::__statements) {
10899                                return std::result::Result::Err(A::Error::duplicate_field(
10900                                    "multiple values for statements",
10901                                ));
10902                            }
10903                            result.statements = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
10904                        }
10905                        __FieldTag::__commit_timestamps => {
10906                            if !fields.insert(__FieldTag::__commit_timestamps) {
10907                                return std::result::Result::Err(A::Error::duplicate_field(
10908                                    "multiple values for commit_timestamps",
10909                                ));
10910                            }
10911                            result.commit_timestamps = map
10912                                .next_value::<std::option::Option<std::vec::Vec<wkt::Timestamp>>>()?
10913                                .unwrap_or_default();
10914                        }
10915                        __FieldTag::__throttled => {
10916                            if !fields.insert(__FieldTag::__throttled) {
10917                                return std::result::Result::Err(A::Error::duplicate_field(
10918                                    "multiple values for throttled",
10919                                ));
10920                            }
10921                            result.throttled = map
10922                                .next_value::<std::option::Option<bool>>()?
10923                                .unwrap_or_default();
10924                        }
10925                        __FieldTag::__progress => {
10926                            if !fields.insert(__FieldTag::__progress) {
10927                                return std::result::Result::Err(A::Error::duplicate_field(
10928                                    "multiple values for progress",
10929                                ));
10930                            }
10931                            result.progress =
10932                                map.next_value::<std::option::Option<
10933                                    std::vec::Vec<crate::model::OperationProgress>,
10934                                >>()?
10935                                .unwrap_or_default();
10936                        }
10937                        __FieldTag::__actions => {
10938                            if !fields.insert(__FieldTag::__actions) {
10939                                return std::result::Result::Err(A::Error::duplicate_field(
10940                                    "multiple values for actions",
10941                                ));
10942                            }
10943                            result.actions = map
10944                                .next_value::<std::option::Option<
10945                                    std::vec::Vec<crate::model::DdlStatementActionInfo>,
10946                                >>()?
10947                                .unwrap_or_default();
10948                        }
10949                        __FieldTag::Unknown(key) => {
10950                            let value = map.next_value::<serde_json::Value>()?;
10951                            result._unknown_fields.insert(key, value);
10952                        }
10953                    }
10954                }
10955                std::result::Result::Ok(result)
10956            }
10957        }
10958        deserializer.deserialize_any(Visitor)
10959    }
10960}
10961
10962#[doc(hidden)]
10963impl serde::ser::Serialize for UpdateDatabaseDdlMetadata {
10964    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10965    where
10966        S: serde::ser::Serializer,
10967    {
10968        use serde::ser::SerializeMap;
10969        #[allow(unused_imports)]
10970        use std::option::Option::Some;
10971        let mut state = serializer.serialize_map(std::option::Option::None)?;
10972        if !self.database.is_empty() {
10973            state.serialize_entry("database", &self.database)?;
10974        }
10975        if !self.statements.is_empty() {
10976            state.serialize_entry("statements", &self.statements)?;
10977        }
10978        if !self.commit_timestamps.is_empty() {
10979            state.serialize_entry("commitTimestamps", &self.commit_timestamps)?;
10980        }
10981        if !wkt::internal::is_default(&self.throttled) {
10982            state.serialize_entry("throttled", &self.throttled)?;
10983        }
10984        if !self.progress.is_empty() {
10985            state.serialize_entry("progress", &self.progress)?;
10986        }
10987        if !self.actions.is_empty() {
10988            state.serialize_entry("actions", &self.actions)?;
10989        }
10990        if !self._unknown_fields.is_empty() {
10991            for (key, value) in self._unknown_fields.iter() {
10992                state.serialize_entry(key, &value)?;
10993            }
10994        }
10995        state.end()
10996    }
10997}
10998
10999impl std::fmt::Debug for UpdateDatabaseDdlMetadata {
11000    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11001        let mut debug_struct = f.debug_struct("UpdateDatabaseDdlMetadata");
11002        debug_struct.field("database", &self.database);
11003        debug_struct.field("statements", &self.statements);
11004        debug_struct.field("commit_timestamps", &self.commit_timestamps);
11005        debug_struct.field("throttled", &self.throttled);
11006        debug_struct.field("progress", &self.progress);
11007        debug_struct.field("actions", &self.actions);
11008        if !self._unknown_fields.is_empty() {
11009            debug_struct.field("_unknown_fields", &self._unknown_fields);
11010        }
11011        debug_struct.finish()
11012    }
11013}
11014
11015/// The request for
11016/// [DropDatabase][google.spanner.admin.database.v1.DatabaseAdmin.DropDatabase].
11017///
11018/// [google.spanner.admin.database.v1.DatabaseAdmin.DropDatabase]: crate::client::DatabaseAdmin::drop_database
11019#[derive(Clone, Default, PartialEq)]
11020#[non_exhaustive]
11021pub struct DropDatabaseRequest {
11022    /// Required. The database to be dropped.
11023    pub database: std::string::String,
11024
11025    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11026}
11027
11028impl DropDatabaseRequest {
11029    pub fn new() -> Self {
11030        std::default::Default::default()
11031    }
11032
11033    /// Sets the value of [database][crate::model::DropDatabaseRequest::database].
11034    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11035        self.database = v.into();
11036        self
11037    }
11038}
11039
11040impl wkt::message::Message for DropDatabaseRequest {
11041    fn typename() -> &'static str {
11042        "type.googleapis.com/google.spanner.admin.database.v1.DropDatabaseRequest"
11043    }
11044}
11045
11046#[doc(hidden)]
11047impl<'de> serde::de::Deserialize<'de> for DropDatabaseRequest {
11048    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11049    where
11050        D: serde::Deserializer<'de>,
11051    {
11052        #[allow(non_camel_case_types)]
11053        #[doc(hidden)]
11054        #[derive(PartialEq, Eq, Hash)]
11055        enum __FieldTag {
11056            __database,
11057            Unknown(std::string::String),
11058        }
11059        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11060            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11061            where
11062                D: serde::Deserializer<'de>,
11063            {
11064                struct Visitor;
11065                impl<'de> serde::de::Visitor<'de> for Visitor {
11066                    type Value = __FieldTag;
11067                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11068                        formatter.write_str("a field name for DropDatabaseRequest")
11069                    }
11070                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11071                    where
11072                        E: serde::de::Error,
11073                    {
11074                        use std::result::Result::Ok;
11075                        use std::string::ToString;
11076                        match value {
11077                            "database" => Ok(__FieldTag::__database),
11078                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11079                        }
11080                    }
11081                }
11082                deserializer.deserialize_identifier(Visitor)
11083            }
11084        }
11085        struct Visitor;
11086        impl<'de> serde::de::Visitor<'de> for Visitor {
11087            type Value = DropDatabaseRequest;
11088            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11089                formatter.write_str("struct DropDatabaseRequest")
11090            }
11091            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11092            where
11093                A: serde::de::MapAccess<'de>,
11094            {
11095                #[allow(unused_imports)]
11096                use serde::de::Error;
11097                use std::option::Option::Some;
11098                let mut fields = std::collections::HashSet::new();
11099                let mut result = Self::Value::new();
11100                while let Some(tag) = map.next_key::<__FieldTag>()? {
11101                    #[allow(clippy::match_single_binding)]
11102                    match tag {
11103                        __FieldTag::__database => {
11104                            if !fields.insert(__FieldTag::__database) {
11105                                return std::result::Result::Err(A::Error::duplicate_field(
11106                                    "multiple values for database",
11107                                ));
11108                            }
11109                            result.database = map
11110                                .next_value::<std::option::Option<std::string::String>>()?
11111                                .unwrap_or_default();
11112                        }
11113                        __FieldTag::Unknown(key) => {
11114                            let value = map.next_value::<serde_json::Value>()?;
11115                            result._unknown_fields.insert(key, value);
11116                        }
11117                    }
11118                }
11119                std::result::Result::Ok(result)
11120            }
11121        }
11122        deserializer.deserialize_any(Visitor)
11123    }
11124}
11125
11126#[doc(hidden)]
11127impl serde::ser::Serialize for DropDatabaseRequest {
11128    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11129    where
11130        S: serde::ser::Serializer,
11131    {
11132        use serde::ser::SerializeMap;
11133        #[allow(unused_imports)]
11134        use std::option::Option::Some;
11135        let mut state = serializer.serialize_map(std::option::Option::None)?;
11136        if !self.database.is_empty() {
11137            state.serialize_entry("database", &self.database)?;
11138        }
11139        if !self._unknown_fields.is_empty() {
11140            for (key, value) in self._unknown_fields.iter() {
11141                state.serialize_entry(key, &value)?;
11142            }
11143        }
11144        state.end()
11145    }
11146}
11147
11148impl std::fmt::Debug for DropDatabaseRequest {
11149    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11150        let mut debug_struct = f.debug_struct("DropDatabaseRequest");
11151        debug_struct.field("database", &self.database);
11152        if !self._unknown_fields.is_empty() {
11153            debug_struct.field("_unknown_fields", &self._unknown_fields);
11154        }
11155        debug_struct.finish()
11156    }
11157}
11158
11159/// The request for
11160/// [GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].
11161///
11162/// [google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl]: crate::client::DatabaseAdmin::get_database_ddl
11163#[derive(Clone, Default, PartialEq)]
11164#[non_exhaustive]
11165pub struct GetDatabaseDdlRequest {
11166    /// Required. The database whose schema we wish to get.
11167    /// Values are of the form
11168    /// `projects/<project>/instances/<instance>/databases/<database>`
11169    pub database: std::string::String,
11170
11171    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11172}
11173
11174impl GetDatabaseDdlRequest {
11175    pub fn new() -> Self {
11176        std::default::Default::default()
11177    }
11178
11179    /// Sets the value of [database][crate::model::GetDatabaseDdlRequest::database].
11180    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11181        self.database = v.into();
11182        self
11183    }
11184}
11185
11186impl wkt::message::Message for GetDatabaseDdlRequest {
11187    fn typename() -> &'static str {
11188        "type.googleapis.com/google.spanner.admin.database.v1.GetDatabaseDdlRequest"
11189    }
11190}
11191
11192#[doc(hidden)]
11193impl<'de> serde::de::Deserialize<'de> for GetDatabaseDdlRequest {
11194    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11195    where
11196        D: serde::Deserializer<'de>,
11197    {
11198        #[allow(non_camel_case_types)]
11199        #[doc(hidden)]
11200        #[derive(PartialEq, Eq, Hash)]
11201        enum __FieldTag {
11202            __database,
11203            Unknown(std::string::String),
11204        }
11205        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11206            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11207            where
11208                D: serde::Deserializer<'de>,
11209            {
11210                struct Visitor;
11211                impl<'de> serde::de::Visitor<'de> for Visitor {
11212                    type Value = __FieldTag;
11213                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11214                        formatter.write_str("a field name for GetDatabaseDdlRequest")
11215                    }
11216                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11217                    where
11218                        E: serde::de::Error,
11219                    {
11220                        use std::result::Result::Ok;
11221                        use std::string::ToString;
11222                        match value {
11223                            "database" => Ok(__FieldTag::__database),
11224                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11225                        }
11226                    }
11227                }
11228                deserializer.deserialize_identifier(Visitor)
11229            }
11230        }
11231        struct Visitor;
11232        impl<'de> serde::de::Visitor<'de> for Visitor {
11233            type Value = GetDatabaseDdlRequest;
11234            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11235                formatter.write_str("struct GetDatabaseDdlRequest")
11236            }
11237            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11238            where
11239                A: serde::de::MapAccess<'de>,
11240            {
11241                #[allow(unused_imports)]
11242                use serde::de::Error;
11243                use std::option::Option::Some;
11244                let mut fields = std::collections::HashSet::new();
11245                let mut result = Self::Value::new();
11246                while let Some(tag) = map.next_key::<__FieldTag>()? {
11247                    #[allow(clippy::match_single_binding)]
11248                    match tag {
11249                        __FieldTag::__database => {
11250                            if !fields.insert(__FieldTag::__database) {
11251                                return std::result::Result::Err(A::Error::duplicate_field(
11252                                    "multiple values for database",
11253                                ));
11254                            }
11255                            result.database = map
11256                                .next_value::<std::option::Option<std::string::String>>()?
11257                                .unwrap_or_default();
11258                        }
11259                        __FieldTag::Unknown(key) => {
11260                            let value = map.next_value::<serde_json::Value>()?;
11261                            result._unknown_fields.insert(key, value);
11262                        }
11263                    }
11264                }
11265                std::result::Result::Ok(result)
11266            }
11267        }
11268        deserializer.deserialize_any(Visitor)
11269    }
11270}
11271
11272#[doc(hidden)]
11273impl serde::ser::Serialize for GetDatabaseDdlRequest {
11274    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11275    where
11276        S: serde::ser::Serializer,
11277    {
11278        use serde::ser::SerializeMap;
11279        #[allow(unused_imports)]
11280        use std::option::Option::Some;
11281        let mut state = serializer.serialize_map(std::option::Option::None)?;
11282        if !self.database.is_empty() {
11283            state.serialize_entry("database", &self.database)?;
11284        }
11285        if !self._unknown_fields.is_empty() {
11286            for (key, value) in self._unknown_fields.iter() {
11287                state.serialize_entry(key, &value)?;
11288            }
11289        }
11290        state.end()
11291    }
11292}
11293
11294impl std::fmt::Debug for GetDatabaseDdlRequest {
11295    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11296        let mut debug_struct = f.debug_struct("GetDatabaseDdlRequest");
11297        debug_struct.field("database", &self.database);
11298        if !self._unknown_fields.is_empty() {
11299            debug_struct.field("_unknown_fields", &self._unknown_fields);
11300        }
11301        debug_struct.finish()
11302    }
11303}
11304
11305/// The response for
11306/// [GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].
11307///
11308/// [google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl]: crate::client::DatabaseAdmin::get_database_ddl
11309#[derive(Clone, Default, PartialEq)]
11310#[non_exhaustive]
11311pub struct GetDatabaseDdlResponse {
11312    /// A list of formatted DDL statements defining the schema of the database
11313    /// specified in the request.
11314    pub statements: std::vec::Vec<std::string::String>,
11315
11316    /// Proto descriptors stored in the database.
11317    /// Contains a protobuf-serialized
11318    /// [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto).
11319    /// For more details, see protobuffer [self
11320    /// description](https://developers.google.com/protocol-buffers/docs/techniques#self-description).
11321    pub proto_descriptors: ::bytes::Bytes,
11322
11323    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11324}
11325
11326impl GetDatabaseDdlResponse {
11327    pub fn new() -> Self {
11328        std::default::Default::default()
11329    }
11330
11331    /// Sets the value of [statements][crate::model::GetDatabaseDdlResponse::statements].
11332    pub fn set_statements<T, V>(mut self, v: T) -> Self
11333    where
11334        T: std::iter::IntoIterator<Item = V>,
11335        V: std::convert::Into<std::string::String>,
11336    {
11337        use std::iter::Iterator;
11338        self.statements = v.into_iter().map(|i| i.into()).collect();
11339        self
11340    }
11341
11342    /// Sets the value of [proto_descriptors][crate::model::GetDatabaseDdlResponse::proto_descriptors].
11343    pub fn set_proto_descriptors<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
11344        self.proto_descriptors = v.into();
11345        self
11346    }
11347}
11348
11349impl wkt::message::Message for GetDatabaseDdlResponse {
11350    fn typename() -> &'static str {
11351        "type.googleapis.com/google.spanner.admin.database.v1.GetDatabaseDdlResponse"
11352    }
11353}
11354
11355#[doc(hidden)]
11356impl<'de> serde::de::Deserialize<'de> for GetDatabaseDdlResponse {
11357    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11358    where
11359        D: serde::Deserializer<'de>,
11360    {
11361        #[allow(non_camel_case_types)]
11362        #[doc(hidden)]
11363        #[derive(PartialEq, Eq, Hash)]
11364        enum __FieldTag {
11365            __statements,
11366            __proto_descriptors,
11367            Unknown(std::string::String),
11368        }
11369        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11370            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11371            where
11372                D: serde::Deserializer<'de>,
11373            {
11374                struct Visitor;
11375                impl<'de> serde::de::Visitor<'de> for Visitor {
11376                    type Value = __FieldTag;
11377                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11378                        formatter.write_str("a field name for GetDatabaseDdlResponse")
11379                    }
11380                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11381                    where
11382                        E: serde::de::Error,
11383                    {
11384                        use std::result::Result::Ok;
11385                        use std::string::ToString;
11386                        match value {
11387                            "statements" => Ok(__FieldTag::__statements),
11388                            "protoDescriptors" => Ok(__FieldTag::__proto_descriptors),
11389                            "proto_descriptors" => Ok(__FieldTag::__proto_descriptors),
11390                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11391                        }
11392                    }
11393                }
11394                deserializer.deserialize_identifier(Visitor)
11395            }
11396        }
11397        struct Visitor;
11398        impl<'de> serde::de::Visitor<'de> for Visitor {
11399            type Value = GetDatabaseDdlResponse;
11400            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11401                formatter.write_str("struct GetDatabaseDdlResponse")
11402            }
11403            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11404            where
11405                A: serde::de::MapAccess<'de>,
11406            {
11407                #[allow(unused_imports)]
11408                use serde::de::Error;
11409                use std::option::Option::Some;
11410                let mut fields = std::collections::HashSet::new();
11411                let mut result = Self::Value::new();
11412                while let Some(tag) = map.next_key::<__FieldTag>()? {
11413                    #[allow(clippy::match_single_binding)]
11414                    match tag {
11415                        __FieldTag::__statements => {
11416                            if !fields.insert(__FieldTag::__statements) {
11417                                return std::result::Result::Err(A::Error::duplicate_field(
11418                                    "multiple values for statements",
11419                                ));
11420                            }
11421                            result.statements = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
11422                        }
11423                        __FieldTag::__proto_descriptors => {
11424                            if !fields.insert(__FieldTag::__proto_descriptors) {
11425                                return std::result::Result::Err(A::Error::duplicate_field(
11426                                    "multiple values for proto_descriptors",
11427                                ));
11428                            }
11429                            struct __With(std::option::Option<::bytes::Bytes>);
11430                            impl<'de> serde::de::Deserialize<'de> for __With {
11431                                fn deserialize<D>(
11432                                    deserializer: D,
11433                                ) -> std::result::Result<Self, D::Error>
11434                                where
11435                                    D: serde::de::Deserializer<'de>,
11436                                {
11437                                    serde_with::As::< std::option::Option<serde_with::base64::Base64> >::deserialize(deserializer).map(__With)
11438                                }
11439                            }
11440                            result.proto_descriptors =
11441                                map.next_value::<__With>()?.0.unwrap_or_default();
11442                        }
11443                        __FieldTag::Unknown(key) => {
11444                            let value = map.next_value::<serde_json::Value>()?;
11445                            result._unknown_fields.insert(key, value);
11446                        }
11447                    }
11448                }
11449                std::result::Result::Ok(result)
11450            }
11451        }
11452        deserializer.deserialize_any(Visitor)
11453    }
11454}
11455
11456#[doc(hidden)]
11457impl serde::ser::Serialize for GetDatabaseDdlResponse {
11458    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11459    where
11460        S: serde::ser::Serializer,
11461    {
11462        use serde::ser::SerializeMap;
11463        #[allow(unused_imports)]
11464        use std::option::Option::Some;
11465        let mut state = serializer.serialize_map(std::option::Option::None)?;
11466        if !self.statements.is_empty() {
11467            state.serialize_entry("statements", &self.statements)?;
11468        }
11469        if !self.proto_descriptors.is_empty() {
11470            struct __With<'a>(&'a ::bytes::Bytes);
11471            impl<'a> serde::ser::Serialize for __With<'a> {
11472                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11473                where
11474                    S: serde::ser::Serializer,
11475                {
11476                    serde_with::As::<serde_with::base64::Base64>::serialize(self.0, serializer)
11477                }
11478            }
11479            state.serialize_entry("protoDescriptors", &__With(&self.proto_descriptors))?;
11480        }
11481        if !self._unknown_fields.is_empty() {
11482            for (key, value) in self._unknown_fields.iter() {
11483                state.serialize_entry(key, &value)?;
11484            }
11485        }
11486        state.end()
11487    }
11488}
11489
11490impl std::fmt::Debug for GetDatabaseDdlResponse {
11491    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11492        let mut debug_struct = f.debug_struct("GetDatabaseDdlResponse");
11493        debug_struct.field("statements", &self.statements);
11494        debug_struct.field("proto_descriptors", &self.proto_descriptors);
11495        if !self._unknown_fields.is_empty() {
11496            debug_struct.field("_unknown_fields", &self._unknown_fields);
11497        }
11498        debug_struct.finish()
11499    }
11500}
11501
11502/// The request for
11503/// [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations].
11504///
11505/// [google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations]: crate::client::DatabaseAdmin::list_database_operations
11506#[derive(Clone, Default, PartialEq)]
11507#[non_exhaustive]
11508pub struct ListDatabaseOperationsRequest {
11509    /// Required. The instance of the database operations.
11510    /// Values are of the form `projects/<project>/instances/<instance>`.
11511    pub parent: std::string::String,
11512
11513    /// An expression that filters the list of returned operations.
11514    ///
11515    /// A filter expression consists of a field name, a
11516    /// comparison operator, and a value for filtering.
11517    /// The value must be a string, a number, or a boolean. The comparison operator
11518    /// must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
11519    /// Colon `:` is the contains operator. Filter rules are not case sensitive.
11520    ///
11521    /// The following fields in the [Operation][google.longrunning.Operation]
11522    /// are eligible for filtering:
11523    ///
11524    /// * `name` - The name of the long-running operation
11525    /// * `done` - False if the operation is in progress, else true.
11526    /// * `metadata.@type` - the type of metadata. For example, the type string
11527    ///   for
11528    ///   [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]
11529    ///   is
11530    ///   `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`.
11531    /// * `metadata.<field_name>` - any field in metadata.value.
11532    ///   `metadata.@type` must be specified first, if filtering on metadata
11533    ///   fields.
11534    /// * `error` - Error associated with the long-running operation.
11535    /// * `response.@type` - the type of response.
11536    /// * `response.<field_name>` - any field in response.value.
11537    ///
11538    /// You can combine multiple expressions by enclosing each expression in
11539    /// parentheses. By default, expressions are combined with AND logic. However,
11540    /// you can specify AND, OR, and NOT logic explicitly.
11541    ///
11542    /// Here are a few examples:
11543    ///
11544    /// * `done:true` - The operation is complete.
11545    /// * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` \
11546    ///   `(metadata.source_type:BACKUP) AND` \
11547    ///   `(metadata.backup_info.backup:backup_howl) AND` \
11548    ///   `(metadata.name:restored_howl) AND` \
11549    ///   `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
11550    ///   `(error:*)` - Return operations where:
11551    ///   * The operation's metadata type is
11552    ///     [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata].
11553    ///   * The database is restored from a backup.
11554    ///   * The backup name contains "backup_howl".
11555    ///   * The restored database's name contains "restored_howl".
11556    ///   * The operation started before 2018-03-28T14:50:00Z.
11557    ///   * The operation resulted in an error.
11558    ///
11559    /// [google.longrunning.Operation]: longrunning::model::Operation
11560    /// [google.spanner.admin.database.v1.RestoreDatabaseMetadata]: crate::model::RestoreDatabaseMetadata
11561    pub filter: std::string::String,
11562
11563    /// Number of operations to be returned in the response. If 0 or
11564    /// less, defaults to the server's maximum allowed page size.
11565    pub page_size: i32,
11566
11567    /// If non-empty, `page_token` should contain a
11568    /// [next_page_token][google.spanner.admin.database.v1.ListDatabaseOperationsResponse.next_page_token]
11569    /// from a previous
11570    /// [ListDatabaseOperationsResponse][google.spanner.admin.database.v1.ListDatabaseOperationsResponse]
11571    /// to the same `parent` and with the same `filter`.
11572    ///
11573    /// [google.spanner.admin.database.v1.ListDatabaseOperationsResponse]: crate::model::ListDatabaseOperationsResponse
11574    /// [google.spanner.admin.database.v1.ListDatabaseOperationsResponse.next_page_token]: crate::model::ListDatabaseOperationsResponse::next_page_token
11575    pub page_token: std::string::String,
11576
11577    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11578}
11579
11580impl ListDatabaseOperationsRequest {
11581    pub fn new() -> Self {
11582        std::default::Default::default()
11583    }
11584
11585    /// Sets the value of [parent][crate::model::ListDatabaseOperationsRequest::parent].
11586    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11587        self.parent = v.into();
11588        self
11589    }
11590
11591    /// Sets the value of [filter][crate::model::ListDatabaseOperationsRequest::filter].
11592    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11593        self.filter = v.into();
11594        self
11595    }
11596
11597    /// Sets the value of [page_size][crate::model::ListDatabaseOperationsRequest::page_size].
11598    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11599        self.page_size = v.into();
11600        self
11601    }
11602
11603    /// Sets the value of [page_token][crate::model::ListDatabaseOperationsRequest::page_token].
11604    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11605        self.page_token = v.into();
11606        self
11607    }
11608}
11609
11610impl wkt::message::Message for ListDatabaseOperationsRequest {
11611    fn typename() -> &'static str {
11612        "type.googleapis.com/google.spanner.admin.database.v1.ListDatabaseOperationsRequest"
11613    }
11614}
11615
11616#[doc(hidden)]
11617impl<'de> serde::de::Deserialize<'de> for ListDatabaseOperationsRequest {
11618    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11619    where
11620        D: serde::Deserializer<'de>,
11621    {
11622        #[allow(non_camel_case_types)]
11623        #[doc(hidden)]
11624        #[derive(PartialEq, Eq, Hash)]
11625        enum __FieldTag {
11626            __parent,
11627            __filter,
11628            __page_size,
11629            __page_token,
11630            Unknown(std::string::String),
11631        }
11632        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11633            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11634            where
11635                D: serde::Deserializer<'de>,
11636            {
11637                struct Visitor;
11638                impl<'de> serde::de::Visitor<'de> for Visitor {
11639                    type Value = __FieldTag;
11640                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11641                        formatter.write_str("a field name for ListDatabaseOperationsRequest")
11642                    }
11643                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11644                    where
11645                        E: serde::de::Error,
11646                    {
11647                        use std::result::Result::Ok;
11648                        use std::string::ToString;
11649                        match value {
11650                            "parent" => Ok(__FieldTag::__parent),
11651                            "filter" => Ok(__FieldTag::__filter),
11652                            "pageSize" => Ok(__FieldTag::__page_size),
11653                            "page_size" => Ok(__FieldTag::__page_size),
11654                            "pageToken" => Ok(__FieldTag::__page_token),
11655                            "page_token" => Ok(__FieldTag::__page_token),
11656                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11657                        }
11658                    }
11659                }
11660                deserializer.deserialize_identifier(Visitor)
11661            }
11662        }
11663        struct Visitor;
11664        impl<'de> serde::de::Visitor<'de> for Visitor {
11665            type Value = ListDatabaseOperationsRequest;
11666            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11667                formatter.write_str("struct ListDatabaseOperationsRequest")
11668            }
11669            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11670            where
11671                A: serde::de::MapAccess<'de>,
11672            {
11673                #[allow(unused_imports)]
11674                use serde::de::Error;
11675                use std::option::Option::Some;
11676                let mut fields = std::collections::HashSet::new();
11677                let mut result = Self::Value::new();
11678                while let Some(tag) = map.next_key::<__FieldTag>()? {
11679                    #[allow(clippy::match_single_binding)]
11680                    match tag {
11681                        __FieldTag::__parent => {
11682                            if !fields.insert(__FieldTag::__parent) {
11683                                return std::result::Result::Err(A::Error::duplicate_field(
11684                                    "multiple values for parent",
11685                                ));
11686                            }
11687                            result.parent = map
11688                                .next_value::<std::option::Option<std::string::String>>()?
11689                                .unwrap_or_default();
11690                        }
11691                        __FieldTag::__filter => {
11692                            if !fields.insert(__FieldTag::__filter) {
11693                                return std::result::Result::Err(A::Error::duplicate_field(
11694                                    "multiple values for filter",
11695                                ));
11696                            }
11697                            result.filter = map
11698                                .next_value::<std::option::Option<std::string::String>>()?
11699                                .unwrap_or_default();
11700                        }
11701                        __FieldTag::__page_size => {
11702                            if !fields.insert(__FieldTag::__page_size) {
11703                                return std::result::Result::Err(A::Error::duplicate_field(
11704                                    "multiple values for page_size",
11705                                ));
11706                            }
11707                            struct __With(std::option::Option<i32>);
11708                            impl<'de> serde::de::Deserialize<'de> for __With {
11709                                fn deserialize<D>(
11710                                    deserializer: D,
11711                                ) -> std::result::Result<Self, D::Error>
11712                                where
11713                                    D: serde::de::Deserializer<'de>,
11714                                {
11715                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
11716                                }
11717                            }
11718                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
11719                        }
11720                        __FieldTag::__page_token => {
11721                            if !fields.insert(__FieldTag::__page_token) {
11722                                return std::result::Result::Err(A::Error::duplicate_field(
11723                                    "multiple values for page_token",
11724                                ));
11725                            }
11726                            result.page_token = map
11727                                .next_value::<std::option::Option<std::string::String>>()?
11728                                .unwrap_or_default();
11729                        }
11730                        __FieldTag::Unknown(key) => {
11731                            let value = map.next_value::<serde_json::Value>()?;
11732                            result._unknown_fields.insert(key, value);
11733                        }
11734                    }
11735                }
11736                std::result::Result::Ok(result)
11737            }
11738        }
11739        deserializer.deserialize_any(Visitor)
11740    }
11741}
11742
11743#[doc(hidden)]
11744impl serde::ser::Serialize for ListDatabaseOperationsRequest {
11745    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11746    where
11747        S: serde::ser::Serializer,
11748    {
11749        use serde::ser::SerializeMap;
11750        #[allow(unused_imports)]
11751        use std::option::Option::Some;
11752        let mut state = serializer.serialize_map(std::option::Option::None)?;
11753        if !self.parent.is_empty() {
11754            state.serialize_entry("parent", &self.parent)?;
11755        }
11756        if !self.filter.is_empty() {
11757            state.serialize_entry("filter", &self.filter)?;
11758        }
11759        if !wkt::internal::is_default(&self.page_size) {
11760            struct __With<'a>(&'a i32);
11761            impl<'a> serde::ser::Serialize for __With<'a> {
11762                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11763                where
11764                    S: serde::ser::Serializer,
11765                {
11766                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
11767                }
11768            }
11769            state.serialize_entry("pageSize", &__With(&self.page_size))?;
11770        }
11771        if !self.page_token.is_empty() {
11772            state.serialize_entry("pageToken", &self.page_token)?;
11773        }
11774        if !self._unknown_fields.is_empty() {
11775            for (key, value) in self._unknown_fields.iter() {
11776                state.serialize_entry(key, &value)?;
11777            }
11778        }
11779        state.end()
11780    }
11781}
11782
11783impl std::fmt::Debug for ListDatabaseOperationsRequest {
11784    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11785        let mut debug_struct = f.debug_struct("ListDatabaseOperationsRequest");
11786        debug_struct.field("parent", &self.parent);
11787        debug_struct.field("filter", &self.filter);
11788        debug_struct.field("page_size", &self.page_size);
11789        debug_struct.field("page_token", &self.page_token);
11790        if !self._unknown_fields.is_empty() {
11791            debug_struct.field("_unknown_fields", &self._unknown_fields);
11792        }
11793        debug_struct.finish()
11794    }
11795}
11796
11797/// The response for
11798/// [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations].
11799///
11800/// [google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations]: crate::client::DatabaseAdmin::list_database_operations
11801#[derive(Clone, Default, PartialEq)]
11802#[non_exhaustive]
11803pub struct ListDatabaseOperationsResponse {
11804    /// The list of matching database [long-running
11805    /// operations][google.longrunning.Operation]. Each operation's name will be
11806    /// prefixed by the database's name. The operation's
11807    /// [metadata][google.longrunning.Operation.metadata] field type
11808    /// `metadata.type_url` describes the type of the metadata.
11809    ///
11810    /// [google.longrunning.Operation]: longrunning::model::Operation
11811    /// [google.longrunning.Operation.metadata]: longrunning::model::Operation::metadata
11812    pub operations: std::vec::Vec<longrunning::model::Operation>,
11813
11814    /// `next_page_token` can be sent in a subsequent
11815    /// [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations]
11816    /// call to fetch more of the matching metadata.
11817    ///
11818    /// [google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations]: crate::client::DatabaseAdmin::list_database_operations
11819    pub next_page_token: std::string::String,
11820
11821    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11822}
11823
11824impl ListDatabaseOperationsResponse {
11825    pub fn new() -> Self {
11826        std::default::Default::default()
11827    }
11828
11829    /// Sets the value of [operations][crate::model::ListDatabaseOperationsResponse::operations].
11830    pub fn set_operations<T, V>(mut self, v: T) -> Self
11831    where
11832        T: std::iter::IntoIterator<Item = V>,
11833        V: std::convert::Into<longrunning::model::Operation>,
11834    {
11835        use std::iter::Iterator;
11836        self.operations = v.into_iter().map(|i| i.into()).collect();
11837        self
11838    }
11839
11840    /// Sets the value of [next_page_token][crate::model::ListDatabaseOperationsResponse::next_page_token].
11841    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11842        self.next_page_token = v.into();
11843        self
11844    }
11845}
11846
11847impl wkt::message::Message for ListDatabaseOperationsResponse {
11848    fn typename() -> &'static str {
11849        "type.googleapis.com/google.spanner.admin.database.v1.ListDatabaseOperationsResponse"
11850    }
11851}
11852
11853#[doc(hidden)]
11854impl gax::paginator::internal::PageableResponse for ListDatabaseOperationsResponse {
11855    type PageItem = longrunning::model::Operation;
11856
11857    fn items(self) -> std::vec::Vec<Self::PageItem> {
11858        self.operations
11859    }
11860
11861    fn next_page_token(&self) -> std::string::String {
11862        use std::clone::Clone;
11863        self.next_page_token.clone()
11864    }
11865}
11866
11867#[doc(hidden)]
11868impl<'de> serde::de::Deserialize<'de> for ListDatabaseOperationsResponse {
11869    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11870    where
11871        D: serde::Deserializer<'de>,
11872    {
11873        #[allow(non_camel_case_types)]
11874        #[doc(hidden)]
11875        #[derive(PartialEq, Eq, Hash)]
11876        enum __FieldTag {
11877            __operations,
11878            __next_page_token,
11879            Unknown(std::string::String),
11880        }
11881        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11882            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11883            where
11884                D: serde::Deserializer<'de>,
11885            {
11886                struct Visitor;
11887                impl<'de> serde::de::Visitor<'de> for Visitor {
11888                    type Value = __FieldTag;
11889                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11890                        formatter.write_str("a field name for ListDatabaseOperationsResponse")
11891                    }
11892                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11893                    where
11894                        E: serde::de::Error,
11895                    {
11896                        use std::result::Result::Ok;
11897                        use std::string::ToString;
11898                        match value {
11899                            "operations" => Ok(__FieldTag::__operations),
11900                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
11901                            "next_page_token" => Ok(__FieldTag::__next_page_token),
11902                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11903                        }
11904                    }
11905                }
11906                deserializer.deserialize_identifier(Visitor)
11907            }
11908        }
11909        struct Visitor;
11910        impl<'de> serde::de::Visitor<'de> for Visitor {
11911            type Value = ListDatabaseOperationsResponse;
11912            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11913                formatter.write_str("struct ListDatabaseOperationsResponse")
11914            }
11915            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11916            where
11917                A: serde::de::MapAccess<'de>,
11918            {
11919                #[allow(unused_imports)]
11920                use serde::de::Error;
11921                use std::option::Option::Some;
11922                let mut fields = std::collections::HashSet::new();
11923                let mut result = Self::Value::new();
11924                while let Some(tag) = map.next_key::<__FieldTag>()? {
11925                    #[allow(clippy::match_single_binding)]
11926                    match tag {
11927                        __FieldTag::__operations => {
11928                            if !fields.insert(__FieldTag::__operations) {
11929                                return std::result::Result::Err(A::Error::duplicate_field(
11930                                    "multiple values for operations",
11931                                ));
11932                            }
11933                            result.operations =
11934                                map.next_value::<std::option::Option<
11935                                    std::vec::Vec<longrunning::model::Operation>,
11936                                >>()?
11937                                .unwrap_or_default();
11938                        }
11939                        __FieldTag::__next_page_token => {
11940                            if !fields.insert(__FieldTag::__next_page_token) {
11941                                return std::result::Result::Err(A::Error::duplicate_field(
11942                                    "multiple values for next_page_token",
11943                                ));
11944                            }
11945                            result.next_page_token = map
11946                                .next_value::<std::option::Option<std::string::String>>()?
11947                                .unwrap_or_default();
11948                        }
11949                        __FieldTag::Unknown(key) => {
11950                            let value = map.next_value::<serde_json::Value>()?;
11951                            result._unknown_fields.insert(key, value);
11952                        }
11953                    }
11954                }
11955                std::result::Result::Ok(result)
11956            }
11957        }
11958        deserializer.deserialize_any(Visitor)
11959    }
11960}
11961
11962#[doc(hidden)]
11963impl serde::ser::Serialize for ListDatabaseOperationsResponse {
11964    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11965    where
11966        S: serde::ser::Serializer,
11967    {
11968        use serde::ser::SerializeMap;
11969        #[allow(unused_imports)]
11970        use std::option::Option::Some;
11971        let mut state = serializer.serialize_map(std::option::Option::None)?;
11972        if !self.operations.is_empty() {
11973            state.serialize_entry("operations", &self.operations)?;
11974        }
11975        if !self.next_page_token.is_empty() {
11976            state.serialize_entry("nextPageToken", &self.next_page_token)?;
11977        }
11978        if !self._unknown_fields.is_empty() {
11979            for (key, value) in self._unknown_fields.iter() {
11980                state.serialize_entry(key, &value)?;
11981            }
11982        }
11983        state.end()
11984    }
11985}
11986
11987impl std::fmt::Debug for ListDatabaseOperationsResponse {
11988    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11989        let mut debug_struct = f.debug_struct("ListDatabaseOperationsResponse");
11990        debug_struct.field("operations", &self.operations);
11991        debug_struct.field("next_page_token", &self.next_page_token);
11992        if !self._unknown_fields.is_empty() {
11993            debug_struct.field("_unknown_fields", &self._unknown_fields);
11994        }
11995        debug_struct.finish()
11996    }
11997}
11998
11999/// The request for
12000/// [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase].
12001///
12002/// [google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase]: crate::client::DatabaseAdmin::restore_database
12003#[derive(Clone, Default, PartialEq)]
12004#[non_exhaustive]
12005pub struct RestoreDatabaseRequest {
12006    /// Required. The name of the instance in which to create the
12007    /// restored database. This instance must be in the same project and
12008    /// have the same instance configuration as the instance containing
12009    /// the source backup. Values are of the form
12010    /// `projects/<project>/instances/<instance>`.
12011    pub parent: std::string::String,
12012
12013    /// Required. The id of the database to create and restore to. This
12014    /// database must not already exist. The `database_id` appended to
12015    /// `parent` forms the full database name of the form
12016    /// `projects/<project>/instances/<instance>/databases/<database_id>`.
12017    pub database_id: std::string::String,
12018
12019    /// Optional. An encryption configuration describing the encryption type and
12020    /// key resources in Cloud KMS used to encrypt/decrypt the database to restore
12021    /// to. If this field is not specified, the restored database will use the same
12022    /// encryption configuration as the backup by default, namely
12023    /// [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type]
12024    /// = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`.
12025    ///
12026    /// [google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type]: crate::model::RestoreDatabaseEncryptionConfig::encryption_type
12027    pub encryption_config: std::option::Option<crate::model::RestoreDatabaseEncryptionConfig>,
12028
12029    /// Required. The source from which to restore.
12030    pub source: std::option::Option<crate::model::restore_database_request::Source>,
12031
12032    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12033}
12034
12035impl RestoreDatabaseRequest {
12036    pub fn new() -> Self {
12037        std::default::Default::default()
12038    }
12039
12040    /// Sets the value of [parent][crate::model::RestoreDatabaseRequest::parent].
12041    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12042        self.parent = v.into();
12043        self
12044    }
12045
12046    /// Sets the value of [database_id][crate::model::RestoreDatabaseRequest::database_id].
12047    pub fn set_database_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12048        self.database_id = v.into();
12049        self
12050    }
12051
12052    /// Sets the value of [encryption_config][crate::model::RestoreDatabaseRequest::encryption_config].
12053    pub fn set_encryption_config<T>(mut self, v: T) -> Self
12054    where
12055        T: std::convert::Into<crate::model::RestoreDatabaseEncryptionConfig>,
12056    {
12057        self.encryption_config = std::option::Option::Some(v.into());
12058        self
12059    }
12060
12061    /// Sets or clears the value of [encryption_config][crate::model::RestoreDatabaseRequest::encryption_config].
12062    pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
12063    where
12064        T: std::convert::Into<crate::model::RestoreDatabaseEncryptionConfig>,
12065    {
12066        self.encryption_config = v.map(|x| x.into());
12067        self
12068    }
12069
12070    /// Sets the value of [source][crate::model::RestoreDatabaseRequest::source].
12071    ///
12072    /// Note that all the setters affecting `source` are mutually
12073    /// exclusive.
12074    pub fn set_source<
12075        T: std::convert::Into<std::option::Option<crate::model::restore_database_request::Source>>,
12076    >(
12077        mut self,
12078        v: T,
12079    ) -> Self {
12080        self.source = v.into();
12081        self
12082    }
12083
12084    /// The value of [source][crate::model::RestoreDatabaseRequest::source]
12085    /// if it holds a `Backup`, `None` if the field is not set or
12086    /// holds a different branch.
12087    pub fn backup(&self) -> std::option::Option<&std::string::String> {
12088        #[allow(unreachable_patterns)]
12089        self.source.as_ref().and_then(|v| match v {
12090            crate::model::restore_database_request::Source::Backup(v) => {
12091                std::option::Option::Some(v)
12092            }
12093            _ => std::option::Option::None,
12094        })
12095    }
12096
12097    /// Sets the value of [source][crate::model::RestoreDatabaseRequest::source]
12098    /// to hold a `Backup`.
12099    ///
12100    /// Note that all the setters affecting `source` are
12101    /// mutually exclusive.
12102    pub fn set_backup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12103        self.source = std::option::Option::Some(
12104            crate::model::restore_database_request::Source::Backup(v.into()),
12105        );
12106        self
12107    }
12108}
12109
12110impl wkt::message::Message for RestoreDatabaseRequest {
12111    fn typename() -> &'static str {
12112        "type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseRequest"
12113    }
12114}
12115
12116#[doc(hidden)]
12117impl<'de> serde::de::Deserialize<'de> for RestoreDatabaseRequest {
12118    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12119    where
12120        D: serde::Deserializer<'de>,
12121    {
12122        #[allow(non_camel_case_types)]
12123        #[doc(hidden)]
12124        #[derive(PartialEq, Eq, Hash)]
12125        enum __FieldTag {
12126            __parent,
12127            __database_id,
12128            __backup,
12129            __encryption_config,
12130            Unknown(std::string::String),
12131        }
12132        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12133            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12134            where
12135                D: serde::Deserializer<'de>,
12136            {
12137                struct Visitor;
12138                impl<'de> serde::de::Visitor<'de> for Visitor {
12139                    type Value = __FieldTag;
12140                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12141                        formatter.write_str("a field name for RestoreDatabaseRequest")
12142                    }
12143                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12144                    where
12145                        E: serde::de::Error,
12146                    {
12147                        use std::result::Result::Ok;
12148                        use std::string::ToString;
12149                        match value {
12150                            "parent" => Ok(__FieldTag::__parent),
12151                            "databaseId" => Ok(__FieldTag::__database_id),
12152                            "database_id" => Ok(__FieldTag::__database_id),
12153                            "backup" => Ok(__FieldTag::__backup),
12154                            "encryptionConfig" => Ok(__FieldTag::__encryption_config),
12155                            "encryption_config" => Ok(__FieldTag::__encryption_config),
12156                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12157                        }
12158                    }
12159                }
12160                deserializer.deserialize_identifier(Visitor)
12161            }
12162        }
12163        struct Visitor;
12164        impl<'de> serde::de::Visitor<'de> for Visitor {
12165            type Value = RestoreDatabaseRequest;
12166            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12167                formatter.write_str("struct RestoreDatabaseRequest")
12168            }
12169            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12170            where
12171                A: serde::de::MapAccess<'de>,
12172            {
12173                #[allow(unused_imports)]
12174                use serde::de::Error;
12175                use std::option::Option::Some;
12176                let mut fields = std::collections::HashSet::new();
12177                let mut result = Self::Value::new();
12178                while let Some(tag) = map.next_key::<__FieldTag>()? {
12179                    #[allow(clippy::match_single_binding)]
12180                    match tag {
12181                        __FieldTag::__parent => {
12182                            if !fields.insert(__FieldTag::__parent) {
12183                                return std::result::Result::Err(A::Error::duplicate_field(
12184                                    "multiple values for parent",
12185                                ));
12186                            }
12187                            result.parent = map
12188                                .next_value::<std::option::Option<std::string::String>>()?
12189                                .unwrap_or_default();
12190                        }
12191                        __FieldTag::__database_id => {
12192                            if !fields.insert(__FieldTag::__database_id) {
12193                                return std::result::Result::Err(A::Error::duplicate_field(
12194                                    "multiple values for database_id",
12195                                ));
12196                            }
12197                            result.database_id = map
12198                                .next_value::<std::option::Option<std::string::String>>()?
12199                                .unwrap_or_default();
12200                        }
12201                        __FieldTag::__backup => {
12202                            if !fields.insert(__FieldTag::__backup) {
12203                                return std::result::Result::Err(A::Error::duplicate_field(
12204                                    "multiple values for backup",
12205                                ));
12206                            }
12207                            if result.source.is_some() {
12208                                return std::result::Result::Err(A::Error::duplicate_field(
12209                                    "multiple values for `source`, a oneof with full ID .google.spanner.admin.database.v1.RestoreDatabaseRequest.backup, latest field was backup",
12210                                ));
12211                            }
12212                            result.source = std::option::Option::Some(
12213                                crate::model::restore_database_request::Source::Backup(
12214                                    map.next_value::<std::option::Option<std::string::String>>()?
12215                                        .unwrap_or_default(),
12216                                ),
12217                            );
12218                        }
12219                        __FieldTag::__encryption_config => {
12220                            if !fields.insert(__FieldTag::__encryption_config) {
12221                                return std::result::Result::Err(A::Error::duplicate_field(
12222                                    "multiple values for encryption_config",
12223                                ));
12224                            }
12225                            result.encryption_config = map.next_value::<std::option::Option<
12226                                crate::model::RestoreDatabaseEncryptionConfig,
12227                            >>()?;
12228                        }
12229                        __FieldTag::Unknown(key) => {
12230                            let value = map.next_value::<serde_json::Value>()?;
12231                            result._unknown_fields.insert(key, value);
12232                        }
12233                    }
12234                }
12235                std::result::Result::Ok(result)
12236            }
12237        }
12238        deserializer.deserialize_any(Visitor)
12239    }
12240}
12241
12242#[doc(hidden)]
12243impl serde::ser::Serialize for RestoreDatabaseRequest {
12244    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12245    where
12246        S: serde::ser::Serializer,
12247    {
12248        use serde::ser::SerializeMap;
12249        #[allow(unused_imports)]
12250        use std::option::Option::Some;
12251        let mut state = serializer.serialize_map(std::option::Option::None)?;
12252        if !self.parent.is_empty() {
12253            state.serialize_entry("parent", &self.parent)?;
12254        }
12255        if !self.database_id.is_empty() {
12256            state.serialize_entry("databaseId", &self.database_id)?;
12257        }
12258        if let Some(value) = self.backup() {
12259            state.serialize_entry("backup", value)?;
12260        }
12261        if self.encryption_config.is_some() {
12262            state.serialize_entry("encryptionConfig", &self.encryption_config)?;
12263        }
12264        if !self._unknown_fields.is_empty() {
12265            for (key, value) in self._unknown_fields.iter() {
12266                state.serialize_entry(key, &value)?;
12267            }
12268        }
12269        state.end()
12270    }
12271}
12272
12273impl std::fmt::Debug for RestoreDatabaseRequest {
12274    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12275        let mut debug_struct = f.debug_struct("RestoreDatabaseRequest");
12276        debug_struct.field("parent", &self.parent);
12277        debug_struct.field("database_id", &self.database_id);
12278        debug_struct.field("encryption_config", &self.encryption_config);
12279        debug_struct.field("source", &self.source);
12280        if !self._unknown_fields.is_empty() {
12281            debug_struct.field("_unknown_fields", &self._unknown_fields);
12282        }
12283        debug_struct.finish()
12284    }
12285}
12286
12287/// Defines additional types related to [RestoreDatabaseRequest].
12288pub mod restore_database_request {
12289    #[allow(unused_imports)]
12290    use super::*;
12291
12292    /// Required. The source from which to restore.
12293    #[derive(Clone, Debug, PartialEq)]
12294    #[non_exhaustive]
12295    pub enum Source {
12296        /// Name of the backup from which to restore.  Values are of the form
12297        /// `projects/<project>/instances/<instance>/backups/<backup>`.
12298        Backup(std::string::String),
12299    }
12300}
12301
12302/// Encryption configuration for the restored database.
12303#[derive(Clone, Default, PartialEq)]
12304#[non_exhaustive]
12305pub struct RestoreDatabaseEncryptionConfig {
12306    /// Required. The encryption type of the restored database.
12307    pub encryption_type: crate::model::restore_database_encryption_config::EncryptionType,
12308
12309    /// Optional. The Cloud KMS key that will be used to encrypt/decrypt the
12310    /// restored database. This field should be set only when
12311    /// [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type]
12312    /// is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form
12313    /// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
12314    ///
12315    /// [google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type]: crate::model::RestoreDatabaseEncryptionConfig::encryption_type
12316    pub kms_key_name: std::string::String,
12317
12318    /// Optional. Specifies the KMS configuration for the one or more keys used to
12319    /// encrypt the database. Values are of the form
12320    /// `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
12321    ///
12322    /// The keys referenced by kms_key_names must fully cover all
12323    /// regions of the database instance configuration. Some examples:
12324    ///
12325    /// * For single region database instance configs, specify a single regional
12326    ///   location KMS key.
12327    /// * For multi-regional database instance configs of type GOOGLE_MANAGED,
12328    ///   either specify a multi-regional location KMS key or multiple regional
12329    ///   location KMS keys that cover all regions in the instance config.
12330    /// * For a database instance config of type USER_MANAGED, please specify only
12331    ///   regional location KMS keys to cover each region in the instance config.
12332    ///   Multi-regional location KMS keys are not supported for USER_MANAGED
12333    ///   instance configs.
12334    pub kms_key_names: std::vec::Vec<std::string::String>,
12335
12336    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12337}
12338
12339impl RestoreDatabaseEncryptionConfig {
12340    pub fn new() -> Self {
12341        std::default::Default::default()
12342    }
12343
12344    /// Sets the value of [encryption_type][crate::model::RestoreDatabaseEncryptionConfig::encryption_type].
12345    pub fn set_encryption_type<
12346        T: std::convert::Into<crate::model::restore_database_encryption_config::EncryptionType>,
12347    >(
12348        mut self,
12349        v: T,
12350    ) -> Self {
12351        self.encryption_type = v.into();
12352        self
12353    }
12354
12355    /// Sets the value of [kms_key_name][crate::model::RestoreDatabaseEncryptionConfig::kms_key_name].
12356    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12357        self.kms_key_name = v.into();
12358        self
12359    }
12360
12361    /// Sets the value of [kms_key_names][crate::model::RestoreDatabaseEncryptionConfig::kms_key_names].
12362    pub fn set_kms_key_names<T, V>(mut self, v: T) -> Self
12363    where
12364        T: std::iter::IntoIterator<Item = V>,
12365        V: std::convert::Into<std::string::String>,
12366    {
12367        use std::iter::Iterator;
12368        self.kms_key_names = v.into_iter().map(|i| i.into()).collect();
12369        self
12370    }
12371}
12372
12373impl wkt::message::Message for RestoreDatabaseEncryptionConfig {
12374    fn typename() -> &'static str {
12375        "type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig"
12376    }
12377}
12378
12379#[doc(hidden)]
12380impl<'de> serde::de::Deserialize<'de> for RestoreDatabaseEncryptionConfig {
12381    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12382    where
12383        D: serde::Deserializer<'de>,
12384    {
12385        #[allow(non_camel_case_types)]
12386        #[doc(hidden)]
12387        #[derive(PartialEq, Eq, Hash)]
12388        enum __FieldTag {
12389            __encryption_type,
12390            __kms_key_name,
12391            __kms_key_names,
12392            Unknown(std::string::String),
12393        }
12394        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12395            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12396            where
12397                D: serde::Deserializer<'de>,
12398            {
12399                struct Visitor;
12400                impl<'de> serde::de::Visitor<'de> for Visitor {
12401                    type Value = __FieldTag;
12402                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12403                        formatter.write_str("a field name for RestoreDatabaseEncryptionConfig")
12404                    }
12405                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12406                    where
12407                        E: serde::de::Error,
12408                    {
12409                        use std::result::Result::Ok;
12410                        use std::string::ToString;
12411                        match value {
12412                            "encryptionType" => Ok(__FieldTag::__encryption_type),
12413                            "encryption_type" => Ok(__FieldTag::__encryption_type),
12414                            "kmsKeyName" => Ok(__FieldTag::__kms_key_name),
12415                            "kms_key_name" => Ok(__FieldTag::__kms_key_name),
12416                            "kmsKeyNames" => Ok(__FieldTag::__kms_key_names),
12417                            "kms_key_names" => Ok(__FieldTag::__kms_key_names),
12418                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12419                        }
12420                    }
12421                }
12422                deserializer.deserialize_identifier(Visitor)
12423            }
12424        }
12425        struct Visitor;
12426        impl<'de> serde::de::Visitor<'de> for Visitor {
12427            type Value = RestoreDatabaseEncryptionConfig;
12428            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12429                formatter.write_str("struct RestoreDatabaseEncryptionConfig")
12430            }
12431            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12432            where
12433                A: serde::de::MapAccess<'de>,
12434            {
12435                #[allow(unused_imports)]
12436                use serde::de::Error;
12437                use std::option::Option::Some;
12438                let mut fields = std::collections::HashSet::new();
12439                let mut result = Self::Value::new();
12440                while let Some(tag) = map.next_key::<__FieldTag>()? {
12441                    #[allow(clippy::match_single_binding)]
12442                    match tag {
12443                        __FieldTag::__encryption_type => {
12444                            if !fields.insert(__FieldTag::__encryption_type) {
12445                                return std::result::Result::Err(A::Error::duplicate_field(
12446                                    "multiple values for encryption_type",
12447                                ));
12448                            }
12449                            result.encryption_type = map.next_value::<std::option::Option<crate::model::restore_database_encryption_config::EncryptionType>>()?.unwrap_or_default();
12450                        }
12451                        __FieldTag::__kms_key_name => {
12452                            if !fields.insert(__FieldTag::__kms_key_name) {
12453                                return std::result::Result::Err(A::Error::duplicate_field(
12454                                    "multiple values for kms_key_name",
12455                                ));
12456                            }
12457                            result.kms_key_name = map
12458                                .next_value::<std::option::Option<std::string::String>>()?
12459                                .unwrap_or_default();
12460                        }
12461                        __FieldTag::__kms_key_names => {
12462                            if !fields.insert(__FieldTag::__kms_key_names) {
12463                                return std::result::Result::Err(A::Error::duplicate_field(
12464                                    "multiple values for kms_key_names",
12465                                ));
12466                            }
12467                            result.kms_key_names = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
12468                        }
12469                        __FieldTag::Unknown(key) => {
12470                            let value = map.next_value::<serde_json::Value>()?;
12471                            result._unknown_fields.insert(key, value);
12472                        }
12473                    }
12474                }
12475                std::result::Result::Ok(result)
12476            }
12477        }
12478        deserializer.deserialize_any(Visitor)
12479    }
12480}
12481
12482#[doc(hidden)]
12483impl serde::ser::Serialize for RestoreDatabaseEncryptionConfig {
12484    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12485    where
12486        S: serde::ser::Serializer,
12487    {
12488        use serde::ser::SerializeMap;
12489        #[allow(unused_imports)]
12490        use std::option::Option::Some;
12491        let mut state = serializer.serialize_map(std::option::Option::None)?;
12492        if !wkt::internal::is_default(&self.encryption_type) {
12493            state.serialize_entry("encryptionType", &self.encryption_type)?;
12494        }
12495        if !self.kms_key_name.is_empty() {
12496            state.serialize_entry("kmsKeyName", &self.kms_key_name)?;
12497        }
12498        if !self.kms_key_names.is_empty() {
12499            state.serialize_entry("kmsKeyNames", &self.kms_key_names)?;
12500        }
12501        if !self._unknown_fields.is_empty() {
12502            for (key, value) in self._unknown_fields.iter() {
12503                state.serialize_entry(key, &value)?;
12504            }
12505        }
12506        state.end()
12507    }
12508}
12509
12510impl std::fmt::Debug for RestoreDatabaseEncryptionConfig {
12511    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12512        let mut debug_struct = f.debug_struct("RestoreDatabaseEncryptionConfig");
12513        debug_struct.field("encryption_type", &self.encryption_type);
12514        debug_struct.field("kms_key_name", &self.kms_key_name);
12515        debug_struct.field("kms_key_names", &self.kms_key_names);
12516        if !self._unknown_fields.is_empty() {
12517            debug_struct.field("_unknown_fields", &self._unknown_fields);
12518        }
12519        debug_struct.finish()
12520    }
12521}
12522
12523/// Defines additional types related to [RestoreDatabaseEncryptionConfig].
12524pub mod restore_database_encryption_config {
12525    #[allow(unused_imports)]
12526    use super::*;
12527
12528    /// Encryption types for the database to be restored.
12529    ///
12530    /// # Working with unknown values
12531    ///
12532    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12533    /// additional enum variants at any time. Adding new variants is not considered
12534    /// a breaking change. Applications should write their code in anticipation of:
12535    ///
12536    /// - New values appearing in future releases of the client library, **and**
12537    /// - New values received dynamically, without application changes.
12538    ///
12539    /// Please consult the [Working with enums] section in the user guide for some
12540    /// guidelines.
12541    ///
12542    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12543    #[derive(Clone, Debug, PartialEq)]
12544    #[non_exhaustive]
12545    pub enum EncryptionType {
12546        /// Unspecified. Do not use.
12547        Unspecified,
12548        /// This is the default option when
12549        /// [encryption_config][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig]
12550        /// is not specified.
12551        ///
12552        /// [google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig]: crate::model::RestoreDatabaseEncryptionConfig
12553        UseConfigDefaultOrBackupEncryption,
12554        /// Use Google default encryption.
12555        GoogleDefaultEncryption,
12556        /// Use customer managed encryption. If specified, `kms_key_name` must
12557        /// must contain a valid Cloud KMS key.
12558        CustomerManagedEncryption,
12559        /// If set, the enum was initialized with an unknown value.
12560        ///
12561        /// Applications can examine the value using [EncryptionType::value] or
12562        /// [EncryptionType::name].
12563        UnknownValue(encryption_type::UnknownValue),
12564    }
12565
12566    #[doc(hidden)]
12567    pub mod encryption_type {
12568        #[allow(unused_imports)]
12569        use super::*;
12570        #[derive(Clone, Debug, PartialEq)]
12571        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12572    }
12573
12574    impl EncryptionType {
12575        /// Gets the enum value.
12576        ///
12577        /// Returns `None` if the enum contains an unknown value deserialized from
12578        /// the string representation of enums.
12579        pub fn value(&self) -> std::option::Option<i32> {
12580            match self {
12581                Self::Unspecified => std::option::Option::Some(0),
12582                Self::UseConfigDefaultOrBackupEncryption => std::option::Option::Some(1),
12583                Self::GoogleDefaultEncryption => std::option::Option::Some(2),
12584                Self::CustomerManagedEncryption => std::option::Option::Some(3),
12585                Self::UnknownValue(u) => u.0.value(),
12586            }
12587        }
12588
12589        /// Gets the enum value as a string.
12590        ///
12591        /// Returns `None` if the enum contains an unknown value deserialized from
12592        /// the integer representation of enums.
12593        pub fn name(&self) -> std::option::Option<&str> {
12594            match self {
12595                Self::Unspecified => std::option::Option::Some("ENCRYPTION_TYPE_UNSPECIFIED"),
12596                Self::UseConfigDefaultOrBackupEncryption => {
12597                    std::option::Option::Some("USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION")
12598                }
12599                Self::GoogleDefaultEncryption => {
12600                    std::option::Option::Some("GOOGLE_DEFAULT_ENCRYPTION")
12601                }
12602                Self::CustomerManagedEncryption => {
12603                    std::option::Option::Some("CUSTOMER_MANAGED_ENCRYPTION")
12604                }
12605                Self::UnknownValue(u) => u.0.name(),
12606            }
12607        }
12608    }
12609
12610    impl std::default::Default for EncryptionType {
12611        fn default() -> Self {
12612            use std::convert::From;
12613            Self::from(0)
12614        }
12615    }
12616
12617    impl std::fmt::Display for EncryptionType {
12618        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12619            wkt::internal::display_enum(f, self.name(), self.value())
12620        }
12621    }
12622
12623    impl std::convert::From<i32> for EncryptionType {
12624        fn from(value: i32) -> Self {
12625            match value {
12626                0 => Self::Unspecified,
12627                1 => Self::UseConfigDefaultOrBackupEncryption,
12628                2 => Self::GoogleDefaultEncryption,
12629                3 => Self::CustomerManagedEncryption,
12630                _ => Self::UnknownValue(encryption_type::UnknownValue(
12631                    wkt::internal::UnknownEnumValue::Integer(value),
12632                )),
12633            }
12634        }
12635    }
12636
12637    impl std::convert::From<&str> for EncryptionType {
12638        fn from(value: &str) -> Self {
12639            use std::string::ToString;
12640            match value {
12641                "ENCRYPTION_TYPE_UNSPECIFIED" => Self::Unspecified,
12642                "USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION" => {
12643                    Self::UseConfigDefaultOrBackupEncryption
12644                }
12645                "GOOGLE_DEFAULT_ENCRYPTION" => Self::GoogleDefaultEncryption,
12646                "CUSTOMER_MANAGED_ENCRYPTION" => Self::CustomerManagedEncryption,
12647                _ => Self::UnknownValue(encryption_type::UnknownValue(
12648                    wkt::internal::UnknownEnumValue::String(value.to_string()),
12649                )),
12650            }
12651        }
12652    }
12653
12654    impl serde::ser::Serialize for EncryptionType {
12655        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12656        where
12657            S: serde::Serializer,
12658        {
12659            match self {
12660                Self::Unspecified => serializer.serialize_i32(0),
12661                Self::UseConfigDefaultOrBackupEncryption => serializer.serialize_i32(1),
12662                Self::GoogleDefaultEncryption => serializer.serialize_i32(2),
12663                Self::CustomerManagedEncryption => serializer.serialize_i32(3),
12664                Self::UnknownValue(u) => u.0.serialize(serializer),
12665            }
12666        }
12667    }
12668
12669    impl<'de> serde::de::Deserialize<'de> for EncryptionType {
12670        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12671        where
12672            D: serde::Deserializer<'de>,
12673        {
12674            deserializer.deserialize_any(wkt::internal::EnumVisitor::<EncryptionType>::new(
12675                ".google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.EncryptionType",
12676            ))
12677        }
12678    }
12679}
12680
12681/// Metadata type for the long-running operation returned by
12682/// [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase].
12683///
12684/// [google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase]: crate::client::DatabaseAdmin::restore_database
12685#[derive(Clone, Default, PartialEq)]
12686#[non_exhaustive]
12687pub struct RestoreDatabaseMetadata {
12688    /// Name of the database being created and restored to.
12689    pub name: std::string::String,
12690
12691    /// The type of the restore source.
12692    pub source_type: crate::model::RestoreSourceType,
12693
12694    /// The progress of the
12695    /// [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase]
12696    /// operation.
12697    ///
12698    /// [google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase]: crate::client::DatabaseAdmin::restore_database
12699    pub progress: std::option::Option<crate::model::OperationProgress>,
12700
12701    /// The time at which cancellation of this operation was received.
12702    /// [Operations.CancelOperation][google.longrunning.Operations.CancelOperation]
12703    /// starts asynchronous cancellation on a long-running operation. The server
12704    /// makes a best effort to cancel the operation, but success is not guaranteed.
12705    /// Clients can use
12706    /// [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
12707    /// other methods to check whether the cancellation succeeded or whether the
12708    /// operation completed despite cancellation. On successful cancellation,
12709    /// the operation is not deleted; instead, it becomes an operation with
12710    /// an [Operation.error][google.longrunning.Operation.error] value with a
12711    /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
12712    /// `Code.CANCELLED`.
12713    ///
12714    /// [google.longrunning.Operation.error]: longrunning::model::Operation::result
12715    /// [google.rpc.Status.code]: rpc::model::Status::code
12716    pub cancel_time: std::option::Option<wkt::Timestamp>,
12717
12718    /// If exists, the name of the long-running operation that will be used to
12719    /// track the post-restore optimization process to optimize the performance of
12720    /// the restored database, and remove the dependency on the restore source.
12721    /// The name is of the form
12722    /// `projects/<project>/instances/<instance>/databases/<database>/operations/<operation>`
12723    /// where the \<database\> is the name of database being created and restored to.
12724    /// The metadata type of the  long-running operation is
12725    /// [OptimizeRestoredDatabaseMetadata][google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata].
12726    /// This long-running operation will be automatically created by the system
12727    /// after the RestoreDatabase long-running operation completes successfully.
12728    /// This operation will not be created if the restore was not successful.
12729    ///
12730    /// [google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata]: crate::model::OptimizeRestoredDatabaseMetadata
12731    pub optimize_database_operation_name: std::string::String,
12732
12733    /// Information about the source used to restore the database, as specified by
12734    /// `source` in
12735    /// [RestoreDatabaseRequest][google.spanner.admin.database.v1.RestoreDatabaseRequest].
12736    ///
12737    /// [google.spanner.admin.database.v1.RestoreDatabaseRequest]: crate::model::RestoreDatabaseRequest
12738    pub source_info: std::option::Option<crate::model::restore_database_metadata::SourceInfo>,
12739
12740    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12741}
12742
12743impl RestoreDatabaseMetadata {
12744    pub fn new() -> Self {
12745        std::default::Default::default()
12746    }
12747
12748    /// Sets the value of [name][crate::model::RestoreDatabaseMetadata::name].
12749    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12750        self.name = v.into();
12751        self
12752    }
12753
12754    /// Sets the value of [source_type][crate::model::RestoreDatabaseMetadata::source_type].
12755    pub fn set_source_type<T: std::convert::Into<crate::model::RestoreSourceType>>(
12756        mut self,
12757        v: T,
12758    ) -> Self {
12759        self.source_type = v.into();
12760        self
12761    }
12762
12763    /// Sets the value of [progress][crate::model::RestoreDatabaseMetadata::progress].
12764    pub fn set_progress<T>(mut self, v: T) -> Self
12765    where
12766        T: std::convert::Into<crate::model::OperationProgress>,
12767    {
12768        self.progress = std::option::Option::Some(v.into());
12769        self
12770    }
12771
12772    /// Sets or clears the value of [progress][crate::model::RestoreDatabaseMetadata::progress].
12773    pub fn set_or_clear_progress<T>(mut self, v: std::option::Option<T>) -> Self
12774    where
12775        T: std::convert::Into<crate::model::OperationProgress>,
12776    {
12777        self.progress = v.map(|x| x.into());
12778        self
12779    }
12780
12781    /// Sets the value of [cancel_time][crate::model::RestoreDatabaseMetadata::cancel_time].
12782    pub fn set_cancel_time<T>(mut self, v: T) -> Self
12783    where
12784        T: std::convert::Into<wkt::Timestamp>,
12785    {
12786        self.cancel_time = std::option::Option::Some(v.into());
12787        self
12788    }
12789
12790    /// Sets or clears the value of [cancel_time][crate::model::RestoreDatabaseMetadata::cancel_time].
12791    pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
12792    where
12793        T: std::convert::Into<wkt::Timestamp>,
12794    {
12795        self.cancel_time = v.map(|x| x.into());
12796        self
12797    }
12798
12799    /// Sets the value of [optimize_database_operation_name][crate::model::RestoreDatabaseMetadata::optimize_database_operation_name].
12800    pub fn set_optimize_database_operation_name<T: std::convert::Into<std::string::String>>(
12801        mut self,
12802        v: T,
12803    ) -> Self {
12804        self.optimize_database_operation_name = v.into();
12805        self
12806    }
12807
12808    /// Sets the value of [source_info][crate::model::RestoreDatabaseMetadata::source_info].
12809    ///
12810    /// Note that all the setters affecting `source_info` are mutually
12811    /// exclusive.
12812    pub fn set_source_info<
12813        T: std::convert::Into<
12814                std::option::Option<crate::model::restore_database_metadata::SourceInfo>,
12815            >,
12816    >(
12817        mut self,
12818        v: T,
12819    ) -> Self {
12820        self.source_info = v.into();
12821        self
12822    }
12823
12824    /// The value of [source_info][crate::model::RestoreDatabaseMetadata::source_info]
12825    /// if it holds a `BackupInfo`, `None` if the field is not set or
12826    /// holds a different branch.
12827    pub fn backup_info(&self) -> std::option::Option<&std::boxed::Box<crate::model::BackupInfo>> {
12828        #[allow(unreachable_patterns)]
12829        self.source_info.as_ref().and_then(|v| match v {
12830            crate::model::restore_database_metadata::SourceInfo::BackupInfo(v) => {
12831                std::option::Option::Some(v)
12832            }
12833            _ => std::option::Option::None,
12834        })
12835    }
12836
12837    /// Sets the value of [source_info][crate::model::RestoreDatabaseMetadata::source_info]
12838    /// to hold a `BackupInfo`.
12839    ///
12840    /// Note that all the setters affecting `source_info` are
12841    /// mutually exclusive.
12842    pub fn set_backup_info<T: std::convert::Into<std::boxed::Box<crate::model::BackupInfo>>>(
12843        mut self,
12844        v: T,
12845    ) -> Self {
12846        self.source_info = std::option::Option::Some(
12847            crate::model::restore_database_metadata::SourceInfo::BackupInfo(v.into()),
12848        );
12849        self
12850    }
12851}
12852
12853impl wkt::message::Message for RestoreDatabaseMetadata {
12854    fn typename() -> &'static str {
12855        "type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata"
12856    }
12857}
12858
12859#[doc(hidden)]
12860impl<'de> serde::de::Deserialize<'de> for RestoreDatabaseMetadata {
12861    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12862    where
12863        D: serde::Deserializer<'de>,
12864    {
12865        #[allow(non_camel_case_types)]
12866        #[doc(hidden)]
12867        #[derive(PartialEq, Eq, Hash)]
12868        enum __FieldTag {
12869            __name,
12870            __source_type,
12871            __backup_info,
12872            __progress,
12873            __cancel_time,
12874            __optimize_database_operation_name,
12875            Unknown(std::string::String),
12876        }
12877        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12878            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12879            where
12880                D: serde::Deserializer<'de>,
12881            {
12882                struct Visitor;
12883                impl<'de> serde::de::Visitor<'de> for Visitor {
12884                    type Value = __FieldTag;
12885                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12886                        formatter.write_str("a field name for RestoreDatabaseMetadata")
12887                    }
12888                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12889                    where
12890                        E: serde::de::Error,
12891                    {
12892                        use std::result::Result::Ok;
12893                        use std::string::ToString;
12894                        match value {
12895                            "name" => Ok(__FieldTag::__name),
12896                            "sourceType" => Ok(__FieldTag::__source_type),
12897                            "source_type" => Ok(__FieldTag::__source_type),
12898                            "backupInfo" => Ok(__FieldTag::__backup_info),
12899                            "backup_info" => Ok(__FieldTag::__backup_info),
12900                            "progress" => Ok(__FieldTag::__progress),
12901                            "cancelTime" => Ok(__FieldTag::__cancel_time),
12902                            "cancel_time" => Ok(__FieldTag::__cancel_time),
12903                            "optimizeDatabaseOperationName" => {
12904                                Ok(__FieldTag::__optimize_database_operation_name)
12905                            }
12906                            "optimize_database_operation_name" => {
12907                                Ok(__FieldTag::__optimize_database_operation_name)
12908                            }
12909                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12910                        }
12911                    }
12912                }
12913                deserializer.deserialize_identifier(Visitor)
12914            }
12915        }
12916        struct Visitor;
12917        impl<'de> serde::de::Visitor<'de> for Visitor {
12918            type Value = RestoreDatabaseMetadata;
12919            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12920                formatter.write_str("struct RestoreDatabaseMetadata")
12921            }
12922            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12923            where
12924                A: serde::de::MapAccess<'de>,
12925            {
12926                #[allow(unused_imports)]
12927                use serde::de::Error;
12928                use std::option::Option::Some;
12929                let mut fields = std::collections::HashSet::new();
12930                let mut result = Self::Value::new();
12931                while let Some(tag) = map.next_key::<__FieldTag>()? {
12932                    #[allow(clippy::match_single_binding)]
12933                    match tag {
12934                        __FieldTag::__name => {
12935                            if !fields.insert(__FieldTag::__name) {
12936                                return std::result::Result::Err(A::Error::duplicate_field(
12937                                    "multiple values for name",
12938                                ));
12939                            }
12940                            result.name = map
12941                                .next_value::<std::option::Option<std::string::String>>()?
12942                                .unwrap_or_default();
12943                        }
12944                        __FieldTag::__source_type => {
12945                            if !fields.insert(__FieldTag::__source_type) {
12946                                return std::result::Result::Err(A::Error::duplicate_field(
12947                                    "multiple values for source_type",
12948                                ));
12949                            }
12950                            result.source_type = map
12951                                .next_value::<std::option::Option<crate::model::RestoreSourceType>>(
12952                                )?
12953                                .unwrap_or_default();
12954                        }
12955                        __FieldTag::__backup_info => {
12956                            if !fields.insert(__FieldTag::__backup_info) {
12957                                return std::result::Result::Err(A::Error::duplicate_field(
12958                                    "multiple values for backup_info",
12959                                ));
12960                            }
12961                            if result.source_info.is_some() {
12962                                return std::result::Result::Err(A::Error::duplicate_field(
12963                                    "multiple values for `source_info`, a oneof with full ID .google.spanner.admin.database.v1.RestoreDatabaseMetadata.backup_info, latest field was backupInfo",
12964                                ));
12965                            }
12966                            result.source_info = std::option::Option::Some(
12967                                crate::model::restore_database_metadata::SourceInfo::BackupInfo(
12968                                    map.next_value::<std::option::Option<
12969                                        std::boxed::Box<crate::model::BackupInfo>,
12970                                    >>()?
12971                                    .unwrap_or_default(),
12972                                ),
12973                            );
12974                        }
12975                        __FieldTag::__progress => {
12976                            if !fields.insert(__FieldTag::__progress) {
12977                                return std::result::Result::Err(A::Error::duplicate_field(
12978                                    "multiple values for progress",
12979                                ));
12980                            }
12981                            result.progress = map
12982                                .next_value::<std::option::Option<crate::model::OperationProgress>>(
12983                                )?;
12984                        }
12985                        __FieldTag::__cancel_time => {
12986                            if !fields.insert(__FieldTag::__cancel_time) {
12987                                return std::result::Result::Err(A::Error::duplicate_field(
12988                                    "multiple values for cancel_time",
12989                                ));
12990                            }
12991                            result.cancel_time =
12992                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
12993                        }
12994                        __FieldTag::__optimize_database_operation_name => {
12995                            if !fields.insert(__FieldTag::__optimize_database_operation_name) {
12996                                return std::result::Result::Err(A::Error::duplicate_field(
12997                                    "multiple values for optimize_database_operation_name",
12998                                ));
12999                            }
13000                            result.optimize_database_operation_name = map
13001                                .next_value::<std::option::Option<std::string::String>>()?
13002                                .unwrap_or_default();
13003                        }
13004                        __FieldTag::Unknown(key) => {
13005                            let value = map.next_value::<serde_json::Value>()?;
13006                            result._unknown_fields.insert(key, value);
13007                        }
13008                    }
13009                }
13010                std::result::Result::Ok(result)
13011            }
13012        }
13013        deserializer.deserialize_any(Visitor)
13014    }
13015}
13016
13017#[doc(hidden)]
13018impl serde::ser::Serialize for RestoreDatabaseMetadata {
13019    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13020    where
13021        S: serde::ser::Serializer,
13022    {
13023        use serde::ser::SerializeMap;
13024        #[allow(unused_imports)]
13025        use std::option::Option::Some;
13026        let mut state = serializer.serialize_map(std::option::Option::None)?;
13027        if !self.name.is_empty() {
13028            state.serialize_entry("name", &self.name)?;
13029        }
13030        if !wkt::internal::is_default(&self.source_type) {
13031            state.serialize_entry("sourceType", &self.source_type)?;
13032        }
13033        if let Some(value) = self.backup_info() {
13034            state.serialize_entry("backupInfo", value)?;
13035        }
13036        if self.progress.is_some() {
13037            state.serialize_entry("progress", &self.progress)?;
13038        }
13039        if self.cancel_time.is_some() {
13040            state.serialize_entry("cancelTime", &self.cancel_time)?;
13041        }
13042        if !self.optimize_database_operation_name.is_empty() {
13043            state.serialize_entry(
13044                "optimizeDatabaseOperationName",
13045                &self.optimize_database_operation_name,
13046            )?;
13047        }
13048        if !self._unknown_fields.is_empty() {
13049            for (key, value) in self._unknown_fields.iter() {
13050                state.serialize_entry(key, &value)?;
13051            }
13052        }
13053        state.end()
13054    }
13055}
13056
13057impl std::fmt::Debug for RestoreDatabaseMetadata {
13058    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13059        let mut debug_struct = f.debug_struct("RestoreDatabaseMetadata");
13060        debug_struct.field("name", &self.name);
13061        debug_struct.field("source_type", &self.source_type);
13062        debug_struct.field("progress", &self.progress);
13063        debug_struct.field("cancel_time", &self.cancel_time);
13064        debug_struct.field(
13065            "optimize_database_operation_name",
13066            &self.optimize_database_operation_name,
13067        );
13068        debug_struct.field("source_info", &self.source_info);
13069        if !self._unknown_fields.is_empty() {
13070            debug_struct.field("_unknown_fields", &self._unknown_fields);
13071        }
13072        debug_struct.finish()
13073    }
13074}
13075
13076/// Defines additional types related to [RestoreDatabaseMetadata].
13077pub mod restore_database_metadata {
13078    #[allow(unused_imports)]
13079    use super::*;
13080
13081    /// Information about the source used to restore the database, as specified by
13082    /// `source` in
13083    /// [RestoreDatabaseRequest][google.spanner.admin.database.v1.RestoreDatabaseRequest].
13084    ///
13085    /// [google.spanner.admin.database.v1.RestoreDatabaseRequest]: crate::model::RestoreDatabaseRequest
13086    #[derive(Clone, Debug, PartialEq)]
13087    #[non_exhaustive]
13088    pub enum SourceInfo {
13089        /// Information about the backup used to restore the database.
13090        BackupInfo(std::boxed::Box<crate::model::BackupInfo>),
13091    }
13092}
13093
13094/// Metadata type for the long-running operation used to track the progress
13095/// of optimizations performed on a newly restored database. This long-running
13096/// operation is automatically created by the system after the successful
13097/// completion of a database restore, and cannot be cancelled.
13098#[derive(Clone, Default, PartialEq)]
13099#[non_exhaustive]
13100pub struct OptimizeRestoredDatabaseMetadata {
13101    /// Name of the restored database being optimized.
13102    pub name: std::string::String,
13103
13104    /// The progress of the post-restore optimizations.
13105    pub progress: std::option::Option<crate::model::OperationProgress>,
13106
13107    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13108}
13109
13110impl OptimizeRestoredDatabaseMetadata {
13111    pub fn new() -> Self {
13112        std::default::Default::default()
13113    }
13114
13115    /// Sets the value of [name][crate::model::OptimizeRestoredDatabaseMetadata::name].
13116    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13117        self.name = v.into();
13118        self
13119    }
13120
13121    /// Sets the value of [progress][crate::model::OptimizeRestoredDatabaseMetadata::progress].
13122    pub fn set_progress<T>(mut self, v: T) -> Self
13123    where
13124        T: std::convert::Into<crate::model::OperationProgress>,
13125    {
13126        self.progress = std::option::Option::Some(v.into());
13127        self
13128    }
13129
13130    /// Sets or clears the value of [progress][crate::model::OptimizeRestoredDatabaseMetadata::progress].
13131    pub fn set_or_clear_progress<T>(mut self, v: std::option::Option<T>) -> Self
13132    where
13133        T: std::convert::Into<crate::model::OperationProgress>,
13134    {
13135        self.progress = v.map(|x| x.into());
13136        self
13137    }
13138}
13139
13140impl wkt::message::Message for OptimizeRestoredDatabaseMetadata {
13141    fn typename() -> &'static str {
13142        "type.googleapis.com/google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata"
13143    }
13144}
13145
13146#[doc(hidden)]
13147impl<'de> serde::de::Deserialize<'de> for OptimizeRestoredDatabaseMetadata {
13148    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13149    where
13150        D: serde::Deserializer<'de>,
13151    {
13152        #[allow(non_camel_case_types)]
13153        #[doc(hidden)]
13154        #[derive(PartialEq, Eq, Hash)]
13155        enum __FieldTag {
13156            __name,
13157            __progress,
13158            Unknown(std::string::String),
13159        }
13160        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13161            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13162            where
13163                D: serde::Deserializer<'de>,
13164            {
13165                struct Visitor;
13166                impl<'de> serde::de::Visitor<'de> for Visitor {
13167                    type Value = __FieldTag;
13168                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13169                        formatter.write_str("a field name for OptimizeRestoredDatabaseMetadata")
13170                    }
13171                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13172                    where
13173                        E: serde::de::Error,
13174                    {
13175                        use std::result::Result::Ok;
13176                        use std::string::ToString;
13177                        match value {
13178                            "name" => Ok(__FieldTag::__name),
13179                            "progress" => Ok(__FieldTag::__progress),
13180                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13181                        }
13182                    }
13183                }
13184                deserializer.deserialize_identifier(Visitor)
13185            }
13186        }
13187        struct Visitor;
13188        impl<'de> serde::de::Visitor<'de> for Visitor {
13189            type Value = OptimizeRestoredDatabaseMetadata;
13190            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13191                formatter.write_str("struct OptimizeRestoredDatabaseMetadata")
13192            }
13193            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13194            where
13195                A: serde::de::MapAccess<'de>,
13196            {
13197                #[allow(unused_imports)]
13198                use serde::de::Error;
13199                use std::option::Option::Some;
13200                let mut fields = std::collections::HashSet::new();
13201                let mut result = Self::Value::new();
13202                while let Some(tag) = map.next_key::<__FieldTag>()? {
13203                    #[allow(clippy::match_single_binding)]
13204                    match tag {
13205                        __FieldTag::__name => {
13206                            if !fields.insert(__FieldTag::__name) {
13207                                return std::result::Result::Err(A::Error::duplicate_field(
13208                                    "multiple values for name",
13209                                ));
13210                            }
13211                            result.name = map
13212                                .next_value::<std::option::Option<std::string::String>>()?
13213                                .unwrap_or_default();
13214                        }
13215                        __FieldTag::__progress => {
13216                            if !fields.insert(__FieldTag::__progress) {
13217                                return std::result::Result::Err(A::Error::duplicate_field(
13218                                    "multiple values for progress",
13219                                ));
13220                            }
13221                            result.progress = map
13222                                .next_value::<std::option::Option<crate::model::OperationProgress>>(
13223                                )?;
13224                        }
13225                        __FieldTag::Unknown(key) => {
13226                            let value = map.next_value::<serde_json::Value>()?;
13227                            result._unknown_fields.insert(key, value);
13228                        }
13229                    }
13230                }
13231                std::result::Result::Ok(result)
13232            }
13233        }
13234        deserializer.deserialize_any(Visitor)
13235    }
13236}
13237
13238#[doc(hidden)]
13239impl serde::ser::Serialize for OptimizeRestoredDatabaseMetadata {
13240    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13241    where
13242        S: serde::ser::Serializer,
13243    {
13244        use serde::ser::SerializeMap;
13245        #[allow(unused_imports)]
13246        use std::option::Option::Some;
13247        let mut state = serializer.serialize_map(std::option::Option::None)?;
13248        if !self.name.is_empty() {
13249            state.serialize_entry("name", &self.name)?;
13250        }
13251        if self.progress.is_some() {
13252            state.serialize_entry("progress", &self.progress)?;
13253        }
13254        if !self._unknown_fields.is_empty() {
13255            for (key, value) in self._unknown_fields.iter() {
13256                state.serialize_entry(key, &value)?;
13257            }
13258        }
13259        state.end()
13260    }
13261}
13262
13263impl std::fmt::Debug for OptimizeRestoredDatabaseMetadata {
13264    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13265        let mut debug_struct = f.debug_struct("OptimizeRestoredDatabaseMetadata");
13266        debug_struct.field("name", &self.name);
13267        debug_struct.field("progress", &self.progress);
13268        if !self._unknown_fields.is_empty() {
13269            debug_struct.field("_unknown_fields", &self._unknown_fields);
13270        }
13271        debug_struct.finish()
13272    }
13273}
13274
13275/// A Cloud Spanner database role.
13276#[derive(Clone, Default, PartialEq)]
13277#[non_exhaustive]
13278pub struct DatabaseRole {
13279    /// Required. The name of the database role. Values are of the form
13280    /// `projects/<project>/instances/<instance>/databases/<database>/databaseRoles/<role>`
13281    /// where `<role>` is as specified in the `CREATE ROLE` DDL statement.
13282    pub name: std::string::String,
13283
13284    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13285}
13286
13287impl DatabaseRole {
13288    pub fn new() -> Self {
13289        std::default::Default::default()
13290    }
13291
13292    /// Sets the value of [name][crate::model::DatabaseRole::name].
13293    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13294        self.name = v.into();
13295        self
13296    }
13297}
13298
13299impl wkt::message::Message for DatabaseRole {
13300    fn typename() -> &'static str {
13301        "type.googleapis.com/google.spanner.admin.database.v1.DatabaseRole"
13302    }
13303}
13304
13305#[doc(hidden)]
13306impl<'de> serde::de::Deserialize<'de> for DatabaseRole {
13307    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13308    where
13309        D: serde::Deserializer<'de>,
13310    {
13311        #[allow(non_camel_case_types)]
13312        #[doc(hidden)]
13313        #[derive(PartialEq, Eq, Hash)]
13314        enum __FieldTag {
13315            __name,
13316            Unknown(std::string::String),
13317        }
13318        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13319            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13320            where
13321                D: serde::Deserializer<'de>,
13322            {
13323                struct Visitor;
13324                impl<'de> serde::de::Visitor<'de> for Visitor {
13325                    type Value = __FieldTag;
13326                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13327                        formatter.write_str("a field name for DatabaseRole")
13328                    }
13329                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13330                    where
13331                        E: serde::de::Error,
13332                    {
13333                        use std::result::Result::Ok;
13334                        use std::string::ToString;
13335                        match value {
13336                            "name" => Ok(__FieldTag::__name),
13337                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13338                        }
13339                    }
13340                }
13341                deserializer.deserialize_identifier(Visitor)
13342            }
13343        }
13344        struct Visitor;
13345        impl<'de> serde::de::Visitor<'de> for Visitor {
13346            type Value = DatabaseRole;
13347            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13348                formatter.write_str("struct DatabaseRole")
13349            }
13350            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13351            where
13352                A: serde::de::MapAccess<'de>,
13353            {
13354                #[allow(unused_imports)]
13355                use serde::de::Error;
13356                use std::option::Option::Some;
13357                let mut fields = std::collections::HashSet::new();
13358                let mut result = Self::Value::new();
13359                while let Some(tag) = map.next_key::<__FieldTag>()? {
13360                    #[allow(clippy::match_single_binding)]
13361                    match tag {
13362                        __FieldTag::__name => {
13363                            if !fields.insert(__FieldTag::__name) {
13364                                return std::result::Result::Err(A::Error::duplicate_field(
13365                                    "multiple values for name",
13366                                ));
13367                            }
13368                            result.name = map
13369                                .next_value::<std::option::Option<std::string::String>>()?
13370                                .unwrap_or_default();
13371                        }
13372                        __FieldTag::Unknown(key) => {
13373                            let value = map.next_value::<serde_json::Value>()?;
13374                            result._unknown_fields.insert(key, value);
13375                        }
13376                    }
13377                }
13378                std::result::Result::Ok(result)
13379            }
13380        }
13381        deserializer.deserialize_any(Visitor)
13382    }
13383}
13384
13385#[doc(hidden)]
13386impl serde::ser::Serialize for DatabaseRole {
13387    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13388    where
13389        S: serde::ser::Serializer,
13390    {
13391        use serde::ser::SerializeMap;
13392        #[allow(unused_imports)]
13393        use std::option::Option::Some;
13394        let mut state = serializer.serialize_map(std::option::Option::None)?;
13395        if !self.name.is_empty() {
13396            state.serialize_entry("name", &self.name)?;
13397        }
13398        if !self._unknown_fields.is_empty() {
13399            for (key, value) in self._unknown_fields.iter() {
13400                state.serialize_entry(key, &value)?;
13401            }
13402        }
13403        state.end()
13404    }
13405}
13406
13407impl std::fmt::Debug for DatabaseRole {
13408    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13409        let mut debug_struct = f.debug_struct("DatabaseRole");
13410        debug_struct.field("name", &self.name);
13411        if !self._unknown_fields.is_empty() {
13412            debug_struct.field("_unknown_fields", &self._unknown_fields);
13413        }
13414        debug_struct.finish()
13415    }
13416}
13417
13418/// The request for
13419/// [ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles].
13420///
13421/// [google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles]: crate::client::DatabaseAdmin::list_database_roles
13422#[derive(Clone, Default, PartialEq)]
13423#[non_exhaustive]
13424pub struct ListDatabaseRolesRequest {
13425    /// Required. The database whose roles should be listed.
13426    /// Values are of the form
13427    /// `projects/<project>/instances/<instance>/databases/<database>`.
13428    pub parent: std::string::String,
13429
13430    /// Number of database roles to be returned in the response. If 0 or less,
13431    /// defaults to the server's maximum allowed page size.
13432    pub page_size: i32,
13433
13434    /// If non-empty, `page_token` should contain a
13435    /// [next_page_token][google.spanner.admin.database.v1.ListDatabaseRolesResponse.next_page_token]
13436    /// from a previous
13437    /// [ListDatabaseRolesResponse][google.spanner.admin.database.v1.ListDatabaseRolesResponse].
13438    ///
13439    /// [google.spanner.admin.database.v1.ListDatabaseRolesResponse]: crate::model::ListDatabaseRolesResponse
13440    /// [google.spanner.admin.database.v1.ListDatabaseRolesResponse.next_page_token]: crate::model::ListDatabaseRolesResponse::next_page_token
13441    pub page_token: std::string::String,
13442
13443    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13444}
13445
13446impl ListDatabaseRolesRequest {
13447    pub fn new() -> Self {
13448        std::default::Default::default()
13449    }
13450
13451    /// Sets the value of [parent][crate::model::ListDatabaseRolesRequest::parent].
13452    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13453        self.parent = v.into();
13454        self
13455    }
13456
13457    /// Sets the value of [page_size][crate::model::ListDatabaseRolesRequest::page_size].
13458    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13459        self.page_size = v.into();
13460        self
13461    }
13462
13463    /// Sets the value of [page_token][crate::model::ListDatabaseRolesRequest::page_token].
13464    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13465        self.page_token = v.into();
13466        self
13467    }
13468}
13469
13470impl wkt::message::Message for ListDatabaseRolesRequest {
13471    fn typename() -> &'static str {
13472        "type.googleapis.com/google.spanner.admin.database.v1.ListDatabaseRolesRequest"
13473    }
13474}
13475
13476#[doc(hidden)]
13477impl<'de> serde::de::Deserialize<'de> for ListDatabaseRolesRequest {
13478    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13479    where
13480        D: serde::Deserializer<'de>,
13481    {
13482        #[allow(non_camel_case_types)]
13483        #[doc(hidden)]
13484        #[derive(PartialEq, Eq, Hash)]
13485        enum __FieldTag {
13486            __parent,
13487            __page_size,
13488            __page_token,
13489            Unknown(std::string::String),
13490        }
13491        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13492            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13493            where
13494                D: serde::Deserializer<'de>,
13495            {
13496                struct Visitor;
13497                impl<'de> serde::de::Visitor<'de> for Visitor {
13498                    type Value = __FieldTag;
13499                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13500                        formatter.write_str("a field name for ListDatabaseRolesRequest")
13501                    }
13502                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13503                    where
13504                        E: serde::de::Error,
13505                    {
13506                        use std::result::Result::Ok;
13507                        use std::string::ToString;
13508                        match value {
13509                            "parent" => Ok(__FieldTag::__parent),
13510                            "pageSize" => Ok(__FieldTag::__page_size),
13511                            "page_size" => Ok(__FieldTag::__page_size),
13512                            "pageToken" => Ok(__FieldTag::__page_token),
13513                            "page_token" => Ok(__FieldTag::__page_token),
13514                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13515                        }
13516                    }
13517                }
13518                deserializer.deserialize_identifier(Visitor)
13519            }
13520        }
13521        struct Visitor;
13522        impl<'de> serde::de::Visitor<'de> for Visitor {
13523            type Value = ListDatabaseRolesRequest;
13524            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13525                formatter.write_str("struct ListDatabaseRolesRequest")
13526            }
13527            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13528            where
13529                A: serde::de::MapAccess<'de>,
13530            {
13531                #[allow(unused_imports)]
13532                use serde::de::Error;
13533                use std::option::Option::Some;
13534                let mut fields = std::collections::HashSet::new();
13535                let mut result = Self::Value::new();
13536                while let Some(tag) = map.next_key::<__FieldTag>()? {
13537                    #[allow(clippy::match_single_binding)]
13538                    match tag {
13539                        __FieldTag::__parent => {
13540                            if !fields.insert(__FieldTag::__parent) {
13541                                return std::result::Result::Err(A::Error::duplicate_field(
13542                                    "multiple values for parent",
13543                                ));
13544                            }
13545                            result.parent = map
13546                                .next_value::<std::option::Option<std::string::String>>()?
13547                                .unwrap_or_default();
13548                        }
13549                        __FieldTag::__page_size => {
13550                            if !fields.insert(__FieldTag::__page_size) {
13551                                return std::result::Result::Err(A::Error::duplicate_field(
13552                                    "multiple values for page_size",
13553                                ));
13554                            }
13555                            struct __With(std::option::Option<i32>);
13556                            impl<'de> serde::de::Deserialize<'de> for __With {
13557                                fn deserialize<D>(
13558                                    deserializer: D,
13559                                ) -> std::result::Result<Self, D::Error>
13560                                where
13561                                    D: serde::de::Deserializer<'de>,
13562                                {
13563                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
13564                                }
13565                            }
13566                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
13567                        }
13568                        __FieldTag::__page_token => {
13569                            if !fields.insert(__FieldTag::__page_token) {
13570                                return std::result::Result::Err(A::Error::duplicate_field(
13571                                    "multiple values for page_token",
13572                                ));
13573                            }
13574                            result.page_token = map
13575                                .next_value::<std::option::Option<std::string::String>>()?
13576                                .unwrap_or_default();
13577                        }
13578                        __FieldTag::Unknown(key) => {
13579                            let value = map.next_value::<serde_json::Value>()?;
13580                            result._unknown_fields.insert(key, value);
13581                        }
13582                    }
13583                }
13584                std::result::Result::Ok(result)
13585            }
13586        }
13587        deserializer.deserialize_any(Visitor)
13588    }
13589}
13590
13591#[doc(hidden)]
13592impl serde::ser::Serialize for ListDatabaseRolesRequest {
13593    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13594    where
13595        S: serde::ser::Serializer,
13596    {
13597        use serde::ser::SerializeMap;
13598        #[allow(unused_imports)]
13599        use std::option::Option::Some;
13600        let mut state = serializer.serialize_map(std::option::Option::None)?;
13601        if !self.parent.is_empty() {
13602            state.serialize_entry("parent", &self.parent)?;
13603        }
13604        if !wkt::internal::is_default(&self.page_size) {
13605            struct __With<'a>(&'a i32);
13606            impl<'a> serde::ser::Serialize for __With<'a> {
13607                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13608                where
13609                    S: serde::ser::Serializer,
13610                {
13611                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
13612                }
13613            }
13614            state.serialize_entry("pageSize", &__With(&self.page_size))?;
13615        }
13616        if !self.page_token.is_empty() {
13617            state.serialize_entry("pageToken", &self.page_token)?;
13618        }
13619        if !self._unknown_fields.is_empty() {
13620            for (key, value) in self._unknown_fields.iter() {
13621                state.serialize_entry(key, &value)?;
13622            }
13623        }
13624        state.end()
13625    }
13626}
13627
13628impl std::fmt::Debug for ListDatabaseRolesRequest {
13629    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13630        let mut debug_struct = f.debug_struct("ListDatabaseRolesRequest");
13631        debug_struct.field("parent", &self.parent);
13632        debug_struct.field("page_size", &self.page_size);
13633        debug_struct.field("page_token", &self.page_token);
13634        if !self._unknown_fields.is_empty() {
13635            debug_struct.field("_unknown_fields", &self._unknown_fields);
13636        }
13637        debug_struct.finish()
13638    }
13639}
13640
13641/// The response for
13642/// [ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles].
13643///
13644/// [google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles]: crate::client::DatabaseAdmin::list_database_roles
13645#[derive(Clone, Default, PartialEq)]
13646#[non_exhaustive]
13647pub struct ListDatabaseRolesResponse {
13648    /// Database roles that matched the request.
13649    pub database_roles: std::vec::Vec<crate::model::DatabaseRole>,
13650
13651    /// `next_page_token` can be sent in a subsequent
13652    /// [ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles]
13653    /// call to fetch more of the matching roles.
13654    ///
13655    /// [google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles]: crate::client::DatabaseAdmin::list_database_roles
13656    pub next_page_token: std::string::String,
13657
13658    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13659}
13660
13661impl ListDatabaseRolesResponse {
13662    pub fn new() -> Self {
13663        std::default::Default::default()
13664    }
13665
13666    /// Sets the value of [database_roles][crate::model::ListDatabaseRolesResponse::database_roles].
13667    pub fn set_database_roles<T, V>(mut self, v: T) -> Self
13668    where
13669        T: std::iter::IntoIterator<Item = V>,
13670        V: std::convert::Into<crate::model::DatabaseRole>,
13671    {
13672        use std::iter::Iterator;
13673        self.database_roles = v.into_iter().map(|i| i.into()).collect();
13674        self
13675    }
13676
13677    /// Sets the value of [next_page_token][crate::model::ListDatabaseRolesResponse::next_page_token].
13678    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13679        self.next_page_token = v.into();
13680        self
13681    }
13682}
13683
13684impl wkt::message::Message for ListDatabaseRolesResponse {
13685    fn typename() -> &'static str {
13686        "type.googleapis.com/google.spanner.admin.database.v1.ListDatabaseRolesResponse"
13687    }
13688}
13689
13690#[doc(hidden)]
13691impl gax::paginator::internal::PageableResponse for ListDatabaseRolesResponse {
13692    type PageItem = crate::model::DatabaseRole;
13693
13694    fn items(self) -> std::vec::Vec<Self::PageItem> {
13695        self.database_roles
13696    }
13697
13698    fn next_page_token(&self) -> std::string::String {
13699        use std::clone::Clone;
13700        self.next_page_token.clone()
13701    }
13702}
13703
13704#[doc(hidden)]
13705impl<'de> serde::de::Deserialize<'de> for ListDatabaseRolesResponse {
13706    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13707    where
13708        D: serde::Deserializer<'de>,
13709    {
13710        #[allow(non_camel_case_types)]
13711        #[doc(hidden)]
13712        #[derive(PartialEq, Eq, Hash)]
13713        enum __FieldTag {
13714            __database_roles,
13715            __next_page_token,
13716            Unknown(std::string::String),
13717        }
13718        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13719            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13720            where
13721                D: serde::Deserializer<'de>,
13722            {
13723                struct Visitor;
13724                impl<'de> serde::de::Visitor<'de> for Visitor {
13725                    type Value = __FieldTag;
13726                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13727                        formatter.write_str("a field name for ListDatabaseRolesResponse")
13728                    }
13729                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13730                    where
13731                        E: serde::de::Error,
13732                    {
13733                        use std::result::Result::Ok;
13734                        use std::string::ToString;
13735                        match value {
13736                            "databaseRoles" => Ok(__FieldTag::__database_roles),
13737                            "database_roles" => Ok(__FieldTag::__database_roles),
13738                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
13739                            "next_page_token" => Ok(__FieldTag::__next_page_token),
13740                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13741                        }
13742                    }
13743                }
13744                deserializer.deserialize_identifier(Visitor)
13745            }
13746        }
13747        struct Visitor;
13748        impl<'de> serde::de::Visitor<'de> for Visitor {
13749            type Value = ListDatabaseRolesResponse;
13750            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13751                formatter.write_str("struct ListDatabaseRolesResponse")
13752            }
13753            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13754            where
13755                A: serde::de::MapAccess<'de>,
13756            {
13757                #[allow(unused_imports)]
13758                use serde::de::Error;
13759                use std::option::Option::Some;
13760                let mut fields = std::collections::HashSet::new();
13761                let mut result = Self::Value::new();
13762                while let Some(tag) = map.next_key::<__FieldTag>()? {
13763                    #[allow(clippy::match_single_binding)]
13764                    match tag {
13765                        __FieldTag::__database_roles => {
13766                            if !fields.insert(__FieldTag::__database_roles) {
13767                                return std::result::Result::Err(A::Error::duplicate_field(
13768                                    "multiple values for database_roles",
13769                                ));
13770                            }
13771                            result.database_roles = map.next_value::<std::option::Option<std::vec::Vec<crate::model::DatabaseRole>>>()?.unwrap_or_default();
13772                        }
13773                        __FieldTag::__next_page_token => {
13774                            if !fields.insert(__FieldTag::__next_page_token) {
13775                                return std::result::Result::Err(A::Error::duplicate_field(
13776                                    "multiple values for next_page_token",
13777                                ));
13778                            }
13779                            result.next_page_token = map
13780                                .next_value::<std::option::Option<std::string::String>>()?
13781                                .unwrap_or_default();
13782                        }
13783                        __FieldTag::Unknown(key) => {
13784                            let value = map.next_value::<serde_json::Value>()?;
13785                            result._unknown_fields.insert(key, value);
13786                        }
13787                    }
13788                }
13789                std::result::Result::Ok(result)
13790            }
13791        }
13792        deserializer.deserialize_any(Visitor)
13793    }
13794}
13795
13796#[doc(hidden)]
13797impl serde::ser::Serialize for ListDatabaseRolesResponse {
13798    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13799    where
13800        S: serde::ser::Serializer,
13801    {
13802        use serde::ser::SerializeMap;
13803        #[allow(unused_imports)]
13804        use std::option::Option::Some;
13805        let mut state = serializer.serialize_map(std::option::Option::None)?;
13806        if !self.database_roles.is_empty() {
13807            state.serialize_entry("databaseRoles", &self.database_roles)?;
13808        }
13809        if !self.next_page_token.is_empty() {
13810            state.serialize_entry("nextPageToken", &self.next_page_token)?;
13811        }
13812        if !self._unknown_fields.is_empty() {
13813            for (key, value) in self._unknown_fields.iter() {
13814                state.serialize_entry(key, &value)?;
13815            }
13816        }
13817        state.end()
13818    }
13819}
13820
13821impl std::fmt::Debug for ListDatabaseRolesResponse {
13822    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13823        let mut debug_struct = f.debug_struct("ListDatabaseRolesResponse");
13824        debug_struct.field("database_roles", &self.database_roles);
13825        debug_struct.field("next_page_token", &self.next_page_token);
13826        if !self._unknown_fields.is_empty() {
13827            debug_struct.field("_unknown_fields", &self._unknown_fields);
13828        }
13829        debug_struct.finish()
13830    }
13831}
13832
13833/// The request for
13834/// [AddSplitPoints][google.spanner.admin.database.v1.DatabaseAdmin.AddSplitPoints].
13835///
13836/// [google.spanner.admin.database.v1.DatabaseAdmin.AddSplitPoints]: crate::client::DatabaseAdmin::add_split_points
13837#[derive(Clone, Default, PartialEq)]
13838#[non_exhaustive]
13839pub struct AddSplitPointsRequest {
13840    /// Required. The database on whose tables/indexes split points are to be
13841    /// added. Values are of the form
13842    /// `projects/<project>/instances/<instance>/databases/<database>`.
13843    pub database: std::string::String,
13844
13845    /// Required. The split points to add.
13846    pub split_points: std::vec::Vec<crate::model::SplitPoints>,
13847
13848    /// Optional. A user-supplied tag associated with the split points.
13849    /// For example, "intital_data_load", "special_event_1".
13850    /// Defaults to "CloudAddSplitPointsAPI" if not specified.
13851    /// The length of the tag must not exceed 50 characters,else will be trimmed.
13852    /// Only valid UTF8 characters are allowed.
13853    pub initiator: std::string::String,
13854
13855    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13856}
13857
13858impl AddSplitPointsRequest {
13859    pub fn new() -> Self {
13860        std::default::Default::default()
13861    }
13862
13863    /// Sets the value of [database][crate::model::AddSplitPointsRequest::database].
13864    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13865        self.database = v.into();
13866        self
13867    }
13868
13869    /// Sets the value of [split_points][crate::model::AddSplitPointsRequest::split_points].
13870    pub fn set_split_points<T, V>(mut self, v: T) -> Self
13871    where
13872        T: std::iter::IntoIterator<Item = V>,
13873        V: std::convert::Into<crate::model::SplitPoints>,
13874    {
13875        use std::iter::Iterator;
13876        self.split_points = v.into_iter().map(|i| i.into()).collect();
13877        self
13878    }
13879
13880    /// Sets the value of [initiator][crate::model::AddSplitPointsRequest::initiator].
13881    pub fn set_initiator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13882        self.initiator = v.into();
13883        self
13884    }
13885}
13886
13887impl wkt::message::Message for AddSplitPointsRequest {
13888    fn typename() -> &'static str {
13889        "type.googleapis.com/google.spanner.admin.database.v1.AddSplitPointsRequest"
13890    }
13891}
13892
13893#[doc(hidden)]
13894impl<'de> serde::de::Deserialize<'de> for AddSplitPointsRequest {
13895    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13896    where
13897        D: serde::Deserializer<'de>,
13898    {
13899        #[allow(non_camel_case_types)]
13900        #[doc(hidden)]
13901        #[derive(PartialEq, Eq, Hash)]
13902        enum __FieldTag {
13903            __database,
13904            __split_points,
13905            __initiator,
13906            Unknown(std::string::String),
13907        }
13908        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13909            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13910            where
13911                D: serde::Deserializer<'de>,
13912            {
13913                struct Visitor;
13914                impl<'de> serde::de::Visitor<'de> for Visitor {
13915                    type Value = __FieldTag;
13916                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13917                        formatter.write_str("a field name for AddSplitPointsRequest")
13918                    }
13919                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13920                    where
13921                        E: serde::de::Error,
13922                    {
13923                        use std::result::Result::Ok;
13924                        use std::string::ToString;
13925                        match value {
13926                            "database" => Ok(__FieldTag::__database),
13927                            "splitPoints" => Ok(__FieldTag::__split_points),
13928                            "split_points" => Ok(__FieldTag::__split_points),
13929                            "initiator" => Ok(__FieldTag::__initiator),
13930                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13931                        }
13932                    }
13933                }
13934                deserializer.deserialize_identifier(Visitor)
13935            }
13936        }
13937        struct Visitor;
13938        impl<'de> serde::de::Visitor<'de> for Visitor {
13939            type Value = AddSplitPointsRequest;
13940            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13941                formatter.write_str("struct AddSplitPointsRequest")
13942            }
13943            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13944            where
13945                A: serde::de::MapAccess<'de>,
13946            {
13947                #[allow(unused_imports)]
13948                use serde::de::Error;
13949                use std::option::Option::Some;
13950                let mut fields = std::collections::HashSet::new();
13951                let mut result = Self::Value::new();
13952                while let Some(tag) = map.next_key::<__FieldTag>()? {
13953                    #[allow(clippy::match_single_binding)]
13954                    match tag {
13955                        __FieldTag::__database => {
13956                            if !fields.insert(__FieldTag::__database) {
13957                                return std::result::Result::Err(A::Error::duplicate_field(
13958                                    "multiple values for database",
13959                                ));
13960                            }
13961                            result.database = map
13962                                .next_value::<std::option::Option<std::string::String>>()?
13963                                .unwrap_or_default();
13964                        }
13965                        __FieldTag::__split_points => {
13966                            if !fields.insert(__FieldTag::__split_points) {
13967                                return std::result::Result::Err(A::Error::duplicate_field(
13968                                    "multiple values for split_points",
13969                                ));
13970                            }
13971                            result.split_points = map.next_value::<std::option::Option<std::vec::Vec<crate::model::SplitPoints>>>()?.unwrap_or_default();
13972                        }
13973                        __FieldTag::__initiator => {
13974                            if !fields.insert(__FieldTag::__initiator) {
13975                                return std::result::Result::Err(A::Error::duplicate_field(
13976                                    "multiple values for initiator",
13977                                ));
13978                            }
13979                            result.initiator = map
13980                                .next_value::<std::option::Option<std::string::String>>()?
13981                                .unwrap_or_default();
13982                        }
13983                        __FieldTag::Unknown(key) => {
13984                            let value = map.next_value::<serde_json::Value>()?;
13985                            result._unknown_fields.insert(key, value);
13986                        }
13987                    }
13988                }
13989                std::result::Result::Ok(result)
13990            }
13991        }
13992        deserializer.deserialize_any(Visitor)
13993    }
13994}
13995
13996#[doc(hidden)]
13997impl serde::ser::Serialize for AddSplitPointsRequest {
13998    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13999    where
14000        S: serde::ser::Serializer,
14001    {
14002        use serde::ser::SerializeMap;
14003        #[allow(unused_imports)]
14004        use std::option::Option::Some;
14005        let mut state = serializer.serialize_map(std::option::Option::None)?;
14006        if !self.database.is_empty() {
14007            state.serialize_entry("database", &self.database)?;
14008        }
14009        if !self.split_points.is_empty() {
14010            state.serialize_entry("splitPoints", &self.split_points)?;
14011        }
14012        if !self.initiator.is_empty() {
14013            state.serialize_entry("initiator", &self.initiator)?;
14014        }
14015        if !self._unknown_fields.is_empty() {
14016            for (key, value) in self._unknown_fields.iter() {
14017                state.serialize_entry(key, &value)?;
14018            }
14019        }
14020        state.end()
14021    }
14022}
14023
14024impl std::fmt::Debug for AddSplitPointsRequest {
14025    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14026        let mut debug_struct = f.debug_struct("AddSplitPointsRequest");
14027        debug_struct.field("database", &self.database);
14028        debug_struct.field("split_points", &self.split_points);
14029        debug_struct.field("initiator", &self.initiator);
14030        if !self._unknown_fields.is_empty() {
14031            debug_struct.field("_unknown_fields", &self._unknown_fields);
14032        }
14033        debug_struct.finish()
14034    }
14035}
14036
14037/// The response for
14038/// [AddSplitPoints][google.spanner.admin.database.v1.DatabaseAdmin.AddSplitPoints].
14039///
14040/// [google.spanner.admin.database.v1.DatabaseAdmin.AddSplitPoints]: crate::client::DatabaseAdmin::add_split_points
14041#[derive(Clone, Default, PartialEq)]
14042#[non_exhaustive]
14043pub struct AddSplitPointsResponse {
14044    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14045}
14046
14047impl AddSplitPointsResponse {
14048    pub fn new() -> Self {
14049        std::default::Default::default()
14050    }
14051}
14052
14053impl wkt::message::Message for AddSplitPointsResponse {
14054    fn typename() -> &'static str {
14055        "type.googleapis.com/google.spanner.admin.database.v1.AddSplitPointsResponse"
14056    }
14057}
14058
14059#[doc(hidden)]
14060impl<'de> serde::de::Deserialize<'de> for AddSplitPointsResponse {
14061    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14062    where
14063        D: serde::Deserializer<'de>,
14064    {
14065        #[allow(non_camel_case_types)]
14066        #[doc(hidden)]
14067        #[derive(PartialEq, Eq, Hash)]
14068        enum __FieldTag {
14069            Unknown(std::string::String),
14070        }
14071        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14072            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14073            where
14074                D: serde::Deserializer<'de>,
14075            {
14076                struct Visitor;
14077                impl<'de> serde::de::Visitor<'de> for Visitor {
14078                    type Value = __FieldTag;
14079                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14080                        formatter.write_str("a field name for AddSplitPointsResponse")
14081                    }
14082                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14083                    where
14084                        E: serde::de::Error,
14085                    {
14086                        use std::result::Result::Ok;
14087                        use std::string::ToString;
14088                        Ok(__FieldTag::Unknown(value.to_string()))
14089                    }
14090                }
14091                deserializer.deserialize_identifier(Visitor)
14092            }
14093        }
14094        struct Visitor;
14095        impl<'de> serde::de::Visitor<'de> for Visitor {
14096            type Value = AddSplitPointsResponse;
14097            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14098                formatter.write_str("struct AddSplitPointsResponse")
14099            }
14100            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14101            where
14102                A: serde::de::MapAccess<'de>,
14103            {
14104                #[allow(unused_imports)]
14105                use serde::de::Error;
14106                use std::option::Option::Some;
14107                let mut result = Self::Value::new();
14108                while let Some(tag) = map.next_key::<__FieldTag>()? {
14109                    #[allow(clippy::match_single_binding)]
14110                    match tag {
14111                        __FieldTag::Unknown(key) => {
14112                            let value = map.next_value::<serde_json::Value>()?;
14113                            result._unknown_fields.insert(key, value);
14114                        }
14115                    }
14116                }
14117                std::result::Result::Ok(result)
14118            }
14119        }
14120        deserializer.deserialize_any(Visitor)
14121    }
14122}
14123
14124#[doc(hidden)]
14125impl serde::ser::Serialize for AddSplitPointsResponse {
14126    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14127    where
14128        S: serde::ser::Serializer,
14129    {
14130        use serde::ser::SerializeMap;
14131        #[allow(unused_imports)]
14132        use std::option::Option::Some;
14133        let mut state = serializer.serialize_map(std::option::Option::None)?;
14134        if !self._unknown_fields.is_empty() {
14135            for (key, value) in self._unknown_fields.iter() {
14136                state.serialize_entry(key, &value)?;
14137            }
14138        }
14139        state.end()
14140    }
14141}
14142
14143impl std::fmt::Debug for AddSplitPointsResponse {
14144    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14145        let mut debug_struct = f.debug_struct("AddSplitPointsResponse");
14146        if !self._unknown_fields.is_empty() {
14147            debug_struct.field("_unknown_fields", &self._unknown_fields);
14148        }
14149        debug_struct.finish()
14150    }
14151}
14152
14153/// The split points of a table/index.
14154#[derive(Clone, Default, PartialEq)]
14155#[non_exhaustive]
14156pub struct SplitPoints {
14157    /// The table to split.
14158    pub table: std::string::String,
14159
14160    /// The index to split.
14161    /// If specified, the `table` field must refer to the index's base table.
14162    pub index: std::string::String,
14163
14164    /// Required. The list of split keys, i.e., the split boundaries.
14165    pub keys: std::vec::Vec<crate::model::split_points::Key>,
14166
14167    /// Optional. The expiration timestamp of the split points.
14168    /// A timestamp in the past means immediate expiration.
14169    /// The maximum value can be 30 days in the future.
14170    /// Defaults to 10 days in the future if not specified.
14171    pub expire_time: std::option::Option<wkt::Timestamp>,
14172
14173    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14174}
14175
14176impl SplitPoints {
14177    pub fn new() -> Self {
14178        std::default::Default::default()
14179    }
14180
14181    /// Sets the value of [table][crate::model::SplitPoints::table].
14182    pub fn set_table<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14183        self.table = v.into();
14184        self
14185    }
14186
14187    /// Sets the value of [index][crate::model::SplitPoints::index].
14188    pub fn set_index<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14189        self.index = v.into();
14190        self
14191    }
14192
14193    /// Sets the value of [keys][crate::model::SplitPoints::keys].
14194    pub fn set_keys<T, V>(mut self, v: T) -> Self
14195    where
14196        T: std::iter::IntoIterator<Item = V>,
14197        V: std::convert::Into<crate::model::split_points::Key>,
14198    {
14199        use std::iter::Iterator;
14200        self.keys = v.into_iter().map(|i| i.into()).collect();
14201        self
14202    }
14203
14204    /// Sets the value of [expire_time][crate::model::SplitPoints::expire_time].
14205    pub fn set_expire_time<T>(mut self, v: T) -> Self
14206    where
14207        T: std::convert::Into<wkt::Timestamp>,
14208    {
14209        self.expire_time = std::option::Option::Some(v.into());
14210        self
14211    }
14212
14213    /// Sets or clears the value of [expire_time][crate::model::SplitPoints::expire_time].
14214    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
14215    where
14216        T: std::convert::Into<wkt::Timestamp>,
14217    {
14218        self.expire_time = v.map(|x| x.into());
14219        self
14220    }
14221}
14222
14223impl wkt::message::Message for SplitPoints {
14224    fn typename() -> &'static str {
14225        "type.googleapis.com/google.spanner.admin.database.v1.SplitPoints"
14226    }
14227}
14228
14229#[doc(hidden)]
14230impl<'de> serde::de::Deserialize<'de> for SplitPoints {
14231    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14232    where
14233        D: serde::Deserializer<'de>,
14234    {
14235        #[allow(non_camel_case_types)]
14236        #[doc(hidden)]
14237        #[derive(PartialEq, Eq, Hash)]
14238        enum __FieldTag {
14239            __table,
14240            __index,
14241            __keys,
14242            __expire_time,
14243            Unknown(std::string::String),
14244        }
14245        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14246            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14247            where
14248                D: serde::Deserializer<'de>,
14249            {
14250                struct Visitor;
14251                impl<'de> serde::de::Visitor<'de> for Visitor {
14252                    type Value = __FieldTag;
14253                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14254                        formatter.write_str("a field name for SplitPoints")
14255                    }
14256                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14257                    where
14258                        E: serde::de::Error,
14259                    {
14260                        use std::result::Result::Ok;
14261                        use std::string::ToString;
14262                        match value {
14263                            "table" => Ok(__FieldTag::__table),
14264                            "index" => Ok(__FieldTag::__index),
14265                            "keys" => Ok(__FieldTag::__keys),
14266                            "expireTime" => Ok(__FieldTag::__expire_time),
14267                            "expire_time" => Ok(__FieldTag::__expire_time),
14268                            _ => Ok(__FieldTag::Unknown(value.to_string())),
14269                        }
14270                    }
14271                }
14272                deserializer.deserialize_identifier(Visitor)
14273            }
14274        }
14275        struct Visitor;
14276        impl<'de> serde::de::Visitor<'de> for Visitor {
14277            type Value = SplitPoints;
14278            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14279                formatter.write_str("struct SplitPoints")
14280            }
14281            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14282            where
14283                A: serde::de::MapAccess<'de>,
14284            {
14285                #[allow(unused_imports)]
14286                use serde::de::Error;
14287                use std::option::Option::Some;
14288                let mut fields = std::collections::HashSet::new();
14289                let mut result = Self::Value::new();
14290                while let Some(tag) = map.next_key::<__FieldTag>()? {
14291                    #[allow(clippy::match_single_binding)]
14292                    match tag {
14293                        __FieldTag::__table => {
14294                            if !fields.insert(__FieldTag::__table) {
14295                                return std::result::Result::Err(A::Error::duplicate_field(
14296                                    "multiple values for table",
14297                                ));
14298                            }
14299                            result.table = map
14300                                .next_value::<std::option::Option<std::string::String>>()?
14301                                .unwrap_or_default();
14302                        }
14303                        __FieldTag::__index => {
14304                            if !fields.insert(__FieldTag::__index) {
14305                                return std::result::Result::Err(A::Error::duplicate_field(
14306                                    "multiple values for index",
14307                                ));
14308                            }
14309                            result.index = map
14310                                .next_value::<std::option::Option<std::string::String>>()?
14311                                .unwrap_or_default();
14312                        }
14313                        __FieldTag::__keys => {
14314                            if !fields.insert(__FieldTag::__keys) {
14315                                return std::result::Result::Err(A::Error::duplicate_field(
14316                                    "multiple values for keys",
14317                                ));
14318                            }
14319                            result.keys =
14320                                map.next_value::<std::option::Option<
14321                                    std::vec::Vec<crate::model::split_points::Key>,
14322                                >>()?
14323                                .unwrap_or_default();
14324                        }
14325                        __FieldTag::__expire_time => {
14326                            if !fields.insert(__FieldTag::__expire_time) {
14327                                return std::result::Result::Err(A::Error::duplicate_field(
14328                                    "multiple values for expire_time",
14329                                ));
14330                            }
14331                            result.expire_time =
14332                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
14333                        }
14334                        __FieldTag::Unknown(key) => {
14335                            let value = map.next_value::<serde_json::Value>()?;
14336                            result._unknown_fields.insert(key, value);
14337                        }
14338                    }
14339                }
14340                std::result::Result::Ok(result)
14341            }
14342        }
14343        deserializer.deserialize_any(Visitor)
14344    }
14345}
14346
14347#[doc(hidden)]
14348impl serde::ser::Serialize for SplitPoints {
14349    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14350    where
14351        S: serde::ser::Serializer,
14352    {
14353        use serde::ser::SerializeMap;
14354        #[allow(unused_imports)]
14355        use std::option::Option::Some;
14356        let mut state = serializer.serialize_map(std::option::Option::None)?;
14357        if !self.table.is_empty() {
14358            state.serialize_entry("table", &self.table)?;
14359        }
14360        if !self.index.is_empty() {
14361            state.serialize_entry("index", &self.index)?;
14362        }
14363        if !self.keys.is_empty() {
14364            state.serialize_entry("keys", &self.keys)?;
14365        }
14366        if self.expire_time.is_some() {
14367            state.serialize_entry("expireTime", &self.expire_time)?;
14368        }
14369        if !self._unknown_fields.is_empty() {
14370            for (key, value) in self._unknown_fields.iter() {
14371                state.serialize_entry(key, &value)?;
14372            }
14373        }
14374        state.end()
14375    }
14376}
14377
14378impl std::fmt::Debug for SplitPoints {
14379    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14380        let mut debug_struct = f.debug_struct("SplitPoints");
14381        debug_struct.field("table", &self.table);
14382        debug_struct.field("index", &self.index);
14383        debug_struct.field("keys", &self.keys);
14384        debug_struct.field("expire_time", &self.expire_time);
14385        if !self._unknown_fields.is_empty() {
14386            debug_struct.field("_unknown_fields", &self._unknown_fields);
14387        }
14388        debug_struct.finish()
14389    }
14390}
14391
14392/// Defines additional types related to [SplitPoints].
14393pub mod split_points {
14394    #[allow(unused_imports)]
14395    use super::*;
14396
14397    /// A split key.
14398    #[derive(Clone, Default, PartialEq)]
14399    #[non_exhaustive]
14400    pub struct Key {
14401        /// Required. The column values making up the split key.
14402        pub key_parts: std::option::Option<wkt::ListValue>,
14403
14404        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14405    }
14406
14407    impl Key {
14408        pub fn new() -> Self {
14409            std::default::Default::default()
14410        }
14411
14412        /// Sets the value of [key_parts][crate::model::split_points::Key::key_parts].
14413        pub fn set_key_parts<T>(mut self, v: T) -> Self
14414        where
14415            T: std::convert::Into<wkt::ListValue>,
14416        {
14417            self.key_parts = std::option::Option::Some(v.into());
14418            self
14419        }
14420
14421        /// Sets or clears the value of [key_parts][crate::model::split_points::Key::key_parts].
14422        pub fn set_or_clear_key_parts<T>(mut self, v: std::option::Option<T>) -> Self
14423        where
14424            T: std::convert::Into<wkt::ListValue>,
14425        {
14426            self.key_parts = v.map(|x| x.into());
14427            self
14428        }
14429    }
14430
14431    impl wkt::message::Message for Key {
14432        fn typename() -> &'static str {
14433            "type.googleapis.com/google.spanner.admin.database.v1.SplitPoints.Key"
14434        }
14435    }
14436
14437    #[doc(hidden)]
14438    impl<'de> serde::de::Deserialize<'de> for Key {
14439        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14440        where
14441            D: serde::Deserializer<'de>,
14442        {
14443            #[allow(non_camel_case_types)]
14444            #[doc(hidden)]
14445            #[derive(PartialEq, Eq, Hash)]
14446            enum __FieldTag {
14447                __key_parts,
14448                Unknown(std::string::String),
14449            }
14450            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14451                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14452                where
14453                    D: serde::Deserializer<'de>,
14454                {
14455                    struct Visitor;
14456                    impl<'de> serde::de::Visitor<'de> for Visitor {
14457                        type Value = __FieldTag;
14458                        fn expecting(
14459                            &self,
14460                            formatter: &mut std::fmt::Formatter,
14461                        ) -> std::fmt::Result {
14462                            formatter.write_str("a field name for Key")
14463                        }
14464                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14465                        where
14466                            E: serde::de::Error,
14467                        {
14468                            use std::result::Result::Ok;
14469                            use std::string::ToString;
14470                            match value {
14471                                "keyParts" => Ok(__FieldTag::__key_parts),
14472                                "key_parts" => Ok(__FieldTag::__key_parts),
14473                                _ => Ok(__FieldTag::Unknown(value.to_string())),
14474                            }
14475                        }
14476                    }
14477                    deserializer.deserialize_identifier(Visitor)
14478                }
14479            }
14480            struct Visitor;
14481            impl<'de> serde::de::Visitor<'de> for Visitor {
14482                type Value = Key;
14483                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14484                    formatter.write_str("struct Key")
14485                }
14486                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14487                where
14488                    A: serde::de::MapAccess<'de>,
14489                {
14490                    #[allow(unused_imports)]
14491                    use serde::de::Error;
14492                    use std::option::Option::Some;
14493                    let mut fields = std::collections::HashSet::new();
14494                    let mut result = Self::Value::new();
14495                    while let Some(tag) = map.next_key::<__FieldTag>()? {
14496                        #[allow(clippy::match_single_binding)]
14497                        match tag {
14498                            __FieldTag::__key_parts => {
14499                                if !fields.insert(__FieldTag::__key_parts) {
14500                                    return std::result::Result::Err(A::Error::duplicate_field(
14501                                        "multiple values for key_parts",
14502                                    ));
14503                                }
14504                                result.key_parts =
14505                                    map.next_value::<std::option::Option<wkt::ListValue>>()?;
14506                            }
14507                            __FieldTag::Unknown(key) => {
14508                                let value = map.next_value::<serde_json::Value>()?;
14509                                result._unknown_fields.insert(key, value);
14510                            }
14511                        }
14512                    }
14513                    std::result::Result::Ok(result)
14514                }
14515            }
14516            deserializer.deserialize_any(Visitor)
14517        }
14518    }
14519
14520    #[doc(hidden)]
14521    impl serde::ser::Serialize for Key {
14522        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14523        where
14524            S: serde::ser::Serializer,
14525        {
14526            use serde::ser::SerializeMap;
14527            #[allow(unused_imports)]
14528            use std::option::Option::Some;
14529            let mut state = serializer.serialize_map(std::option::Option::None)?;
14530            if self.key_parts.is_some() {
14531                state.serialize_entry("keyParts", &self.key_parts)?;
14532            }
14533            if !self._unknown_fields.is_empty() {
14534                for (key, value) in self._unknown_fields.iter() {
14535                    state.serialize_entry(key, &value)?;
14536                }
14537            }
14538            state.end()
14539        }
14540    }
14541
14542    impl std::fmt::Debug for Key {
14543        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14544            let mut debug_struct = f.debug_struct("Key");
14545            debug_struct.field("key_parts", &self.key_parts);
14546            if !self._unknown_fields.is_empty() {
14547                debug_struct.field("_unknown_fields", &self._unknown_fields);
14548            }
14549            debug_struct.finish()
14550        }
14551    }
14552}
14553
14554/// Indicates the dialect type of a database.
14555///
14556/// # Working with unknown values
14557///
14558/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14559/// additional enum variants at any time. Adding new variants is not considered
14560/// a breaking change. Applications should write their code in anticipation of:
14561///
14562/// - New values appearing in future releases of the client library, **and**
14563/// - New values received dynamically, without application changes.
14564///
14565/// Please consult the [Working with enums] section in the user guide for some
14566/// guidelines.
14567///
14568/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14569#[derive(Clone, Debug, PartialEq)]
14570#[non_exhaustive]
14571pub enum DatabaseDialect {
14572    /// Default value. This value will create a database with the
14573    /// GOOGLE_STANDARD_SQL dialect.
14574    Unspecified,
14575    /// GoogleSQL supported SQL.
14576    GoogleStandardSql,
14577    /// PostgreSQL supported SQL.
14578    Postgresql,
14579    /// If set, the enum was initialized with an unknown value.
14580    ///
14581    /// Applications can examine the value using [DatabaseDialect::value] or
14582    /// [DatabaseDialect::name].
14583    UnknownValue(database_dialect::UnknownValue),
14584}
14585
14586#[doc(hidden)]
14587pub mod database_dialect {
14588    #[allow(unused_imports)]
14589    use super::*;
14590    #[derive(Clone, Debug, PartialEq)]
14591    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14592}
14593
14594impl DatabaseDialect {
14595    /// Gets the enum value.
14596    ///
14597    /// Returns `None` if the enum contains an unknown value deserialized from
14598    /// the string representation of enums.
14599    pub fn value(&self) -> std::option::Option<i32> {
14600        match self {
14601            Self::Unspecified => std::option::Option::Some(0),
14602            Self::GoogleStandardSql => std::option::Option::Some(1),
14603            Self::Postgresql => std::option::Option::Some(2),
14604            Self::UnknownValue(u) => u.0.value(),
14605        }
14606    }
14607
14608    /// Gets the enum value as a string.
14609    ///
14610    /// Returns `None` if the enum contains an unknown value deserialized from
14611    /// the integer representation of enums.
14612    pub fn name(&self) -> std::option::Option<&str> {
14613        match self {
14614            Self::Unspecified => std::option::Option::Some("DATABASE_DIALECT_UNSPECIFIED"),
14615            Self::GoogleStandardSql => std::option::Option::Some("GOOGLE_STANDARD_SQL"),
14616            Self::Postgresql => std::option::Option::Some("POSTGRESQL"),
14617            Self::UnknownValue(u) => u.0.name(),
14618        }
14619    }
14620}
14621
14622impl std::default::Default for DatabaseDialect {
14623    fn default() -> Self {
14624        use std::convert::From;
14625        Self::from(0)
14626    }
14627}
14628
14629impl std::fmt::Display for DatabaseDialect {
14630    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14631        wkt::internal::display_enum(f, self.name(), self.value())
14632    }
14633}
14634
14635impl std::convert::From<i32> for DatabaseDialect {
14636    fn from(value: i32) -> Self {
14637        match value {
14638            0 => Self::Unspecified,
14639            1 => Self::GoogleStandardSql,
14640            2 => Self::Postgresql,
14641            _ => Self::UnknownValue(database_dialect::UnknownValue(
14642                wkt::internal::UnknownEnumValue::Integer(value),
14643            )),
14644        }
14645    }
14646}
14647
14648impl std::convert::From<&str> for DatabaseDialect {
14649    fn from(value: &str) -> Self {
14650        use std::string::ToString;
14651        match value {
14652            "DATABASE_DIALECT_UNSPECIFIED" => Self::Unspecified,
14653            "GOOGLE_STANDARD_SQL" => Self::GoogleStandardSql,
14654            "POSTGRESQL" => Self::Postgresql,
14655            _ => Self::UnknownValue(database_dialect::UnknownValue(
14656                wkt::internal::UnknownEnumValue::String(value.to_string()),
14657            )),
14658        }
14659    }
14660}
14661
14662impl serde::ser::Serialize for DatabaseDialect {
14663    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14664    where
14665        S: serde::Serializer,
14666    {
14667        match self {
14668            Self::Unspecified => serializer.serialize_i32(0),
14669            Self::GoogleStandardSql => serializer.serialize_i32(1),
14670            Self::Postgresql => serializer.serialize_i32(2),
14671            Self::UnknownValue(u) => u.0.serialize(serializer),
14672        }
14673    }
14674}
14675
14676impl<'de> serde::de::Deserialize<'de> for DatabaseDialect {
14677    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14678    where
14679        D: serde::Deserializer<'de>,
14680    {
14681        deserializer.deserialize_any(wkt::internal::EnumVisitor::<DatabaseDialect>::new(
14682            ".google.spanner.admin.database.v1.DatabaseDialect",
14683        ))
14684    }
14685}
14686
14687/// Indicates the type of the restore source.
14688///
14689/// # Working with unknown values
14690///
14691/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14692/// additional enum variants at any time. Adding new variants is not considered
14693/// a breaking change. Applications should write their code in anticipation of:
14694///
14695/// - New values appearing in future releases of the client library, **and**
14696/// - New values received dynamically, without application changes.
14697///
14698/// Please consult the [Working with enums] section in the user guide for some
14699/// guidelines.
14700///
14701/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14702#[derive(Clone, Debug, PartialEq)]
14703#[non_exhaustive]
14704pub enum RestoreSourceType {
14705    /// No restore associated.
14706    TypeUnspecified,
14707    /// A backup was used as the source of the restore.
14708    Backup,
14709    /// If set, the enum was initialized with an unknown value.
14710    ///
14711    /// Applications can examine the value using [RestoreSourceType::value] or
14712    /// [RestoreSourceType::name].
14713    UnknownValue(restore_source_type::UnknownValue),
14714}
14715
14716#[doc(hidden)]
14717pub mod restore_source_type {
14718    #[allow(unused_imports)]
14719    use super::*;
14720    #[derive(Clone, Debug, PartialEq)]
14721    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14722}
14723
14724impl RestoreSourceType {
14725    /// Gets the enum value.
14726    ///
14727    /// Returns `None` if the enum contains an unknown value deserialized from
14728    /// the string representation of enums.
14729    pub fn value(&self) -> std::option::Option<i32> {
14730        match self {
14731            Self::TypeUnspecified => std::option::Option::Some(0),
14732            Self::Backup => std::option::Option::Some(1),
14733            Self::UnknownValue(u) => u.0.value(),
14734        }
14735    }
14736
14737    /// Gets the enum value as a string.
14738    ///
14739    /// Returns `None` if the enum contains an unknown value deserialized from
14740    /// the integer representation of enums.
14741    pub fn name(&self) -> std::option::Option<&str> {
14742        match self {
14743            Self::TypeUnspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
14744            Self::Backup => std::option::Option::Some("BACKUP"),
14745            Self::UnknownValue(u) => u.0.name(),
14746        }
14747    }
14748}
14749
14750impl std::default::Default for RestoreSourceType {
14751    fn default() -> Self {
14752        use std::convert::From;
14753        Self::from(0)
14754    }
14755}
14756
14757impl std::fmt::Display for RestoreSourceType {
14758    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14759        wkt::internal::display_enum(f, self.name(), self.value())
14760    }
14761}
14762
14763impl std::convert::From<i32> for RestoreSourceType {
14764    fn from(value: i32) -> Self {
14765        match value {
14766            0 => Self::TypeUnspecified,
14767            1 => Self::Backup,
14768            _ => Self::UnknownValue(restore_source_type::UnknownValue(
14769                wkt::internal::UnknownEnumValue::Integer(value),
14770            )),
14771        }
14772    }
14773}
14774
14775impl std::convert::From<&str> for RestoreSourceType {
14776    fn from(value: &str) -> Self {
14777        use std::string::ToString;
14778        match value {
14779            "TYPE_UNSPECIFIED" => Self::TypeUnspecified,
14780            "BACKUP" => Self::Backup,
14781            _ => Self::UnknownValue(restore_source_type::UnknownValue(
14782                wkt::internal::UnknownEnumValue::String(value.to_string()),
14783            )),
14784        }
14785    }
14786}
14787
14788impl serde::ser::Serialize for RestoreSourceType {
14789    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14790    where
14791        S: serde::Serializer,
14792    {
14793        match self {
14794            Self::TypeUnspecified => serializer.serialize_i32(0),
14795            Self::Backup => serializer.serialize_i32(1),
14796            Self::UnknownValue(u) => u.0.serialize(serializer),
14797        }
14798    }
14799}
14800
14801impl<'de> serde::de::Deserialize<'de> for RestoreSourceType {
14802    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14803    where
14804        D: serde::Deserializer<'de>,
14805    {
14806        deserializer.deserialize_any(wkt::internal::EnumVisitor::<RestoreSourceType>::new(
14807            ".google.spanner.admin.database.v1.RestoreSourceType",
14808        ))
14809    }
14810}